Bug #669191 - Address book dialog has incorrect default size
authorMathieu Trudel-Lapierre <mathieu@canonical.com>
Thu, 3 May 2012 10:00:10 +0000 (12:00 +0200)
committerMilan Crha <mcrha@redhat.com>
Thu, 3 May 2012 10:00:10 +0000 (12:00 +0200)
libedataserverui/e-name-selector-dialog.c

index f595d37..18e7368 100644 (file)
@@ -447,10 +447,23 @@ name_selector_dialog_constructed (GObject *object)
                GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
                NULL);
 
+       /* Try to figure out a sane default size for the dialog. We used to hard
+        * code this to 512 so keep using 512 if the screen is big enough,
+        * otherwise use -1 (use as little as possible, use the
+        * GtkScrolledWindow's scrollbars).
+        *
+        * This should allow scrolling on tiny netbook resolutions and let
+        * others see as much of the dialog as possible.
+        *
+        * 600 pixels seems to be a good lower bound resolution to allow room
+        * above or below for other UI (window manager's?)
+        */
+       gtk_window_set_default_size (GTK_WINDOW (object), 700,
+               gdk_screen_height () >= 600 ? 512 : -1);
+
        gtk_dialog_set_default_response (
                GTK_DIALOG (object), GTK_RESPONSE_CLOSE);
        gtk_window_set_modal (GTK_WINDOW (object), TRUE);
-       gtk_window_set_default_size (GTK_WINDOW (object), 700, -1);
        gtk_window_set_resizable (GTK_WINDOW (object), TRUE);
        gtk_container_set_border_width (GTK_CONTAINER (object), 4);
        gtk_window_set_title (