~cdar07/ubuntu/quantal/totem/fix-for-954952

« back to all changes in this revision

Viewing changes to debian/patches/04_port_to_gobject.patch

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha, Rico Tzschichholz, Jeremy Bicha
  • Date: 2012-01-09 16:19:39 UTC
  • mfrom: (1.11.14)
  • Revision ID: package-import@ubuntu.com-20120109161939-wfwd46cy3ytl1qq3
Tags: 3.3.4-0ubuntu1~precise1
[ Rico Tzschichholz ]
* New upstream release

[ Jeremy Bicha]
* debian/watch: Watch for .xz tarballs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Port to the new pygobject, this can be dropped when we
2
 
 update to Totem 3.2
3
 
Ubuntu-Bug: https://bugs.launchpad.net/bugs/855100
4
 
Author: Jeremy Bicha <jbicha@ubuntu.com>
5
 
Index: totem-3.0.1/src/plugins/iplayer/iplayer.py
6
 
===================================================================
7
 
--- totem-3.0.1.orig/src/plugins/iplayer/iplayer.py     2011-04-26 06:22:22.000000000 -0400
8
 
+++ totem-3.0.1/src/plugins/iplayer/iplayer.py  2011-12-01 14:46:18.742808885 -0500
9
 
@@ -1,7 +1,7 @@
10
 
 # -*- coding: utf-8 -*-
11
 
 
12
 
 import gettext
13
 
-import gobject
14
 
+from gi.repository import GObject
15
 
 from gi.repository import Peas
16
 
 from gi.repository import Gtk
17
 
 from gi.repository import Totem
18
 
@@ -13,12 +13,14 @@
19
 
 D_ = gettext.dgettext
20
 
 _ = gettext.gettext
21
 
 
22
 
-class IplayerPlugin (gobject.GObject, Peas.Activatable):
23
 
+class IplayerPlugin (GObject.Object, Peas.Activatable):
24
 
        __gtype_name__ = 'IplayerPlugin'
25
 
 
26
 
-       object = gobject.property(type = gobject.GObject)
27
 
+       object = GObject.property(type = GObject.Object)
28
 
 
29
 
        def __init__ (self):
30
 
+                GObject.Object.__init__ (self)
31
 
+
32
 
                self.debug = False
33
 
                self.totem = None
34
 
                self.programme_download_lock = threading.Lock ()
35
 
@@ -164,11 +166,11 @@
36
 
                                # while the idle function is waiting in the queue, invalidating an iter
37
 
                                for name, count in self.feed.get (channel_id).categories ():
38
 
                                        category_id = category_name_to_id (name)
39
 
-                                       gobject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, [name, category_id, None])
40
 
+                                       GObject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, [name, category_id, None])
41
 
                        except:
42
 
                                # Only show the error once, rather than for each channel (it gets a bit grating)
43
 
                                if not shown_error:
44
 
-                                       gobject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, None)
45
 
+                                       GObject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, None)
46
 
                                        shown_error = True
47
 
 
48
 
                        tree_iter = self.tree_model.iter_next (tree_iter)
49
 
@@ -187,7 +189,7 @@
50
 
 
51
 
                category_iter = self.tree_model.get_iter (self.category_path)
52
 
                if category_iter == None:
53
 
-                       gobject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
54
 
+                       GObject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
55
 
                        self.plugin.programme_download_lock.release ()
56
 
                        return
57
 
 
58
 
@@ -198,7 +200,7 @@
59
 
                # Retrieve the programmes and return them
60
 
                feed = self.feed.get (channel_id).get (category_id)
61
 
                if feed == None:
62
 
-                       gobject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
63
 
+                       GObject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
64
 
                        self.plugin.programme_download_lock.release ()
65
 
                        return
66
 
 
67
 
@@ -206,7 +208,7 @@
68
 
                try:
69
 
                        programmes = feed.list ()
70
 
                except:
71
 
-                       gobject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
72
 
+                       GObject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
73
 
                        self.plugin.programme_download_lock.release ()
74
 
                        return
75
 
 
76
 
@@ -225,7 +227,7 @@
77
 
                                print "Programme has no HTTP streams"
78
 
                                continue
79
 
 
80
 
-                       gobject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path,
81
 
+                       GObject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path,
82
 
                                          [programme.get_title (), programme.get_summary (), media.url],
83
 
                                          remove_placeholder)
84
 
                        remove_placeholder = False
