set the read filter dialog modal and transient to the parent window if requested. This way, it will receive input signals (solving problems with GTK2's gtk_file_chooser).

To do this, add another construct_args flag, so it will be modal only if really needed ...

svn path=/trunk/; revision=16926
This commit is contained in:
Ulf Lamping 2005-12-31 17:09:27 +00:00
parent 851692e8fb
commit b4471e0195
9 changed files with 28 additions and 9 deletions

View File

@ -550,7 +550,8 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
static construct_args_t args = {
"Service Response Time Statistics Filter",
FALSE,
FALSE
FALSE,
FALSE
};
/* if the window is already open, bring it to front and

View File

@ -431,7 +431,8 @@ file_open_cmd(GtkWidget *w)
static construct_args_t args = {
"Ethereal: Read Filter",
FALSE,
FALSE
FALSE,
TRUE
};
if (file_open_w != NULL) {
@ -760,7 +761,8 @@ file_merge_cmd(GtkWidget *w)
static construct_args_t args = {
"Ethereal: Read Filter",
FALSE,
FALSE
FALSE,
TRUE
};
if (file_merge_w != NULL) {

View File

@ -105,7 +105,8 @@ capture_filter_construct_cb(GtkWidget *w, gpointer user_data _U_)
static construct_args_t args = {
"Ethereal: Capture Filter",
FALSE,
FALSE
FALSE,
FALSE
};
/* Has a filter dialog box already been opened for that button? */
@ -194,7 +195,8 @@ cfilter_dialog_cb(GtkWidget *w _U_)
static construct_args_t args = {
"Ethereal: Capture Filter",
FALSE,
FALSE
FALSE,
FALSE
};
/* Has a filter dialog box already been opened for editing
@ -222,7 +224,8 @@ dfilter_dialog_cb(GtkWidget *w _U_)
static construct_args_t args = {
"Ethereal: Display Filter",
TRUE,
TRUE
TRUE,
FALSE
};
display_filter_construct_cb(OBJECT_GET_DATA(top_level, E_FILT_BT_PTR_KEY), &args);
@ -362,6 +365,12 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te,
gtk_window_set_default_size(GTK_WINDOW(main_w), 400, 400);
OBJECT_SET_DATA(main_w, E_FILT_CONSTRUCT_ARGS_KEY, construct_args);
if(construct_args->modal_and_transient) {
GdkWindow* parent = gtk_widget_get_parent_window(parent_filter_te);
gtk_window_set_transient_for(GTK_WINDOW(main_w), GTK_WINDOW(parent));
gtk_window_set_modal(GTK_WINDOW(main_w), TRUE);
}
main_vb = gtk_vbox_new(FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
gtk_container_add(GTK_CONTAINER(main_w), main_vb);

View File

@ -41,6 +41,8 @@ typedef struct {
gboolean wants_apply_button; /**< dialog should have an Apply button */
gboolean activate_on_ok; /**< if parent text widget should be
activated on "Ok" or "Apply" */
gboolean modal_and_transient; /**< dialog is modal and transient to the
parent window (e.g. to gtk_file_chooser) */
} construct_args_t;
/** Create a "Capture Filter" dialog box caused by a button click.

View File

@ -125,7 +125,8 @@ find_frame_cb(GtkWidget *w _U_, gpointer d _U_)
static construct_args_t args = {
"Ethereal: Search Filter",
FALSE,
TRUE
TRUE,
FALSE
};
if (find_frame_w != NULL) {

View File

@ -1085,6 +1085,7 @@ gtk_iostat_init(const char *optarg _U_)
io->graphs[i].args->title = NULL;
io->graphs[i].args->wants_apply_button=TRUE;
io->graphs[i].args->activate_on_ok=TRUE;
io->graphs[i].args->modal_and_transient=FALSE;
io->graphs[i].filter_bt=NULL;
}

View File

@ -3273,7 +3273,8 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
static construct_args_t args = {
"Ethereal: Display Filter",
TRUE,
TRUE
TRUE,
FALSE
};
/* use user-defined title if preference is set */

View File

@ -418,7 +418,8 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
static construct_args_t args = {
"Service Response Time Statistics Filter",
TRUE,
FALSE
FALSE,
FALSE
};
/* if the window is already open, bring it to front */

View File

@ -160,6 +160,7 @@ tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
end_dlg_list->args.title = g_strdup_printf("%s Filter", dlg_data->win_title);
end_dlg_list->args.wants_apply_button = TRUE;
end_dlg_list->args.activate_on_ok = FALSE;
end_dlg_list->args.modal_and_transient = FALSE;
end_dlg_list->next = NULL;
dlg_data->index = end_dlg_list->cont.index;
current_dlg = end_dlg_list;