summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-12-14 20:29:33 +0000
committerBastien Nocera <hadess@hadess.net>2010-12-14 20:29:33 +0000
commit035126a970da54711ae0076ccae1e79f84c081f5 (patch)
treefb47d3f9dac53131ad0b176b63170f545ebff348
parentf48054ccf1f5cbfa4700f5b369ce302d4e575153 (diff)
background: Add emblem for slideshow previews
Though for some reason the icon ends up being tiny...
-rw-r--r--panels/background/Makefile.am7
-rw-r--r--panels/background/background.ui8
-rw-r--r--panels/background/bg-colors-source.c2
-rw-r--r--panels/background/bg-source.c2
-rw-r--r--panels/background/bg-wallpapers-source.c4
-rw-r--r--panels/background/cc-background-panel.c11
-rw-r--r--panels/background/gnome-wp-item.c56
-rw-r--r--panels/background/gnome-wp-item.h18
-rw-r--r--panels/background/slideshow-emblem.svg104
-rw-r--r--panels/background/slideshow-symbolic.svg (renamed from panels/background/slideshow-emblem-symbolic.svg)0
10 files changed, 156 insertions, 56 deletions
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 @@
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="backgrounds-liststore">
<columns>
- <!-- column-name pixbuf -->
- <column type="GdkPixbuf"/>
+ <!-- column-name gicon -->
+ <column type="GIcon"/>
<!-- column-name data -->
<column type="gpointer"/>
<!-- column-name source-id -->
@@ -69,7 +69,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="pixbuf-renderer"/>
<attributes>
- <attribute name="pixbuf">0</attribute>
+ <attribute name="gicon">0</attribute>
</attributes>
</child>
</object>
@@ -135,7 +135,7 @@
<child>
<object class="GtkImage" id="slide_image">
<property name="visible">True</property>
- <property name="icon_name">slideshow-emblem-symbolic</property>
+ <property name="icon_name">slideshow-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
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 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="128"
+ height="128"
+ id="svg4978"
+ version="1.1"
+ inkscape:version="0.48.0 r9654"
+ sodipodi:docname="slideshow-emblem.svg">
+ <defs
+ id="defs4980" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="41.944792"
+ inkscape:cy="39.155574"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="962"
+ inkscape:window-height="817"
+ inkscape:window-x="4"
+ inkscape:window-y="51"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata4983">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-924.36215)">
+ <g
+ style="display:inline"
+ id="g14317"
+ transform="matrix(7.1989829,0,0,7.1989829,-772.01578,-783.40043)">
+ <g
+ style="stroke:#000000;stroke-opacity:1"
+ transform="translate(69,-449)"
+ id="g14258"
+ inkscape:label="document-open-recent">
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:none;stroke:#000000;stroke-width:2.15384626;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path14260"
+ sodipodi:cx="48"
+ sodipodi:cy="696"
+ sodipodi:rx="7"
+ sodipodi:ry="7"
+ d="m 55,696 c 0,3.86599 -3.134007,7 -7,7 -3.865993,0 -7,-3.13401 -7,-7 0,-3.86599 3.134007,-7 7,-7 3.865993,0 7,3.13401 7,7 z"
+ transform="matrix(0.92857143,0,0,0.92857143,2.9285714,49.21429)" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 45.5,693.5 2,2 3,-3"
+ id="path14262"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccc" />
+ </g>
+ <g
+ inkscape:label="document-open-recent"
+ id="g4692"
+ transform="translate(69,-450)">
+ <path
+ transform="matrix(0.92857143,0,0,0.92857143,2.9285714,49.21429)"
+ d="m 55,696 c 0,3.86599 -3.134007,7 -7,7 -3.865993,0 -7,-3.13401 -7,-7 0,-3.86599 3.134007,-7 7,-7 3.865993,0 7,3.13401 7,7 z"
+ sodipodi:ry="7"
+ sodipodi:rx="7"
+ sodipodi:cy="696"
+ sodipodi:cx="48"
+ id="path3869"
+ style="color:#000000;fill:none;stroke:#ffffff;stroke-width:2.15384626;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="ccc"
+ inkscape:connector-curvature="0"
+ id="path4639"
+ d="m 45.5,693.5 2,2 3,-3"
+ style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/panels/background/slideshow-emblem-symbolic.svg b/panels/background/slideshow-symbolic.svg
index 815115cbf..815115cbf 100644
--- a/panels/background/slideshow-emblem-symbolic.svg
+++ b/panels/background/slideshow-symbolic.svg