summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-12-05 22:28:12 +0000
committerGerald Combs <gerald@wireshark.org>2012-12-05 22:28:12 +0000
commit07898cae39896087f39c31458a3eb077d44c6a95 (patch)
tree33dc28f90e6ab4ba4760f3f8ae57744b85da004e /ui
parent025f5d1ecd576c1cd546fc489326dacb49647a4d (diff)
downloadwireshark-07898cae39896087f39c31458a3eb077d44c6a95.tar.gz
Create 16x16 and 24x24 versions of the document icon with a contrasting
border. Add them as pixbufs to ui/gtk/toolbar_icons.h and use them to replace the file icon XPM in stock_icons.c. Add modelines. svn path=/trunk/; revision=46413
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/Makefile.am10
-rw-r--r--ui/gtk/Makefile.common2
-rw-r--r--ui/gtk/stock_icons.c46
-rw-r--r--ui/qt/main_window.ui4
4 files changed, 56 insertions, 6 deletions
diff --git a/ui/gtk/Makefile.am b/ui/gtk/Makefile.am
index e43400c529..3cecad0e6a 100644
--- a/ui/gtk/Makefile.am
+++ b/ui/gtk/Makefile.am
@@ -132,6 +132,16 @@ pipe_icon.h:
echo >> $@
gdk-pixbuf-csource --raw --name=pipe_pb_data $(top_srcdir)/image/toolbar/pipe_16.png >> $@
+toolbar_icons.h:
+ echo "/* This file was automatically generated. DO NOT EDIT. */" > $@
+ echo >> $@
+ for icon16 in wireshark_file ; do \
+ gdk-pixbuf-csource --raw --name=toolbar_$${icon16}_16_pb_data $(top_srcdir)/image/toolbar/toolbar_$${icon16}_16.png >> $@ ;\
+ done
+ for icon24 in wireshark_file ; do \
+ gdk-pixbuf-csource --raw --name=toolbar_$${icon24}_24_pb_data $(top_srcdir)/image/toolbar/toolbar_$${icon24}_24.png >> $@ ;\
+ done
+
EXTRA_DIST = \
$(GENERATOR_FILES) \
airpcap_dlg.c \
diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common
index 738538afa6..7c9bc2754a 100644
--- a/ui/gtk/Makefile.common
+++ b/ui/gtk/Makefile.common
@@ -145,6 +145,7 @@ WIRESHARK_GTK_SRC = \
about_dlg.c main_welcome.c: ../../image/wssplash.xpm ../../image/wssplash-dev.xpm remote_icons.h
main_statusbar.c: expert_indicators.h capture_comment_icons.h
capture_if_dlg.c: network_icons.h remote_icons.h pipe_icon.h
+stock_icons.c: toolbar_icons.h
WIRESHARK_TAP_SRC = \
afp_stat.c \
@@ -336,6 +337,7 @@ noinst_HEADERS = \
supported_protos_dlg.h \
tap_param_dlg.h \
text_page_utils.h \
+ toolbar_icons.h \
uat_gui.h \
voip_calls.h \
voip_calls_dlg.h \
diff --git a/ui/gtk/stock_icons.c b/ui/gtk/stock_icons.c
index bc8b0bd117..2568c8de75 100644
--- a/ui/gtk/stock_icons.c
+++ b/ui/gtk/stock_icons.c
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include "ui/gtk/stock_icons.h"
+#include "ui/gtk/toolbar_icons.h"
/* these icons are derived from the original stock icons */
#include "../../image/toolbar/capture_interfaces_24.xpm"
@@ -72,13 +73,18 @@
#include "../../image/toolbar/voip_flow_24.xpm"
#include "../../image/toolbar/telephone_16.xpm"
#include "../../image/toolbar/analyze_24.xpm"
-#include "../../image/WiresharkDoc_24.xpm"
typedef struct stock_pixmap_tag{
const char * name;
const char ** xpm_data;
} stock_pixmap_t;
+typedef struct stock_pixbuf_tag{
+ const char * name;
+ const guint8 * pb_data16; /* Optional */
+ const guint8 * pb_data24; /* Mandatory */
+} stock_pixbuf_t;
+
/* generate application specific stock items */
void stock_icons_init(void) {
GtkIconFactory * factory;
@@ -211,10 +217,13 @@ void stock_icons_init(void) {
{ WIRESHARK_STOCK_TELEPHONE, telephone_16_xpm},
{ WIRESHARK_STOCK_PREPARE_FILTER, display_filter_24_xpm},
{ WIRESHARK_STOCK_ANALYZE, analyze_24_xpm},
- { WIRESHARK_STOCK_FILE, WiresharkDoc_24_xpm},
{ NULL, NULL }
};
+ static const stock_pixbuf_t pixbufs[] = {
+ { WIRESHARK_STOCK_FILE, toolbar_wireshark_file_16_pb_data, toolbar_wireshark_file_24_pb_data},
+ { NULL, NULL, NULL }
+ };
/* Register our stock items */
gtk_stock_add (stock_items, G_N_ELEMENTS (stock_items));
@@ -222,7 +231,8 @@ void stock_icons_init(void) {
factory = gtk_icon_factory_new();
gtk_icon_factory_add_default(factory);
- /* Create the stock items to add into our icon factory */
+ /* Add pixmaps our icon factory */
+ /* Please use pixbufs (below) for new icons */
for (i = 0; pixmaps[i].name != NULL; i++) {
/* The default icon */
pixbuf = gdk_pixbuf_new_from_xpm_data((const char **) (pixmaps[i].xpm_data));
@@ -237,6 +247,23 @@ void stock_icons_init(void) {
g_object_unref (G_OBJECT (pixbuf));
}
+ /* Add pixbufs our icon factory */
+ for (i = 0; pixbufs[i].name != NULL; i++) {
+ /* Default image */
+ icon_set = gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_inline(-1, pixbufs[i].pb_data24, FALSE, NULL));
+
+ if (pixbufs[i].pb_data16) {
+ GtkIconSource *source16 = gtk_icon_source_new();
+ gtk_icon_source_set_pixbuf(source16, gdk_pixbuf_new_from_inline(-1, pixbufs[i].pb_data16, FALSE, NULL));
+ gtk_icon_source_set_size_wildcarded(source16, FALSE);
+ gtk_icon_source_set_size(source16, GTK_ICON_SIZE_MENU);
+ gtk_icon_set_add_source(icon_set, source16);
+ }
+
+ gtk_icon_factory_add (factory, pixbufs[i].name, icon_set);
+ gtk_icon_set_unref (icon_set);
+ }
+
/* use default stock icons for Wireshark specifics where the icon metapher makes sense */
/* PLEASE DON'T REUSE STOCK ICONS IF THEY ARE USUALLY USED FOR SOME DIFFERENT MEANING!!!) */
icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_OPEN);
@@ -270,4 +297,15 @@ void stock_icons_init(void) {
g_object_unref (G_OBJECT (factory));
}
-
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 5c9733bc9a..3ad2e72f14 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -586,7 +586,7 @@
<action name="actionFileSave">
<property name="icon">
<iconset resource="../../image/toolbar.qrc">
- <normaloff>:/toolbar/main/WiresharkDoc-24.png</normaloff>:/toolbar/main/WiresharkDoc-24.png</iconset>
+ <normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</iconset>
</property>
<property name="text">
<string>&amp;Save</string>
@@ -601,7 +601,7 @@
<action name="actionFileSaveAs">
<property name="icon">
<iconset resource="../../image/toolbar.qrc">
- <normaloff>:/toolbar/main/WiresharkDoc-24.png</normaloff>:/toolbar/main/WiresharkDoc-24.png</iconset>
+ <normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</iconset>
</property>
<property name="text">
<string>Save &amp;As...</string>