diff --git a/panels/background/Makefile.am b/panels/background/Makefile.am index c9c1f2f2b..56ecee3a6 100644 --- a/panels/background/Makefile.am +++ b/panels/background/Makefile.am @@ -7,8 +7,11 @@ dist_ui_DATA = \ display-base.png \ display-overlay.png -slideshowicondir = $(datadir)/icons/hicolor/scalable/emblems/ -slideshowicon_DATA = slideshow-emblem-symbolic.svg +slideshowicondir = $(datadir)/icons/hicolor/scalable/categories/ +slideshowicon_DATA = slideshow-symbolic.svg + +slideshowemblemdir = $(datadir)/icons/hicolor/scalable/emblems/ +slideshowemblem_DATA = slideshow-emblem.svg INCLUDES = \ $(PANEL_CFLAGS) \ diff --git a/panels/background/background.ui b/panels/background/background.ui index f4364024d..fdb020ff0 100644 --- a/panels/background/background.ui +++ b/panels/background/background.ui @@ -4,8 +4,8 @@ - - + + @@ -69,7 +69,7 @@ - 0 + 0 @@ -135,7 +135,7 @@ True - slideshow-emblem-symbolic + slideshow-symbolic False diff --git a/panels/background/bg-colors-source.c b/panels/background/bg-colors-source.c index 52b1e2dc9..6bed0a54c 100644 --- a/panels/background/bg-colors-source.c +++ b/panels/background/bg-colors-source.c @@ -81,7 +81,7 @@ bg_colors_source_init (BgColorsSource *self) for (c = colors, n = color_names; *c; c++, n++) { GnomeWPItem *item; - GdkPixbuf *pixbuf; + GIcon *pixbuf; GdkColor color; item = g_new0 (GnomeWPItem, 1); diff --git a/panels/background/bg-source.c b/panels/background/bg-source.c index 9f130cc74..ba447fb94 100644 --- a/panels/background/bg-source.c +++ b/panels/background/bg-source.c @@ -136,7 +136,7 @@ bg_source_init (BgSource *self) priv = self->priv = SOURCE_PRIVATE (self); - priv->store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_POINTER); + priv->store = gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_POINTER); } GtkListStore* diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c index 38f4f2156..8b76007f7 100644 --- a/panels/background/bg-wallpapers-source.c +++ b/panels/background/bg-wallpapers-source.c @@ -138,7 +138,7 @@ item_changed_cb (GnomeBG *bg, if (gtk_tree_model_get_iter (model, &iter, path)) { - GdkPixbuf *pixbuf; + GIcon *pixbuf; g_signal_handlers_block_by_func (bg, G_CALLBACK (item_changed_cb), data); @@ -169,7 +169,7 @@ load_wallpapers (gchar *key, BgWallpapersSourcePrivate *priv = source->priv; GtkTreeIter iter; GtkTreePath *path; - GdkPixbuf *pixbuf; + GIcon *pixbuf; GtkListStore *store = bg_source_get_liststore (BG_SOURCE (source)); if (item->deleted == TRUE) diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c index 7e92cb937..73fe77490 100644 --- a/panels/background/cc-background-panel.c +++ b/panels/background/cc-background-panel.c @@ -528,10 +528,13 @@ preview_draw_cb (GtkWidget *widget, if (priv->current_background) { - pixbuf = gnome_wp_item_get_thumbnail (priv->current_background, - priv->thumb_factory, - preview_width, - preview_height); + GIcon *icon; + icon = gnome_wp_item_get_frame_thumbnail (priv->current_background, + priv->thumb_factory, + preview_width, + preview_height, + -2); + pixbuf = GDK_PIXBUF (icon); } if (!priv->display_base) diff --git a/panels/background/gnome-wp-item.c b/panels/background/gnome-wp-item.c index 67c4d4374..9685c608f 100644 --- a/panels/background/gnome-wp-item.c +++ b/panels/background/gnome-wp-item.c @@ -211,64 +211,54 @@ void gnome_wp_item_free (GnomeWPItem * item) { g_free (item); } -static GdkPixbuf * -add_slideshow_frame (GdkPixbuf *pixbuf) +static GEmblem * +get_slideshow_icon (void) { - GdkPixbuf *sheet, *sheet2; - GdkPixbuf *tmp; - gint w, h; + GIcon *themed; + GEmblem *emblem; - w = gdk_pixbuf_get_width (pixbuf); - h = gdk_pixbuf_get_height (pixbuf); - - sheet = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h); - gdk_pixbuf_fill (sheet, 0x00000000); - sheet2 = gdk_pixbuf_new_subpixbuf (sheet, 1, 1, w - 2, h - 2); - gdk_pixbuf_fill (sheet2, 0xffffffff); - g_object_unref (sheet2); - - tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w + 6, h + 6); - - gdk_pixbuf_fill (tmp, 0x00000000); - gdk_pixbuf_composite (sheet, tmp, 6, 6, w, h, 6.0, 6.0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - gdk_pixbuf_composite (sheet, tmp, 3, 3, w, h, 3.0, 3.0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - gdk_pixbuf_composite (pixbuf, tmp, 0, 0, w, h, 0.0, 0.0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - - g_object_unref (sheet); - - return tmp; + themed = g_themed_icon_new ("slideshow-emblem"); + emblem = g_emblem_new_with_origin (themed, G_EMBLEM_ORIGIN_DEVICE); + g_object_unref (themed); + return emblem; } -GdkPixbuf * gnome_wp_item_get_frame_thumbnail (GnomeWPItem * item, +GIcon * gnome_wp_item_get_frame_thumbnail (GnomeWPItem * item, GnomeDesktopThumbnailFactory * thumbs, int width, int height, gint frame) { GdkPixbuf *pixbuf = NULL; + GIcon *icon = NULL; set_bg_properties (item); - if (frame != -1) + if (frame >= 0) pixbuf = gnome_bg_create_frame_thumbnail (item->bg, thumbs, gdk_screen_get_default (), width, height, frame); else pixbuf = gnome_bg_create_thumbnail (item->bg, thumbs, gdk_screen_get_default(), width, height); - if (pixbuf && gnome_bg_changes_with_time (item->bg)) + if (pixbuf && frame != -2 && gnome_bg_changes_with_time (item->bg)) { - GdkPixbuf *tmp; + GEmblem *emblem; - tmp = add_slideshow_frame (pixbuf); + emblem = get_slideshow_icon (); + icon = g_emblemed_icon_new (G_ICON (pixbuf), emblem); + g_object_unref (emblem); g_object_unref (pixbuf); - pixbuf = tmp; + } + else + { + icon = G_ICON (pixbuf); } gnome_bg_get_image_size (item->bg, thumbs, width, height, &item->width, &item->height); - return pixbuf; + return icon; } -GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item, +GIcon * gnome_wp_item_get_thumbnail (GnomeWPItem * item, GnomeDesktopThumbnailFactory * thumbs, gint width, gint height) { @@ -283,7 +273,7 @@ void gnome_wp_item_update_size (GnomeWPItem * item, if (!strcmp (item->filename, "(none)")) { item->size = g_strdup (item->name); } else { - if (gnome_bg_has_multiple_sizes (item->bg)) + if (gnome_bg_has_multiple_sizes (item->bg) || gnome_bg_changes_with_time (item->bg)) item->size = g_strdup (_("multiple sizes")); else { if (thumbs != NULL && (item->width <= 0 || item->height <= 0)) { diff --git a/panels/background/gnome-wp-item.h b/panels/background/gnome-wp-item.h index 33a148922..01e40d59e 100644 --- a/panels/background/gnome-wp-item.h +++ b/panels/background/gnome-wp-item.h @@ -73,15 +73,15 @@ GnomeWPItem * gnome_wp_item_new (const gchar *filename, GnomeDesktopThumbnailFactory *thumbnails); void gnome_wp_item_free (GnomeWPItem *item); -GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem *item, - GnomeDesktopThumbnailFactory *thumbs, - gint width, - gint height); -GdkPixbuf * gnome_wp_item_get_frame_thumbnail (GnomeWPItem *item, - GnomeDesktopThumbnailFactory *thumbs, - gint width, - gint height, - gint frame); +GIcon * gnome_wp_item_get_thumbnail (GnomeWPItem *item, + GnomeDesktopThumbnailFactory *thumbs, + gint width, + gint height); +GIcon * gnome_wp_item_get_frame_thumbnail (GnomeWPItem *item, + GnomeDesktopThumbnailFactory *thumbs, + gint width, + gint height, + gint frame); void gnome_wp_item_update (GnomeWPItem *item); void gnome_wp_item_update_size (GnomeWPItem *item, GnomeDesktopThumbnailFactory *thumbs); void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item); diff --git a/panels/background/slideshow-emblem.svg b/panels/background/slideshow-emblem.svg new file mode 100644 index 000000000..4ba3a09d9 --- /dev/null +++ b/panels/background/slideshow-emblem.svg @@ -0,0 +1,104 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/panels/background/slideshow-emblem-symbolic.svg b/panels/background/slideshow-symbolic.svg similarity index 100% rename from panels/background/slideshow-emblem-symbolic.svg rename to panels/background/slideshow-symbolic.svg