1
1

Lots of fixes: screen layout is much nicer on the GNOME edition now;

Listbox widget fully implemented;

MC Idle handlers implemented

Find command now works;

Changing the listing mode works;

various other bug fixes.
Этот коммит содержится в:
Miguel de Icaza 1998-03-07 03:02:01 +00:00
родитель 566c79dc42
Коммит 057f69beae
15 изменённых файлов: 245 добавлений и 63 удалений

Просмотреть файл

@ -1,12 +1,27 @@
Fri Mar 6 14:48:34 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
Fri Mar 6 20:50:19 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gmain.c (create_panels): New per-port variable, used to flush
all of the pending X events.
(x_set_idle): Implement idle functions, now the find command works
properly.
* gwidget.c (x_create_radio): Connect to the "toggled" signal to
keep track of the radio button.
* gwidget.c (x_update_input): This can be invoked before the
(listbox_select): callback for the select and double click
actions.
(x_update_input): This can be invoked before the
widget X resources have been allocated. Take care of this.
(x_create_input): update the cursor position as well.
(x_list_insert, x_create_listbox, x_list_delete_nth,
x_listbox_select_nth): implement the Listbox widget.
* gconf.h: New configuration options:
PORT_HAS_PANEL_ADJUST_TOP_FILE and
PORT_HAS_PANEL_RESET_SORT_LABELS
1998-03-06 Federico Mena Quintero <federico@nuclecu.unam.mx>

Просмотреть файл

@ -1,18 +1,22 @@
/* Defines which features are used on the GNOME edition */
#define PORT_HAS_FRONTEND_RUN_DLG 1
#define PORT_HAS_FILE_HANDLERS 1
#define PORT_HAS_GETCH 1
#define PORT_HAS_MY_SYSTEM 1
#define PORT_HAS_DIALOG_TITLE 1
#define PORT_WANTS_CLEAN_BUTTON 1
#define PORT_HAS_CREATE_PANELS 1
#define PORT_HAS_PANEL_UPDATE_COLS 1
#define PORT_HAS_PAINT_FRAME 1
#define PORT_WANTS_GET_SORT_FN 1
#define PORT_HAS_LLINES 1
#define PORT_HAS_LOAD_HINT 1
#define PORT_HAS_FILTER_CHANGED 1
#define PORT_HAS_FRONTEND_RUN_DLG 1
#define PORT_HAS_FILE_HANDLERS 1
#define PORT_HAS_GETCH 1
#define PORT_HAS_MY_SYSTEM 1
#define PORT_HAS_DIALOG_TITLE 1
#define PORT_WANTS_CLEAN_BUTTON 1
#define PORT_HAS_CREATE_PANELS 1
#define PORT_HAS_PANEL_UPDATE_COLS 1
#define PORT_HAS_PAINT_FRAME 1
#define PORT_WANTS_GET_SORT_FN 1
#define PORT_HAS_LLINES 1
#define PORT_HAS_LOAD_HINT 1
#define PORT_HAS_FILTER_CHANGED 1
#define PORT_HAS_PANEL_ADJUST_TOP_FILE 1
#define PORT_HAS_PANEL_RESET_SORT_LABELS 1
#define PORT_HAS_FLUSH_EVENTS 1
#define PORT_HAS_SET_IDLE 1
#define mi_getch() fprintf (stderr, "mi_getch is not implemented in this port\n")
#define frontend_run_dlg(x) gtkrundlg_event (x)

Просмотреть файл

@ -169,7 +169,6 @@ gnome_listing_cmd (GtkWidget *widget, WPanel *panel)
return;
configure_panel_listing (panel, view_type, use_msformat, user, status);
panel_switch_new_display_mode (panel);
}
void configure_box (void);
@ -224,7 +223,7 @@ create_container (Dlg_head *h, char *name)
container->splitted = 0;
app = gnome_app_new ("gmc", name);
gtk_widget_set_usize (GTK_WIDGET (app), 400, 200);
gtk_widget_set_usize (GTK_WIDGET (app), 400, 300);
panel = panel_new (name);
vbox = gtk_vbox_new (0, 0);

