[glade] Added glade-devhelp stock icon
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Added glade-devhelp stock icon
- Date: Tue, 12 Mar 2013 22:31:17 +0000 (UTC)
commit 3d3bce03f7c3b50ba83ae8277d0b3d9ba4701d8d
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Sun Mar 10 18:28:43 2013 -0300
Added glade-devhelp stock icon
gladeui/glade-app.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index ccff86a..9ff11af 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -277,6 +277,38 @@ pointer_mode_register_icon (GtkIconFactory *factory,
}
}
+static void
+register_stock_icon (GtkIconFactory *factory,
+ const gchar *stock_id,
+ const gchar *icon_name,
+ const gchar *file_name,
+ GtkIconSize size)
+{
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+ GdkPixbuf *pixbuf;
+ GtkIconInfo *info;
+ gint w, h;
+
+ if (gtk_icon_size_lookup (size, &w, &h) &&
+ (info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, MIN (w, h), 0)))
+ {
+ pixbuf = gtk_icon_info_load_icon (info, NULL);
+ }
+ else
+ {
+ gchar *path = g_build_filename (glade_app_get_pixmaps_dir (), file_name, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+ g_free (path);
+ }
+
+ if (pixbuf)
+ {
+ GtkIconSet *icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
+ gtk_icon_factory_add (factory, stock_id, icon_set);
+ g_object_unref (pixbuf);
+ }
+}
+
/*
* glade_app_register_stock_icons:
* @size: icon size
@@ -295,6 +327,11 @@ glade_app_register_stock_icons (GtkIconSize size)
pointer_mode_register_icon (factory, "glade-margin-edit", GLADE_POINTER_MARGIN_EDIT, size);
pointer_mode_register_icon (factory, "glade-align-edit", GLADE_POINTER_ALIGN_EDIT, size);
+ register_stock_icon (factory, "glade-devhelp",
+ GLADE_DEVHELP_ICON_NAME,
+ GLADE_DEVHELP_FALLBACK_ICON_FILE,
+ size);
+
gtk_icon_factory_add_default (factory);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]