r3023 - in trunk/src/target/OM-2007.2/libraries/libmokoui2: . libmokoui

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Sep 21 11:34:31 CEST 2007


Author: thomas
Date: 2007-09-21 11:34:30 +0200 (Fri, 21 Sep 2007)
New Revision: 3023

Modified:
   trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
   trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-stock.c
Log:
* libmokoui/moko-stock.c: (_moko_stock_add_icon):
Correctly load all the available sizes for additional stock icons


Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog	2007-09-21 08:00:03 UTC (rev 3022)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog	2007-09-21 09:34:30 UTC (rev 3023)
@@ -1,3 +1,8 @@
+2007-09-21  Thomas Wood  <thomas at openedhand.com>
+
+	* libmokoui/moko-stock.c: (_moko_stock_add_icon):
+	Correctly load all the available sizes for additional stock icons
+
 2007-09-20  Thomas Wood  <thomas at openedhand.com>
 
 	* libmokoui/moko-search-bar.c: (moko_search_bar_init),

Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-stock.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-stock.c	2007-09-21 08:00:03 UTC (rev 3022)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-stock.c	2007-09-21 09:34:30 UTC (rev 3023)
@@ -77,24 +77,15 @@
   if (theme == NULL)
     theme = gtk_icon_theme_get_default ();
 
-  pixbuf = gtk_icon_theme_load_icon (theme, item->stock_id,
-                                     32, 0, NULL);
-
-  if (pixbuf == NULL)
-  {
-    g_print ("Cannot load stock icon from theme : %s\n", item->stock_id);
-    return;
-  }
-
   set = gtk_icon_set_new ();
 
-  /*
-   * This is temporary hack to make sure we have all the sizes available.
-   * Ideally we should try loading the pixbuf at the correct size from the theme
-   * for each possible size in GtkIconSize, rather than re-using the same pixbuf
-   */
   for (i = GTK_ICON_SIZE_MENU; i <= GTK_ICON_SIZE_DIALOG; i++)
   {
+    gint width, height;
+
+    gtk_icon_size_lookup (i, &width, &height);
+    pixbuf = gtk_icon_theme_load_icon (theme, item->stock_id, width, 0, NULL);
+
     source = gtk_icon_source_new ();
     gtk_icon_source_set_size (source, i);
     gtk_icon_source_set_size_wildcarded (source, FALSE);





More information about the commitlog mailing list