[gnome-control-center] background: Make whole dialog visible on small screens



commit 130dd418b83a98c2f42343ef56862488daf2509c
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 14 11:33:01 2014 +0200

    background: Make whole dialog visible on small screens
    
    When using a small screen, make sure that the whole of the dialogue
    is visible, including the confirmation buttons. This means that the
    dialogue will be maximised when on smaller screens (just like its
    parent), and that we won't set a number of columns for the icon
    view.
    
    We will also stop making the dialogue much bigger than the
    Settings window itself.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692495

 panels/background/cc-background-chooser-dialog.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/panels/background/cc-background-chooser-dialog.c 
b/panels/background/cc-background-chooser-dialog.c
index 570e5da..167cc94 100644
--- a/panels/background/cc-background-chooser-dialog.c
+++ b/panels/background/cc-background-chooser-dialog.c
@@ -81,13 +81,20 @@ cc_background_chooser_dialog_realize (GtkWidget *widget)
   GtkWindow *parent;
 
   parent = gtk_window_get_transient_for (GTK_WINDOW (chooser));
-  if (parent != NULL)
+  g_assert (parent);
+
+  if (gtk_window_is_maximized (parent))
+    {
+      gtk_window_maximize (GTK_WINDOW (chooser));
+    }
+  else
     {
       gint width;
       gint height;
 
       gtk_window_get_size (parent, &width, &height);
       gtk_widget_set_size_request (GTK_WIDGET (chooser), (gint) (0.5 * width), (gint) (0.9 * height));
+      gtk_icon_view_set_columns (GTK_ICON_VIEW (chooser->priv->icon_view), 3);
     }
 
   GTK_WIDGET_CLASS (cc_background_chooser_dialog_parent_class)->realize (widget);
@@ -284,7 +291,6 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
   gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 0);
   gtk_container_add (GTK_CONTAINER (vbox), grid);
-  gtk_widget_set_size_request (grid, 860, 550);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
@@ -396,7 +402,6 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
 
   priv->icon_view = gtk_icon_view_new ();
   gtk_widget_set_hexpand (priv->icon_view, TRUE);
-  gtk_icon_view_set_columns (GTK_ICON_VIEW (priv->icon_view), 3);
   gtk_container_add (GTK_CONTAINER (priv->sw_content), priv->icon_view);
   g_signal_connect (priv->icon_view, "selection-changed", G_CALLBACK (on_selection_changed), chooser);
   g_signal_connect (priv->icon_view, "item-activated", G_CALLBACK (on_item_activated), chooser);


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