[nautilus-actions] Provides a default size and position for main window



commit 97abe54632de74346b291b5ae34a90e0bb0e0221
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Sep 14 20:27:24 2013 +0200

    Provides a default size and position for main window

 ChangeLog               |    5 +++++
 src/core/na-gtk-utils.c |   47 +++++++++++++++++++++--------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2365a44..874ffda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-14 Pierre Wieser <pwieser trychlos org>
+
+       * src/core/na-gtk-utils.c (na_gtk_utils_restore_window_position):
+       Provides a default size and position for main window.
+
 2013-09-13 Pierre Wieser <pwieser trychlos org>
 
        * docs/nact/Makefile.am: Fix the DOC_LINGUAS variable.
diff --git a/src/core/na-gtk-utils.c b/src/core/na-gtk-utils.c
index 1b27e33..53db811 100644
--- a/src/core/na-gtk-utils.c
+++ b/src/core/na-gtk-utils.c
@@ -162,34 +162,29 @@ na_gtk_utils_restore_window_position( GtkWindow *toplevel, const gchar *wsp_name
        /* bad hack for the first time we open the main window
         * try to target an ideal size and position
         */
-       if( !strcmp( wsp_name, NA_IPREFS_MAIN_WINDOW_WSP ) &&
-                       x == 1 && y == 1 && width == 1 && height == 1 ){
-                               x = 50;
-                               y = 70;
-                               width = 1030;
-                               height = 560;
-
-       } else {
-               display = gdk_display_get_default();
-               screen = gdk_display_get_screen( display, 0 );
-               screen_width = gdk_screen_get_width( screen );
-               screen_height = gdk_screen_get_height( screen );
-
-               /* very dirty hack based on the assumption that Gnome 2.x has a bottom
-                * and a top panel bars, while Gnome 3.x only has one.
-                * Don't know how to get usable height of screen, and don't bother today.
-                */
-               screen_height -= DEFAULT_HEIGHT;
-#if ! GTK_CHECK_VERSION( 3, 0, 0 )
-               screen_height -= DEFAULT_HEIGHT;
-#endif
-
-               width = MAX( width, screen_width-x );
-               height = MAX( height, screen_height-y );
+       if( !strcmp( wsp_name, NA_IPREFS_MAIN_WINDOW_WSP )){
+               if( x == 1 && y == 1 && width == 1 && height == 1 ){
+                       x = 50;
+                       y = 70;
+                       width = 1030;
+                       height = 560;
+
+               } else {
+                       display = gdk_display_get_default();
+                       screen = gdk_display_get_screen( display, 0 );
+                       screen_width = gdk_screen_get_width( screen );
+                       screen_height = gdk_screen_get_height( screen );
+                       g_debug( "%s: screen=(%d,%d), DEFAULT_HEIGHT=%d",
+                                       thisfn, screen_width, screen_height, DEFAULT_HEIGHT );
+
+                       screen_height -= 2*DEFAULT_HEIGHT;
+                       width = MIN( width, screen_width-x );
+                       height = MIN( height, screen_height-y );
+               }
        }
 
-       g_debug( "%s: wsp_name=%s, screen=(%d,%d), x=%d, y=%d, width=%d, height=%d",
-                       thisfn, wsp_name, screen_width, screen_height, x, y, width, height );
+       g_debug( "%s: wsp_name=%s, x=%d, y=%d, width=%d, height=%d",
+                       thisfn, wsp_name, x, y, width, height );
 
        gtk_window_move( toplevel, x, y );
        gtk_window_resize( toplevel, width, height );


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