diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-06-12 04:55:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-06-12 04:55:37 +0000 |
commit | e00bcd3bc325870b5e8adf9d9e2ca6429d7d6d44 (patch) | |
tree | 9bc954e8c626b34e6876241ccbb9ee9fccbf20bc | |
parent | 7a6a0df99765b2a5758eef0d7e3d4b07b5848f20 (diff) | |
download | gnunet-gtk-e00bcd3bc325870b5e8adf9d9e2ca6429d7d6d44.tar.gz gnunet-gtk-e00bcd3bc325870b5e8adf9d9e2ca6429d7d6d44.zip |
finally icons working nicely
-rw-r--r-- | pixmaps/icons/Makefile.am | 4 | ||||
-rw-r--r-- | src/core/main.c | 30 |
2 files changed, 19 insertions, 15 deletions
diff --git a/pixmaps/icons/Makefile.am b/pixmaps/icons/Makefile.am index fcf18774..9ab5a531 100644 --- a/pixmaps/icons/Makefile.am +++ b/pixmaps/icons/Makefile.am | |||
@@ -1,5 +1,5 @@ | |||
1 | theme=hicolor | 1 | theme=hicolor |
2 | themedir=$(datadir)/icons/$(theme) | 2 | themedir="icons/$(theme)" |
3 | theme_icons = \ | 3 | theme_icons = \ |
4 | apps,gnunet-gtk.svg \ | 4 | apps,gnunet-gtk.svg \ |
5 | apps,gnunet-gtk-16.png \ | 5 | apps,gnunet-gtk-16.png \ |
@@ -7,7 +7,7 @@ theme_icons = \ | |||
7 | apps,gnunet-gtk-24.png \ | 7 | apps,gnunet-gtk-24.png \ |
8 | apps,gnunet-gtk-32.png | 8 | apps,gnunet-gtk-32.png |
9 | 9 | ||
10 | install_icon_exec=${top_srcdir}/pixmaps/icons/icon-theme-installer -t ${theme} -s ${srcdir} -b ${themedir} -m "${mkinstalldirs}" -x "${INSTALL_DATA}" | 10 | install_icon_exec=${top_srcdir}/pixmaps/icons/icon-theme-installer -t ${theme} -s ${srcdir} -d "$(datadir)/gnunet-gtk/" -b ${themedir} -m "${mkinstalldirs}" -x "${INSTALL_DATA}" |
11 | 11 | ||
12 | install-data-local: | 12 | install-data-local: |
13 | $(install_icon_exec) -i "${theme_icons}" | 13 | $(install_icon_exec) -i "${theme_icons}" |
diff --git a/src/core/main.c b/src/core/main.c index 0b92ef8e..27353922 100644 --- a/src/core/main.c +++ b/src/core/main.c | |||
@@ -76,6 +76,22 @@ customLog (const char *msg) | |||
76 | } | 76 | } |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | static void | ||
80 | setIconSearchPath() | ||
81 | { | ||
82 | char *dataDir; | ||
83 | char *buf; | ||
84 | |||
85 | dataDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); | ||
86 | buf = GNUNET_malloc(strlen(dataDir) + strlen("../gnunet-gtk/icons/") + 2); | ||
87 | strcpy(buf, dataDir); | ||
88 | strcat(buf, "../gnunet-gtk/icons/"); | ||
89 | gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), | ||
90 | buf); | ||
91 | GNUNET_free(buf); | ||
92 | GNUNET_free(dataDir); | ||
93 | } | ||
94 | |||
79 | int | 95 | int |
80 | main (int argc, char *const *argv) | 96 | main (int argc, char *const *argv) |
81 | { | 97 | { |
@@ -85,8 +101,6 @@ main (int argc, char *const *argv) | |||
85 | struct GNUNET_GE_Context *my_ctx; | 101 | struct GNUNET_GE_Context *my_ctx; |
86 | struct GNUNET_GC_Configuration *cfg; | 102 | struct GNUNET_GC_Configuration *cfg; |
87 | char *log; | 103 | char *log; |
88 | char *dataDir; | ||
89 | char *gtkDataDir; | ||
90 | GNUNET_GE_KIND mask; | 104 | GNUNET_GE_KIND mask; |
91 | #if ENABLE_NLS | 105 | #if ENABLE_NLS |
92 | char *path; | 106 | char *path; |
@@ -120,6 +134,7 @@ main (int argc, char *const *argv) | |||
120 | bind_textdomain_codeset ("GNUnet", "UTF-8"); | 134 | bind_textdomain_codeset ("GNUnet", "UTF-8"); |
121 | bind_textdomain_codeset ("gnunet-gtk", "UTF-8"); | 135 | bind_textdomain_codeset ("gnunet-gtk", "UTF-8"); |
122 | #endif | 136 | #endif |
137 | setIconSearchPath(); | ||
123 | GNUNET_GTK_initialize_common_library (cfg, &GNUNET_GTK_main_quit); | 138 | GNUNET_GTK_initialize_common_library (cfg, &GNUNET_GTK_main_quit); |
124 | /* configure GTK logging */ | 139 | /* configure GTK logging */ |
125 | GNUNET_GC_get_configuration_value_string (cfg, | 140 | GNUNET_GC_get_configuration_value_string (cfg, |
@@ -138,17 +153,6 @@ main (int argc, char *const *argv) | |||
138 | GNUNET_GE_setDefaultContext (my_ctx); | 153 | GNUNET_GE_setDefaultContext (my_ctx); |
139 | root = | 154 | root = |
140 | glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); | 155 | glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); |
141 | if (NULL == gtk_window_get_icon(GTK_WINDOW(root))) | ||
142 | { | ||
143 | /* theme-based loading failed, set directly */ | ||
144 | dataDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); | ||
145 | gtkDataDir = | ||
146 | GNUNET_malloc (strlen (dataDir) + | ||
147 | strlen ("/../gnunet-gtk/gnunet-gtk.png") + 2); | ||
148 | strcpy (gtkDataDir, dataDir); | ||
149 | strcat (gtkDataDir, "/../gnunet-gtk/gnunet-gtk.png"); | ||
150 | gtk_window_set_icon_from_file(GTK_WINDOW(root), gtkDataDir, NULL); | ||
151 | } | ||
152 | gtk_window_maximize (GTK_WINDOW (root)); | 156 | gtk_window_maximize (GTK_WINDOW (root)); |
153 | gtk_widget_show (root); | 157 | gtk_widget_show (root); |
154 | gtk_window_present (GTK_WINDOW (root)); | 158 | gtk_window_present (GTK_WINDOW (root)); |