[Goodies-commits] r3952 - xfmpc/trunk/src

Mike Massonnet mmassonnet at xfce.org
Fri Feb 15 03:35:47 CET 2008


Author: mmassonnet
Date: 2008-02-15 02:35:47 +0000 (Fri, 15 Feb 2008)
New Revision: 3952

Modified:
   xfmpc/trunk/src/interface.c
   xfmpc/trunk/src/preferences.c
Log:
Remember window size
* preferences.c:
  - New user preferences LastWindowWidth and LastWindowHeight
* interface.c(xfmpc_interface_init):
  - Restore last window size
* interface.c(xfmpc_interface_state_event):
  - Save window size


Modified: xfmpc/trunk/src/interface.c
===================================================================
--- xfmpc/trunk/src/interface.c	2008-02-15 02:35:41 UTC (rev 3951)
+++ xfmpc/trunk/src/interface.c	2008-02-15 02:35:47 UTC (rev 3952)
@@ -176,14 +176,19 @@
   g_signal_connect (G_OBJECT (interface), "window-state-event", G_CALLBACK (xfmpc_interface_state_event), NULL);
 
   gint posx, posy;
+  gint width, height;
   gboolean sticky;
   g_object_get (G_OBJECT (interface->preferences),
                 "last-window-posx", &posx,
                 "last-window-posy", &posy,
+                "last-window-width", &width,
+                "last-window-height", &height,
                 "last-window-state-sticky", &sticky,
                 NULL);
   if (G_LIKELY (posx != -1 && posy != -1))
     gtk_window_move (GTK_WINDOW (interface), posx, posy);
+  if (G_LIKELY (width != -1 && height != -1))
+    gtk_window_set_default_size (GTK_WINDOW (interface), width, height);
   if (sticky == TRUE)
     gtk_window_stick (GTK_WINDOW (interface));
 
@@ -490,11 +495,15 @@
                         GdkEvent *event)
 {
   gint posx, posy;
+  gint width, height;
   gtk_window_get_position (GTK_WINDOW (interface), &posx, &posy);
+  gtk_window_get_size (GTK_WINDOW (interface), &width, &height);
 
   g_object_set (G_OBJECT (interface->preferences),
                 "last-window-posx", posx,
                 "last-window-posy", posy,
+                "last-window-width", width,
+                "last-window-height", height,
                 NULL);
 
   gtk_main_quit ();

Modified: xfmpc/trunk/src/preferences.c
===================================================================
--- xfmpc/trunk/src/preferences.c	2008-02-15 02:35:41 UTC (rev 3951)
+++ xfmpc/trunk/src/preferences.c	2008-02-15 02:35:47 UTC (rev 3952)
@@ -33,6 +33,8 @@
   PROP_0,
   PROP_LAST_WINDOW_POSX,
   PROP_LAST_WINDOW_POSY,
+  PROP_LAST_WINDOW_WIDTH,
+  PROP_LAST_WINDOW_HEIGHT,
   PROP_LAST_WINDOW_STATE_STICKY,
   PROP_PLAYLIST_AUTOCENTER,
   N_PROPERTIES,
@@ -134,6 +136,21 @@
                                                      G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
+                                   PROP_LAST_WINDOW_WIDTH,
+                                   g_param_spec_int ("last-window-width",
+                                                     "LastWindowWidth",
+                                                     "Window width",
+                                                     -1, G_MAXINT, -1,
+                                                     G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_LAST_WINDOW_HEIGHT,
+                                   g_param_spec_int ("last-window-height",
+                                                     "LastWindowHeight",
+                                                     "Window height",
+                                                     -1, G_MAXINT, -1,
+                                                     G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
                                    PROP_LAST_WINDOW_STATE_STICKY,
                                    g_param_spec_boolean ("last-window-state-sticky",
                                                          "LastWindowStateSticky",




More information about the Goodies-commits mailing list