[evolution-rss] rss_build_icon() new function to load folder icons



commit 51955223a6f1ae55fc5ad3d8a3c9525a40ed9b3e
Author: Lucian Langa <lucilanga gnome org>
Date:   Sun Nov 29 12:12:11 2009 +0200

    rss_build_icon() new function to load folder icons

 src/rss-icon-factory.c |   24 ++++++++++++++++++++++++
 src/rss-icon-factory.h |   14 +++++++++-----
 src/rss.c              |    2 +-
 3 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/src/rss-icon-factory.c b/src/rss-icon-factory.c
index 2f7e214..dde9231 100644
--- a/src/rss-icon-factory.c
+++ b/src/rss-icon-factory.c
@@ -17,6 +17,7 @@
  */
 
 #include <rss-icon-factory.h>
+#include <e-util/e-icon-factory.h>
 
 #include <rss.h>
 
@@ -31,6 +32,29 @@ static RssStockIcon stock_icons [] = {
         { RSS_MAIN, RSS_MAIN_FILE }
 };
 
+//behaviour of e_icon_factory_get_icon() has changed
+//so we now have to reimplement it
+GdkPixbuf *
+rss_build_icon(const gchar *icon_name,
+		GtkIconSize icon_size)
+{
+	GdkPixbuf *pixbuf, *unscaled;
+	gint size, width, height;
+        g_return_val_if_fail (icon_name != NULL, NULL);
+	if (!gtk_icon_size_lookup (icon_size, &width, &height))
+		return NULL;
+	size = height;
+
+	unscaled = gdk_pixbuf_new_from_file(icon_name, NULL);
+	if (gdk_pixbuf_get_width(unscaled) != size || gdk_pixbuf_get_height(unscaled) != size) {
+		pixbuf = e_icon_factory_pixbuf_scale (unscaled, size, size);
+		g_object_unref (unscaled);
+	} else
+		pixbuf = unscaled;
+
+	return pixbuf;
+}
+
 void
 rss_build_stock_images(void)
 {
diff --git a/src/rss-icon-factory.h b/src/rss-icon-factory.h
index 9845a55..15ee626 100644
--- a/src/rss-icon-factory.h
+++ b/src/rss-icon-factory.h
@@ -1,21 +1,23 @@
 /*  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
  */
 
+#include <e-util/e-icon-factory.h>
+
 #define RSS_TEXT_HTML "rss-text-html"
 #define RSS_TEXT_HTML_FILE "rss-text-html.png"
 
@@ -25,6 +27,8 @@
 #define RSS_MAIN "rss-main"
 #define RSS_MAIN_FILE "rss-24.png"
 
+GdkPixbuf *rss_build_icon(const gchar *icon_name,
+			GtkIconSize icon_size);
 void rss_build_stock_images(void);
 void init_rss_builtin_images(void);
 
diff --git a/src/rss.c b/src/rss.c
index 9552fd0..4eb1484 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -5415,7 +5415,7 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
 			result = FALSE;
 			goto out;
 		}
-		icon = e_icon_factory_get_icon (img_file, GTK_ICON_SIZE_MENU);
+		icon = rss_build_icon (img_file, GTK_ICON_SIZE_MENU);
 		g_hash_table_insert(icons, g_strdup(key), GINT_TO_POINTER(1));
 		sizes = gtk_icon_theme_get_icon_sizes(gtk_icon_theme_get_default(),
 				"mail-read"); //will mail-read always be there?



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