[gnome-control-center] background: Clean up uses of GIcon



commit fabc31b44702fdb949b7d47414a625623d17f0d2
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Aug 12 23:48:46 2014 +0200

    background: Clean up uses of GIcon
    
    Now that we are compositing our own emblems, there is no need to use
    GIcon. We can directly use GdkPixbufs everywhere.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732375

 panels/background/bg-colors-source.c     |    4 ++--
 panels/background/bg-wallpapers-source.c |    4 ++--
 panels/background/cc-background-item.c   |   17 ++++++++---------
 panels/background/cc-background-item.h   |    6 +++---
 panels/background/cc-background-panel.c  |   14 ++++++--------
 5 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/panels/background/bg-colors-source.c b/panels/background/bg-colors-source.c
index b8b65e7..09e484a 100644
--- a/panels/background/bg-colors-source.c
+++ b/panels/background/bg-colors-source.c
@@ -75,7 +75,7 @@ bg_colors_source_add_color (BgColorsSource               *self,
 {
   CcBackgroundItemFlags flags;
   CcBackgroundItem *item;
-  GIcon *pixbuf;
+  GdkPixbuf *pixbuf;
   cairo_surface_t *surface;
   int scale_factor;
   int thumbnail_height, thumbnail_width;
@@ -108,7 +108,7 @@ bg_colors_source_add_color (BgColorsSource               *self,
                                              thumb_factory,
                                              thumbnail_width, thumbnail_height,
                                              scale_factor);
-  surface = gdk_cairo_surface_create_from_pixbuf (GDK_PIXBUF (pixbuf), scale_factor, NULL);
+  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale_factor, NULL);
   gtk_list_store_insert_with_values (store, &iter, 0,
                                      0, surface,
                                      1, item,
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index e4bced5..8ea171a 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -48,7 +48,7 @@ load_wallpapers (gchar              *key,
 {
   BgWallpapersSourcePrivate *priv = source->priv;
   GtkTreeIter iter;
-  GIcon *pixbuf;
+  GdkPixbuf *pixbuf;
   GtkListStore *store = bg_source_get_liststore (BG_SOURCE (source));
   cairo_surface_t *surface = NULL;
   gboolean deleted;
@@ -72,7 +72,7 @@ load_wallpapers (gchar              *key,
   if (pixbuf == NULL)
     goto out;
 
-  surface = gdk_cairo_surface_create_from_pixbuf (GDK_PIXBUF (pixbuf), scale_factor, NULL);
+  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale_factor, NULL);
   gtk_list_store_set (store, &iter,
                       0, surface,
                       1, item,
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index b4b8a4b..d0687ef 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 #include <glib/gi18n-lib.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include <libgnome-desktop/gnome-bg.h>
 #include <gdesktop-enums.h>
@@ -85,11 +84,11 @@ G_DEFINE_TYPE (CcBackgroundItem, cc_background_item, G_TYPE_OBJECT)
 
 static GdkPixbuf *slideshow_emblem = NULL;
 
-static GIcon *
+static GdkPixbuf *
 get_emblemed_pixbuf (CcBackgroundItem *item, GdkPixbuf *pixbuf, gint scale_factor)
 {
+        GdkPixbuf *retval;
         GIcon *icon = NULL;
-        GIcon *retval;
         GtkIconInfo *icon_info = NULL;
         int eh;
         int ew;
@@ -219,7 +218,7 @@ render_at_size (GnomeBG *bg,
         return pixbuf;
 }
 
-GIcon *
+GdkPixbuf *
 cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
                                         GnomeDesktopThumbnailFactory *thumbs,
                                         int                           width,
@@ -229,7 +228,7 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
                                         gboolean                      force_size)
 {
         GdkPixbuf *pixbuf = NULL;
-        GIcon *icon = NULL;
+        GdkPixbuf *retval = NULL;
 
        g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), NULL);
        g_return_val_if_fail (width > 0 && height > 0, NULL);
@@ -265,10 +264,10 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
         if (pixbuf != NULL
             && frame != -2
             && gnome_bg_changes_with_time (item->priv->bg)) {
-                icon = get_emblemed_pixbuf (item, pixbuf, scale_factor);
+                retval = get_emblemed_pixbuf (item, pixbuf, scale_factor);
                 g_object_unref (pixbuf);
         } else {
-                icon = G_ICON (pixbuf);
+                retval = pixbuf;
        }
 
         gnome_bg_get_image_size (item->priv->bg,
@@ -280,11 +279,11 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
 
         update_size (item);
 
-        return icon;
+        return retval;
 }
 
 
-GIcon *
+GdkPixbuf *
 cc_background_item_get_thumbnail (CcBackgroundItem             *item,
                                   GnomeDesktopThumbnailFactory *thumbs,
                                   int                           width,
diff --git a/panels/background/cc-background-item.h b/panels/background/cc-background-item.h
index 633a719..6c9f5c4 100644
--- a/panels/background/cc-background-item.h
+++ b/panels/background/cc-background-item.h
@@ -21,7 +21,7 @@
 #define __CC_BACKGROUND_ITEM_H
 
 #include <glib-object.h>
-
+#include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
 #include <gdesktop-enums.h>
 #include <libgnome-desktop/gnome-bg.h>
@@ -70,12 +70,12 @@ gboolean           cc_background_item_load                (CcBackgroundItem
                                                           GFileInfo                    *info);
 gboolean           cc_background_item_changes_with_time   (CcBackgroundItem             *item);
 
-GIcon     *        cc_background_item_get_thumbnail       (CcBackgroundItem             *item,
+GdkPixbuf *        cc_background_item_get_thumbnail       (CcBackgroundItem             *item,
                                                            GnomeDesktopThumbnailFactory *thumbs,
                                                            int                           width,
                                                            int                           height,
                                                            int                           scale_factor);
-GIcon     *        cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
+GdkPixbuf *        cc_background_item_get_frame_thumbnail (CcBackgroundItem             *item,
                                                            GnomeDesktopThumbnailFactory *thumbs,
                                                            int                           width,
                                                            int                           height,
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 77c623d..3151d5f 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -215,7 +215,6 @@ update_display_preview (CcBackgroundPanel *panel,
   const gint preview_height = 168;
   gint scale_factor;
   GdkPixbuf *pixbuf;
-  GIcon *icon;
   cairo_t *cr;
 
   gtk_widget_get_allocation (widget, &allocation);
@@ -224,13 +223,12 @@ update_display_preview (CcBackgroundPanel *panel,
     return;
 
   scale_factor = gtk_widget_get_scale_factor (widget);
-  icon = cc_background_item_get_frame_thumbnail (current_background,
-                                                 priv->thumb_factory,
-                                                 preview_width,
-                                                 preview_height,
-                                                 scale_factor,
-                                                 -2, TRUE);
-  pixbuf = GDK_PIXBUF (icon);
+  pixbuf = cc_background_item_get_frame_thumbnail (current_background,
+                                                   priv->thumb_factory,
+                                                   preview_width,
+                                                   preview_height,
+                                                   scale_factor,
+                                                   -2, TRUE);
 
   cr = gdk_cairo_create (gtk_widget_get_window (widget));
   gdk_cairo_set_source_pixbuf (cr,


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