[evince] ev-window: set default size according to screen size and window-ratio property



commit dcfa0a20fbf1c6f0a02ef9ca7e4c9899380aa073
Author: Alessandro Campagni <alessandro campagni gmail com>
Date:   Thu May 9 02:05:34 2013 +0200

    ev-window: set default size according to screen size and window-ratio property
    
    See  https://bugzilla.gnome.org/show_bug.cgi?id=617547

 shell/ev-window.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 235848f..e3d8f44 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -7012,6 +7012,22 @@ _gtk_css_provider_load_from_resource (GtkCssProvider *provider,
 }
 
 static void
+ev_window_set_default_size (EvWindow *ev_window)
+{
+       GdkScreen *screen;
+       gint height;
+       gint width;
+       gdouble height_ratio;
+       gdouble width_ratio;
+
+       screen = gtk_window_get_screen (GTK_WINDOW (ev_window));
+       height = gdk_screen_get_height (screen);
+       g_settings_get (ev_window->priv->default_settings, "window-ratio", "(dd)", &width_ratio, 
&height_ratio);
+       width = floor (height / height_ratio * width_ratio);
+       gtk_window_set_default_size (GTK_WINDOW (ev_window), width, height);
+}
+
+static void
 ev_window_init (EvWindow *ev_window)
 {
        GtkActionGroup *action_group;
@@ -7442,7 +7458,7 @@ ev_window_init (EvWindow *ev_window)
        /* Set it user interface params */
        ev_window_setup_recent (ev_window);
 
-       gtk_window_set_default_size (GTK_WINDOW (ev_window), 600, 600);
+       ev_window_set_default_size (ev_window);
 
         ev_window_sizing_mode_changed_cb (ev_window->priv->model, NULL, ev_window);
        ev_window_setup_action_sensitivity (ev_window);


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