85
 
Index: totem-3.0.1/src/plugins/jamendo/jamendo.py
86
 
===================================================================
87
 
--- totem-3.0.1.orig/src/plugins/jamendo/jamendo.py     2011-04-26 06:22:22.000000000 -0400
88
 
+++ totem-3.0.1/src/plugins/jamendo/jamendo.py  2011-12-01 14:46:18.746808885 -0500
89
 
@@ -31,7 +31,7 @@
90
 
 """
91
 
 
92
 
 import os
93
 
-import gobject
94
 
+from gi.repository import GObject
95
 
 from gi.repository import Gio
96
 
 from gi.repository import Peas
97
 
 from gi.repository import PeasGtk
98
 
@@ -61,12 +61,12 @@
99
 
         raise
100
 
 
101
 
 socket.setdefaulttimeout(30)
102
 
-gobject.threads_init()
103
 
+GObject.threads_init()
104
 
 
105
 
-class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
106
 
+class JamendoPlugin(GObject.Object, Peas.Activatable, PeasGtk.Configurable):
107
 
     __gtype_name__ = 'JamendoPlugin'
108
 
 
109
 
-    object = gobject.property(type = gobject.GObject)
110
 
+    object = GObject.property(type = GObject.Object)
111
 
 
112
 
     """
113
 
     Jamendo totem plugin GUI.
114
 
@@ -78,6 +78,8 @@
115
 
     TAB_LATEST      = 2
116
 
 
117
 
     def __init__(self):
118
 
+        GObject.Object.__init__ (self)
119
 
+
120
 
         self.debug = True
121
 
         self.gstreamer_plugins_present = True
122
 
         self.totem = None
123
 
@@ -671,10 +673,10 @@
124
 
                 #  http://www.jamendo.com/en/album/4818
125
 
                 # If Jamendo doesn't support your language, *do not translate this string*!
126
 
                 album['url'] = album['url'].replace('/en/', '/' + _('en') + '/')
127
 
-                gobject.idle_add(self.loop_cb[0], self.loop_cb[1], album)
128
 
-            gobject.idle_add(self.done_cb[0], self.done_cb[1], albums)
129
 
+                GObject.idle_add(self.loop_cb[0], self.loop_cb[1], album)
130
 
+            GObject.idle_add(self.done_cb[0], self.done_cb[1], albums)
131
 
         except Exception as exc:
132
 
-            gobject.idle_add(self.error_cb[0], self.error_cb[1], exc)
133
 
+            GObject.idle_add(self.error_cb[0], self.error_cb[1], exc)
134
 
         finally:
135
 
             self.lock.release()
136
 
 
137
 
Index: totem-3.0.1/src/plugins/opensubtitles/opensubtitles.py
138
 
===================================================================
139
 
--- totem-3.0.1.orig/src/plugins/opensubtitles/opensubtitles.py 2011-04-26 06:22:22.000000000 -0400
140
 
+++ totem-3.0.1/src/plugins/opensubtitles/opensubtitles.py      2011-12-01 14:49:36.038810973 -0500
141
 
@@ -6,8 +6,8 @@
142
 
 from gi.repository import Gio
143
 
 from gi.repository import Pango
144
 
 from gi.repository import Totem
145
 
-import gobject
146
 
-gobject.threads_init()
147
 
+from gi.repository import GObject
148
 
+
149
 
 import xmlrpclib
150
 
 import threading
151
 
 import xdg.BaseDirectory
152
 
@@ -21,6 +21,8 @@
153
 
 D_ = gettext.dgettext
154
 
 _ = gettext.gettext
155
 
 
156
 
+GObject.threads_init()
157
 
+
158
 
 USER_AGENT = 'Totem'
159
 
 OK200 = '200 OK'
160
 
 TOTEM_REMOTE_COMMAND_REPLACE = 14
161
 
@@ -295,12 +297,14 @@
162
 
 
163
 
         return None
164
 
 
165
 
-class OpenSubtitles(gobject.GObject, Peas.Activatable):
166
 
+class OpenSubtitles(GObject.Object, Peas.Activatable):
167
 
     __gtype_name__ = 'OpenSubtitles'
168
 
 
169
 
-    object = gobject.property(type = gobject.GObject)
170
 
+    object = GObject.property(type = GObject.Object)
171
 
 
172
 
     def __init__(self):
173
 
+        GObject.Object.__init__ (self)
174
 
