[virt-tools-list] AppIndicator3 not appindicator

Marc Deslauriers marc.deslauriers at canonical.com
Mon Jul 29 18:38:24 UTC 2013


On 13-07-29 07:29 AM, Cole Robinson wrote:
> Thanks for trying this out and fixing my typo. Unfortunate that this is still
> an issue.
> 
> Marc, you did the original appindicators patch, any chance you can give
> virt-manager git a spin and fix the issues with appindicator3 ? My guess is
> they are minor. If I don't hear back for a week I'll likely drop the
> appindicators support since it is currently broken, but I'm happy to revive it
> later when someone has it working.
> 
> git clone git://git.fedorahosted.org/virt-manager.git
> cd virt-manager
> ./virt-manager --debug
> Preferences->Enable tray icon


Here you go:


>From bcb0993cc9902574da2ec2e21ae960503ddfc6db Mon Sep 17 00:00:00 2001
From: Marc Deslauriers <marc.deslauriers at ubuntu.com>
Date: Mon, 29 Jul 2013 14:25:07 -0400
Subject: [PATCH] systray: Switch AppIndicator code to GIR

Switch AppIndicator code to use GObject introspection.
---
 virtManager/systray.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/virtManager/systray.py b/virtManager/systray.py
index 992a59b..d504495 100644
--- a/virtManager/systray.py
+++ b/virtManager/systray.py
@@ -123,7 +123,8 @@ class vmmSystray(vmmGObject):
         self.systray_menu.add(Gtk.SeparatorMenuItem())

         if self.systray_indicator:
-            hide_item = Gtk.MenuItem("_Show Virtual Machine Manager")
+            hide_item = Gtk.MenuItem.new_with_mnemonic(
+                    _("_Show Virtual Machine Manager"))
             hide_item.connect("activate", self.systray_activate)
             self.systray_menu.add(hide_item)

@@ -138,10 +139,10 @@ class vmmSystray(vmmGObject):
             return

         if self.systray_indicator:
-            self.systray_icon = AppIndicator3.Indicator("virt-manager",
+            self.systray_icon = AppIndicator3.Indicator.new("virt-manager",
                                 "virt-manager-icon",
-                                AppIndicator3.CATEGORY_OTHER)
-            self.systray_icon.set_status(AppIndicator3.STATUS_ACTIVE)
+                                AppIndicator3.IndicatorCategory.OTHER)
+            self.systray_icon.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
             self.systray_icon.set_menu(self.systray_menu)

         else:
@@ -162,9 +163,11 @@ class vmmSystray(vmmGObject):
         else:
             if self.systray_indicator:
                 if do_show:
-                    self.systray_icon.set_status(AppIndicator3.STATUS_ACTIVE)
+                    self.systray_icon.set_status(
+                            AppIndicator3.IndicatorStatus.ACTIVE)
                 else:
-                    self.systray_icon.set_status(AppIndicator3.STATUS_PASSIVE)
+                    self.systray_icon.set_status(
+                            AppIndicator3.IndicatorStatus.PASSIVE)
             else:
                 self.systray_icon.set_visible(do_show)

-- 
1.8.1.2




More information about the virt-tools-list mailing list