Fix several bugglets as reported by Tom. -miguel

This commit is contained in:
Miguel de Icaza 1998-03-14 23:20:51 +00:00
parent 5b49482824
commit 51900cea50
9 changed files with 66 additions and 18 deletions

View File

@ -1,3 +1,14 @@
Sat Mar 14 17:13:26 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gmain.c (gnome_dlg_send_destroy): New signal handler for
"delete_event". I return TRUE (ie, do not kill this window), and
manually queue que destruction of this window.
* gtools.c (query_dialog): Do not allow resizing; do not destroy
the dialog ourselves, this is properly handled by dlg.c now
(pack_button): Do not use the defaults: we do not want growing
buttons;
Fri Mar 13 16:01:28 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gwidget.c (buttonbar_clicked, x_create_buttonbar): Button bar

View File

@ -141,10 +141,14 @@ xtoolkit_create_dialog (Dlg_head *h, int flags)
{
GtkWidget *win, *ted;
if (flags & DLG_GNOME_APP)
win = gnome_app_new ("mc", h->name);
else
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (!(flags & DLG_NO_TOPLEVEL)){
if (flags & DLG_GNOME_APP)
win = gnome_app_new ("mc", h->name);
else
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
} else
win = 0;
h->grided = flags;
h->idle_fn_tag = -1;
if (!(flags & DLG_NO_TED)){
@ -154,10 +158,23 @@ xtoolkit_create_dialog (Dlg_head *h, int flags)
bind_gtk_keys (GTK_WIDGET (ted), h);
}
bind_gtk_keys (GTK_WIDGET (win), h);
if (win)
bind_gtk_keys (GTK_WIDGET (win), h);
return (widget_data) win;
}
/* Used to bind a window for an already created Dlg_head. This is
* used together with the DLG_NO_TOPLEVEL: the dialog is created
* with the DLG_NO_TOPLEVEL and later, when the window is created
* it is assigned with this routine
*/
void
x_dlg_set_window (Dlg_head *h, GtkWidget *win)
{
h->wdata = (widget_data) win;
bind_gtk_keys (GTK_WIDGET (win), h);
}
void
x_set_dialog_title (Dlg_head *h, char *title)
{
@ -201,6 +218,15 @@ x_add_widget (Dlg_head *h, Widget_Item *w)
}
}
static int
gnome_dlg_send_destroy (GtkWidget *widget, Dlg_head *h)
{
printf ("destruyendo\n");
h->ret_value = B_CANCEL;
dlg_stop (h);
return TRUE;
}
void
x_init_dlg (Dlg_head *h)
{
@ -219,6 +245,8 @@ x_init_dlg (Dlg_head *h)
gtk_widget_show (GTK_WIDGET (h->wdata));
}
gtk_signal_connect (GTK_OBJECT (h->wdata), "delete_event",
GTK_SIGNAL_FUNC (gnome_dlg_send_destroy), h);
x_focus_widget (h->current);
}

View File

@ -10,6 +10,7 @@ int xtoolkit_end (void);
/* Required by the standard code */
widget_data xtoolkit_create_dialog (Dlg_head *h, int with_grid);
widget_data xtoolkit_get_main_dialog (Dlg_head *h);
void x_dlg_set_window (Dlg_head *h, GtkWidget *win);
widget_data x_create_panel_container (int which);
void x_panel_container_show (widget_data wdata);

View File

@ -918,7 +918,10 @@ panel_switch_new_display_mode (WPanel *panel)
static GtkWidget *
panel_create_cwd (WPanel *panel)
{
return gtk_label_new ("");
GtkWidget *label = gtk_label_new ("");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
return label;
}
static void

View File

@ -43,9 +43,10 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
int i, result = -1;
h = create_dlg (0, 0, 0, 0, dialog_colors, default_dlg_callback, "[QueryBox]", "query",
DLG_NO_TED);
DLG_NO_TED | DLG_NO_TOPLEVEL);
dialog = GTK_DIALOG (gtk_dialog_new ());
h->wdata = dialog;
x_dlg_set_window (h, dialog);
gtk_window_set_policy (GTK_WINDOW (dialog), 0, 0, 0);
x_set_dialog_title (h, header);
@ -94,7 +95,6 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
dlg_run_done (h);
last_query_dlg = h;
gtk_grab_remove (GTK_WIDGET (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
switch (h->ret_value){
case B_CANCEL:

View File

@ -1,3 +1,8 @@
Sat Mar 14 17:30:21 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* file.c (panel_operate): Why was the flags in query_dialog set to
D_INSERT is a big mistery. Should be fixed now.
Fri Mar 13 18:10:58 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* dlg.c (dlg_stop): New routine used to finish dialog boxes.

View File

@ -570,9 +570,8 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
case KEY_F (10):
case XCTRL ('c'):
case XCTRL ('g'):
h->running = 0;
x_dialog_stop (h);
h->ret_value = B_CANCEL;
dlg_stop (h);
break;
}
}

View File

@ -199,12 +199,13 @@ Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
char *help_ctx, char *name, int flags);
/* The flags: */
#define DLG_GNOME_APP 16 /* GNOME only: use a gnome-app for the toplevel window */
#define DLG_NO_TED 8 /* GNOME only: do not manage layout with a GNOME GtkTed widget */
#define DLG_GRID 4 /* Widgets should be created under .widgets */
#define DLG_TRYUP 2 /* Try to move two lines up the dialog */
#define DLG_CENTER 1 /* Center the dialog */
#define DLG_NONE 0 /* No options */
#define DLG_NO_TOPLEVEL 32 /* GNOME only: Do not create a toplevel window, user provides it */
#define DLG_GNOME_APP 16 /* GNOME only: use a gnome-app for the toplevel window */
#define DLG_NO_TED 8 /* GNOME only: do not manage layout with a GNOME GtkTed widget */
#define DLG_GRID 4 /* Widgets should be created under .widgets */
#define DLG_TRYUP 2 /* Try to move two lines up the dialog */
#define DLG_CENTER 1 /* Center the dialog */
#define DLG_NONE 0 /* No options */
int add_widget (Dlg_head *dest, void *Widget);
int add_widgetl (Dlg_head *dest, void *Widget, WLay layout);

View File

@ -2119,7 +2119,7 @@ panel_operate (void *source_panel, int operation, char *thedefault)
if (know_not_what_am_i_doing)
query_set_sel (1);
i = query_dialog (op_names [operation], cmd_buf,
3, 2, "&Yes", "&No");
D_ERROR, 2, "&Yes", "&No");
if (i != 0)
return 0;
} else if (operation != OP_DELETE) {