[Xfce4-commits] <thunar:master> Remember the maximize state for new windows. Patch by Nick (bug #4697).

Jannis Pohlmann noreply at xfce.org
Fri Oct 16 12:16:01 CEST 2009


Updating branch refs/heads/master
         to 46c9c926b2522f9e5527ed2497b5bc5069da70af (commit)
       from 8474b21004aa7d5a0df15591216e2a30966914ff (commit)

commit 46c9c926b2522f9e5527ed2497b5bc5069da70af
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Fri Oct 16 12:10:40 2009 +0200

    Remember the maximize state for new windows. Patch by Nick (bug #4697).
    
    This adds a new property 'last-window-maximized' to the
    ThunarPreferences (written as LastWindowMaximized=true/false in the
    settings file). We only remember the maximize state if the last window
    was maximized. Otherwise, we remember the window size and that the
    window was not maximized at all.

 thunar/thunar-preferences.c |   15 +++++++++++++++
 thunar/thunar-window.c      |   15 +++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c
index 74f0776..84d1f9b 100644
--- a/thunar/thunar-preferences.c
+++ b/thunar/thunar-preferences.c
@@ -67,6 +67,7 @@ enum
   PROP_LAST_VIEW,
   PROP_LAST_WINDOW_HEIGHT,
   PROP_LAST_WINDOW_WIDTH,
+  PROP_LAST_WINDOW_FULLSCREEN,
   PROP_MISC_VOLUME_MANAGEMENT,
   PROP_MISC_CASE_SENSITIVE,
   PROP_MISC_DATE_STYLE,
@@ -399,6 +400,20 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass)
                                                      "last-window-width",
                                                      1, G_MAXINT, 640,
                                                      EXO_PARAM_READWRITE));
+                                                     
+  /**
+   * ThunarPreferences:last-window-maximized:
+   *
+   * The last known maximized state of a #ThunarWindow, which will be used as
+   * default width for newly created windows.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_LAST_WINDOW_FULLSCREEN,
+                                   g_param_spec_boolean ("last-window-maximized",
+                                                         "LastWindowMaximized",
+                                                         "last-window-maximized",
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
 
   /**
    * ThunarPreferences:misc-volume-management:
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 04fb7cf..aebe3e7 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -677,6 +677,7 @@ thunar_window_init (ThunarWindow *window)
   gint            position;
   gint            width;
   gint            height;
+  gboolean        maximized;
 
   /* grab a reference on the provider factory */
   window->provider_factory = thunarx_provider_factory_get_default ();
@@ -766,8 +767,12 @@ thunar_window_init (ThunarWindow *window)
   g_signal_connect_swapped (G_OBJECT (window->launcher), "change-directory", G_CALLBACK (thunar_window_set_current_directory), window);
 
   /* determine the default window size from the preferences */
-  g_object_get (G_OBJECT (window->preferences), "last-window-width", &width, "last-window-height", &height, NULL);
+  g_object_get (G_OBJECT (window->preferences), "last-window-width", &width, "last-window-height", &height, "last-window-maximized", &maximized, NULL);
   gtk_window_set_default_size (GTK_WINDOW (window), width, height);
+  
+  /* restore the maxized state of the window */
+  if (G_UNLIKELY (maximized))
+    gtk_window_maximize (GTK_WINDOW (window));
 
   window->table = gtk_table_new (6, 1, FALSE);
   gtk_container_add (GTK_CONTAINER (window), window->table);
@@ -2670,7 +2675,13 @@ thunar_window_save_geometry_timer (gpointer user_data)
               gtk_window_get_size (GTK_WINDOW (window), &width, &height);
 
               /* ...and remember them as default for new windows */
-              g_object_set (G_OBJECT (window->preferences), "last-window-width", width, "last-window-height", height, NULL);
+              g_object_set (G_OBJECT (window->preferences), "last-window-width", width, "last-window-height", height,
+                            "last-window-maximized", FALSE, NULL);
+            }
+          else
+            {
+              /* only store that the window is full screen */
+              g_object_set (G_OBJECT (window->preferences), "last-window-maximized", TRUE, NULL);
             }
         }
     }



More information about the Xfce4-commits mailing list