[evolution-rss] fix for gtk refuses to load icons with size 0



commit 854a0e9faa690547e747dcbd855bb1a22495e4b5
Author: Lucian Langa <lucilanga gnome org>
Date:   Fri Oct 23 22:41:45 2009 +0300

    fix for gtk refuses to load icons with size 0

 src/rss-config-factory.c |    2 +-
 src/rss-icon-factory.c   |   12 +++++++-----
 src/rss.c                |   44 +++++++++++++++++++-------------------------
 3 files changed, 27 insertions(+), 31 deletions(-)
---
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 15094bd..d52a9ff 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -500,7 +500,7 @@ build_dialog_add(gchar *url, gchar *feed_text)
 	/*set feed icon*/
 	if (key) {
 		gtk_image_set_from_icon_name(image,
-			g_hash_table_lookup(icons, key) ? key : "evolution-rss-main",
+			g_hash_table_lookup(icons, key) ? key : "rss",
 			GTK_ICON_SIZE_SMALL_TOOLBAR);
 		gtk_widget_show(GTK_WIDGET(image));
 	}
diff --git a/src/rss-icon-factory.c b/src/rss-icon-factory.c
index 669fd66..2f7e214 100644
--- a/src/rss-icon-factory.c
+++ b/src/rss-icon-factory.c
@@ -1,16 +1,16 @@
 /*  Evoution RSS Reader Plugin
- *  Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org> 
- *  
+ *  Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or 
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
@@ -57,6 +57,8 @@ rss_build_stock_images(void)
 		gtk_icon_set_unref(set);
 	}
         gtk_icon_source_free(source);
+	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+                                           EVOLUTION_ICONDIR);
 }
 
 void
diff --git a/src/rss.c b/src/rss.c
index b053c01..73877c6 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -2654,8 +2654,6 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t);
 
 void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
 {
-	static gboolean initialised = FALSE;
-	gchar *iconfile;
 	gchar *rss_folder, *ofolder, *key;
 	gchar *main_folder = get_main_folder();
 #if (EVOLUTION_VERSION < 22703)
@@ -2707,7 +2705,7 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
 				g_hash_table_insert(icons, g_strdup(key), icon);
 				g_object_set (t->renderer, "pixbuf", icon, "visible", 1, NULL);
 			} else
-				goto defico; //failed to load the icon so just throw the default
+				goto normal; //failed to load the icon so just throw the default
 
 			g_free(feed_file);
 #endif
@@ -2724,30 +2722,20 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
 		goto out;
 	}
 
-normal:	if (!initialised) { //move this to startup
-#if (EVOLUTION_VERSION < 22703)
-defico:
-#endif
-		iconfile = g_build_filename (EVOLUTION_ICONDIR,
-	                                    "rss-16.png",
-						NULL);
 #if (EVOLUTION_VERSION >= 22703)
-		folder_icon = e_icon_factory_get_icon (iconfile, GTK_ICON_SIZE_MENU);
-		gtk_icon_theme_add_builtin_icon     ("evolution-rss-main",
-				GTK_ICON_SIZE_INVALID,
-				folder_icon);
+normal:	gtk_tree_store_set (
+                t->store, t->iter,
+                COL_STRING_ICON_NAME, "rss-16",
+                -1);
 #else
+normal:	if (!initialised) { //move this to startup
+		iconfile = g_build_filename (EVOLUTION_ICONDIR,
+			"rss-16.png",
+			NULL);
 		folder_icon = e_icon_factory_get_icon (iconfile, E_ICON_SIZE_MENU);
-#endif
 		g_free(iconfile);
 		initialised = TRUE;
 	}
-#if (EVOLUTION_VERSION >= 22703)
-	gtk_tree_store_set (
-                t->store, t->iter,
-                COL_STRING_ICON_NAME, "evolution-rss-main",
-                -1);
-#else
 	g_object_set (t->renderer, "pixbuf", folder_icon, "visible", 1, NULL);
 #endif
 out:	g_free(main_folder);
@@ -5404,6 +5392,8 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
 	struct _EMFolderTreeModelStoreInfo *si;
 	CamelStore *store = rss_component_peek_local_store();
 	CamelFolder *rss_folder;
+	gint i=0, size;
+	gint *sizes;
 
 	pixbuf = gdk_pixbuf_new_from_file(img_file, NULL);
 
@@ -5418,11 +5408,15 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
 			result = FALSE;
 			goto out;
 		}
-		icon = e_icon_factory_get_icon (img_file, GTK_ICON_SIZE_DIALOG);
+		icon = e_icon_factory_get_icon (img_file, GTK_ICON_SIZE_MENU);
 		g_hash_table_insert(icons, g_strdup(key), GINT_TO_POINTER(1));
-		gtk_icon_theme_add_builtin_icon(key,
-						GTK_ICON_SIZE_INVALID,
-						icon);
+		sizes = gtk_icon_theme_get_icon_sizes(gtk_icon_theme_get_default(),
+				"mail-read"); //will mail-read always be there?
+		for (i=0; -1 != (size = sizes[i]); i++)
+			gtk_icon_theme_add_builtin_icon(key,
+				size,
+				icon);
+		g_free(sizes);
 
 #if EVOLUTION_VERSION < 22900 //kb//
 		si = g_hash_table_lookup (mod->store_hash, store);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]