[Xfce4-commits] r30118 - terminal/trunk/terminal

Nick Schermer nick at xfce.org
Sun Jun 28 20:27:19 CEST 2009


Author: nick
Date: 2009-06-28 18:27:19 +0000 (Sun, 28 Jun 2009)
New Revision: 30118

Modified:
   terminal/trunk/terminal/terminal-stock.c
Log:
Peek in the icon theme if the stock icon exists.

This avoid Gtk warnings when one or more of the stock
icons is not avaible and you open the menu for the
first time.


Modified: terminal/trunk/terminal/terminal-stock.c
===================================================================
--- terminal/trunk/terminal/terminal-stock.c	2009-06-28 18:26:56 UTC (rev 30117)
+++ terminal/trunk/terminal/terminal-stock.c	2009-06-28 18:27:19 UTC (rev 30118)
@@ -65,6 +65,7 @@
 void
 terminal_stock_init (void)
 {
+  GtkIconTheme   *icon_theme;
   GtkIconFactory *icon_factory;
   GtkIconSource  *icon_source;
   GtkIconSet     *icon_set;
@@ -77,6 +78,9 @@
   /* we try to avoid allocating multiple icon sources */
   icon_source = gtk_icon_source_new ();
 
+  /* get default icon theme */
+  icon_theme = gtk_icon_theme_get_default ();
+
   /* register our stock icons */
   for (n = 0; n < G_N_ELEMENTS (terminal_stock_icons); ++n)
     {
@@ -90,7 +94,9 @@
       gtk_icon_set_add_source (icon_set, icon_source);
 
       /* add an alternative stock name if there is one */
-      if (terminal_stock_icons[n].stock != NULL)
+      if (terminal_stock_icons[n].stock != NULL
+          && gtk_icon_theme_has_icon (icon_theme,
+                 terminal_stock_icons[n].stock))
         {
           gtk_icon_source_set_icon_name (icon_source,
               terminal_stock_icons[n].stock);




More information about the Xfce4-commits mailing list