[billreminder: 5/10] Add basic ubuntu unity integration
- From: Og B. Maciel <ogmaciel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [billreminder: 5/10] Add basic ubuntu unity integration
- Date: Fri, 17 Jun 2011 04:10:58 +0000 (UTC)
commit 62b0cdd81f2669942a9df9ff26be4a29dd74129e
Author: Luiz Armesto <luiz armesto gmail com>
Date: Thu Jun 16 21:02:02 2011 -0300
Add basic ubuntu unity integration
src/gui/maindialog.py | 5 ++++
src/gui/widgets/unity.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index 87ecfee..1dd4028 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -17,6 +17,7 @@ from gui.widgets.viewbill import ViewBill as ViewBill
from gui.widgets.trayicon import NotifyIcon
from gui.widgets.chartwidget import ChartWidget
from gui.widgets.timeline import Timeline, Event
+from gui.widgets.unity import UNITY, UnityIntegration
# Import data model modules
from lib.actions import Actions
@@ -143,6 +144,10 @@ class MainDialog(gobject.GObject):
self.reloadTreeView()
self.notify = NotifyIcon(self)
+ # Integrate with Ubuntu Unity
+ if UNITY:
+ self.unity = UnityIntegration(self)
+
def set_action_strings(self):
# for some reason the actions strings do not get translated yet
# so we define them here so they would be picked up by the pyfile scanner
diff --git a/src/gui/widgets/unity.py b/src/gui/widgets/unity.py
new file mode 100644
index 0000000..a40a47f
--- /dev/null
+++ b/src/gui/widgets/unity.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+try:
+ from gi.repository import Unity, Dbusmenu
+ UNITY = True
+except:
+ UNITY = False
+
+class UnityIntegration:
+
+ def __init__(self, parent):
+
+ self.parent = parent
+
+ self.launcher = Unity.LauncherEntry.get_for_desktop_id("billreminder.desktop")
+
+ # This is broken
+ ## Add quicklist
+ #self.quicklist = Dbusmenu.Menuitem.new()
+ #
+ #new_bill = Dbusmenu.Menuitem.new()
+ #new_bill.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "Add New Bill")
+ #new_bill.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True)
+ #new_bill.connect("item-activated", self.on_new_bill_activate)
+ #
+ #self.quicklist.child_append(new_bill)
+ #
+ #self.launcher.set_property("quicklist", self.quicklist)
+
+ self.parent.connect('bill-added', self.on_update_count)
+ self.parent.connect('bill-updated', self.on_update_count)
+ self.parent.connect('bill-removed', self.on_update_count)
+
+ count = self.parent.actions.count_not_paid()
+ self.set_count(count)
+
+ def on_new_bill_activate(self, menuitem, arg):
+ self.parent.ui.get_object("newBill").emit('activate')
+
+ def on_update_count(self, signal, bill):
+ count = self.parent.actions.count_not_paid()
+ self.set_count(count)
+
+ def set_count(self, count):
+ self.launcher.set_property("count", count)
+ if count:
+ self.launcher.set_property("count_visible", True)
+ else:
+ self.launcher.set_property("count_visible", False)
+
+ def set_urgency(self, urgency):
+ self.launcher.set_property("urgency", urgency)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]