[gnome-control-center/wip/jsparber/background: 8/29] background: expand thumbnails to fill a gallery row
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/jsparber/background: 8/29] background: expand thumbnails to fill a gallery row
- Date: Sat, 17 Feb 2018 18:11:06 +0000 (UTC)
commit 4f1e2a70c88c7f2432e5905da37768e48e43c5b7
Author: Julian Sparber <julian sparber net>
Date: Sat Nov 11 21:33:07 2017 +0100
background: expand thumbnails to fill a gallery row
- change gallery wallpaper size
- use same margin size everywhere around the flowbox
https://bugzilla.gnome.org/show_bug.cgi?id=788515
panels/background/background.ui | 9 +++---
panels/background/cc-background-panel.c | 51 ++++++++++++++++-----------------
2 files changed, 28 insertions(+), 32 deletions(-)
---
diff --git a/panels/background/background.ui b/panels/background/background.ui
index db3793cb1..dc40911b0 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -138,18 +138,17 @@
<object class="GtkFlowBox" id="background-gallery">
<property name="visible">True</property>
<property name="can_focus">False</property>
-
- <property name="expand">True</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>
- <property name="margin_top">50</property>
- <property name="margin_bottom">32</property>
</object>
</child>
<child>
@@ -159,7 +158,7 @@
<property name="halign">center</property>
<property name="valign">end</property>
<property name="margin">32</property>
- <property name="margin_top">0</property>
+ <property name="margin_top">7</property>
<property name="orientation">vertical</property>
<property name="spacing">16</property>
<child>
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index bb9d0bbcf..dd76ab0c0 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -335,16 +335,30 @@ on_gallery_item_draw (GtkWidget *widget,
cairo_t *cr,
GdkPixbuf *pixbuf)
{
- const gint width = gtk_widget_get_allocated_width (gtk_widget_get_parent (widget));
- const gint height = gtk_widget_get_allocated_height (gtk_widget_get_parent (widget));
+ 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);
+ 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 = gdk_pixbuf_scale_simple (pixbuf,
- width,
- height,
+ new_width,
+ new_height,
GDK_INTERP_BILINEAR);
+
gdk_cairo_set_source_pixbuf (cr,
pixbuf,
- 0, 0);
+ -(new_width - space_width)/2, -(new_height - space_height)/2);
cairo_paint (cr);
return TRUE;
@@ -894,8 +908,8 @@ create_gallery_item (gpointer item,
GdkPixbuf *pixbuf;
CcBackgroundItem *self = item;
gint scale_factor;
- const gint preview_width = 400;//panel->gallery_size;//309;
- const gint preview_height = 400 * 9 / 16; //panel->gallery_size * 9/16;//168;
+ const gint preview_width = 800;//panel->gallery_size;//309;
+ const gint preview_height = 800 * 9 / 16; //panel->gallery_size * 9/16;//168;
scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (panel));
@@ -909,38 +923,21 @@ create_gallery_item (gpointer item,
if (cc_background_item_changes_with_time (self)) {
add_slideshow_emblem (pixbuf, scale_factor);
}
- //widget = gtk_image_new_from_pixbuf (pixbuf);
widget = gtk_drawing_area_new ();
- gtk_widget_set_size_request (widget, 200, 200 * 9/16);
+ gtk_widget_set_size_request (widget, 250, 250 * 9/16);
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);
- /*frame = gtk_aspect_frame_new (NULL,
- 0.5,
- 0.5,
- 1.7777,
- FALSE);
-
- gtk_widget_set_size_request (frame, preview_width, -1);
- gtk_frame_set_shadow_type (frame,
- GTK_SHADOW_NONE);
- gtk_container_add (GTK_CONTAINER (frame), widget);
-
-
- gtk_widget_show (frame);
- gtk_container_add (GTK_CONTAINER (flow), frame);
-
-*/
-
gtk_container_add (GTK_CONTAINER (flow), widget);
-
return flow;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]