Merge lp:~tom-blacknight/docky/emesene into lp:docky

Proposed by ukblacknight
Status: Rejected
Rejected by: Rico Tzschichholz
Proposed branch: lp:~tom-blacknight/docky/emesene
Merge into: lp:docky
Diff against target: 129 lines (+117/-0) (has conflicts)
2 files modified
scripts/emesene_control.py (+114/-0)
scripts/metadata/emesene_control.py.info (+3/-0)
Conflict adding file scripts.  Moved existing file to scripts.moved.
To merge this branch: bzr merge lp:~tom-blacknight/docky/emesene
Reviewer Review Type Date Requested Status
Rico Tzschichholz Needs Fixing
Review via email: mp+20486@code.launchpad.net

Commit message

Emesene helper

To post a comment you must log in.
Revision history for this message
ukblacknight (tom-blacknight) wrote :

I just need the contents of /scripts merging - the emesene helper and it's associated metadata file. Apologies if all of this is totally wrong, but I'm still learning bzr/source control!

Revision history for this message
ukblacknight (tom-blacknight) wrote :

I forgot to mention - this will only work on emesene svn version 2267 or greater, as it has important changes to the D-Bus plugin.

I think a 1.6.1 release is expected at least before the launch of Ubuntu 10.04.

lp:~tom-blacknight/docky/emesene updated
1166. By Rico Tzschichholz

Rework of autostart checking and setting (also fixes bug 529320)

1167. By Rico Tzschichholz

properly disable plugin when it gets dragged of a dock

1168. By Rico Tzschichholz

Handle InvalidOperationException thrown by AddinManger.Initalize

1169. By Rico Tzschichholz

fix version output on console

1170. By Rico Tzschichholz

add very simple Desktop docklet, could be extended with more functions in the future

1171. By Rico Tzschichholz

translations: update Chinese (Simplified), Galician, Hungarian, Russian - add Hindi

1172. By Robert Dyer

try to fix bug 533872 - fullscreen apps on multiple monitors - based on patch from Florian Scandella

1173. By Rico Tzschichholz

update translation template

1174. By Rico Tzschichholz

add new translators and fix translation template

Revision history for this message
Rico Tzschichholz (ricotz) :
review: Needs Fixing

Unmerged revisions

1180. By ukblacknight

Changed my name on the copyright.

1179. By ukblacknight

Helper should now start.

1178. By ukblacknight

Resolved conflicts

1177. By ukblacknight

Cleaned up emesene_control.py

1176. By ukblacknight

helper files added.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'scripts'
2=== renamed directory 'scripts' => 'scripts.moved'
3=== added file 'scripts/emesene_control.py'
4--- scripts/emesene_control.py 1970-01-01 00:00:00 +0000
5+++ scripts/emesene_control.py 2010-03-02 20:38:14 +0000
6@@ -0,0 +1,114 @@
7+#!/usr/bin/env python
8+
9+#
10+# Copyright (C) 2009-2010 Jason Smith, Rico Tzschichholz
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU General Public License as published by
14+# the Free Software Foundation, either version 3 of the License, or
15+# (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU General Public License for more details.
21+#
22+# You should have received a copy of the GNU General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+
26+import atexit
27+import gobject
28+import glib
29+import dbus
30+import dbus.glib
31+import sys
32+import os
33+
34+try:
35+ from docky.docky import DockyItem, DockySink
36+ from signal import signal, SIGTERM
37+ from sys import exit
38+except ImportError, e:
39+ print e
40+ exit()
41+
42+emesenebus = "org.emesene.dbus"
43+emesenepath = "/org/emesene/dbus"
44+emeseneiface = "org.emesene.dbus"
45+
46+class DockyEmeseneItem(DockyItem):
47+ def __init__(self, path):
48+ DockyItem.__init__(self, path)
49+ self.msg_count = 0
50+ self.emesene = None
51+
52+ self.bus.add_signal_receiver(self.name_owner_changed_cb, dbus_interface='org.freedesktop.DBus', signal_name = 'NameOwnerChanged')
53+ obj = self.bus.get_object("org.freedesktop.DBus", "/org/freedesktop/DBus")
54+ self.bus_interface = dbus.Interface(obj, "org.freedesktop.DBus")
55+
56+ self.bus_interface.ListNames (reply_handler=self.list_names_handler, error_handler=self.list_names_error_handler)
57+
58+ self.bus.add_signal_receiver(self.conversation_updated, "unread_messages", emeseneiface, emesenebus, emesenepath)
59+
60+ def list_names_handler(self, names):
61+ if emesenebus in names:
62+ self.init_emesene_objects()
63+ self.update_badge()
64+
65+ def list_names_error_handler(self, error):
66+ print "error getting bus names - %s" % str(error)
67+
68+ def name_owner_changed_cb(self, name, old_owner, new_owner):
69+ if name == emesenebus:
70+ if new_owner:
71+ self.init_emesene_objects()
72+ else:
73+ self.emesene = None
74+ self.msg_count = 0
75+ self.update_badge()
76+
77+ def init_emesene_objects(self):
78+ try:
79+ obj = self.bus.get_object(emesenebus, emesenepath)
80+ self.emesene = dbus.Interface(obj, emeseneiface)
81+ except:
82+ print 'Emesene dbus could not be found.'
83+
84+ def conversation_updated(self,count):
85+ self.update_badge()
86+
87+ def update_badge(self):
88+ if not self.emesene:
89+ self.iface.ResetBadgeText()
90+ return False
91+
92+ print 'update the badge'
93+
94+ count = self.emesene.get_message_count()
95+ if count > 0:
96+ self.iface.SetBadgeText("%s" % count)
97+ else:
98+ self.iface.ResetBadgeText()
99+
100+ return True
101+
102+class DockyEmeseneSink(DockySink):
103+ def item_path_found(self, pathtoitem, item):
104+ if item.GetOwnsDesktopFile() and item.GetDesktopFile().endswith ("emesene.desktop"):
105+ self.items[pathtoitem] = DockyEmeseneItem(pathtoitem)
106+
107+
108+emesenesink = DockyEmeseneSink()
109+
110+def cleanup():
111+ dockysink.dispose()
112+
113+if __name__ == "__main__":
114+ mainloop = gobject.MainLoop(is_running=True)
115+
116+ atexit.register (cleanup)
117+ signal(SIGTERM, lambda signum, strack_frame: exit(1))
118+ print 'Starting emesene handler...'
119+
120+ mainloop.run()
121
122=== added directory 'scripts/metadata'
123=== added file 'scripts/metadata/emesene_control.py.info'
124--- scripts/metadata/emesene_control.py.info 1970-01-01 00:00:00 +0000
125+++ scripts/metadata/emesene_control.py.info 2010-03-02 20:38:14 +0000
126@@ -0,0 +1,3 @@
127+NAME="Emesene Controls"
128+DESCRIPTION="See your message count status on Emesene"
129+ICON="emesene"

Subscribers

People subscribed via source and target branches

to status/vote changes: