[gnome-control-center/wip/jsparber/background: 4/28] background: resize preview when the window size is less then 500px



commit 8a5150eff6cc575449aeee6d78277210ce4a1d48
Author: Julian Sparber <julian sparber net>
Date:   Tue Nov 7 16:00:00 2017 +0100

    background: resize preview when the window size is less then 500px
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788515

 panels/background/background.ui         | 44 ++++++++++++++++++++++-----------
 panels/background/cc-background-panel.c | 22 ++---------------
 2 files changed, 31 insertions(+), 35 deletions(-)
---
diff --git a/panels/background/background.ui b/panels/background/background.ui
index 147b567f4..4b8d0adb3 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -11,31 +11,43 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="margin">16</property>
-        <property name="halign">center</property>
+        <property name="halign">fill</property>
         <property name="orientation">vertical</property>
-        <property name="expand">False</property>
+        <property name="expand">True</property>
+        <property name="height_request">100</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="margin">6</property>
-            <property name="spacing">6</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">
-                <property name="width_request">310</property>
-                <property name="height_request">170</property>
+              <object class="GtkBox" id="background-preview-top">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="valign">center</property>
-                <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
+                <property name="margin">6</property>
+                <property name="spacing">6</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>
         <child>
           <object class="GtkBox" id="bottom-hbox">
@@ -111,6 +123,8 @@
       <object class="GtkBox" id="backgroud-gallery-box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="expand">True</property>
+        <property name="height_request">450</property>
         <style>
           <class name="background-gallery"/>
         </style>
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index cc88edd1f..995389e65 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -169,8 +169,8 @@ get_or_create_cached_pixbuf (CcBackgroundPanel *panel,
 {
   GtkAllocation allocation;
 
-  //const gint preview_width;// = 310; //309
-  //const gint preview_height;// = 174; //168
+  //const gint preview_width = 310; //309
+  //const gint preview_height = 174; //168
   gint scale_factor;
   GdkPixbuf *pixbuf;
   const gint preview_width = gtk_widget_get_allocated_width (widget);
@@ -211,15 +211,6 @@ on_preview_draw (GtkWidget         *widget,
   return TRUE;
 }
 
-static gboolean
-resize_preview (GtkWidget *widget,
-               GdkEvent  *event,
-               gpointer   user_data)
-{
-  g_print ("run me");
-  return TRUE;
-}
-
 static void
 reload_current_bg (CcBackgroundPanel *panel,
                    GSettings *settings)
@@ -585,14 +576,6 @@ is_gnome_photos_installed ()
   return TRUE;
 }
 
-static void
-on_window_resize (GtkWidget    *widget,
-                  GdkRectangle *allocation,
-                  gpointer      user_data)
-{
-  g_print ("New size\n");
-}
-
 static GtkWidget *
 create_gallery_item (gpointer item,
                      gpointer user_data)
@@ -710,5 +693,4 @@ cc_background_panel_init (CcBackgroundPanel *panel)
 
   /* Background settings */
   g_signal_connect (panel->settings, "changed", G_CALLBACK (on_settings_changed), panel);
-  g_signal_connect (panel, "configure-event", G_CALLBACK (resize_preview), panel);
 }


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