From 0b56dfbf01171226a0bb035afcd13358b6477710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 2 Aug 2015 08:18:11 +0200 Subject: Imported Upstream version 0.6.4 --- src/gui/indicator.vala | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/gui/indicator.vala') 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); -- cgit v1.2.3