+
175
 
         self.dialog = None
176
 
         self.totem = None
177
 
         self.settings = Gio.Settings.new ('org.gnome.totem.plugins.opensubtitles')
178
 
@@ -483,10 +487,10 @@
179
 
 
180
 
         thread = SearchThread(self.model)
181
 
         thread.start()
182
 
-        gobject.idle_add(self.os_populate_treeview)
183
 
+        GObject.idle_add(self.os_populate_treeview)
184
 
 
185
 
         self.progress.set_text(_(u'Searching subtitles…'))
186
 
-        gobject.timeout_add(350, self.os_progress_bar_increment, thread)
187
 
+        GObject.timeout_add(350, self.os_progress_bar_increment, thread)
188
 
 
189
 
     def os_populate_treeview(self):
190
 
         """
191
 
@@ -541,10 +545,10 @@
192
 
 
193
 
             thread = DownloadThread(self.model, subtitle_id)
194
 
             thread.start()
195
 
-            gobject.idle_add(self.os_save_subtitles, filename)
196
 
+            GObject.idle_add(self.os_save_subtitles, filename)
197
 
 
198
 
             self.progress.set_text(_(u'Downloading the subtitles…'))
199
 
-            gobject.timeout_add(350, self.os_progress_bar_increment, thread)
200
 
+            GObject.timeout_add(350, self.os_progress_bar_increment, thread)
201
 
         else:
202
 
             #warn user!
203
 
             pass
204
 
@@ -563,9 +567,9 @@
205
 
             fp = Gio.file_new_for_uri (filename)
206
 
             suburi = fp.get_uri ()
207
 
 
208
 
-            subFile  = fp.replace('', False)
209
 
-            subFile.write(self.model.subtitles)
210
 
-            subFile.close()
211
 
+            subFile = fp.replace ('', False, Gio.FileCreateFlags.REPLACE_DESTINATION, None)
212
 
+            subFile.write (self.model.subtitles, None)
213
 
+            subFile.close (None)
214
 
 
215
 
         self.model.lock.release()
216
 
 
217
 
Index: totem-3.0.1/src/plugins/coherence_upnp/coherence_upnp.py
218
 
===================================================================
219
 
--- totem-3.0.1.orig/src/plugins/coherence_upnp/coherence_upnp.py       2011-04-26 06:22:22.000000000 -0400
220
 
+++ totem-3.0.1/src/plugins/coherence_upnp/coherence_upnp.py    2011-12-01 14:46:18.750808885 -0500
221
 
@@ -5,6 +5,7 @@
222
 
 
223
 
 # Copyright 2008, Frank Scholz <coherence@beebits.net>
224
 
 
225
 
+from gi.repository import GObject
226
 
 from gi.repository import Peas
227
 
 from gi.repository import Gtk
228
 
 from gi.repository import Totem
229
 
@@ -17,12 +18,14 @@
230
 
 D_ = gettext.dgettext
231
 
 _ = gettext.gettext
232
 
 
233
 
-class UPnPClient(gobject.GObject, Peas.Activatable):
234
 
+class UPnPClient(GObject.Object, Peas.Activatable):
235
 
     __gtype_name__ = 'UPnPClient'
236
 
 
237
 
-    object = gobject.property(type = gobject.GObject)
238
 
+    object = GObject.property(type = GObject.Object)
239
 
 
240
 
     def __init__ (self):
241
 
+        GObject.Object.__init__ (self)
242
 
+
243
 
         self.totem_object = None
244
 
         self.ui = TreeWidget()
245
 
         self.ui.window.set_shadow_type(gtk.SHADOW_IN)
246
 
Index: totem-3.0.1/src/plugins/dbus-service/dbus-service.py
247
 
===================================================================
248
 
--- totem-3.0.1.orig/src/plugins/dbus-service/dbus-service.py   2011-04-26 06:22:22.000000000 -0400
249
 
+++ totem-3.0.1/src/plugins/dbus-service/dbus-service.py        2011-12-01 14:46:18.750808885 -0500
250
 
@@ -20,17 +20,24 @@
251
 
 ## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
252
 
 ## See license_change file for details.
253
 
 
254
 
-import gobject
255
 
+from gi.repository import GObject
256
 
 from gi.repository import Peas
257
 
 from gi.repository import Gtk
258
 
 from gi.repository import Totem
259
 
 import dbus, dbus.service
260
 
 from dbus.mainloop.glib import DBusGMainLoop
261
 
 
262
 
-class dbusservice(gobject.GObject, Peas.Activatable):
263
 
+class dbusservice(GObject.Object, Peas.Activatable):
264
 
        __gtype_name__ = 'dbusservice'
265
 
 
266
 
-       object = gobject.property(type = gobject.GObject)
267
 
+       object = GObject.property(type = GObject.Object)
268
 
+
269
 
+        def __init__(self):
270
 
+                GObject.Object.__init__ (self)
271
 
+
272
 
+                self.root = None
273
 
+                self.player = None
274
 
+                self.track_list = None
275
 
 
276
 
        def do_activate(self):
277
 
                DBusGMainLoop(set_as_default = True)
278
 
Index: totem-3.0.1/src/plugins/pythonconsole/console.py
279
 
===================================================================
280
 
--- totem-3.0.1.orig/src/plugins/pythonconsole/console.py       2011-04-26 06:22:22.000000000 -0400
281
 
+++ totem-3.0.1/src/plugins/pythonconsole/console.py    2011-12-01 14:46:18.754808885 -0500
282
 
@@ -36,7 +36,7 @@
283
 
 import sys
284
 
 import re
285
 
 import traceback
286
 
-import gobject
287
 
+from gi.repository import GObject
288
 
 from gi.repository import Pango
289
 
 from gi.repository import Gtk
290
 
 from gi.repository import Gdk
291
 
@@ -117,7 +117,7 @@
292
 
                                cur = buffer.get_end_iter()
293
 
                                
294
 
                        buffer.place_cursor(cur)
295
 
-                       gobject.idle_add(self.scroll_to_end)
296
 
+                       GObject.idle_add(self.scroll_to_end)
297
 
                        return True
298
 
                
299
 
                elif event.keyval == Gdk.KEY_Return:
300
 
@@ -161,21 +161,21 @@
301
 
                        cur = buffer.get_end_iter()
302
 
                        buffer.move_mark(inp_mark, cur)
303
 
                        buffer.place_cursor(cur)
304
 
-                       gobject.idle_add(self.scroll_to_end)
305
 
+                       GObject.idle_add(self.scroll_to_end)
306
 
                        return True
307
 
 
308
 
                elif event.keyval == Gdk.KEY_KP_Down or event.keyval == Gdk.KEY_Down:
309
 
                        # Next entry from history
310
 
                        view.emit_stop_by_name("key_press_event")
311
 
                        self.history_down()
312
 
-                       gobject.idle_add(self.scroll_to_end)
313
 
+                       GObject.idle_add(self.scroll_to_end)
314
 
                        return True
315
 
 
316
 
                elif event.keyval == Gdk.KEY_KP_Up or event.keyval == Gdk.KEY_Up:
317
 
                        # Previous entry from history
318
 
                        view.emit_stop_by_name("key_press_event")
319
 
                        self.history_up()
320
 
-                       gobject.idle_add(self.scroll_to_end)
321
 
+                       GObject.idle_add(self.scroll_to_end)
322
 
                        return True
323
 
 
324
 
                elif event.keyval == Gdk.KEY_KP_Left or event.keyval == Gdk.KEY_Left or \
325
 
@@ -246,7 +246,7 @@
326
 
                else:
327
 
                    buf.insert_with_tags(buf.get_end_iter(), text, tag)
328
 
 
329
 
-               gobject.idle_add(self.scroll_to_end)
330
 
+               GObject.idle_add(self.scroll_to_end)
331
 
        
332
 
        def eval(self, command, display_command = False):
333
 
                buffer = self.view.get_buffer()
334
 
Index: totem-3.0.1/src/plugins/pythonconsole/pythonconsole.py
335
 
===================================================================
336
 
--- totem-3.0.1.orig/src/plugins/pythonconsole/pythonconsole.py 2011-04-26 06:22:22.000000000 -0400
337
 
+++ totem-3.0.1/src/plugins/pythonconsole/pythonconsole.py      2011-12-01 14:46:18.754808885 -0500
338
 
@@ -40,7 +40,7 @@
339
 
 from gi.repository import Gtk
340
 
 from gi.repository import Totem
341
 
 from gi.repository import Gio
342
 
-import gobject
343
 
+from gi.repository import GObject
344
 
 try:
345
 
        import rpdb2
346
 
        have_rpdb2 = True
347
 
@@ -66,12 +66,14 @@
348
 
 </ui>
349
 
 """
