Show menu item icons on Fedora too

This commit is contained in:
Hylke Bons 2011-03-15 17:16:23 +00:00
parent 0940bfa9a4
commit ec4785eec6
2 changed files with 29 additions and 20 deletions

View file

@ -87,7 +87,7 @@ namespace SparkleLib {
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
public static string SparkleKeysPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
public static string SparkleInstallPath = Path.Combine (Defines.PREFIX, "sparkleshare");
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons", "hicolor");
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons");
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "icons");
}

View file

@ -150,39 +150,37 @@ namespace SparkleShare {
Sensitive = false
};
// A menu item that provides a link to the SparkleShare folder
Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") {
IconName = "folder-sparkleshare",
IsImportant = true // FIXME: doesn't shot the icon on Fedora
};
folder_action.Activated += delegate {
SparkleShare.Controller.OpenSparkleShareFolder ();
};
Menu.Add (status_menu_item);
Menu.Add (new SeparatorMenuItem ());
Menu.Add (folder_action.CreateMenuItem ());
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){
Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16))
};
folder_item.Activated += delegate {
SparkleShare.Controller.OpenSparkleShareFolder ();
};
Menu.Add (folder_item);
if (SparkleShare.Controller.Folders.Count > 0) {
// Creates a menu item for each repository with a link to their logs
foreach (string path in SparkleShare.Controller.Folders) {
folder_action = new Gtk.Action ("", Path.GetFileName (path)) {
IconName = "folder",
IsImportant = true
Gdk.Pixbuf folder_icon = IconTheme.Default.LoadIcon ("folder", 16,
IconLookupFlags.GenericFallback);
ImageMenuItem subfolder_item = new SparkleMenuItem (Path.GetFileName (path)) {
Image = new Image (folder_icon)
};
// if (repo.HasUnsyncedChanges)
// folder_action.IconName = "dialog-error";
subfolder_item.Activated += OpenEventLogDelegate (path);
folder_action.Activated += OpenEventLogDelegate (path);
MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();
Menu.Add (menu_item);
Menu.Add (subfolder_item);
}
@ -382,4 +380,15 @@ namespace SparkleShare {
}
class SparkleMenuItem : ImageMenuItem {
public SparkleMenuItem (string text) : base (text)
{
SetProperty ("always-show-image", new GLib.Value (true));
}
}
}