[Goodies-commits] r7459 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Thu Jun 4 22:48:52 CEST 2009
Author: mmassonnet
Date: 2009-06-04 20:48:51 +0000 (Thu, 04 Jun 2009)
New Revision: 7459
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/application.vala
xfce4-notes-plugin/trunk/panel-plugin/note.vala
xfce4-notes-plugin/trunk/panel-plugin/window.vala
Log:
Properly save window geometry
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-06-04 16:01:58 UTC (rev 7458)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-06-04 20:48:51 UTC (rev 7459)
@@ -1,5 +1,17 @@
2009-06-04 Mike Massonnet <mmassonnet at xfce.org>
+Properly save window geometry
+ * panel-plugin/window.vala:
+ - New method get_geometry() to return in accordance the geometry
+ despit the state of the visibility.
+ * panel-plugin/application.vala:
+ - Properly save window geometry.
+ * panel-plugin/note.vala:
+ - Fix a null pointer sent within the lambda in the setter of the
+ property dirty. Move the code to a normal function.
+
+2009-06-04 Mike Massonnet <mmassonnet at xfce.org>
+
Load/save notes contents and windows configuration
* panel-plugin/application.vala:
- Load/save windows configuration from/to config_file.
Modified: xfce4-notes-plugin/trunk/panel-plugin/application.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-06-04 16:01:58 UTC (rev 7458)
+++ xfce4-notes-plugin/trunk/panel-plugin/application.vala 2009-06-04 20:48:51 UTC (rev 7459)
@@ -213,20 +213,16 @@
var keyfile = new GLib.KeyFile ();
try {
foreach (var win in this.window_list) {
- int winx, winy;
- win.get_position (out winx, out winy);
- int width = win.allocation.width;
- // TODO if shaded
- int height = win.allocation.height;
+ int winx, winy, width, height;
+ win.get_geometry (out winx, out winy, out width, out height);
int last_page = win.get_current_page ();
int transparency = (int)((1 - win.opacity) * 100);
bool visible = (bool)(win.get_flags () & Gtk.WidgetFlags.VISIBLE);
keyfile.set_integer (win.name, "PosX", winx);
keyfile.set_integer (win.name, "PosY", winy);
- // TODO if !visible
- keyfile.set_integer (win.name, "Width", visible ? width : win.default_width);
- keyfile.set_integer (win.name, "Height", visible ? height : win.default_height);
+ keyfile.set_integer (win.name, "Width", width);
+ keyfile.set_integer (win.name, "Height", height);
keyfile.set_integer (win.name, "LastTab", last_page);
keyfile.set_boolean (win.name, "Above", win.above);
keyfile.set_boolean (win.name, "Sticky", win.sticky);
@@ -327,13 +323,13 @@
string name;
string path = "%s/%s".printf (notes_path, window.name);
try {
- var dir = GLib.Dir.open (path, 0);
- while ((name = dir.read_name ()) != null) {
- string filename = "%s/%s".printf (path, name);
- GLib.FileUtils.unlink (filename);
+ var dir = GLib.Dir.open (path, 0);
+ while ((name = dir.read_name ()) != null) {
+ string filename = "%s/%s".printf (path, name);
+ GLib.FileUtils.unlink (filename);
+ }
+ GLib.DirUtils.remove (path);
}
- GLib.DirUtils.remove (path);
- }
catch (FileError e) {
}
Modified: xfce4-notes-plugin/trunk/panel-plugin/note.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/note.vala 2009-06-04 16:01:58 UTC (rev 7458)
+++ xfce4-notes-plugin/trunk/panel-plugin/note.vala 2009-06-04 20:48:51 UTC (rev 7459)
@@ -46,12 +46,7 @@
else {
if (this.save_timeout > 0)
Source.remove (this.save_timeout);
- this.save_timeout = Timeout.add_seconds (60, () => {
- save_data ();
- this.save_timeout = 0;
- this._dirty = false;
- return false;
- });
+ this.save_timeout = Timeout.add_seconds (60, save_cb);
}
}
}
@@ -80,10 +75,7 @@
}
~Note () {
- if (this.save_timeout > 0) {
- Source.remove (this.save_timeout);
- this.save_timeout = 0;
- }
+ this.dirty = false;
}
public override void size_request (ref Gtk.Requisition requisition) {
@@ -119,6 +111,18 @@
this.dirty = true;
}
+ /**
+ * save_cb:
+ *
+ * Send save-data signal.
+ */
+ private bool save_cb () {
+ save_data ();
+ this.save_timeout = 0;
+ this._dirty = false;
+ return false;
+ }
+
}
}
Modified: xfce4-notes-plugin/trunk/panel-plugin/window.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-06-04 16:01:58 UTC (rev 7458)
+++ xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-06-04 20:48:51 UTC (rev 7459)
@@ -776,6 +776,24 @@
}
/**
+ * get_geometry:
+ *
+ * Returns the X,Y position and width/height.
+ */
+ public void get_geometry (out int winx, out int winy, out int width, out int height) {
+ // Window is shaded
+ if (!(bool)(this.content_box.get_flags () & Gtk.WidgetFlags.VISIBLE)) {
+ get_size (out this.width, null);
+ }
+ else {
+ get_size (out this.width, out this.height);
+ }
+ get_position (out winx, out winy);
+ width = this.width;
+ height = this.height;
+ }
+
+ /**
* set_window_list:
*
* Saves a list of window inside window.window_list to be shown
More information about the Goodies-commits
mailing list