diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-02 08:18:11 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-02 08:18:11 +0200 |
commit | 0b56dfbf01171226a0bb035afcd13358b6477710 (patch) | |
tree | 7d4c1e2f57e6ea49fe56af50a0ba3414bf127927 /src/gui/indicator.vala | |
parent | a1c05d93bbb3c1bdb0c0fed9d7110804037cfd55 (diff) |
Imported Upstream version 0.6.4upstream/0.6.4
Diffstat (limited to 'src/gui/indicator.vala')
-rw-r--r-- | src/gui/indicator.vala | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/indicator.vala b/src/gui/indicator.vala index b46ee59..ddb85e6 100644 --- a/src/gui/indicator.vala +++ b/src/gui/indicator.vala @@ -67,25 +67,37 @@ public class Indicator : GLib.Object { ///////////////////////////////////////////////////////////////////// public Indicator() { - string icon = ""; + string icon = "gnome-pie-symbolic"; var screen = (Gdk.X11.Screen)Gdk.Screen.get_default(); + bool gnome_shell = false; - if (screen.get_window_manager_name() == "Mutter") + if (screen.get_window_manager_name() == "GNOME Shell") { icon = "gnome-pie"; - else - icon = "gnome-pie-symbolic"; + gnome_shell = true; + } #if HAVE_APPINDICATOR - string path = ""; + string path = ""; try { path = GLib.Path.get_dirname(GLib.FileUtils.read_link("/proc/self/exe"))+"/resources"; } catch (GLib.FileError e) { warning("Failed to get path of executable!"); } - this.indicator = new AppIndicator.Indicator.with_path("Gnome-Pie", icon, - AppIndicator.IndicatorCategory.APPLICATION_STATUS, path); + if (gnome_shell) { + + if (GLib.File.new_for_path(path).query_exists()) { + this.indicator = new AppIndicator.Indicator("Gnome-Pie", path + "/" + icon + ".svg", + AppIndicator.IndicatorCategory.APPLICATION_STATUS); + } else { + this.indicator = new AppIndicator.Indicator("Gnome-Pie", icon, + AppIndicator.IndicatorCategory.APPLICATION_STATUS); + } + } else { + this.indicator = new AppIndicator.Indicator.with_path("Gnome-Pie", icon, + AppIndicator.IndicatorCategory.APPLICATION_STATUS, path); + } var menu = new Gtk.Menu(); #else this.indicator = new Gtk.StatusIcon(); @@ -136,7 +148,9 @@ public class Indicator : GLib.Object { // quit item item = new Gtk.ImageMenuItem.with_mnemonic(_("_Quit")); - item.activate.connect(Gtk.main_quit); + item.activate.connect(()=>{ + GLib.Application.get_default().release(); + }); item.show(); menu.append(item); |