forked from osmocom/wireshark
Add a "dlg_window_new()" routine, which creates a GTK_WINDOW_DIALOG
window and makes it transient for the top-level window; the transient-for at least provides a hint to X window managers to minimize the dialog if the main window is minimized; keep the dialog on top of the main window in the Z order for windows; perhaps (if there are any window managers that actually *do* this) even put it atop the main window in the X-Y plane (KWM doesn't and I seem to remember that the Exceed X server for Windows doesn't). It's generally considered the Right Thing To Do for dialog boxes. Use that routine to create dialog boxes, rather than doing it directly in the code for that dialog box. svn path=/trunk/; revision=2112
This commit is contained in:
parent
1e59b9dc86
commit
105d0f4f70
|
@ -1,7 +1,7 @@
|
|||
/* capture_dlg.c
|
||||
* Routines for packet capture windows
|
||||
*
|
||||
* $Id: capture_dlg.c,v 1.27 2000/06/27 04:35:57 guy Exp $
|
||||
* $Id: capture_dlg.c,v 1.28 2000/07/05 02:45:38 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -131,7 +131,7 @@ capture_prep_cb(GtkWidget *w, gpointer d)
|
|||
err_str);
|
||||
}
|
||||
|
||||
cap_open_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
cap_open_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(cap_open_w), "Ethereal: Capture Preferences");
|
||||
gtk_signal_connect(GTK_OBJECT(cap_open_w), "destroy",
|
||||
GTK_SIGNAL_FUNC(capture_prep_destroy_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* color_dlg.c
|
||||
* Definitions for dialog boxes for color filters
|
||||
*
|
||||
* $Id: color_dlg.c,v 1.3 2000/06/27 04:35:58 guy Exp $
|
||||
* $Id: color_dlg.c,v 1.4 2000/07/05 02:45:38 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -42,6 +42,7 @@
|
|||
#include "file.h"
|
||||
#include "dfilter.h"
|
||||
#include "simple_dialog.h"
|
||||
#include "dlg_utils.h"
|
||||
#include "ui_util.h"
|
||||
|
||||
static GtkWidget* colorize_dialog_new(colfilter *filter);
|
||||
|
@ -126,7 +127,7 @@ colorize_dialog_new (colfilter *filter)
|
|||
filter->row_selected = -1; /* no row selected */
|
||||
tooltips = gtk_tooltips_new ();
|
||||
|
||||
color_win = gtk_window_new (GTK_WINDOW_DIALOG);
|
||||
color_win = dlg_window_new ();
|
||||
gtk_object_set_data (GTK_OBJECT (color_win), "color_win", color_win);
|
||||
gtk_window_set_title (GTK_WINDOW (color_win), ("Add color to protocols"));
|
||||
|
||||
|
@ -633,7 +634,7 @@ edit_color_filter_dialog_new (colfilter *filter,
|
|||
|
||||
tooltips = gtk_tooltips_new ();
|
||||
|
||||
edit_dialog = gtk_window_new (GTK_WINDOW_DIALOG);
|
||||
edit_dialog = dlg_window_new ();
|
||||
gtk_object_set_data (GTK_OBJECT (edit_dialog), "edit_dialog", edit_dialog);
|
||||
gtk_window_set_title (GTK_WINDOW (edit_dialog), ("Edit color filter"));
|
||||
colorf->edit_dialog = edit_dialog;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* display_opts.c
|
||||
* Routines for packet display windows
|
||||
*
|
||||
* $Id: display_opts.c,v 1.9 2000/06/27 05:18:44 guy Exp $
|
||||
* $Id: display_opts.c,v 1.10 2000/07/05 02:45:39 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -107,7 +107,7 @@ display_opt_cb(GtkWidget *w, gpointer d) {
|
|||
if we've changed it with "Apply". */
|
||||
prev_timestamp_type = timestamp_type;
|
||||
|
||||
display_opt_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
display_opt_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(display_opt_w), "Ethereal: Display Options");
|
||||
gtk_signal_connect(GTK_OBJECT(display_opt_w), "destroy",
|
||||
GTK_SIGNAL_FUNC(display_opt_destroy_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* dlg_utils.c
|
||||
* Utilities to use when constructing dialogs
|
||||
*
|
||||
* $Id: dlg_utils.c,v 1.3 2000/05/26 07:32:56 guy Exp $
|
||||
* $Id: dlg_utils.c,v 1.4 2000/07/05 02:45:39 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -30,12 +30,25 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "gtkglobals.h"
|
||||
|
||||
static void
|
||||
dlg_activate (GtkWidget *widget, gpointer ok_button);
|
||||
|
||||
static gint
|
||||
dlg_key_press (GtkWidget *widget, GdkEventKey *event, gpointer cancel_button);
|
||||
|
||||
/* Create a dialog box window that belongs to Ethereal's main window. */
|
||||
GtkWidget *
|
||||
dlg_window_new(void)
|
||||
{
|
||||
GtkWidget *win;
|
||||
|
||||
win = gtk_window_new(GTK_WINDOW_DIALOG);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
|
||||
return win;
|
||||
}
|
||||
|
||||
/* Set the "activate" signal for a widget to call a routine to
|
||||
activate the "OK" button for a dialog box.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* dlg_utils.h
|
||||
* Declarations of utilities to use when constructing dialogs
|
||||
*
|
||||
* $Id: dlg_utils.h,v 1.2 2000/05/08 04:23:46 guy Exp $
|
||||
* $Id: dlg_utils.h,v 1.3 2000/07/05 02:45:39 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -22,7 +22,17 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Create a dialog box window that belongs to Ethereal's main window. */
|
||||
GtkWidget *dlg_window_new(void);
|
||||
|
||||
/* Set the "activate" signal for a widget to call a routine to
|
||||
activate the "OK" button for a dialog box. */
|
||||
void dlg_set_activate(GtkWidget *widget, GtkWidget *ok_button);
|
||||
|
||||
/* Set the "key_press_event" signal for a top-level dialog window to
|
||||
call a routine to activate the "Cancel" button for a dialog box if
|
||||
the key being pressed is the <Esc> key. */
|
||||
void dlg_set_cancel(GtkWidget *widget, GtkWidget *cancel_button);
|
||||
|
||||
GtkWidget *dlg_radio_button_new_with_label_with_mnemonic(GSList *group,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* (This used to be a notebook page under "Preferences", hence the
|
||||
* "prefs" in the file name.)
|
||||
*
|
||||
* $Id: filter_prefs.c,v 1.11 2000/04/01 12:03:40 guy Exp $
|
||||
* $Id: filter_prefs.c,v 1.12 2000/07/05 02:45:39 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include "packet.h"
|
||||
#include "file.h"
|
||||
#include "util.h"
|
||||
#include "dlg_utils.h"
|
||||
#include "ui_util.h"
|
||||
#include "prefs_dlg.h"
|
||||
|
||||
|
@ -221,7 +222,7 @@ filter_dialog_new(GtkWidget *caller, GtkWidget *filter_te)
|
|||
*cancel_bt; /* cancel button */
|
||||
GtkWidget *filter_pg = NULL; /* filter settings box */
|
||||
|
||||
main_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
main_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(main_w), "Ethereal: Filters");
|
||||
|
||||
/* Call a handler when we're destroyed, so we can inform
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* find_dlg.c
|
||||
* Routines for "find frame" window
|
||||
*
|
||||
* $Id: find_dlg.c,v 1.11 2000/06/27 04:36:00 guy Exp $
|
||||
* $Id: find_dlg.c,v 1.12 2000/07/05 02:45:40 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -83,7 +83,7 @@ find_frame_cb(GtkWidget *w, gpointer d)
|
|||
return;
|
||||
}
|
||||
|
||||
find_frame_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
find_frame_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(find_frame_w), "Ethereal: Find Frame");
|
||||
gtk_signal_connect(GTK_OBJECT(find_frame_w), "destroy",
|
||||
GTK_SIGNAL_FUNC(find_frame_destroy_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* goto_dlg.c
|
||||
* Routines for "go to frame" window
|
||||
*
|
||||
* $Id: goto_dlg.c,v 1.7 2000/06/27 04:36:01 guy Exp $
|
||||
* $Id: goto_dlg.c,v 1.8 2000/07/05 02:45:40 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -64,7 +64,7 @@ goto_frame_cb(GtkWidget *w, gpointer d)
|
|||
GtkWidget *goto_frame_w, *main_vb, *fnumber_hb, *fnumber_lb, *fnumber_te,
|
||||
*bbox, *ok_bt, *cancel_bt;
|
||||
|
||||
goto_frame_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
goto_frame_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(goto_frame_w), "Ethereal: Go To Frame");
|
||||
|
||||
/* Container for each row of widgets */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugins_dlg.c
|
||||
* Dialog boxes for plugins
|
||||
*
|
||||
* $Id: plugins_dlg.c,v 1.13 2000/02/07 17:07:54 gram Exp $
|
||||
* $Id: plugins_dlg.c,v 1.14 2000/07/05 02:45:40 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include "globals.h"
|
||||
#include "plugins.h"
|
||||
#include "keys.h"
|
||||
#include "dlg_utils.h"
|
||||
#include "prefs_dlg.h"
|
||||
#include "simple_dialog.h"
|
||||
|
||||
|
@ -82,7 +83,7 @@ tools_plugins_cmd_cb(GtkWidget *widget, gpointer data)
|
|||
GtkWidget *save_bn;
|
||||
gchar *titles[] = {"Name", "Description", "Version", "Enabled"};
|
||||
|
||||
plugins_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
plugins_window = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(plugins_window), "Ethereal: Plugins");
|
||||
|
||||
main_vbox = gtk_vbox_new(FALSE, 0);
|
||||
|
@ -311,7 +312,7 @@ plugins_filter_cb(GtkWidget *button, gpointer clist)
|
|||
if (selected_row == -1) return;
|
||||
pt_plug = find_plugin(selected_name, selected_version);
|
||||
|
||||
filter_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
filter_window = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(filter_window), "Ethereal: Plugin Filter");
|
||||
gtk_window_set_modal(GTK_WINDOW(filter_window), TRUE);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* prefs_dlg.c
|
||||
* Routines for handling preferences
|
||||
*
|
||||
* $Id: prefs_dlg.c,v 1.11 2000/05/08 07:58:20 guy Exp $
|
||||
* $Id: prefs_dlg.c,v 1.12 2000/07/05 02:45:41 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -92,7 +92,7 @@ prefs_cb(GtkWidget *w, gpointer sp) {
|
|||
return;
|
||||
}
|
||||
|
||||
prefs_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
prefs_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(prefs_w), "Ethereal: Preferences");
|
||||
gtk_signal_connect(GTK_OBJECT(prefs_w), "delete-event",
|
||||
GTK_SIGNAL_FUNC(prefs_main_delete_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* print_dlg.c
|
||||
* Dialog boxes for printing
|
||||
*
|
||||
* $Id: print_dlg.c,v 1.18 2000/06/27 04:36:03 guy Exp $
|
||||
* $Id: print_dlg.c,v 1.19 2000/07/05 02:45:41 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -119,7 +119,7 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
|
|||
return;
|
||||
}
|
||||
|
||||
print_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
print_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(print_w), "Ethereal: Print");
|
||||
gtk_signal_connect(GTK_OBJECT(print_w), "destroy",
|
||||
GTK_SIGNAL_FUNC(print_destroy_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* progress_dlg.c
|
||||
* Routines for progress-bar (modal) dialog
|
||||
*
|
||||
* $Id: progress_dlg.c,v 1.2 2000/07/03 19:42:36 guy Exp $
|
||||
* $Id: progress_dlg.c,v 1.3 2000/07/05 02:45:41 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
|
||||
#include "gtkglobals.h"
|
||||
#include "dlg_utils.h"
|
||||
#include "ui_util.h"
|
||||
|
||||
#define PROG_BAR_KEY "progress_bar"
|
||||
|
@ -62,7 +63,7 @@ create_progress_dlg(gchar *title, gboolean *stop_flag)
|
|||
GtkWidget *dlg_w, *main_vb, *title_lb, *prog_bar, *cancel_al,
|
||||
*cancel_bt;
|
||||
|
||||
dlg_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
dlg_w = dlg_window_new();
|
||||
gtk_window_set_title(GTK_WINDOW(dlg_w), title);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* dialog.c
|
||||
* Dialog box routines.
|
||||
/* simple_dialog.c
|
||||
* Simple message dialog box routines.
|
||||
*
|
||||
* $Id: simple_dialog.c,v 1.2 2000/05/03 07:19:38 guy Exp $
|
||||
* $Id: simple_dialog.c,v 1.3 2000/07/05 02:45:42 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -81,7 +81,7 @@ simple_dialog(gint type, gint *btn_mask, gchar *msg_format, ...) {
|
|||
gchar **icon;
|
||||
|
||||
/* Main window */
|
||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
win = dlg_window_new();
|
||||
gtk_container_border_width(GTK_CONTAINER(win), 7);
|
||||
|
||||
switch (type) {
|
||||
|
|
Loading…
Reference in New Issue