[tomboy/autosync: 10/15] Add (but don't yet use) autosync preferences
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tomboy/autosync: 10/15] Add (but don't yet use) autosync preferences
- Date: Mon, 8 Feb 2010 08:52:20 +0000 (UTC)
commit dbf126eef6ce89514cf73b879bf1c291280dfa08
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sun Feb 7 19:11:37 2010 -0800
Add (but don't yet use) autosync preferences
Tomboy/Preferences.cs | 4 ++++
Tomboy/PreferencesDialog.cs | 34 ++++++++++++++++++++++++++++++++++
data/tomboy.schemas.in | 17 +++++++++++++++++
3 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/Tomboy/Preferences.cs b/Tomboy/Preferences.cs
index bba7738..7e7c0fb 100644
--- a/Tomboy/Preferences.cs
+++ b/Tomboy/Preferences.cs
@@ -38,6 +38,7 @@ namespace Tomboy
public const string SYNC_LOCAL_PATH = "/apps/tomboy/sync/sync_local_path";
public const string SYNC_SELECTED_SERVICE_ADDIN = "/apps/tomboy/sync/sync_selected_service_addin";
public const string SYNC_CONFIGURED_CONFLICT_BEHAVIOR = "/apps/tomboy/sync/sync_conflict_behavior";
+ public const string SYNC_AUTOSYNC_TIMEOUT = "/apps/tomboy/sync/autosync_timeout";
public const string INSERT_TIMESTAMP_FORMAT = "/apps/tomboy/insert_timestamp/format";
@@ -133,6 +134,9 @@ namespace Tomboy
case SYNC_CONFIGURED_CONFLICT_BEHAVIOR:
return 0;
+ case SYNC_AUTOSYNC_TIMEOUT:
+ return -1;
+
case INSERT_TIMESTAMP_FORMAT:
return Catalog.GetString ("dddd, MMMM d, h:mm tt");
}
diff --git a/Tomboy/PreferencesDialog.cs b/Tomboy/PreferencesDialog.cs
index e2bd3a0..d77bc96 100644
--- a/Tomboy/PreferencesDialog.cs
+++ b/Tomboy/PreferencesDialog.cs
@@ -450,6 +450,40 @@ namespace Tomboy
syncAddinPrefsContainer.Show ();
vbox.PackStart (syncAddinPrefsContainer, true, true, 10);
+ // Autosync preference
+ int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
+ if (timeout > 0 && timeout < 5) {
+ timeout = 5;
+ Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
+ }
+ Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
+ // Translators: This is and the next string go together.
+ // Together they look like "Automatically Sync in Background Every [_] Minutes",
+ // where "[_]" is a GtkSpinButton.
+ Gtk.CheckButton autosyncCheck =
+ new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
+ Gtk.SpinButton autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
+ autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
+ Gtk.Label autosyncExtraText =
+ // Translators: See above comment for details on
+ // this string.
+ new Gtk.Label (Catalog.GetString ("Minutes"));
+ autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
+ EventHandler updateTimeoutPref = (o, e) => {
+ Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
+ autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
+ };
+ autosyncCheck.Toggled += (o, e) => {
+ autosyncSpinner.Sensitive = autosyncCheck.Active;
+ updateTimeoutPref (o, e);
+ };
+ autosyncSpinner.ValueChanged += updateTimeoutPref;
+
+ autosyncBox.PackStart (autosyncCheck);
+ autosyncBox.PackStart (autosyncSpinner);
+ autosyncBox.PackStart (autosyncExtraText);
+ vbox.PackStart (autosyncBox, false, true, 0);
+
Gtk.HButtonBox bbox = new Gtk.HButtonBox ();
bbox.Spacing = 4;
bbox.LayoutStyle = Gtk.ButtonBoxStyle.End;
diff --git a/data/tomboy.schemas.in b/data/tomboy.schemas.in
index 423b2f2..5a0175d 100644
--- a/data/tomboy.schemas.in
+++ b/data/tomboy.schemas.in
@@ -549,6 +549,23 @@
</schema>
<schema>
+ <key>/schemas/apps/tomboy/sync/autosync_timeout</key>
+ <applyto>/apps/tomboy/sync/autosync_timeout</applyto>
+ <owner>tomboy</owner>
+ <type>int</type>
+ <default>-1</default>
+ <locale name="C">
+ <short>Automatic Background Synchronization Timeout</short>
+ <long>
+ Integer value indicating how frequently to perform a background sync
+ of your notes (when sync is configured). Any value less than 0
+ indicates that autosync is disabled. The lowest acceptable positive
+ value is 5. Value is in minutes.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/tomboy/insert_timestamp/format</key>
<applyto>/apps/tomboy/insert_timestamp/format</applyto>
<owner>tomboy</owner>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]