controller: Shouldn't be changing people's bookmarks
This commit is contained in:
parent
513ecb378e
commit
0e2a31c2cd
|
@ -364,12 +364,5 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string GenerateCryptoSalt ()
|
|
||||||
{
|
|
||||||
string salt = Path.GetRandomFileName ().SHA1 ();
|
|
||||||
return salt.Substring (0, 16);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleController : SparkleControllerBase {
|
public class SparkleController : SparkleControllerBase {
|
||||||
|
|
||||||
public SparkleController () : base ()
|
public SparkleController ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string PluginsPath {
|
public override string PluginsPath {
|
||||||
get {
|
get {
|
||||||
return new string [] { Defines.INSTALL_DIR, "plugins" }.Combine ();
|
return Path.Combine (Defines.INSTALL_DIR, "plugins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,19 +47,21 @@ namespace SparkleShare {
|
||||||
string autostart_path = Path.Combine (
|
string autostart_path = Path.Combine (
|
||||||
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "autostart");
|
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "autostart");
|
||||||
|
|
||||||
string desktopfile_path = Path.Combine (autostart_path, "sparkleshare.desktop");
|
string autostart_file_path = Path.Combine (autostart_path, "org.sparkleshare.SparkleShare.Autostart.desktop");
|
||||||
|
|
||||||
|
if (File.Exists (autostart_file_path))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!Directory.Exists (autostart_path))
|
if (!Directory.Exists (autostart_path))
|
||||||
Directory.CreateDirectory (autostart_path);
|
Directory.CreateDirectory (autostart_path);
|
||||||
|
|
||||||
if (!File.Exists (desktopfile_path)) {
|
|
||||||
try {
|
try {
|
||||||
File.WriteAllText (desktopfile_path,
|
File.WriteAllText (autostart_file_path,
|
||||||
"[Desktop Entry]\n" +
|
"[Desktop Entry]\n" +
|
||||||
"Type=Application\n" +
|
"Type=Application\n" +
|
||||||
"Name=SparkleShare\n" +
|
"Name=SparkleShare\n" +
|
||||||
"Exec=sparkleshare start\n" +
|
"Exec=sparkleshare\n" +
|
||||||
"Icon=folder-sparkleshare\n" +
|
"Icon=org.sparkleshare.SparkleShare\n" +
|
||||||
"Terminal=false\n" +
|
"Terminal=false\n" +
|
||||||
"X-GNOME-Autostart-enabled=true\n" +
|
"X-GNOME-Autostart-enabled=true\n" +
|
||||||
"Categories=Network");
|
"Categories=Network");
|
||||||
|
@ -69,26 +71,7 @@ namespace SparkleShare {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Controller", "Failed adding SparkleShare to login items: " + e.Message);
|
SparkleLogger.LogInfo ("Controller", "Failed adding SparkleShare to login items: " + e.Message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the user's
|
|
||||||
// list of bookmarked places
|
|
||||||
public override void AddToBookmarks ()
|
|
||||||
{
|
|
||||||
string bookmarks_file_path = Path.Combine (SparkleConfig.DefaultConfig.HomePath, ".gtk-bookmarks");
|
|
||||||
string sparkleshare_bookmark = "file://" + FoldersPath + " SparkleShare";
|
|
||||||
|
|
||||||
if (File.Exists (bookmarks_file_path)) {
|
|
||||||
string bookmarks = File.ReadAllText (bookmarks_file_path);
|
|
||||||
|
|
||||||
if (!bookmarks.Contains (sparkleshare_bookmark))
|
|
||||||
File.AppendAllText (bookmarks_file_path, "file://" + FoldersPath + " SparkleShare");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
File.WriteAllText (bookmarks_file_path, "file://" + FoldersPath + " SparkleShare");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,6 +119,22 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void CopyToClipboard (string text)
|
||||||
|
{
|
||||||
|
Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
|
||||||
|
clipboard.Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void SetFolderIcon ()
|
||||||
|
{
|
||||||
|
var process = new SparkleProcess ("gvfs-set-attribute", SparkleConfig.DefaultConfig.FoldersPath + " " +
|
||||||
|
"metadata::custom-icon-name org.sparkleshare.SparkleShare");
|
||||||
|
|
||||||
|
process.StartAndWaitForExit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenFolder (string path)
|
public override void OpenFolder (string path)
|
||||||
{
|
{
|
||||||
OpenFile (path);
|
OpenFile (path);
|
||||||
|
@ -151,24 +150,8 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void CopyToClipboard (string text)
|
|
||||||
{
|
|
||||||
Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
|
|
||||||
clipboard.Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override void InstallProtocolHandler ()
|
public override void InstallProtocolHandler ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void SetFolderIcon ()
|
|
||||||
{
|
|
||||||
var process = new SparkleProcess ("gvfs-set-attribute", SparkleConfig.DefaultConfig.FoldersPath + " " +
|
|
||||||
"metadata::custom-icon-name org.sparkleshare.SparkleShare");
|
|
||||||
|
|
||||||
process.StartAndWaitForExit ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,12 +124,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void AddToBookmarks ()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override bool CreateSparkleShareFolder ()
|
public override bool CreateSparkleShareFolder ()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists (Program.Controller.FoldersPath)) {
|
if (!Directory.Exists (Program.Controller.FoldersPath)) {
|
||||||
|
|
|
@ -165,9 +165,6 @@ namespace SparkleShare {
|
||||||
// Installs the sparkleshare:// protocol handler
|
// Installs the sparkleshare:// protocol handler
|
||||||
public abstract void SetFolderIcon ();
|
public abstract void SetFolderIcon ();
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the sidebar
|
|
||||||
public abstract void AddToBookmarks ();
|
|
||||||
|
|
||||||
// Creates the SparkleShare folder in the user's home folder
|
// Creates the SparkleShare folder in the user's home folder
|
||||||
public abstract bool CreateSparkleShareFolder ();
|
public abstract bool CreateSparkleShareFolder ();
|
||||||
|
|
||||||
|
@ -222,8 +219,7 @@ namespace SparkleShare {
|
||||||
InstallProtocolHandler ();
|
InstallProtocolHandler ();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (CreateSparkleShareFolder ())
|
CreateSparkleShareFolder ();
|
||||||
AddToBookmarks ();
|
|
||||||
|
|
||||||
} catch (DirectoryNotFoundException) {
|
} catch (DirectoryNotFoundException) {
|
||||||
this.lost_folders_path = true;
|
this.lost_folders_path = true;
|
||||||
|
|
Loading…
Reference in a new issue