aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2001-12-12 21:39:01 +0000
committerGerald Combs <gerald@wireshark.org>2001-12-12 21:39:01 +0000
commit7e092f2dd86c37089c98397e0d56bf45680fe4b5 (patch)
tree7934672ab2655891cbaefb3a79774cde4dda8024 /gtk
parenta93f4f8515b39e6e4d66b44e3dc420092fc79f34 (diff)
Go nuts with the 3D logo.
Add a routine to ui_util.c that sets a window's icon pixmap to a 16x16 version of the 3D logo. Call the routine for each window that is created. This has been tested with kwm and Sawfish (which expect a 16x16 icon), but we may have to come up with a better solution for other window managers (e.g. olwm and mwm). Add a 3D exclamation point image. Replace the exclamation point and Ethereal logo images used in simple_dialog() with their 3D counterparts. Remove the old icons from the source distribution. svn path=/trunk/; revision=4390
Diffstat (limited to 'gtk')
-rw-r--r--gtk/dlg_utils.c5
-rw-r--r--gtk/follow_dlg.c4
-rw-r--r--gtk/help_dlg.c4
-rw-r--r--gtk/main.c5
-rw-r--r--gtk/proto_hier_stats_dlg.c5
-rw-r--r--gtk/simple_dialog.c12
-rw-r--r--gtk/summary_dlg.c5
-rw-r--r--gtk/tcp_graph.c14
-rw-r--r--gtk/ui_util.c33
-rw-r--r--gtk/ui_util.h5
10 files changed, 77 insertions, 15 deletions
diff --git a/gtk/dlg_utils.c b/gtk/dlg_utils.c
index ef882fac09..23bc45eb4e 100644
--- a/gtk/dlg_utils.c
+++ b/gtk/dlg_utils.c
@@ -1,7 +1,7 @@
/* dlg_utils.c
* Utilities to use when constructing dialogs
*
- * $Id: dlg_utils.c,v 1.5 2000/08/23 06:55:37 guy Exp $
+ * $Id: dlg_utils.c,v 1.6 2001/12/12 21:38:58 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -31,6 +31,7 @@
#include <gdk/gdkkeysyms.h>
#include "gtkglobals.h"
+#include "ui_util.h"
static void
dlg_activate (GtkWidget *widget, gpointer ok_button);
@@ -47,6 +48,8 @@ dlg_window_new(const gchar *title)
win = gtk_window_new(GTK_WINDOW_DIALOG);
gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
gtk_window_set_title(GTK_WINDOW(win), title);
+ gtk_signal_connect (GTK_OBJECT (win), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
return win;
}
diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c
index 4751cac421..3bbf339022 100644
--- a/gtk/follow_dlg.c
+++ b/gtk/follow_dlg.c
@@ -1,6 +1,6 @@
/* follow_dlg.c
*
- * $Id: follow_dlg.c,v 1.14 2001/11/21 23:16:26 gram Exp $
+ * $Id: follow_dlg.c,v 1.15 2001/12/12 21:38:58 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -224,6 +224,8 @@ follow_stream_cb(GtkWidget * w, gpointer data)
gtk_signal_connect(GTK_OBJECT(streamwindow), "destroy",
GTK_SIGNAL_FUNC(follow_destroy_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (streamwindow), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
if (incomplete_tcp_stream) {
gtk_window_set_title(GTK_WINDOW(streamwindow),
"Contents of TCP stream (incomplete)");
diff --git a/gtk/help_dlg.c b/gtk/help_dlg.c
index 0cbd11554f..ad9963b99d 100644
--- a/gtk/help_dlg.c
+++ b/gtk/help_dlg.c
@@ -1,6 +1,6 @@
/* help_dlg.c
*
- * $Id: help_dlg.c,v 1.18 2001/08/21 06:39:18 guy Exp $
+ * $Id: help_dlg.c,v 1.19 2001/12/12 21:38:58 gerald Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -93,6 +93,8 @@ void help_cb(GtkWidget *w, gpointer data)
gtk_window_set_title(GTK_WINDOW(help_w), "Ethereal: Help");
gtk_signal_connect(GTK_OBJECT(help_w), "destroy",
GTK_SIGNAL_FUNC(help_destroy_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (help_w), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
gtk_widget_set_usize(GTK_WIDGET(help_w), DEF_WIDTH * 2/3, DEF_HEIGHT * 2/3);
gtk_container_border_width(GTK_CONTAINER(help_w), 2);
diff --git a/gtk/main.c b/gtk/main.c
index 6964e55686..45aa63efbc 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.217 2001/12/06 04:25:09 gram Exp $
+ * $Id: main.c,v 1.218 2001/12/12 21:38:58 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -147,6 +147,7 @@
#include "register.h"
#include "prefs.h"
#include "ringbuffer.h"
+#include "ui_util.h"
#include "image/clist_ascend.xpm"
#include "image/clist_descend.xpm"
@@ -1825,6 +1826,8 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
gtk_widget_set_name(top_level, "main window");
gtk_signal_connect(GTK_OBJECT(top_level), "delete_event",
GTK_SIGNAL_FUNC(main_window_delete_event_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (top_level), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
gtk_window_set_title(GTK_WINDOW(top_level), "The Ethereal Network Analyzer");
gtk_widget_set_usize(GTK_WIDGET(top_level), DEF_WIDTH, -1);
gtk_window_set_policy(GTK_WINDOW(top_level), TRUE, TRUE, FALSE);
diff --git a/gtk/proto_hier_stats_dlg.c b/gtk/proto_hier_stats_dlg.c
index 4f9326e139..da0a18e8b7 100644
--- a/gtk/proto_hier_stats_dlg.c
+++ b/gtk/proto_hier_stats_dlg.c
@@ -1,6 +1,6 @@
/* proto_hier_stats_dlg.c
*
- * $Id: proto_hier_stats_dlg.c,v 1.4 2001/03/29 04:21:35 gram Exp $
+ * $Id: proto_hier_stats_dlg.c,v 1.5 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -31,6 +31,7 @@
#include "proto_hier_stats.h"
#include "dlg_utils.h"
+#include "ui_util.h"
#include "main.h"
#define NUM_STAT_COLUMNS 6
@@ -185,6 +186,8 @@ proto_hier_stats_cb(GtkWidget *w, gpointer d)
dlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "Ethereal: " WNAME);
+ gtk_signal_connect (GTK_OBJECT (dlg), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c
index d0377422d0..d4f5608092 100644
--- a/gtk/simple_dialog.c
+++ b/gtk/simple_dialog.c
@@ -1,7 +1,7 @@
/* simple_dialog.c
* Simple message dialog box routines.
*
- * $Id: simple_dialog.c,v 1.7 2000/10/09 06:38:36 guy Exp $
+ * $Id: simple_dialog.c,v 1.8 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -42,8 +42,8 @@
#include "simple_dialog.h"
#include "dlg_utils.h"
-#include "image/icon-excl.xpm"
-#include "image/icon-ethereal.xpm"
+#include "image/eexcl3d64.xpm"
+#include "image/eicon3d64.xpm"
static void simple_dialog_cancel_cb(GtkWidget *, gpointer);
@@ -78,16 +78,16 @@ simple_dialog(gint type, gint *btn_mask, gchar *msg_format, ...) {
/* Main window */
switch (type & ~ESD_TYPE_MODAL) {
case ESD_TYPE_WARN :
- icon = icon_excl_xpm;
+ icon = eexcl3d64_xpm;
win = dlg_window_new("Ethereal: Warning");
break;
case ESD_TYPE_CRIT :
- icon = icon_excl_xpm;
+ icon = eexcl3d64_xpm;
win = dlg_window_new("Ethereal: Error");
break;
case ESD_TYPE_INFO :
default :
- icon = icon_ethereal_xpm;
+ icon = eicon3d64_xpm;
win = dlg_window_new("Ethereal: Information");
break;
}
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 64c50371a0..b0b313cd51 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -1,7 +1,7 @@
/* summary_dlg.c
* Routines for capture file summary window
*
- * $Id: summary_dlg.c,v 1.9 2001/02/11 09:28:17 guy Exp $
+ * $Id: summary_dlg.c,v 1.10 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,7 @@
#include "summary.h"
#include "summary_dlg.h"
#include "dlg_utils.h"
+#include "ui_util.h"
#define SUM_STR_MAX 1024
@@ -75,6 +76,8 @@ summary_open_cb(GtkWidget *w, gpointer d)
seconds = summary.stop_time - summary.start_time;
sum_open_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(sum_open_w), "Ethereal: Summary");
+ gtk_signal_connect (GTK_OBJECT (sum_open_w), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 3);
diff --git a/gtk/tcp_graph.c b/gtk/tcp_graph.c
index fc85b34b57..f9871fd70b 100644
--- a/gtk/tcp_graph.c
+++ b/gtk/tcp_graph.c
@@ -3,7 +3,7 @@
* By Pavel Mores <pvl@uh.cz>
* Win32 port: rwh@unifiedtech.com
*
- * $Id: tcp_graph.c,v 1.9 2001/12/12 01:19:28 guy Exp $
+ * $Id: tcp_graph.c,v 1.10 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -48,6 +48,7 @@
#include "gtkglobals.h" /* set_scrollbar_placement_srollw() and
* remember_scrolled_window() */
#include "simple_dialog.h"
+#include "ui_util.h"
#include "tcp_graph.h"
/* from <net/ethernet.h> */
@@ -578,6 +579,8 @@ static void create_text_widget (struct graph *g)
gtk_widget_set_name (streamwindow, "Packet chain");
gtk_widget_set_usize (GTK_WIDGET (streamwindow), TXT_WIDTH, TXT_HEIGHT);
gtk_container_border_width (GTK_CONTAINER(streamwindow), 2);
+ gtk_signal_connect (GTK_OBJECT (streamwindow), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (streamwindow), box);
@@ -677,6 +680,8 @@ static void create_drawing_area (struct graph *g)
#endif
g->toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (g->toplevel, "Test Graph");
+ gtk_signal_connect (GTK_OBJECT (g->toplevel), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
/* Create the drawing area */
g->drawing_area = gtk_drawing_area_new ();
@@ -817,6 +822,8 @@ static void control_panel_create (struct graph *g)
gtk_box_pack_start (GTK_BOX (button_box), close, TRUE, TRUE, 0);
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_signal_connect (GTK_OBJECT (toplevel), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
table = gtk_table_new (2, 1, FALSE);
gtk_container_add (GTK_CONTAINER (toplevel), table);
@@ -957,6 +964,9 @@ static void callback_create_help (GtkWidget *widget, gpointer data)
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(toplevel), "Help for TCP graphing");
gtk_widget_set_usize (toplevel, 500, 400);
+ gtk_signal_connect (GTK_OBJECT (toplevel), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
+
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (toplevel), box);
scroll = gtk_scrolled_window_new (NULL, NULL);
@@ -2536,6 +2546,8 @@ static void magnify_create (struct graph *g, int x, int y)
memcpy ((void * )mg, (void * )g, sizeof (struct graph));
mg->toplevel = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_signal_connect (GTK_OBJECT (mg->toplevel), "realize",
+ GTK_SIGNAL_FUNC (window_icon_realize_cb), NULL);
mg->drawing_area = mg->toplevel;
gtk_widget_set_usize (mg->toplevel, g->magnify.width, g->magnify.height);
gtk_widget_set_events (mg->drawing_area, GDK_EXPOSURE_MASK
diff --git a/gtk/ui_util.c b/gtk/ui_util.c
index e37bb6c934..e6aea4360a 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.4 2001/03/24 02:23:08 guy Exp $
+ * $Id: ui_util.c,v 1.5 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -34,6 +34,8 @@
#include "gtkglobals.h"
#include "ui_util.h"
#include "../ui_util.h"
+#include "image/eicon3d16.xpm"
+
/* Set the name of the top-level window and its icon.
XXX - for some reason, KWM insists on making the icon name be just
@@ -66,3 +68,32 @@ reactivate_window(GtkWidget *win)
gdk_window_show(win->window);
gdk_window_raise(win->window);
}
+
+/* Set our window icon. The GDK documentation doesn't provide any
+ actual documentation for gdk_window_set_icon(), so we'll steal
+ libgimp/gimpdialog.c:gimp_dialog_realize_callback() from the Gimp
+ sources and assume it's safe.
+
+ XXX - The current icon size is fixed at 16x16 pixels, which looks fine
+ in KDE and GNOME. Some windowing environments (e.g. CDE) have larger
+ icon sizes, so we need to find a way to size our icon appropriately.
+
+ */
+void
+window_icon_realize_cb (GtkWidget *win, gpointer data)
+{
+#ifndef WIN32
+ static GdkPixmap *icon_pmap = NULL;
+ static GdkBitmap *icon_mask = NULL;
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (win);
+
+ if (icon_pmap == NULL) {
+ icon_pmap = gdk_pixmap_create_from_xpm_d (win->window,
+ &icon_mask, &style->bg[GTK_STATE_NORMAL], eicon3d16_xpm);
+ }
+
+ gdk_window_set_icon (win->window, NULL, icon_pmap, icon_mask);
+#endif
+}
diff --git a/gtk/ui_util.h b/gtk/ui_util.h
index 361fcae413..a02fc98c39 100644
--- a/gtk/ui_util.h
+++ b/gtk/ui_util.h
@@ -1,7 +1,7 @@
/* ui_util.h
* Definitions for UI utility routines
*
- * $Id: ui_util.h,v 1.1 2001/03/24 02:23:08 guy Exp $
+ * $Id: ui_util.h,v 1.2 2001/12/12 21:38:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -33,4 +33,7 @@
pop up the existing one rather than creating a new one. */
void reactivate_window(GtkWidget *);
+/* Set the window icon to the 16x16 3D icon. */
+void window_icon_realize_cb (GtkWidget *, gpointer);
+
#endif /* __GTKGUIUI_UTIL_H__ */