1
Description: Port to the new pygobject, this can be dropped when we
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
10
# -*- coding: utf-8 -*-
14
+from gi.repository import GObject
15
from gi.repository import Peas
16
from gi.repository import Gtk
17
from gi.repository import Totem
22
-class IplayerPlugin (gobject.GObject, Peas.Activatable):
23
+class IplayerPlugin (GObject.Object, Peas.Activatable):
24
__gtype_name__ = 'IplayerPlugin'
26
- object = gobject.property(type = gobject.GObject)
27
+ object = GObject.property(type = GObject.Object)
30
+ GObject.Object.__init__ (self)
34
self.programme_download_lock = threading.Lock ()
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])
42
# Only show the error once, rather than for each channel (it gets a bit grating)
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)
48
tree_iter = self.tree_model.iter_next (tree_iter)
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 ()
59
# Retrieve the programmes and return them
60
feed = self.feed.get (channel_id).get (category_id)
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 ()
69
programmes = feed.list ()
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 ()
77
print "Programme has no HTTP streams"
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],
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
94
+from gi.repository import GObject
95
from gi.repository import Gio
96
from gi.repository import Peas
97
from gi.repository import PeasGtk
101
socket.setdefaulttimeout(30)
102
-gobject.threads_init()
103
+GObject.threads_init()
105
-class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
106
+class JamendoPlugin(GObject.Object, Peas.Activatable, PeasGtk.Configurable):
107
__gtype_name__ = 'JamendoPlugin'
109
- object = gobject.property(type = gobject.GObject)
110
+ object = GObject.property(type = GObject.Object)
113
Jamendo totem plugin GUI.
118
+ GObject.Object.__init__ (self)
121
self.gstreamer_plugins_present = True
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)
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
142
from gi.repository import Gio
143
from gi.repository import Pango
144
from gi.repository import Totem
146
-gobject.threads_init()
147
+from gi.repository import GObject
151
import xdg.BaseDirectory
153
D_ = gettext.dgettext
156
+GObject.threads_init()
160
TOTEM_REMOTE_COMMAND_REPLACE = 14
161
@@ -295,12 +297,14 @@
165
-class OpenSubtitles(gobject.GObject, Peas.Activatable):
166
+class OpenSubtitles(GObject.Object, Peas.Activatable):
167
__gtype_name__ = 'OpenSubtitles'
169
- object = gobject.property(type = gobject.GObject)
170
+ object = GObject.property(type = GObject.Object)
173
+ GObject.Object.__init__ (self)
177
self.settings = Gio.Settings.new ('org.gnome.totem.plugins.opensubtitles')
178
@@ -483,10 +487,10 @@
180
thread = SearchThread(self.model)
182
- gobject.idle_add(self.os_populate_treeview)
183
+ GObject.idle_add(self.os_populate_treeview)
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)
189
def os_populate_treeview(self):
191
@@ -541,10 +545,10 @@
193
thread = DownloadThread(self.model, subtitle_id)
195
- gobject.idle_add(self.os_save_subtitles, filename)
196
+ GObject.idle_add(self.os_save_subtitles, filename)
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)
205
fp = Gio.file_new_for_uri (filename)
206
suburi = fp.get_uri ()
208
- subFile = fp.replace('', False)
209
- subFile.write(self.model.subtitles)
211
+ subFile = fp.replace ('', False, Gio.FileCreateFlags.REPLACE_DESTINATION, None)
212
+ subFile.write (self.model.subtitles, None)
213
+ subFile.close (None)
215
self.model.lock.release()
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
223
# Copyright 2008, Frank Scholz <coherence@beebits.net>
225
+from gi.repository import GObject
226
from gi.repository import Peas
227
from gi.repository import Gtk
228
from gi.repository import Totem
230
D_ = gettext.dgettext
233
-class UPnPClient(gobject.GObject, Peas.Activatable):
234
+class UPnPClient(GObject.Object, Peas.Activatable):
235
__gtype_name__ = 'UPnPClient'
237
- object = gobject.property(type = gobject.GObject)
238
+ object = GObject.property(type = GObject.Object)
241
+ GObject.Object.__init__ (self)
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
251
## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
252
## See license_change file for details.
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
262
-class dbusservice(gobject.GObject, Peas.Activatable):
263
+class dbusservice(GObject.Object, Peas.Activatable):
264
__gtype_name__ = 'dbusservice'
266
- object = gobject.property(type = gobject.GObject)
267
+ object = GObject.property(type = GObject.Object)
269
+ def __init__(self):
270
+ GObject.Object.__init__ (self)
274
+ self.track_list = None
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
287
+from gi.repository import GObject
288
from gi.repository import Pango
289
from gi.repository import Gtk
290
from gi.repository import Gdk
292
cur = buffer.get_end_iter()
294
buffer.place_cursor(cur)
295
- gobject.idle_add(self.scroll_to_end)
296
+ GObject.idle_add(self.scroll_to_end)
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)
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")
312
- gobject.idle_add(self.scroll_to_end)
313
+ GObject.idle_add(self.scroll_to_end)
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")
320
- gobject.idle_add(self.scroll_to_end)
321
+ GObject.idle_add(self.scroll_to_end)
324
elif event.keyval == Gdk.KEY_KP_Left or event.keyval == Gdk.KEY_Left or \
327
buf.insert_with_tags(buf.get_end_iter(), text, tag)
329
- gobject.idle_add(self.scroll_to_end)
330
+ GObject.idle_add(self.scroll_to_end)
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
339
from gi.repository import Gtk
340
from gi.repository import Totem
341
from gi.repository import Gio
343
+from gi.repository import GObject
351
-class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
352
+class PythonConsolePlugin(GObject.Object, Peas.Activatable):
353
__gtype_name__ = 'PythonConsolePlugin'
355
- object = gobject.property(type = gobject.GObject)
356
+ object = GObject.property(type = GObject.Object)
359
+ GObject.Object.__init__ (self)
365
rpdb2.start_embedded_debugger(password)
368
- gobject.idle_add(start_debugger, password)
369
+ GObject.idle_add(start_debugger, password)
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
378
# From code by James Livingston
381
+from gi.repository import GObject
382
from gi.repository import Peas
383
from gi.repository import Totem
385
-class SamplePython(gobject.GObject, Peas.Activatable):
386
+class SamplePython(GObject.Object, Peas.Activatable):
387
__gtype_name__ = 'SamplePython'
389
- object = gobject.property(type = gobject.GObject)
390
+ object = GObject.property(type = GObject.Object)
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
402
+from gi.repository import Gio
407
longlongformat = 'q' # long long
408
bytesize = struct.calcsize(longlongformat)
410
- fp = gio.File(name)
411
+ fp = Gio.File.new_for_uri (name)
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')
419
if filesize < 65536 * 2:
423
+ data = file(fp.get_path(), 'rb')
425
- if data.can_seek() != True:
426
- return SEEK_ERROR, 0
428
for x in range(65536/bytesize):
429
buffer = data.read(bytesize)
430
(l_value,)= struct.unpack(longlongformat, buffer)
432
hash = hash & 0xFFFFFFFFFFFFFFFF #to remain as 64bit number
434
- if data.seek(max(0,filesize-65536),1) != True:
435
+ data.seek (max (0, filesize - 65536), os.SEEK_SET)
437
+ if data.tell() != max (0, filesize - 65536):
440
for x in range(65536/bytesize):