diff --git a/SparkleShare/SparkleLinController.cs b/SparkleShare/SparkleLinController.cs index 34e27385..4422fcc3 100644 --- a/SparkleShare/SparkleLinController.cs +++ b/SparkleShare/SparkleLinController.cs @@ -73,7 +73,9 @@ namespace SparkleShare { // from the Internet category if needed public override void InstallLauncher () { - string apps_path = SparkleHelpers.CombineMore (SparklePaths.HomePath, ".local", "share", "applications"); + string apps_path = Path.Combine (SparkleConfig.DefaultConfig.HomePath, + ".local", "share", "applications"); + string desktopfile_path = SparkleHelpers.CombineMore (apps_path, "sparkleshare.desktop"); if (!File.Exists (desktopfile_path)) { @@ -104,8 +106,8 @@ namespace SparkleShare { // list of bookmarked places public override void AddToBookmarks () { - string bookmarks_file_path = Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks"); - string sparkleshare_bookmark = "file://" + SparklePaths.SparklePath + " SparkleShare"; + string bookmarks_file_path = Path.Combine (SparkleConfig.DefaultConfig.HomePath, ".gtk-bookmarks"); + string sparkleshare_bookmark = "file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"; if (File.Exists (bookmarks_file_path)) { StreamReader reader = new StreamReader (bookmarks_file_path); @@ -114,12 +116,12 @@ namespace SparkleShare { if (!bookmarks.Contains (sparkleshare_bookmark)) { TextWriter writer = File.AppendText (bookmarks_file_path); - writer.WriteLine ("file://" + SparklePaths.SparklePath + " SparkleShare"); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); writer.Close (); } } else { StreamWriter writer = new StreamWriter (bookmarks_file_path); - writer.WriteLine ("file://" + SparklePaths.SparklePath + " SparkleShare"); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); writer.Close (); } } @@ -128,12 +130,12 @@ namespace SparkleShare { // Creates the SparkleShare folder in the user's home folder public override bool CreateSparkleShareFolder () { - if (!Directory.Exists (SparklePaths.SparklePath)) { + if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) { - Directory.CreateDirectory (SparklePaths.SparklePath); - SparkleHelpers.DebugInfo ("Controller", "Created '" + SparklePaths.SparklePath + "'"); + Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath); + SparkleHelpers.DebugInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'"); - string gvfs_command_path = SparkleHelpers.CombineMore (Path.VolumeSeparatorChar.ToString (), + string gvfs_command_path = Path.Combine (Path.VolumeSeparatorChar.ToString (), "usr", "bin", "gvfs-set-attribute"); // Add a special icon to the SparkleShare folder @@ -145,12 +147,12 @@ namespace SparkleShare { process.StartInfo.FileName = "gvfs-set-attribute"; // Clear the custom (legacy) icon path - process.StartInfo.Arguments = "-t unset " + SparklePaths.SparklePath + " metadata::custom-icon"; + process.StartInfo.Arguments = "-t unset " + SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon"; process.Start (); process.WaitForExit (); // Give the SparkleShare folder an icon name, so that it scales - process.StartInfo.Arguments = SparklePaths.SparklePath + " metadata::custom-icon-name 'folder-sparkleshare'"; + process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon-name 'folder-sparkleshare'"; process.Start (); process.WaitForExit (); } @@ -164,13 +166,13 @@ namespace SparkleShare { public override string EventLogHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, + string path = Path.Combine (Defines.PREFIX, "share", "sparkleshare", "html", "event-log.html"); string html = String.Join (Environment.NewLine, File.ReadAllLines (path)); html = html.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js")); + Path.Combine (Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js")); return html; } @@ -179,7 +181,7 @@ namespace SparkleShare { public override string DayEntryHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, + string path = Path.Combine (Defines.PREFIX, "share", "sparkleshare", "html", "day-entry.html"); return String.Join (Environment.NewLine, File.ReadAllLines (path)); @@ -189,7 +191,7 @@ namespace SparkleShare { public override string EventEntryHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, + string path = Path.Combine (Defines.PREFIX, "share", "sparkleshare", "html", "event-entry.html"); return String.Join (Environment.NewLine, File.ReadAllLines (path)); @@ -199,7 +201,7 @@ namespace SparkleShare { public override void OpenSparkleShareFolder (string subfolder) { - string folder = Path.Combine (SparklePaths.SparklePath, subfolder); + string folder = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder); Process process = new Process (); process.StartInfo.FileName = "xdg-open"; diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 28a221ac..3c187b5d 100644 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -240,8 +240,8 @@ namespace SparkleShare { ListStore folder_store = new ListStore (typeof (string)); - foreach (string host in SparkleShare.Controller.FolderPaths) - folder_store.AppendValues (host); + //foreach (string host in SparkleShare.Controller.FolderPaths) + // folder_store.AppendValues (host); FolderEntry.Completion.Model = folder_store; FolderEntry.Completion.TextColumn = 0; diff --git a/SparkleShare/SparkleUIHelpers.cs b/SparkleShare/SparkleUIHelpers.cs index 4786be01..dd347b3d 100644 --- a/SparkleShare/SparkleUIHelpers.cs +++ b/SparkleShare/SparkleUIHelpers.cs @@ -40,14 +40,20 @@ namespace SparkleShare { public static Gdk.Pixbuf GetIcon (string name, int size) { IconTheme icon_theme = new IconTheme (); - icon_theme.AppendSearchPath (SparklePaths.SparkleIconPath); - icon_theme.AppendSearchPath (SparklePaths.SparkleLocalIconPath); + + icon_theme.AppendSearchPath ( + Path.Combine (SparkleUI.AssetsPath, "icons")); + + icon_theme.AppendSearchPath ( + Path.Combine (SparkleConfig.ConfigPath, "icons")); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); + } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); + } catch { return null; }