tomboy r1896 - in trunk: . Tomboy
- From: btimothy svn gnome org
- To: svn-commits-list gnome org
- Subject: tomboy r1896 - in trunk: . Tomboy
- Date: Sun, 24 Feb 2008 04:56:05 +0000 (GMT)
Author: btimothy
Date: Sun Feb 24 04:56:05 2008
New Revision: 1896
URL: http://svn.gnome.org/viewvc/tomboy?rev=1896&view=rev
Log:
* Tomboy/RecentChanges.cs: Set a sane default width and size for when
Tomboy is first run (had to make larger now that we have a
notebooks sidebar thing. Save and restore the size and position of
the search window when it is closed or when Tomboy exits. Fixes
bug #518316.
* Tomboy/Preferences.cs: Added some preferences that we'll have to
localize during the 0.11.x timeframe after string freeze to save
the search window position and size.
Modified:
trunk/ChangeLog
trunk/Tomboy/Preferences.cs
trunk/Tomboy/RecentChanges.cs
Modified: trunk/Tomboy/Preferences.cs
==============================================================================
--- trunk/Tomboy/Preferences.cs (original)
+++ trunk/Tomboy/Preferences.cs Sun Feb 24 04:56:05 2008
@@ -39,6 +39,12 @@
public const string SYNC_CONFIGURED_CONFLICT_BEHAVIOR = "/apps/tomboy/sync/sync_conflict_behavior";
public const string INSERT_TIMESTAMP_FORMAT = "/apps/tomboy/insert_timestamp/format";
+
+ // TODO: Convert these into properly localized settings in 0.11.x after freeze is lifted
+ public const string SEARCH_WINDOW_X_POS = "/apps/tomboy/search_window_x_pos";
+ public const string SEARCH_WINDOW_Y_POS = "/apps/tomboy/search_window_y_pos";
+ public const string SEARCH_WINDOW_WIDTH = "/apps/tomboy/search_window_width";
+ public const string SEARCH_WINDOW_HEIGHT = "/apps/tomboy/search_window_height";
static GConf.Client client;
static GConf.NotifyEventHandler changed_handler;
Modified: trunk/Tomboy/RecentChanges.cs
==============================================================================
--- trunk/Tomboy/RecentChanges.cs (original)
+++ trunk/Tomboy/RecentChanges.cs Sun Feb 24 04:56:05 2008
@@ -78,8 +78,10 @@
{
this.manager = manager;
this.IconName = "tomboy";
- this.DefaultWidth = 200;
+ this.DefaultWidth = 450;
+ this.DefaultHeight = 400;
this.current_matches = new Hashtable ();
+ this.Resizable = true;
selected_tags = new Dictionary<Tag, Tag> ();
@@ -161,6 +163,8 @@
if (tree_req.Width > 480)
matches_window.WidthRequest = 480;
+
+ RestorePosition ();
matches_window.HscrollbarPolicy = Gtk.PolicyType.Automatic;
matches_window.VscrollbarPolicy = Gtk.PolicyType.Automatic;
@@ -200,6 +204,8 @@
// until the note's QueueSave () kicks in.
Notebooks.NotebookManager.NoteAddedToNotebook += OnNoteAddedToNotebook;
Notebooks.NotebookManager.NoteRemovedFromNotebook += OnNoteRemovedFromNotebook;
+
+ Tomboy.ExitingEvent += OnExitingEvent;
}
Gtk.MenuBar CreateMenuBar ()
@@ -946,6 +952,9 @@
am ["OpenNotebookTemplateNoteAction"].Activated -= OnOpenNotebookTemplateNote;
am ["CloseWindowAction"].Activated -= OnCloseWindow;
}
+
+ SavePosition ();
+ Tomboy.ExitingEvent -= OnExitingEvent;
Hide ();
Destroy ();
@@ -1368,5 +1377,46 @@
find_combo.Entry.Text = value;
}
}
+ /// <summary>
+ /// Save the position and size of the RecentChanges window
+ /// </summary>
+ private void SavePosition ()
+ {
+ int x;
+ int y;
+ int width;
+ int height;
+
+ GetPosition(out x, out y);
+ GetSize(out width, out height);
+
+ Preferences.Set (Preferences.SEARCH_WINDOW_X_POS, x.ToString ());
+ Preferences.Set (Preferences.SEARCH_WINDOW_Y_POS, y.ToString ());
+ Preferences.Set (Preferences.SEARCH_WINDOW_WIDTH, width.ToString ());
+ Preferences.Set (Preferences.SEARCH_WINDOW_HEIGHT, height.ToString ());
+ }
+
+ private void RestorePosition ()
+ {
+ string xStr = Preferences.Get (Preferences.SEARCH_WINDOW_X_POS) as string;
+ string yStr = Preferences.Get (Preferences.SEARCH_WINDOW_Y_POS) as string;
+ string widthStr = Preferences.Get (Preferences.SEARCH_WINDOW_WIDTH) as string;
+ string heightStr = Preferences.Get (Preferences.SEARCH_WINDOW_HEIGHT) as string;
+
+ if (xStr == null || xStr == string.Empty
+ || yStr == null || yStr == string.Empty
+ || widthStr == null || widthStr == string.Empty
+ || heightStr == null || heightStr == string.Empty)
+ return;
+
+ DefaultSize =
+ new Gdk.Size (int.Parse (widthStr), int.Parse (heightStr));
+ Move (int.Parse (xStr), int.Parse (yStr));
+ }
+
+ private void OnExitingEvent (object sender, EventArgs args)
+ {
+ SavePosition ();
}
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]