tomboy r1777 - in trunk: . Tomboy/Addins/SshSyncService Tomboy/Synchronization
- From: sharm svn gnome org
- To: svn-commits-list gnome org
- Subject: tomboy r1777 - in trunk: . Tomboy/Addins/SshSyncService Tomboy/Synchronization
- Date: Mon, 14 Jan 2008 14:41:34 +0000 (GMT)
Author: sharm
Date: Mon Jan 14 14:41:33 2008
New Revision: 1777
URL: http://svn.gnome.org/viewvc/tomboy?rev=1777&view=rev
Log:
* Tomboy/Synchronization/FuseSyncServiceAddin.cs: Added ability to set
default fuse mount timeout with
/apps/tomboy/sync_fuse_mount_timeout_ms key in gconf. Sets timeout
time in milliseconds. Fixes bug #480736. Also, for debugging
purposes, the exact fuse mount command is printed to the log.
* Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs: Added ability to
choose SSH server port by appending ":22" (for example) to the
server name. Saves port in /apps/tomboy/sync_sshfs_port. Fixes
bug #488117.
Modified:
trunk/ChangeLog
trunk/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs
trunk/Tomboy/Synchronization/FuseSyncServiceAddin.cs
Modified: trunk/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs
==============================================================================
--- trunk/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs (original)
+++ trunk/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs Mon Jan 14 14:41:33 2008
@@ -28,11 +28,13 @@
Gtk.Table table = new Gtk.Table (3, 2, false);
// Read settings out of gconf
- string server = Preferences.Get ("/apps/tomboy/sync_sshfs_server") as String;
- string folder = Preferences.Get ("/apps/tomboy/sync_sshfs_folder") as String;
- string username = Preferences.Get ("/apps/tomboy/sync_sshfs_username") as String;
+ string server, folder, username;
+ int port;
+ GetConfigSettings (out server, out folder, out username, out port);
if (server == null)
server = string.Empty;
+ if (port != 22)
+ server += ":" + port.ToString ();
if (folder == null)
folder = string.Empty;
if (username == null)
@@ -85,8 +87,9 @@
protected override bool VerifyConfiguration ()
{
string server, folder, username;
+ int port;
- if (!GetPrefWidgetSettings (out server, out folder, out username)) {
+ if (!GetPrefWidgetSettings (out server, out folder, out username, out port)) {
// TODO: Figure out a way to send the error back to the client
Logger.Debug ("One of url, username was empty");
throw new TomboySyncException (Catalog.GetString ("Server or username field is empty."));
@@ -98,9 +101,11 @@
protected override void SaveConfigurationValues ()
{
string server, folder, username;
- GetPrefWidgetSettings (out server, out folder, out username);
+ int port;
+ GetPrefWidgetSettings (out server, out folder, out username, out port);
Preferences.Set ("/apps/tomboy/sync_sshfs_server", server);
+ Preferences.Set ("/apps/tomboy/sync_sshfs_port", port);
Preferences.Set ("/apps/tomboy/sync_sshfs_folder", folder);
Preferences.Set ("/apps/tomboy/sync_sshfs_username", username);
}
@@ -111,6 +116,7 @@
protected override void ResetConfigurationValues ()
{
Preferences.Set ("/apps/tomboy/sync_sshfs_server", string.Empty);
+ Preferences.Set ("/apps/tomboy/sync_sshfs_port", 22);
Preferences.Set ("/apps/tomboy/sync_sshfs_folder", string.Empty);
Preferences.Set ("/apps/tomboy/sync_sshfs_username", string.Empty);
}
@@ -122,7 +128,8 @@
{
get {
string server, folder, username;
- return GetConfigSettings (out server, out folder, out username);
+ int port;
+ return GetConfigSettings (out server, out folder, out username, out port);
}
}
@@ -150,13 +157,15 @@
protected override string GetFuseMountExeArgs (string mountPath, bool fromStoredValues)
{
+ int port = 22;
string server, folder, username;
if (fromStoredValues)
- GetConfigSettings (out server, out folder, out username);
+ GetConfigSettings (out server, out folder, out username, out port);
else
- GetPrefWidgetSettings (out server, out folder, out username);
+ GetPrefWidgetSettings (out server, out folder, out username, out port);
return string.Format (
- "{0} {1}:{2} {3}",
+ "-p {0} {1} {2}:{3} {4}",
+ port,
username,
server,
folder,
@@ -185,9 +194,13 @@
/// <summary>
/// Get config settings
/// </summary>
- private bool GetConfigSettings (out string server, out string folder, out string username)
+ private bool GetConfigSettings (out string server, out string folder, out string username, out int port)
{
server = Preferences.Get ("/apps/tomboy/sync_sshfs_server") as String;
+ port = 22;
+ try {
+ port = (int)Preferences.Get ("/apps/tomboy/sync_sshfs_port");
+ } catch {}
folder = Preferences.Get ("/apps/tomboy/sync_sshfs_folder") as String;
username = Preferences.Get ("/apps/tomboy/sync_sshfs_username") as String;
@@ -198,9 +211,17 @@
/// <summary>
/// Get config settings
/// </summary>
- private bool GetPrefWidgetSettings (out string server, out string folder, out string username)
+ private bool GetPrefWidgetSettings (out string server, out string folder, out string username, out int port)
{
+ port = 22;
server = serverEntry.Text.Trim ();
+ int lastColonIndex = server.LastIndexOf(":");
+ if (lastColonIndex > 0) {
+ try {
+ port = int.Parse (server.Substring (lastColonIndex + 1));
+ } catch {}
+ server = server.Substring (0, lastColonIndex);
+ }
folder = folderEntry.Text.Trim ();
username = usernameEntry.Text.Trim ();
Modified: trunk/Tomboy/Synchronization/FuseSyncServiceAddin.cs
==============================================================================
--- trunk/Tomboy/Synchronization/FuseSyncServiceAddin.cs (original)
+++ trunk/Tomboy/Synchronization/FuseSyncServiceAddin.cs Mon Jan 14 14:41:33 2008
@@ -10,6 +10,7 @@
public abstract class FuseSyncServiceAddin : SyncServiceAddin
{
#region Private Data
+ const int defaultMountTimeoutMs = 10000;
private string mountPath;
private InterruptableTimeout unmountTimeout;
@@ -212,9 +213,13 @@
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = fuseMountExePath;
p.StartInfo.Arguments = GetFuseMountExeArgs (mountPath, useStoredValues);
+ Logger.Debug (string.Format (
+ "Mounting sync path with this command: {0} {1}",
+ p.StartInfo.FileName,
+ p.StartInfo.Arguments));
p.StartInfo.CreateNoWindow = true;
p.Start ();
- int timeoutMs = 10000; // Important to timeout. Is 10 seconds appropriate?
+ int timeoutMs = GetTimeoutMs ();
bool exited = p.WaitForExit (timeoutMs);
if (!exited) {
@@ -245,6 +250,18 @@
return true;
}
+
+ private int GetTimeoutMs ()
+ {
+ try {
+ return (int) Preferences.Get ("/apps/tomboy/sync_fuse_mount_timeout_ms");
+ } catch {
+ try {
+ Preferences.Set ("/apps/tomboy/sync_fuse_mount_timeout_ms", defaultMountTimeoutMs);
+ } catch {}
+ return defaultMountTimeoutMs;
+ }
+ }
private void SetUpMountPath ()
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]