Просмотреть файл

@ -135,6 +135,7 @@ xtoolkit_create_dialog (Dlg_head *h, int flags)
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
h->grided = flags;
h->idle_fn_tag = -1;
if (!(flags & DLG_NO_TED)){
ted = gtk_ted_new_layout (h->name, LIBDIR "/layout");
gtk_container_add (GTK_CONTAINER (win), ted);
@ -256,6 +257,38 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg)
return default_dlg_callback (h, id, msg);
}
void
x_flush_events (void)
{
while (gtk_events_pending ())
gtk_main_iteration ();
}
static int
gnome_idle_handler (gpointer data)
{
Dlg_head *h = data;
(*h->callback)(h, 0, DLG_IDLE);
return TRUE;
}
/* Turn on and off the idle message sending */
void
x_set_idle (Dlg_head *h, int enable_idle)
{
if (enable_idle){
if (h->idle_fn_tag != -1)
return;
h->idle_fn_tag = gtk_idle_add (gnome_idle_handler, h);
} else {
if (h->idle_fn_tag == -1)
return;
gtk_idle_remove (h->idle_fn_tag);
h->idle_fn_tag = -1;
}
}
void
create_panels (void)
{

Просмотреть файл

@ -754,6 +754,9 @@ void
panel_switch_new_display_mode (WPanel *panel)
{
GtkWidget *old_list = panel->list;
if (!old_list)
return;
panel->list = panel_create_file_list (panel);
gtk_widget_destroy (old_list);
@ -945,3 +948,9 @@ void
paint_frame (WPanel *panel)
{
}
void
x_reset_sort_labels (WPanel *panel)
{
panel_switch_new_display_mode (panel);
}

Просмотреть файл

@ -71,7 +71,7 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
/* Init the widgets */
init_dlg (h);
gtk_grab_add (dialog);
gtk_grab_add (GTK_WIDGET (dialog));
/* Now do the GTK stuff */
gtk_container_add (GTK_CONTAINER (dialog->vbox), GTK_WIDGET (label->widget.wdata));
@ -84,8 +84,8 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
frontend_run_dlg (h);
dlg_run_done (h);
gtk_grab_remove (dialog);
gtk_widget_destroy (dialog);
gtk_grab_remove (GTK_WIDGET (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
switch (h->ret_value){
case B_CANCEL:

Просмотреть файл

@ -76,11 +76,14 @@ x_button_set (WButton *b, char *text)
}
/* Radio buttons */
void
static void
radio_toggle (GtkObject *object, WRadio *r)
{
int idx = (int) gtk_object_get_data (object, "index");
if (!GTK_TOGGLE_BUTTON (object)->active)
return;
g_return_if_fail (idx != 0);
idx--;
r->sel = idx;
@ -101,12 +104,12 @@ x_create_radio (Dlg_head *h, widget_data parent, WRadio *r)
} else {
w = gtk_radio_button_new_with_label (group, r->texts [i]);
}
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), (i == r->sel));
gtk_signal_connect (GTK_OBJECT (w), "toggled", GTK_SIGNAL_FUNC (radio_toggle), r);
gtk_object_set_data (GTK_OBJECT (w), "index", (void *) (i+1));
gtk_box_pack_start_defaults (GTK_BOX (vbox), w);
gtk_widget_show (w);
}
gtk_widget_show (vbox);
gtk_widget_show_all (vbox);
r->widget.wdata = (widget_data) vbox;
return 1;
@ -156,27 +159,111 @@ x_update_input (WInput *in)
void
x_listbox_select_nth (WListbox *l, int nth)
{
static int inside;
GtkCList *clist;
if (inside)
return;
inside = 1;
clist = GTK_CLIST (l->widget.wdata);
gtk_clist_select_row (clist, nth, 0);
if (!gtk_clist_row_is_visible (clist, nth))
gtk_clist_moveto (clist, nth, 0, 0.5, 0.0);
inside = 0;
}
void
x_listbox_delete_nth (WListbox *l, int nth)
{
gtk_clist_remove (GTK_CLIST (l->widget.wdata), nth);
}
static void
listbox_select (GtkWidget *widget, int row, int column, GdkEvent *event, WListbox *l)
{
Dlg_head *h = l->widget.parent;
static int inside;
if (inside)
return;
inside = 1;
listbox_select_by_number (l, row);
if (event && event->type == GDK_2BUTTON_PRESS){
printf ("Activando\n");
switch (l->action){
case listbox_nothing:
break;
case listbox_finish:
h->running = 0;
h->ret_value = B_ENTER;
gtk_main_quit ();
return;
case listbox_cback:
if ((*l->cback)(l) == listbox_finish){
gtk_main_quit ();
return;
}
}
}
inside = 0;
}
int
x_create_listbox (Dlg_head *h, widget_data parent, WListbox *l)
{
GtkWidget *listbox;
GtkRequisition req;
WLEntry *p;
int i;
listbox = gtk_clist_new (1);
gtk_clist_set_selection_mode (GTK_CLIST (listbox), GTK_SELECTION_BROWSE);
gtk_widget_size_request (listbox, &req);
gtk_widget_set_usize (listbox, req.width, req.height + 20*8);
gtk_signal_connect (GTK_OBJECT (listbox), "select_row",
GTK_SIGNAL_FUNC (listbox_select), l);
gtk_widget_show (listbox);
l->widget.wdata = (widget_data) listbox;
for (p = l->list, i = 0; i < l->count; i++, p = p->next){
char *text [1];
text [0] = p->text;
gtk_clist_append (GTK_CLIST (listbox), text);
}
return 1;
}
void
x_list_insert (WListbox *l, WLEntry *p, WLEntry *e)
{
int pos = 0, i;
char *text [1];
if (!l->widget.wdata)
return;
for (i = 0; i < l->count; i++){
if (p == e)
break;
p = p->next;
pos++;
}
if (p != e){
printf ("x_list_insert: should not happen!\n");
return;
}
text [0] = e->text;
gtk_clist_append (GTK_CLIST (l->widget.wdata), text);
}
/* Labels */

Просмотреть файл

@ -451,3 +451,39 @@ flags=
[replace-Widget-overlab]
geometry=1,6,1,1
flags=ew
[mfind-Widget-listbox]
geometry=0,0,6,3
flags=snew
[mfind-Widget-button-edit]
geometry=2,5,1,1
flags=
[mfind-Widget-button-view]
geometry=1,5,1,1
flags=
[mfind-Widget-button-quit]
geometry=4,4,1,1
flags=
[mfind-Widget-button-again]
geometry=1,4,1,1
flags=
[mfind-Widget-button-panelize]
geometry=0,5,1,1
flags=
[mfind-Widget-start-stop]
geometry=2,4,1,1
flags=
[mfind-Widget-label-search]
geometry=0,3,1,1
flags=
[mfind-Widget-button-chdir]
geometry=0,4,1,1
flags=

Просмотреть файл

@ -1,8 +1,16 @@
Fri Mar 6 14:24:19 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
Fri Mar 6 19:29:54 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* find.c: Simplify header files: use the fs.h include file.
(use x_flush_events).
* screen.c (string_file_name): In GNOME, the CList widget does the
filename truncation, so we do not do it here.
(panel_new): Initialize all of the wpanel contents to zero. This
will is required by the GNOME X ports (to figure out if a field
has been inited or not).
Thu Mar 5 10:28:40 1998 Norbert Warmuth <k3190@fh-sw.de>
* popt.c (poptParseArgvString): make it compile with the native

Просмотреть файл

@ -50,6 +50,10 @@ Dlg_head *current_dlg = 0;
/* A hook list for idle events */
Hook *idle_hook = 0;
#ifndef PORT_HAS_SET_IDLE
# define x_set_idle(d,x)
#endif
static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
{
move (h->y+y, h->x+x);
@ -244,6 +248,7 @@ Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
void set_idle_proc (Dlg_head *d, int state)
{
d->send_idle_msg = state;
x_set_idle (d, state);
}
/* add component to dialog buffer */

Просмотреть файл

@ -107,6 +107,9 @@ typedef struct Dlg_head {
widget_data wdata;
int grided; /* Does it use the automatic layout? */
#ifdef HAVE_GNOME
int idle_fn_tag; /* Tag for the idle routine, -1 if none */
#endif
} Dlg_head;
/* XView widget layout */

Просмотреть файл

@ -331,8 +331,7 @@ check_buttons (void)
static int
check_buttons (void)
{
while (gtk_events_pending ())
gtk_main_iteration ();
x_flush_events ();
if (op_dlg->running)
return FILE_CONT;

Просмотреть файл

@ -26,34 +26,8 @@
# include <io.h>
# include <direct.h>
#endif
#include "fs.h"
#include <malloc.h> /* For free() */
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
#if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
# include <dirent.h>
# define NLENGTH(dirent) (strlen ((dirent)->d_name))
#else
# define dirent direct
# define NLENGTH(dirent) ((dirent)->d_namlen)
# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif /* HAVE_SYS_NDIR_H */
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif /* HAVE_SYS_DIR_H */
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif /* HAVE_NDIR_H */
#endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
#include <sys/stat.h>
#include <sys/param.h>
#include <stdlib.h>
@ -86,6 +60,9 @@ extern int verbose; /* Should be in a more sensible header file */
#include "xvmain.h"
#endif
#ifndef PORT_HAS_FLUSH_EVENTS
# define x_flush_events()
#endif
/* Size of the find parameters window */
#define FIND_Y 12
@ -552,8 +529,9 @@ do_search (struct Dlg_head *h)
}
#ifdef HAVE_XVIEW
xv_post_proc (h, (void (*)(void *))do_search, (void *)h);
#endif
#endif
#endif
x_flush_events ();
}
static int

Просмотреть файл

@ -97,8 +97,11 @@ Hook *select_file_hook = 0;
int panel_callback (Dlg_head *h, WPanel *p, int Msg, int Par);
int panel_event (Gpm_Event *event, WPanel *panel);
#ifndef HAVE_TK
#ifndef PORT_HAS_PANEL_ADJUST_TOP_FILE
# define x_adjust_top_file(p)
#endif
#ifndef PORT_HAS_PANEL_RESET_SORT_LABELS
# define x_reset_sort_labels(x)
#endif
@ -908,7 +911,8 @@ panel_new (char *panel_name)
int i, err;
panel = xmalloc (sizeof (WPanel), "panel_new");
memset (panel, 0, sizeof (WPanel));
/* No know sizes of the panel at startup */
init_widget (&panel->widget, 0, 0, 0, 0, (callback_fn)
panel_callback, (destroy_fn) panel_destroy,
@ -1368,7 +1372,6 @@ panel_format (WPanel *panel)
case list_brief:
return "half 2,type,name";
case list_user:
return panel->user_format;

Просмотреть файл

@ -2,11 +2,14 @@
/* key.h defines */
#define PORT_HAS_FILE_HANDLERS 1
#define PORT_HAS_GETCH 1
#define PORT_HAS_FRONTEND_RUN_DLG 1
#define PORT_WANTS_GET_SORT_FN 1
#define PORT_HAS_FILTER_CHANGED 1
#define PORT_HAS_FILE_HANDLERS 1
#define PORT_HAS_GETCH 1
#define PORT_HAS_FRONTEND_RUN_DLG 1
#define PORT_WANTS_GET_SORT_FN 1
#define PORT_HAS_FILTER_CHANGED 1
#define PORT_HAS_PANEL_ADJUST_TOP_FILE 1
#define PORT_HAS_PANEL_RESET_SORT_LABELS 1
#define frontend_run_dlg(x) tkrundlg_event (x)
/* Other */