[gnome-control-center/wip/jsparber/background: 18/40] background: moved gallery item code to grid-item class
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/jsparber/background: 18/40] background: moved gallery item code to grid-item class
- Date: Tue, 6 Feb 2018 19:19:27 +0000 (UTC)
commit 3a7393cee59e1d7d57e91ee3771ae3234f6f1577
Author: Julian Sparber <julian sparber net>
Date: Mon Nov 13 16:29:31 2017 +0100
background: moved gallery item code to grid-item class
https://bugzilla.gnome.org/show_bug.cgi?id=788515
panels/background/background.ui | 289 ++++++++++++++-------------
panels/background/cc-background-grid-item.c | 143 ++++++++++++--
panels/background/cc-background-grid-item.h | 3 +-
panels/background/cc-background-panel.c | 154 +--------------
panels/background/data/background.css | 2 +-
5 files changed, 290 insertions(+), 301 deletions(-)
---
diff --git a/panels/background/background.ui b/panels/background/background.ui
index dc40911..083fbf9 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -5,186 +5,179 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="background-preview">
+ <object class="GtkBox" id="left_space">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="expand">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="content">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin">16</property>
- <property name="halign">fill</property>
<property name="orientation">vertical</property>
- <property name="expand">False</property>
- <property name="height_request">150</property>
<child>
- <object class="GtkAspectFrame">
+ <object class="GtkBox" id="background-preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="expand">True</property>
- <property name="obey-child">False</property>
- <property name="ratio">1.7777</property>
+ <property name="margin">16</property>
+ <property name="halign">fill</property>
+ <property name="orientation">vertical</property>
+ <property name="expand">False</property>
+ <property name="height_request">150</property>
<child>
- <object class="GtkBox" id="background-preview-top">
+ <object class="GtkAspectFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <style>
- <class name="black-border"/>
- </style>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="expand">True</property>
+ <property name="obey-child">False</property>
+ <property name="ratio">1.7777</property>
<child>
- <object class="GtkDrawingArea" id="background-desktop-drawingarea">
+ <object class="GtkBox" id="background-preview-top">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="expand">True</property>
+ <property name="orientation">vertical</property>
+ <style>
+ <class name="black-border"/>
+ </style>
+ <child>
+ <object class="GtkDrawingArea" id="background-desktop-drawingarea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="expand">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRevealer" id="wallpaper-info">
- <property name="visible">True</property>
- <property name="reveal-child">True</property>
<child>
- <object class="GtkBox" id="slide-box">
+ <object class="GtkRevealer" id="wallpaper-info">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_top">10</property>
+ <property name="reveal-child">True</property>
<child>
- <object class="GtkBox" id="hbox2">
+ <object class="GtkBox" id="slide-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
+ <property name="margin_top">10</property>
<child>
- <object class="GtkImage" id="slide_image">
+ <object class="GtkBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">slideshow-symbolic</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkImage" id="slide_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">slideshow-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="strut">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="slide-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" comments="This refers to a slideshow
background">Changes throughout the day</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="strut">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label"> </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="slide-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="This refers to a slideshow
background">Changes throughout the day</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="background-gallery-box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="expand">True</property>
- <style>
- <class name="background-gallery"/>
- </style>
<child>
- <object class="GtkScrolledWindow">
+ <object class="GtkBox" id="background-gallery-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hscrollbar_policy">never</property>
+ <property name="expand">True</property>
+ <!--<property name="height_request">150</property>-->
+ <style>
+ <class name="background-gallery"/>
+ </style>
<child>
- <object class="GtkBox" id="box4">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
+ <property name="hscrollbar_policy">never</property>
<child>
- <object class="GtkFlowBox" id="background-gallery">
+ <object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">False</property>
- <property name="homogeneous">True</property>
- <property name="orientation">horizontal</property>
- <property name="min-children-per-line">2</property>
- <property name="max-children-per-line">1000</property>
- <property name="row_spacing">5</property>
- <property name="column_spacing">5</property>
- <property name="halign">fill</property>
- <property name="valign">fill</property>
- <property name="margin">25</property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">end</property>
- <property name="margin">32</property>
- <property name="margin_top">7</property>
<property name="orientation">vertical</property>
- <property name="spacing">16</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkFlowBox" id="background-gallery">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Photos or Files can be used to set any
image as the background</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">False</property>
+ <property name="homogeneous">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="min-children-per-line">2</property>
+ <property name="max-children-per-line">1000</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">5</property>
+ <property name="halign">fill</property>
+ <property name="valign">fill</property>
+ <property name="margin">25</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
+ <property name="valign">end</property>
+ <property name="margin">32</property>
+ <property name="margin_top">7</property>
+ <property name="orientation">vertical</property>
<property name="spacing">16</property>
<child>
- <object class="GtkButton" id="open-gnome-photos">
- <property name="label" translatable="yes">Open Photos app</property>
+ <object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Photos or Files can be used to set any
image as the background</property>
</object>
<packing>
<property name="expand">False</property>
@@ -193,11 +186,37 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="open-picture-folder">
- <property name="label" translatable="yes">Open Pictures folder</property>
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="spacing">16</property>
+ <child>
+ <object class="GtkButton" id="open-gnome-photos">
+ <property name="label" translatable="yes">Open Photos app</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="open-picture-folder">
+ <property name="label" translatable="yes">Open Pictures folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -206,29 +225,31 @@
</packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
- <packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="right_space">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ </object>
</child>
</object>
<object class="GtkListStore" id="sources-liststore">
diff --git a/panels/background/cc-background-grid-item.c b/panels/background/cc-background-grid-item.c
index c2341cc..5d83502 100644
--- a/panels/background/cc-background-grid-item.c
+++ b/panels/background/cc-background-grid-item.c
@@ -24,11 +24,9 @@ struct _CcBackgroundGridItem
{
GtkFlowBoxChild parent;
- GtkImage *image;
-
/* data */
CcBackgroundItem *item;
-
+ GdkPixbuf *cached_pixbuf;
};
@@ -36,15 +34,116 @@ G_DEFINE_TYPE (CcBackgroundGridItem, cc_background_grid_item, GTK_TYPE_FLOW_BOX_
enum {
PROP_0,
- PROP_ITEM
+ PROP_ITEM,
+ PROP_PIXBUF_CACHE
};
+static void
+add_slideshow_emblem (GdkPixbuf *pixbuf,
+ gint w,
+ gint h,
+ gint scale_factor)
+{
+ GdkPixbuf *slideshow_emblem;
+ GIcon *icon = NULL;
+ GtkIconInfo *icon_info = NULL;
+ GError *error = NULL;
+ GtkIconTheme *theme;
+
+ int eh;
+ int ew;
+ //int h;
+ //int w;
+ int x;
+ int y;
+
+ icon = g_themed_icon_new ("slideshow-emblem");
+ theme = gtk_icon_theme_get_default ();
+ icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (theme,
+ icon,
+ 16,
+ scale_factor,
+ GTK_ICON_LOOKUP_FORCE_SIZE |
+ GTK_ICON_LOOKUP_USE_BUILTIN);
+ if (icon_info == NULL) {
+ g_warning ("Your icon theme is missing the slideshow-emblem icon, "
+ "please file a bug against it");
+ }
+ else {
+
+ slideshow_emblem = gtk_icon_info_load_icon (icon_info, &error);
+ if (slideshow_emblem == NULL) {
+ g_warning ("Failed to load slideshow emblem: %s", error->message);
+ g_error_free (error);
+ }
+ else {
+ eh = gdk_pixbuf_get_height (slideshow_emblem);
+ ew = gdk_pixbuf_get_width (slideshow_emblem);
+ //h = gdk_pixbuf_get_height (pixbuf);
+ //w = gdk_pixbuf_get_width (pixbuf);
+ x = w - ew - 5;
+ y = h - eh - 5;
+
+ gdk_pixbuf_composite (slideshow_emblem, pixbuf, x, y, ew, eh, x, y, 1.0, 1.0, GDK_INTERP_BILINEAR,
255);
+ }
+ }
+
+ g_clear_object (&icon_info);
+ g_clear_object (&icon);
+}
+
+static gboolean
+on_gallery_item_draw (GtkWidget *widget,
+ cairo_t *cr,
+ CcBackgroundGridItem *item)
+{
+ GdkPixbuf *pixbuf = item->cached_pixbuf;
+ GdkPixbuf *new_pixbuf;
+ const gint space_width = gtk_widget_get_allocated_width (widget);
+ const gint space_height = gtk_widget_get_allocated_height ( (widget));
+ //const gint pixbuf_width = gdk_pixbuf_get_width (pixbuf);
+ //const gint pixbuf_height = gdk_pixbuf_get_height (pixbuf);
+ const gint scale_factor = gtk_widget_get_scale_factor (widget);
+ gint new_width;
+ gint new_height;
+
+ if (space_width * 9/16 > space_height) {
+ new_width = space_width;
+ new_height = space_width * 9/16;
+ }
+ else {
+ new_width = space_height * 16/9;
+ new_height = space_height;
+ }
+
+ new_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
+ new_width,
+ new_height,
+ GDK_INTERP_BILINEAR);
+
+ if (cc_background_item_changes_with_time (cc_background_grid_item_get_ref
(gtk_widget_get_parent(widget)))) {
+ add_slideshow_emblem (new_pixbuf, (space_width + new_width) / 2, (space_height + new_height)/2,
scale_factor);
+ }
+
+
+ gdk_cairo_set_source_pixbuf (cr,
+ new_pixbuf,
+ (space_width - new_width) / 2,
+ (space_height - new_height) / 2);
+
+ g_object_unref (new_pixbuf);
+ cairo_paint (cr);
+
+ return TRUE;
+}
+
GtkWidget*
-cc_background_grid_item_new (CcBackgroundItem *item)
+cc_background_grid_item_new (CcBackgroundItem *item, GdkPixbuf *pixbuf)
{
return g_object_new (CC_TYPE_BACKGROUND_GRID_ITEM,
"item", item,
+ "cached_pixbuf", pixbuf,
NULL);
}
@@ -88,8 +187,10 @@ cc_background_grid_item_set_property (GObject *object,
{
case PROP_ITEM:
- self->item = g_value_dup_object (value);
- g_debug ("Every set %p -> %p", value, self->item);
+ g_set_object (&self->item, g_value_get_object (value));
+ break;
+ case PROP_PIXBUF_CACHE:
+ g_set_object (&self->cached_pixbuf, g_value_get_object (value));
break;
default:
@@ -111,6 +212,10 @@ cc_background_grid_item_get_property (GObject *object,
g_value_set_object (value, self->item);
break;
+ case PROP_PIXBUF_CACHE:
+ g_value_set_object (value, self->cached_pixbuf);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -128,10 +233,6 @@ cc_background_grid_item_class_init (CcBackgroundGridItemClass *klass)
object_class->get_property = cc_background_grid_item_get_property;
object_class->set_property = cc_background_grid_item_set_property;
- /*g_object_class_override_property (object_class,
- PROP_ITEM,
- "item");
- */
g_object_class_install_property (object_class,
PROP_ITEM,
g_param_spec_object ("item",
@@ -139,12 +240,28 @@ cc_background_grid_item_class_init (CcBackgroundGridItemClass *klass)
"The reference to this background item",
CC_TYPE_BACKGROUND_ITEM,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_PIXBUF_CACHE,
+ g_param_spec_object ("cached_pixbuf",
+ "Cached Pixbuf for preview",
+ "The pixbuf for caching the preview in gallery",
+ GDK_TYPE_PIXBUF,
+ G_PARAM_READWRITE));
}
static void
cc_background_grid_item_init (CcBackgroundGridItem *self)
{
- g_debug ("Item ref: %p", self->item);
- //gtk_widget_init_template (GTK_WIDGET (self));
+ GtkWidget *drawing;
+
+ drawing = gtk_drawing_area_new ();
+ gtk_widget_set_hexpand(drawing, TRUE);
+ gtk_widget_set_vexpand(drawing, TRUE);
+ g_signal_connect (G_OBJECT (drawing), "draw",
+ G_CALLBACK (on_gallery_item_draw), self);
+
+ gtk_widget_set_size_request (self, 250, 200);
+ gtk_widget_show (drawing);
+ gtk_container_add (GTK_CONTAINER (self), drawing);
}
diff --git a/panels/background/cc-background-grid-item.h b/panels/background/cc-background-grid-item.h
index 2c0a197..1e90a7f 100644
--- a/panels/background/cc-background-grid-item.h
+++ b/panels/background/cc-background-grid-item.h
@@ -28,7 +28,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CcBackgroundGridItem, cc_background_grid_item, CC, BACKGROUND_GRID_LIST,
GtkFlowBoxChild)
-GtkWidget * cc_background_grid_item_new (CcBackgroundItem *);
+GtkWidget * cc_background_grid_item_new (CcBackgroundItem *,
+ GdkPixbuf *);
void cc_background_grid_item_set_ref (GtkWidget *,
CcBackgroundItem *);
CcBackgroundItem * cc_background_grid_item_get_ref (GtkWidget *);
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index ff4d491..981c05e 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -183,88 +183,6 @@ get_save_path (CcBackgroundPanel *panel, GSettings *settings)
NULL);
}
-static void
-add_slideshow_emblem (GdkPixbuf *pixbuf,
- gint w,
- gint h,
- gint scale_factor)
-{
- GdkPixbuf *slideshow_emblem;
- GIcon *icon = NULL;
- GtkIconInfo *icon_info = NULL;
- GError *error = NULL;
- GtkIconTheme *theme;
-
- int eh;
- int ew;
- //int h;
- //int w;
- int x;
- int y;
-
- icon = g_themed_icon_new ("slideshow-emblem");
- theme = gtk_icon_theme_get_default ();
- icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (theme,
- icon,
- 16,
- scale_factor,
- GTK_ICON_LOOKUP_FORCE_SIZE |
- GTK_ICON_LOOKUP_USE_BUILTIN);
- if (icon_info == NULL) {
- g_warning ("Your icon theme is missing the slideshow-emblem icon, "
- "please file a bug against it");
- }
- else {
-
- slideshow_emblem = gtk_icon_info_load_icon (icon_info, &error);
- if (slideshow_emblem == NULL) {
- g_warning ("Failed to load slideshow emblem: %s", error->message);
- g_error_free (error);
- }
- else {
- eh = gdk_pixbuf_get_height (slideshow_emblem);
- ew = gdk_pixbuf_get_width (slideshow_emblem);
- //h = gdk_pixbuf_get_height (pixbuf);
- //w = gdk_pixbuf_get_width (pixbuf);
- x = w - ew - 5;
- y = h - eh - 5;
-
- gdk_pixbuf_composite (slideshow_emblem, pixbuf, x, y, ew, eh, x, y, 1.0, 1.0, GDK_INTERP_BILINEAR,
255);
- }
- }
-
- g_clear_object (&icon_info);
- g_clear_object (&icon);
-}
-
-
-
-static GdkPixbuf*
-get_or_create_cached_pixbuf_with_size (CcBackgroundPanel *panel,
- const gint width,
- const gint height,
- CcBackgroundItem *item)
-{
- gint scale_factor;
- GdkPixbuf *pixbuf;
-
- pixbuf = g_object_get_data (G_OBJECT (item), "pixbuf");
- if (pixbuf == NULL ||
- gdk_pixbuf_get_width (pixbuf) != width ||
- gdk_pixbuf_get_height (pixbuf) != height) {
- scale_factor = gtk_widget_get_scale_factor (panel);
- pixbuf = cc_background_item_get_frame_thumbnail (item,
- panel->thumb_factory,
- width,
- height,
- scale_factor,
- -2, TRUE);
- g_object_set_data_full (G_OBJECT (item), "pixbuf", pixbuf, g_object_unref);
- }
-
- return pixbuf;
-}
-
static GdkPixbuf*
get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
GtkWidget *widget,
@@ -405,55 +323,6 @@ calculate_contiguous_workarea (ScreenshotData *data)
return TRUE;
}
-static gboolean
-on_gallery_item_draw (GtkWidget *widget,
- cairo_t *cr,
- GdkPixbuf *pixbuf)
-{
- //GdkPixbuf *pixbuf;
- const gint space_width = gtk_widget_get_allocated_width (widget);
- const gint space_height = gtk_widget_get_allocated_height ( (widget));
- const gint pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- const gint pixbuf_height = gdk_pixbuf_get_height (pixbuf);
- const gint scale_factor = gtk_widget_get_scale_factor (widget);
- gint new_width;
- gint new_height;
-
- if (space_width * 9/16 > space_height) {
- new_width = space_width;
- new_height = space_width * 9/16;
- }
- else {
- new_width = space_height * 16/9;
- new_height = space_height;
- }
-
- /* pixbuf = get_or_create_cached_pixbuf_with_size (panel,
- new_width,
- new_height,
- cc_background_grid_item_get_ref (gtk_widget_get_parent(widget)));
-
-*/
-
- pixbuf = gdk_pixbuf_scale_simple (pixbuf,
- new_width,
- new_height,
- GDK_INTERP_BILINEAR);
-
- if (cc_background_item_changes_with_time (cc_background_grid_item_get_ref
(gtk_widget_get_parent(widget)))) {
- add_slideshow_emblem (pixbuf, (space_width + new_width) / 2, (space_height + new_height)/2,
scale_factor);
- }
-
- gdk_cairo_set_source_pixbuf (cr,
- pixbuf,
- (space_width - new_width) / 2,
- (space_height - new_height) / 2);
- cairo_paint (cr);
-
- return TRUE;
-}
-
-
static void
on_panel_resize (GtkWidget *widget,
GdkRectangle *allocation,
@@ -935,10 +804,9 @@ create_gallery_item (gpointer item,
gpointer user_data)
{
CcBackgroundPanel *panel = user_data;
+ CcBackgroundItem *self = item;
GtkWidget *flow;
- GtkWidget *widget;
GdkPixbuf *pixbuf;
- CcBackgroundItem *self = item;
gint scale_factor;
const gint preview_width = 400;
const gint preview_height = 400 * 9 / 16;
@@ -951,25 +819,7 @@ create_gallery_item (gpointer item,
preview_height,
scale_factor,
-2, TRUE);
-
- /*if (cc_background_item_changes_with_time (self)) {
- add_slideshow_emblem (pixbuf, scale_factor);
- }
- */
- widget = gtk_drawing_area_new ();
- gtk_widget_set_hexpand(widget, TRUE);
- gtk_widget_set_vexpand(widget, TRUE);
- g_signal_connect (G_OBJECT (widget), "draw",
- G_CALLBACK (on_gallery_item_draw), pixbuf);
-
- flow = cc_background_grid_item_new(self);
-
- gtk_widget_set_size_request (flow, 250, 200);
- cc_background_grid_item_set_ref (flow, self);
- gtk_widget_show (flow);
- gtk_widget_show (widget);
- gtk_container_add (GTK_CONTAINER (flow), widget);
-
+ flow = cc_background_grid_item_new(self, pixbuf);
return flow;
}
diff --git a/panels/background/data/background.css b/panels/background/data/background.css
index 04695ed..2c7ee12 100644
--- a/panels/background/data/background.css
+++ b/panels/background/data/background.css
@@ -1,6 +1,6 @@
.background-gallery {
background: #fff;
- border-top: 1px solid #b6b6b3;
+ border: 1px solid #b6b6b3;
}
.black-border {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]