replaced some deprecated GObject calls with GLib

This commit is contained in:
Daniel Pavel 2013-04-30 11:47:30 +02:00
parent 22a8ca37b6
commit 22da75cb72
5 changed files with 17 additions and 17 deletions

View File

@ -33,8 +33,8 @@ def _look_for_application_icons():
_look_for_application_icons()
from gi.repository import GObject, Gtk
GObject.threads_init()
from gi.repository import GLib, Gtk
GLib.threads_init()
def error_dialog(window, title, text):

View File

@ -4,7 +4,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from gi.repository import Gtk, GObject
from gi.repository import Gtk, GLib
from logitech.unifying_receiver import settings as _settings
@ -32,12 +32,12 @@ def _process_apply_queue():
# print ("task", *task)
if task[0] == 'write':
_, setting, value, sbox = task
GObject.idle_add(_write_start, sbox, priority=0)
GLib.idle_add(_write_start, sbox, priority=0)
value = setting.write(value)
elif task[0] == 'read':
_, setting, force_read, sbox = task
value = setting.read(not force_read)
GObject.idle_add(_update_setting_item, sbox, value, priority=99)
GLib.idle_add(_update_setting_item, sbox, value, priority=99)
from threading import Thread as _Thread
_queue_processor = _Thread(name='SettingsProcessor', target=_process_apply_queue)

View File

@ -4,7 +4,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from gi.repository import Gtk, Gdk, GObject
from gi.repository import Gtk, Gdk, GLib
from logitech.unifying_receiver import status as _status
from . import config_panel as _config_panel
@ -77,7 +77,7 @@ def _make_receiver_box(name):
c.set_visible(active)
if active:
GObject.timeout_add(50, _update_info_label, f)
GLib.timeout_add(50, _update_info_label, f)
toggle_info_action = _action.make_toggle('dialog-information', 'Details', _toggle_info_label, frame)
toolbar.insert(toggle_info_action.create_tool_item(), 0)
@ -194,7 +194,7 @@ def _make_device_box(index):
children[2].set_visible(active) # info label
if active:
GObject.timeout_add(30, _update_info_label, f)
GLib.timeout_add(30, _update_info_label, f)
def _toggle_config(action, f):
active = action.get_active()
@ -209,7 +209,7 @@ def _make_device_box(index):
children[4].set_visible(active) # unpair button
if active:
GObject.timeout_add(30, _config_panel.update, f)
GLib.timeout_add(30, _config_panel.update, f)
toggle_info_action = _action.make_toggle('dialog-information', 'Details', _toggle_info_label, frame)
toolbar.insert(toggle_info_action.create_tool_item(), 0)
@ -334,7 +334,7 @@ def _update_receiver_box(frame, receiver):
i.set_sensitive(True)
i._tick = 0
frame._pairing_icon.set_visible(True)
GObject.timeout_add(1000, _pairing_tick, frame._pairing_icon, receiver.status)
GLib.timeout_add(1000, _pairing_tick, frame._pairing_icon, receiver.status)
else:
frame._pairing_icon.set_visible(False)
frame._pairing_icon.set_sensitive(True)

View File

@ -4,7 +4,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from gi.repository import Gtk, GObject
from gi.repository import Gtk, GLib
from logging import getLogger, DEBUG as _DEBUG
_log = getLogger('pair-window')
@ -95,10 +95,10 @@ def _prepare(assistant, page, receiver):
assert receiver.status.get(_status.ERROR) is None
spinner = page.get_children()[-1]
spinner.start()
GObject.timeout_add(2000, _check_lock_state, assistant, receiver)
GLib.timeout_add(2000, _check_lock_state, assistant, receiver)
assistant.set_page_complete(page, True)
else:
GObject.idle_add(_pairing_failed, assistant, receiver, 'the pairing lock did not open')
GLib.idle_add(_pairing_failed, assistant, receiver, 'the pairing lock did not open')
else:
assistant.remove_page(0)
@ -167,7 +167,7 @@ def _pairing_succeeded(assistant, receiver, device):
hbox.show_all()
else:
return True
GObject.timeout_add(500, _check_encrypted, device)
GLib.timeout_add(500, _check_encrypted, device)
page.show_all()

View File

@ -4,7 +4,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from gi.repository import Gtk, GObject, GdkPixbuf
from gi.repository import Gtk, GLib, GdkPixbuf
from . import action as _action, icons as _icons
from logitech.unifying_receiver import status as _status
@ -50,9 +50,9 @@ def check_systray(icon, window):
logging.info("check_systray %s %s", i2.is_embedded(), i2.get_visible())
w2.set_has_systray(i2.is_embedded() and i2.get_visible())
# first guess
GObject.timeout_add(250, _check_systray, i, w)
GLib.timeout_add(250, _check_systray, i, w)
# just to make sure...
# GObject.timeout_add(1000, _check_systray, i, w)
# GLib.timeout_add(1000, _check_systray, i, w)
_size_changed(icon, None, window)
icon.connect('size-changed', _size_changed, window)