linux: Fix custom folder icon in Nautilus

This commit is contained in:
Hylke Bons 2012-08-18 21:14:29 +01:00
parent 9f122d02fb
commit 470fc8b61d
11 changed files with 35 additions and 37 deletions

View file

@ -6,21 +6,21 @@ system_themedir = $(datadir)/icons/$(theme)
app_themedir = $(pkgdatadir)/icons/$(theme) app_themedir = $(pkgdatadir)/icons/$(theme)
system_theme_icons = \ system_theme_icons = \
apps,folder-sparkleshare-16.png \ apps,sparkleshare-16.png \
apps,folder-sparkleshare-22.png \ apps,sparkleshare-22.png \
apps,folder-sparkleshare-24.png \ apps,sparkleshare-24.png \
apps,folder-sparkleshare-256.png \ apps,sparkleshare-256.png \
apps,folder-sparkleshare-32.png \ apps,sparkleshare-32.png \
apps,folder-sparkleshare-48.png apps,sparkleshare-48.png
app_theme_icons = \ app_theme_icons = \
animations,process-working-22.png \ animations,process-working-22.png \
places,folder-sparkleshare-16.png \ places,sparkleshare-16.png \
places,folder-sparkleshare-22.png \ places,sparkleshare-22.png \
places,folder-sparkleshare-24.png \ places,sparkleshare-24.png \
places,folder-sparkleshare-256.png \ places,sparkleshare-256.png \
places,folder-sparkleshare-32.png \ places,sparkleshare-32.png \
places,folder-sparkleshare-48.png \ places,sparkleshare-48.png \
status,process-syncing-i-24.png \ status,process-syncing-i-24.png \
status,process-syncing-ii-24.png \ status,process-syncing-ii-24.png \
status,process-syncing-iii-24.png \ status,process-syncing-iii-24.png \

View file

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 689 B

View file

Before

Width:  |  Height:  |  Size: 926 B

After

Width:  |  Height:  |  Size: 926 B

View file

Before

Width:  |  Height:  |  Size: 926 B

After

Width:  |  Height:  |  Size: 926 B

View file

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -120,38 +120,35 @@ 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);
SparkleLogger.LogInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'"); SparkleLogger.LogInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'");
folder_created = true;
}
string gvfs_command_path = new string [] { Path.VolumeSeparatorChar.ToString (), string gvfs_command_path = new string [] { Path.VolumeSeparatorChar.ToString (),
"usr", "bin", "gvfs-set-attribute" }.Combine (); "usr", "bin", "gvfs-set-attribute" }.Combine ();
// Add a special icon to the SparkleShare folder
if (File.Exists (gvfs_command_path)) {
Process process = new Process ();
process.StartInfo.FileName = "gvfs-set-attribute";
// Add a special icon to the SparkleShare folder process.Start ();
if (File.Exists (gvfs_command_path)) { process.WaitForExit ();
Process process = new Process ();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "gvfs-set-attribute";
// Clear the custom (legacy) icon path // Give the SparkleShare folder an icon name, so that it scales
process.StartInfo.Arguments = "-t unset " + process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath +
SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon"; " metadata::custom-icon-name 'sparkleshare'";
process.Start (); process.Start ();
process.WaitForExit (); process.WaitForExit ();
// Give the SparkleShare folder an icon name, so that it scales
process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath +
" metadata::custom-icon-name 'folder-sparkleshare'";
process.Start ();
process.WaitForExit ();
}
return true;
} }
return false; return folder_created;
} }

View file

@ -135,7 +135,7 @@ namespace SparkleShare {
this.menu.Add (new SeparatorMenuItem ()); this.menu.Add (new SeparatorMenuItem ());
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){ ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){
Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16)) Image = new Image (SparkleUIHelpers.GetIcon ("sparkleshare", 16))
}; };
folder_item.Activated += delegate { folder_item.Activated += delegate {

View file

@ -2,7 +2,7 @@
Type=Application Type=Application
Name=SparkleShare Name=SparkleShare
Exec=sparkleshare start Exec=sparkleshare start
Icon=folder-sparkleshare Icon=sparkleshare
Terminal=false Terminal=false
X-GNOME-Autostart-enabled=true X-GNOME-Autostart-enabled=true
Categories=Network; Categories=Network;

View file

@ -65,6 +65,7 @@ namespace SparkleShare {
return message = string.Format (message, change_set.Changes [0].Path); return message = string.Format (message, change_set.Changes [0].Path);
} else if (change_set.Changes.Count > 1) { } else if (change_set.Changes.Count > 1) {
message = string.Format (message, change_set.Changes [0].Path);
return string.Format (message + " and {0} more", change_set.Changes.Count - 1); return string.Format (message + " and {0} more", change_set.Changes.Count - 1);
} else { } else {