linux: Fix custom folder icon name
This commit is contained in:
parent
2d371550f2
commit
d047a5f2d5
|
@ -19,9 +19,10 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using SparkleLib;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using Mono.Unix.Native;
|
using Mono.Unix.Native;
|
||||||
using SparkleLib;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
@ -94,32 +95,15 @@ namespace SparkleShare {
|
||||||
// Creates the SparkleShare folder in the user's home folder
|
// Creates the SparkleShare folder in the user's home folder
|
||||||
public override bool CreateSparkleShareFolder ()
|
public override bool CreateSparkleShareFolder ()
|
||||||
{
|
{
|
||||||
bool folder_created = false;
|
|
||||||
|
|
||||||
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
|
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
|
||||||
Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath);
|
Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath);
|
||||||
Syscall.chmod (SparkleConfig.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
|
Syscall.chmod (SparkleConfig.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'");
|
SparkleLogger.LogInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'");
|
||||||
folder_created = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string gvfs_command_path = new string [] { Path.VolumeSeparatorChar.ToString (),
|
return false;
|
||||||
"usr", "bin", "gvfs-set-attribute" }.Combine ();
|
|
||||||
|
|
||||||
// Add a special icon to the SparkleShare folder
|
|
||||||
if (File.Exists (gvfs_command_path)) {
|
|
||||||
var process = new Process ();
|
|
||||||
|
|
||||||
process.StartInfo.FileName = "gvfs-set-attribute";
|
|
||||||
process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath +
|
|
||||||
" metadata::custom-icon-name 'folder-sparkleshare'";
|
|
||||||
|
|
||||||
process.Start ();
|
|
||||||
process.WaitForExit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return folder_created;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,5 +161,14 @@ namespace SparkleShare {
|
||||||
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 ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,8 +162,10 @@ namespace SparkleShare {
|
||||||
// Installs the sparkleshare:// protocol handler
|
// Installs the sparkleshare:// protocol handler
|
||||||
public abstract void InstallProtocolHandler ();
|
public abstract void InstallProtocolHandler ();
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the user's
|
// Installs the sparkleshare:// protocol handler
|
||||||
// list of bookmarked places
|
public abstract void SetFolderIcon ();
|
||||||
|
|
||||||
|
// Adds the SparkleShare folder to the sidebar
|
||||||
public abstract void AddToBookmarks ();
|
public abstract void AddToBookmarks ();
|
||||||
|
|
||||||
// Creates the SparkleShare folder in the user's home folder
|
// Creates the SparkleShare folder in the user's home folder
|
||||||
|
@ -227,6 +229,8 @@ namespace SparkleShare {
|
||||||
this.lost_folders_path = true;
|
this.lost_folders_path = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetFolderIcon ();
|
||||||
|
|
||||||
// Watch the SparkleShare folder
|
// Watch the SparkleShare folder
|
||||||
this.watcher = new FileSystemWatcher () {
|
this.watcher = new FileSystemWatcher () {
|
||||||
Filter = "*",
|
Filter = "*",
|
||||||
|
|
Loading…
Reference in a new issue