Show menu item icons on Fedora too
This commit is contained in:
parent
ad840bee77
commit
0dfac3279f
|
@ -87,7 +87,7 @@ namespace SparkleLib {
|
||||||
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
||||||
public static string SparkleKeysPath = 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 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");
|
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "icons");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,39 +150,37 @@ namespace SparkleShare {
|
||||||
Sensitive = false
|
Sensitive = false
|
||||||
};
|
};
|
||||||
|
|
||||||
// A menu item that provides a link to the SparkleShare folder
|
Menu.Add (status_menu_item);
|
||||||
Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") {
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
IconName = "folder-sparkleshare",
|
|
||||||
IsImportant = true // FIXME: doesn't shot the icon on Fedora
|
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){
|
||||||
|
Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16))
|
||||||
};
|
};
|
||||||
|
|
||||||
folder_action.Activated += delegate {
|
folder_item.Activated += delegate {
|
||||||
SparkleShare.Controller.OpenSparkleShareFolder ();
|
SparkleShare.Controller.OpenSparkleShareFolder ();
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu.Add (status_menu_item);
|
Menu.Add (folder_item);
|
||||||
Menu.Add (new SeparatorMenuItem ());
|
|
||||||
Menu.Add (folder_action.CreateMenuItem ());
|
|
||||||
|
|
||||||
if (SparkleShare.Controller.Folders.Count > 0) {
|
if (SparkleShare.Controller.Folders.Count > 0) {
|
||||||
|
|
||||||
// Creates a menu item for each repository with a link to their logs
|
// Creates a menu item for each repository with a link to their logs
|
||||||
foreach (string path in SparkleShare.Controller.Folders) {
|
foreach (string path in SparkleShare.Controller.Folders) {
|
||||||
|
|
||||||
folder_action = new Gtk.Action ("", Path.GetFileName (path)) {
|
Gdk.Pixbuf folder_icon = IconTheme.Default.LoadIcon ("folder", 16,
|
||||||
IconName = "folder",
|
IconLookupFlags.GenericFallback);
|
||||||
IsImportant = true
|
|
||||||
|
ImageMenuItem subfolder_item = new SparkleMenuItem (Path.GetFileName (path)) {
|
||||||
|
Image = new Image (folder_icon)
|
||||||
};
|
};
|
||||||
|
|
||||||
// if (repo.HasUnsyncedChanges)
|
// if (repo.HasUnsyncedChanges)
|
||||||
// folder_action.IconName = "dialog-error";
|
// folder_action.IconName = "dialog-error";
|
||||||
|
|
||||||
|
subfolder_item.Activated += OpenEventLogDelegate (path);
|
||||||
|
|
||||||
folder_action.Activated += OpenEventLogDelegate (path);
|
Menu.Add (subfolder_item);
|
||||||
|
|
||||||
MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();
|
|
||||||
|
|
||||||
Menu.Add (menu_item);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,4 +380,15 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SparkleMenuItem : ImageMenuItem {
|
||||||
|
|
||||||
|
public SparkleMenuItem (string text) : base (text)
|
||||||
|
{
|
||||||
|
|
||||||
|
SetProperty ("always-show-image", new GLib.Value (true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue