[geany/geany] 1a5554: Add our stock icons manually
Colomban Wendling
git-noreply at xxxxx
Fri Jan 10 17:33:04 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Fri, 10 Jan 2014 17:33:04 UTC
Commit: 1a5554c41cffce0c90252c1f6503aae369659b88
https://github.com/geany/geany/commit/1a5554c41cffce0c90252c1f6503aae369659b88
Log Message:
-----------
Add our stock icons manually
Although GtkIconFactory implements GtkBuildable properly and works just
fine, Glade can't handle it and keeps removing it upon save. So, drop
the automatic setup to a manual one so the UI description is editable
with Glade again, and which also has the small advantage of not
repeating the stock ID strings.
Modified Paths:
--------------
data/geany.glade
src/ui_utils.c
Modified: data/geany.glade
7 files changed, 0 insertions(+), 7 deletions(-)
===================================================================
@@ -3,13 +3,6 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkAccelGroup" id="accelgroup1"/>
- <object class="GtkIconFactory" id="iconfactory1">
- <sources>
- <source stock-id="geany-build" icon-name="geany-build"/>
- <source stock-id="geany-close-all" icon-name="geany-close-all"/>
- <source stock-id="geany-save-all" icon-name="geany-save-all"/>
- </sources>
- </object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">3</property>
<property name="upper">1000</property>
Modified: src/ui_utils.c
25 files changed, 24 insertions(+), 1 deletions(-)
===================================================================
@@ -1886,6 +1886,28 @@ static void create_config_files_menu(void)
}
+/* adds factory icons with a named icon source using the stock items id */
+static void add_stock_icons(const GtkStockItem *items, gsize count)
+{
+ GtkIconFactory *factory = gtk_icon_factory_new();
+ GtkIconSource *source = gtk_icon_source_new();
+ gsize i;
+
+ for (i = 0; i < count; i++)
+ {
+ GtkIconSet *set = gtk_icon_set_new();
+
+ gtk_icon_source_set_icon_name(source, items[i].stock_id);
+ gtk_icon_set_add_source(set, source);
+ gtk_icon_factory_add(factory, items[i].stock_id, set);
+ gtk_icon_set_unref(set);
+ }
+ gtk_icon_source_free(source);
+ gtk_icon_factory_add_default(factory);
+ g_object_unref(factory);
+}
+
+
void ui_init_stock_items(void)
{
GtkStockItem items[] =
@@ -1895,7 +1917,8 @@ void ui_init_stock_items(void)
{ GEANY_STOCK_BUILD, N_("Build"), 0, 0, GETTEXT_PACKAGE }
};
- gtk_stock_add((GtkStockItem *) items, G_N_ELEMENTS(items));
+ gtk_stock_add(items, G_N_ELEMENTS(items));
+ add_stock_icons(items, G_N_ELEMENTS(items));
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list