~ubuntu-branches/ubuntu/utopic/awn-extras-applets/utopic

« back to all changes in this revision

Viewing changes to debian/patches/04-tomboy-threading-free.patch

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-04-11 22:38:55 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100411223855-mamzuv887xyms08b
Tags: 0.4.0-0ubuntu1
* New upstream release.
 - Close cairo-menu after a click (LP: #511256)
 - Fix crash of awn-system-monitor (LP: #545164)
 - Fix crash when removing a volume >1 or adding volume >1 or using prefs
   while > 1 volumes is present (LP: #556175)
 - Fix crash of media-control when Rhythmbox quit (LP: #558463)
 - Fix crash of file-browser-launcher when there is no .gtk-bookmarks
   (LP: #551119)
* debian/awn-c-extras.install: 
 - Install icons and ini files for webapplets
* debian/awn-python-core.install:
 - Install ui file for comics (LP: #552376)
* debian/patches:
 - 03-remove-cairo-menu-pref.patch: Merged upstream.
 - 04-tomboy-threading-free.patch: Merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: awn-extras-0.4.0~rc1/applets/maintained/tomboy-applet/tomboy-applet.py
2
 
===================================================================
3
 
--- awn-extras-0.4.0~rc1.orig/applets/maintained/tomboy-applet/tomboy-applet.py 2010-03-30 00:41:03.000000000 +0200
4
 
+++ awn-extras-0.4.0~rc1/applets/maintained/tomboy-applet/tomboy-applet.py      2010-03-30 00:41:42.000000000 +0200
5
 
@@ -15,21 +15,23 @@
6
 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
7
 
 
8
 
 import os
9
 
-import threading
10
 
 
11
 
 import pygtk
12
 
 pygtk.require("2.0")
13
 
 import gtk
14
 
 
15
 
-from awn.extras import awnlib, __version__
16
 
+from awn.extras import awnlib, __version__, _
17
 
 
18
 
 try:
19
 
     import dbus
20
 
+    from dbus.mainloop.glib import DBusGMainLoop
21
 
+
22
 
+    DBusGMainLoop(set_as_default=True)
23
 
 except ImportError:
24
 
     dbus = None
25
 
 
26
 
-applet_name = "Tomboy Applet"
27
 
-applet_description = "Control Tomboy with D-Bus"
28
 
+applet_name = _("Tomboy Applet")
29
 
+applet_description = _("Control Tomboy with D-Bus")
30
 
 applet_system_notebook = "system:notebook:"
31
 
 applet_system_template = "system:template"
32
 
 
33
 
@@ -45,6 +47,7 @@
34
 
 
35
 
     __interface = None
36
 
     tags = None
37
 
+    __dialog = None
38
 
 
39
 
     def __init__(self, awnlib):
40
 
         self.awn = awnlib
41
 
@@ -52,23 +55,26 @@
42
 
         awnlib.icon.file(applet_logo)
43
 
 
44
 
         if dbus is not None:
45
 
-            def run_tomboy():
46
 
-                try:
47
 
-                    bus = dbus.SessionBus()
48
 
-                    if bus_name not in bus.list_names():
49
 
-                        bus.start_service_by_name(bus_name)
50
 
-                    self.connect(bus)
51
 
-                except dbus.DBusException, e:
52
 
-                    awnlib.errors.general("Could not connect to Tomboy: %s" % e)
53
 
-            threading.Thread(target=run_tomboy).start()
54
 
+            try:
55
 
+                bus = dbus.SessionBus()
56
 
+                if bus_name not in bus.list_names():
57
 
+                    bus.start_service_by_name(bus_name)
58
 
+                self.connect(bus)
59
 
+            except dbus.DBusException, e:
60
 
+                awnlib.errors.general("Could not connect to Tomboy: %s" % e)
61
 
 
62
 
     def connect(self, bus):
63
 
         object = bus.get_object(bus_name, object_name)
64
 
         self.__interface = dbus.Interface(object, if_name)
65
 
+        self.__interface.connect_to_signal("NoteAdded", self.notes_changed)
66
 
+        self.__interface.connect_to_signal("NoteDeleted", self.notes_changed)
67
 
         self.__version = self.__interface.Version()
68
 
         if self.__interface is not None:
69
 
             self.main_dialog()
70
 
 
71
 
+    def notes_changed(self, *args, **kwargs):
72
 
+        self.main_dialog()
73
 
+
74
 
     def display_search(self, widget):
75
 
         self.__interface.DisplaySearch()
76
 
 
77
 
@@ -103,16 +109,20 @@
78
 
 
79
 
     def create_from_tag_dialog(self, widget):
80
 
         dialog = self.awn.dialog.new("create_from_tag")
81
 
-        dialog.add(gtk.Label("Select a tag:"))
82
 
-        for tag in self.collect_tags():
83
 
-            button = gtk.Button(tag)
84
 
-            button.connect("clicked", self.create_from_tag, tag)
85
 
-            dialog.add(button)
86
 
+        available_tags = self.collect_tags()
87
 
+        if len(available_tags) > 0:
88
 
+            dialog.add(gtk.Label(_("Select a tag:")))
89
 
+            for tag in available_tags:
90
 
+                button = gtk.Button(tag)
91
 
+                button.connect("clicked", self.create_from_tag, tag)
92
 
+                dialog.add(button)
93
 
+        else:
94
 
+            dialog.add(gtk.Label(_("No tags were created yet")))
95
 
         dialog.show_all()
96
 
 
97
 
     def view_from_tag(self, widget, tag):
98
 
         dialog = self.awn.dialog.new("view_from_tag")
99
 
-        dialog.add(gtk.Label("Select a note:"))
100
 
+        dialog.add(gtk.Label(_("Select a note:")))
101
 
 
102
 
         for note in self.__interface.GetAllNotesWithTag(applet_system_notebook + tag):
103
 
             if applet_system_template not in self.__interface.GetTagsForNote(note):
104
 
@@ -123,7 +133,7 @@
105
 
 
106
 
     def view_from_tag_dialog(self, widget):
107
 
         dialog = self.awn.dialog.new("view_from_tag_select")
108
 
-        dialog.add(gtk.Label("Select a tag:"))
109
 
+        dialog.add(gtk.Label(_("Select a tag:")))
110
 
         for tag in self.collect_tags():
111
 
             button = gtk.Button(tag)
112
 
             button.connect("clicked", self.view_from_tag, tag)
113
 
@@ -131,28 +141,32 @@
114
 
         dialog.show_all()
115
 
 
116
 
     def main_dialog(self):
117
 
-        dialog = self.awn.dialog.new("main")
118
 
+        if self.__dialog != None:
119
 
+            self.awn.dialog.unregister("main")
120
 
+            self.__dialog = None
121
 
+
122
 
+        self.__dialog = dialog = self.awn.dialog.new("main")
123
 
 
124
 
         for note in self.list_all_notes()[:10]:
125
 
             self.button = gtk.Button(self.__interface.GetNoteTitle(note))
126
 
             self.button.connect("clicked", self.button_display, note)
127
 
             dialog.add(self.button)
128
 
 
129
 
-        dialog.add(gtk.Label("Version : " + self.__version))
130
 
+        dialog.add(gtk.Label(_("Version: %s") % self.__version))
131
 
 
132
 
-        button1 = gtk.Button("Search")
133
 
+        button1 = gtk.Button(_("Search"))
134
 
         button1.connect("clicked", self.display_search)
135
 
         dialog.add(button1)
136
 
 
137
 
-        button2 = gtk.Button("New Note")
138
 
+        button2 = gtk.Button(_("New Note"))
139
 
         button2.connect("clicked", self.create_note)
140
 
         dialog.add(button2)
141
 
 
142
 
-        button3 = gtk.Button("New Tagged Note")
143
 
+        button3 = gtk.Button(_("New Tagged Note"))
144
 
         button3.connect("clicked", self.create_from_tag_dialog)
145
 
         dialog.add(button3)
146
 
 
147
 
-        button4 = gtk.Button("View Tagged Note")
148
 
+        button4 = gtk.Button(_("View Tagged Note"))
149
 
         button4.connect("clicked", self.view_from_tag_dialog)
150
 
         dialog.add(button4)
151