350
 
 
351
 
-class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
352
 
+class PythonConsolePlugin(GObject.Object, Peas.Activatable):
353
 
        __gtype_name__ = 'PythonConsolePlugin'
354
 
 
355
 
-       object = gobject.property(type = gobject.GObject)
356
 
+       object = GObject.property(type = GObject.Object)
357
 
 
358
 
        def __init__(self):
359
 
+                GObject.Object.__init__ (self)
360
 
+
361
 
                self.totem = None
362
 
                self.window = None
363
 
        
364
 
@@ -136,7 +138,7 @@
365
 
                                rpdb2.start_embedded_debugger(password)
366
 
                                return False
367
 
 
368
 
-                       gobject.idle_add(start_debugger, password)
369
 
+                       GObject.idle_add(start_debugger, password)
370
 
                dialog.destroy()
371
 
 
372
 
        def destroy_console(self, *args):
373
 
Index: totem-3.0.1/src/plugins/sample-python/sample-python.py
374
 
===================================================================
375
 
--- totem-3.0.1.orig/src/plugins/sample-python/sample-python.py 2011-04-26 06:22:22.000000000 -0400
376
 
+++ totem-3.0.1/src/plugins/sample-python/sample-python.py      2011-12-01 14:46:18.754808885 -0500
377
 
