[gnome-control-center/wip/jsparber/background: 12/40] background: change margins for preview to 16px



commit 59c2bb6be467a38cdbbe94388a9bf29554b50399
Author: Julian Sparber <julian sparber net>
Date:   Wed Nov 8 22:52:31 2017 +0100

    background: change margins for preview to 16px
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788515

 panels/background/background.ui         |   95 +++++++++++++++----------------
 panels/background/cc-background-panel.c |   47 ++++++++++-----
 2 files changed, 78 insertions(+), 64 deletions(-)
---
diff --git a/panels/background/background.ui b/panels/background/background.ui
index 4b8d0ad..29da671 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -14,7 +14,7 @@
         <property name="halign">fill</property>
         <property name="orientation">vertical</property>
         <property name="expand">True</property>
-        <property name="height_request">100</property>
+        <property name="height_request">200</property>
         <child>
           <object class="GtkAspectFrame">
             <property name="visible">True</property>
@@ -27,8 +27,6 @@
               <object class="GtkBox" id="background-preview-top">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="margin">6</property>
-                <property name="spacing">6</property>
                 <property name="orientation">vertical</property>
                 <style>
                   <class name="black-border"/>
@@ -50,67 +48,66 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="bottom-hbox">
+          <object class="GtkRevealer" id="wallpaper-info">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">12</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">12</property>
-                <property name="spacing">2</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>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
       </object>
       <packing>
@@ -120,7 +117,7 @@
       </packing>
     </child>
     <child>
-      <object class="GtkBox" id="backgroud-gallery-box">
+      <object class="GtkBox" id="background-gallery-box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="expand">True</property>
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 1a47d0d..14a39d6 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -167,8 +167,8 @@ update_preview (CcBackgroundPanel *panel,
       changes_with_time = cc_background_item_changes_with_time (current_background);
     }
 
-  gtk_widget_set_visible (WID ("slide_image"), changes_with_time);
-  gtk_widget_set_visible (WID ("slide-label"), changes_with_time);
+  gtk_revealer_set_reveal_child (GTK_REVEALER (WID ("wallpaper-info")),
+                                 changes_with_time);
 
   gtk_widget_queue_draw (WID ("background-desktop-drawingarea"));
 }
@@ -202,16 +202,16 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
       gdk_pixbuf_get_width (pixbuf) != preview_width ||
       gdk_pixbuf_get_height (pixbuf) != preview_height) {
 
-      gtk_widget_get_allocation (widget, &allocation);
-      scale_factor = gtk_widget_get_scale_factor (widget);
-      pixbuf = cc_background_item_get_frame_thumbnail (background,
-                                                       panel->thumb_factory,
-                                                       preview_width,
-                                                       preview_height,
-                                                       scale_factor,
-                                                       -2, TRUE);
-      g_object_set_data_full (G_OBJECT (background), "pixbuf", pixbuf, g_object_unref);
-    }
+    gtk_widget_get_allocation (widget, &allocation);
+    scale_factor = gtk_widget_get_scale_factor (widget);
+    pixbuf = cc_background_item_get_frame_thumbnail (background,
+                                                     panel->thumb_factory,
+                                                     preview_width,
+                                                     preview_height,
+                                                     scale_factor,
+                                                     -2, TRUE);
+    g_object_set_data_full (G_OBJECT (background), "pixbuf", pixbuf, g_object_unref);
+  }
 
   return pixbuf;
 }
@@ -222,9 +222,26 @@ update_display_preview (CcBackgroundPanel *panel,
                         CcBackgroundItem  *background)
 {
   GdkPixbuf *pixbuf;
-  cairo_t *cr;
+  const gint width = gtk_widget_get_allocated_width (panel);
+  gint height  = gtk_widget_get_allocated_height (panel);
+  gint request_height;
+  const gint preview_width = gtk_widget_get_allocated_width (widget);
+  const gint preview_height = gtk_widget_get_allocated_height (widget);
+  /*g_print ("Height %d", height);
+  if (preview_width > 310) {
+    gtk_widget_set_vexpand (WID ("background-preview"), FALSE);
+    gtk_widget_set_size_request (widget, 310, preview_height);
+  }
+  else {
+    gtk_widget_set_vexpand (WID ("background-preview"), TRUE);
+    gtk_widget_set_size_request (widget, -1, -1);
+  }
+  */
 
-  pixbuf = get_or_create_cached_pixbuf (panel, widget, background);
+  /*gtk_widget_get_size_request (WID ("background-gallery-box"), NULL, &request_height);
+  g_print ("Height %d\n", height);
+  gtk_widget_set_size_request (WID ("background-gallery-box"), -1, height - 300);
+  */
 
   pixbuf = get_or_create_cached_pixbuf (panel,
                                         widget,


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