aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--colors.c30
-rw-r--r--gtk/ui_util.c35
-rw-r--r--ui_util.h9
3 files changed, 36 insertions, 38 deletions
diff --git a/colors.c b/colors.c
index f6675ae0fc..eef68888b0 100644
--- a/colors.c
+++ b/colors.c
@@ -1,7 +1,7 @@
/* colors.c
* Definitions for color structures and routines
*
- * $Id: colors.c,v 1.26 1999/12/20 03:45:02 guy Exp $
+ * $Id: colors.c,v 1.27 1999/12/20 06:05:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -345,11 +345,8 @@ void
color_display_cb(GtkWidget *w, gpointer d)
{
if (colorize_win != NULL) {
- /* There's already a color dialog box active; raise it.
- XXX - request that it be given the input focus, too.
- Alas, GDK has nothing to do that, e.g., in X, by calling
- "XSetInputFocus()" on a window.... */
- gdk_window_raise(colorize_win->window);
+ /* There's already a color dialog box active; reactivate it. */
+ reactivate_window(colorize_win);
} else {
/* Create a new "Colorize Display" dialog. */
colorize_win = colorize_dialog_new(cf.colors);
@@ -883,11 +880,8 @@ edit_color_filter_dialog_new (colfilter *filter,
colorf = gtk_clist_get_row_data(GTK_CLIST(color_filters),
filter->row_selected);
if (colorf->edit_dialog != NULL) {
- /* There's already an edit box open for this filter; raise it.
- XXX - request that it be given the input focus, too.
- Alas, GDK has nothing to do that, e.g., in X, by calling
- "XSetInputFocus()" on a window.... */
- gdk_window_raise(colorf->edit_dialog->window);
+ /* There's already an edit box open for this filter; reactivate it. */
+ reactivate_window(colorf->edit_dialog);
return;
}
@@ -1082,11 +1076,8 @@ edit_color_filter_fg_cb (GtkButton *button,
color_selection_fg = gtk_object_get_data(GTK_OBJECT (colorf->edit_dialog),
COLOR_SELECTION_FG);
if (color_selection_fg != NULL) {
- /* Yes. Just raise it.
- XXX - request that it be given the input focus, too.
- Alas, GDK has nothing to do that, e.g., in X, by calling
- "XSetInputFocus()" on a window.... */
- gdk_window_raise(color_selection_fg->window);
+ /* Yes. Just reactivate it. */
+ reactivate_window(color_selection_fg);
} else {
/* No. Create a new color selection box, and associate it with
this dialog. */
@@ -1115,11 +1106,8 @@ edit_color_filter_bg_cb (GtkButton *button,
color_selection_bg = gtk_object_get_data(GTK_OBJECT (colorf->edit_dialog),
COLOR_SELECTION_BG);
if (color_selection_bg != NULL) {
- /* Yes. Just raise it.
- XXX - request that it be given the input focus, too.
- Alas, GDK has nothing to do that, e.g., in X, by calling
- "XSetInputFocus()" on a window.... */
- gdk_window_raise(color_selection_bg->window);
+ /* Yes. Just reactivate it. */
+ reactivate_window(color_selection_bg);
} else {
/* No. Create a new color selection box, and associate it with
this dialog. */
diff --git a/gtk/ui_util.c b/gtk/ui_util.c
index 084a843478..f5b7495fb3 100644
--- a/gtk/ui_util.c
+++ b/gtk/ui_util.c
@@ -1,7 +1,7 @@
/* ui_util.c
* UI utility routines
*
- * $Id: ui_util.c,v 1.1 1999/12/09 07:19:20 guy Exp $
+ * $Id: ui_util.c,v 1.2 1999/12/20 06:05:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -34,21 +34,6 @@
#include <stdarg.h>
#include <stdio.h>
-#if 0
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#endif
-
#ifdef NEED_SNPRINTF_H
# ifdef HAVE_STDARG_H
# include <stdarg.h>
@@ -78,6 +63,24 @@ set_main_window_name(gchar *icon_name)
gdk_window_set_icon_name(top_level->window, icon_name);
}
+/* Given a pointer to a GtkWidget for a top-level window, raise it and
+ de-iconify it. This routine is used if the user has done something to
+ ask that a window of a certain type be popped up when there can be only
+ one such window and such a window has already been popped up - we
+ pop up the existing one rather than creating a new one.
+
+ XXX - we should request that it be given the input focus, too. Alas,
+ GDK has nothing to do that, e.g. by calling "XSetInputFocus()" in a
+ window in X.
+
+ XXX - will this do the right thing on window systems other than X? */
+void
+reactivate_window(GtkWidget *win)
+{
+ gdk_window_show(win->window);
+ gdk_window_raise(win->window);
+}
+
static void simple_dialog_cancel_cb(GtkWidget *, gpointer);
static const gchar bm_key[] = "button mask";
diff --git a/ui_util.h b/ui_util.h
index 18908960d0..5a25c45704 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -1,7 +1,7 @@
/* ui_util.h
* Definitions for UI utility routines
*
- * $Id: ui_util.h,v 1.1 1999/12/09 07:19:04 guy Exp $
+ * $Id: ui_util.h,v 1.2 1999/12/20 06:05:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -33,6 +33,13 @@ extern "C" {
/* Set the name of the top-level window and its icon. */
void set_main_window_name(gchar *);
+/* Given a pointer to a GtkWidget for a top-level window, raise it and
+ de-iconify it. This routine is used if the user has done something to
+ ask that a window of a certain type be popped up when there can be only
+ one such window and such a window has already been popped up - we
+ pop up the existing one rather than creating a new one. */
+void reactivate_window(GtkWidget *);
+
/* Dialog type. */
#define ESD_TYPE_INFO 0
#define ESD_TYPE_WARN 1