@@ -1,13 +1,13 @@
378
 
 # From code by James Livingston
379
 
 
380
 
-import gobject
381
 
+from gi.repository import GObject
382
 
 from gi.repository import Peas
383
 
 from gi.repository import Totem
384
 
 
385
 
-class SamplePython(gobject.GObject, Peas.Activatable):
386
 
+class SamplePython(GObject.Object, Peas.Activatable):
387
 
        __gtype_name__ = 'SamplePython'
388
 
 
389
 
-       object = gobject.property(type = gobject.GObject)
390
 
+       object = GObject.property(type = GObject.Object)
391
 
 
392
 
        def do_activate(self):
393
 
                print "Activating sample Python plugin"
394
 
Index: totem-3.0.1/src/plugins/opensubtitles/hash.py
395
 
===================================================================
396
 
--- totem-3.0.1.orig/src/plugins/opensubtitles/hash.py  2011-04-26 06:22:22.000000000 -0400
397
 
+++ totem-3.0.1/src/plugins/opensubtitles/hash.py       2011-12-01 14:46:18.758808885 -0500
398
 
@@ -1,6 +1,6 @@
399
 
 import struct
400
 
 import os
401
 
-import gio
402
 
+from gi.repository import Gio
403
 
 
404
 
 SIZE_ERROR = -1
405
 
 SEEK_ERROR = -2
406
 
@@ -12,27 +12,27 @@
407
 
        longlongformat = 'q'  # long long 
408
 
        bytesize = struct.calcsize(longlongformat) 
409
 
            
410
 
-       fp = gio.File(name) 
411
 
+       fp = Gio.File.new_for_uri (name)
412
 
            
413
 
-       filesize = fp.query_info('standard::size', 0).get_attribute_uint64('standard::size') 
414
 
+       file_info = fp.query_info ('standard::size', 0, None)
415
 
+       filesize = file_info.get_attribute_uint64 ('standard::size')
416
 
        
417
 
        hash = filesize 
418
 
           
419
 
        if filesize < 65536 * 2: 
420
 
               return SIZE_ERROR, 0
421
 
 
422
 
-       data = fp.read()                 
423
 
+       data = file(fp.get_path(), 'rb')
424
 
        
425
 
-       if data.can_seek() != True:
426
 
-               return SEEK_ERROR, 0
427
 
-
428
 
        for x in range(65536/bytesize):
429
 
                buffer = data.read(bytesize)
430
 
                (l_value,)= struct.unpack(longlongformat, buffer)  
431
 
                hash += l_value 
432
 
                hash = hash & 0xFFFFFFFFFFFFFFFF #to remain as 64bit number  
433
 
                
434
 
-       if data.seek(max(0,filesize-65536),1) != True:
435
 
+       data.seek (max (0, filesize - 65536), os.SEEK_SET)
436
 
+
437
 
+       if data.tell() != max (0, filesize - 65536):
438
 
                return SEEK_ERROR, 0
439
 
 
440
 
        for x in range(65536/bytesize):