GObject -> GLib

This commit is contained in:
Yann Leboulanger 2013-07-29 18:35:49 +02:00
parent 3bd8c6e144
commit 137ae2b54a
8 changed files with 30 additions and 27 deletions

View file

@ -35,7 +35,7 @@ commands as a frontend.
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from os.path import expanduser from os.path import expanduser
from gi.repository import GObject from gi.repository import GLib
from ..framework import CommandContainer, command, doc from ..framework import CommandContainer, command, doc
from .hosts import * from .hosts import *
@ -64,7 +64,7 @@ class Execute(CommandContainer):
@classmethod @classmethod
def monitor(cls, processor, popen): def monitor(cls, processor, popen):
poller = cls.poller(processor, popen) poller = cls.poller(processor, popen)
GObject.timeout_add(cls.POLL_INTERVAL, next, poller) GLib.timeout_add(cls.POLL_INTERVAL, next, poller)
@classmethod @classmethod
def poller(cls, processor, popen): def poller(cls, processor, popen):

View file

@ -30,7 +30,7 @@
import socket import socket
import base64 import base64
from gi.repository import GObject from gi.repository import GLib
import time import time
import nbxmpp import nbxmpp
@ -442,7 +442,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
def cleanup_gupnp(): def cleanup_gupnp():
if self.no_gupnp_reply_id: if self.no_gupnp_reply_id:
GObject.source_remove(self.no_gupnp_reply_id) GLib.source_remove(self.no_gupnp_reply_id)
self.no_gupnp_reply_id = 0 self.no_gupnp_reply_id = 0
gajim.gupnp_igd.disconnect(self.ok_id) gajim.gupnp_igd.disconnect(self.ok_id)
gajim.gupnp_igd.disconnect(self.fail_id) gajim.gupnp_igd.disconnect(self.fail_id)
@ -482,7 +482,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
self.fail_id = gajim.gupnp_igd.connect('error-mapping-port', fail) self.fail_id = gajim.gupnp_igd.connect('error-mapping-port', fail)
port = gajim.config.get('file_transfers_port') port = gajim.config.get('file_transfers_port')
self.no_gupnp_reply_id = GObject.timeout_add_seconds(10, no_upnp_reply) self.no_gupnp_reply_id = GLib.timeout_add_seconds(10, no_upnp_reply)
gajim.gupnp_igd.add_port('TCP', 0, my_ip, port, 3600, gajim.gupnp_igd.add_port('TCP', 0, my_ip, port, 3600,
'Gajim file transfer') 'Gajim file transfer')

View file

@ -39,7 +39,7 @@ import signal
if os.name != 'nt': if os.name != 'nt':
signal.signal(signal.SIGPIPE, signal.SIG_DFL) signal.signal(signal.SIGPIPE, signal.SIG_DFL)
import getpass import getpass
from gi.repository import GObject from gi.repository import GLib
from common.connection import CommonConnection from common.connection import CommonConnection
from common import gajim from common import gajim
@ -239,7 +239,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
# refresh all contacts data every five seconds # refresh all contacts data every five seconds
self.call_resolve_timeout = True self.call_resolve_timeout = True
GObject.timeout_add_seconds(5, self._on_resolve_timeout) GLib.timeout_add_seconds(5, self._on_resolve_timeout)
return True return True
def disconnect(self, on_purpose=False): def disconnect(self, on_purpose=False):

View file

@ -29,6 +29,7 @@ from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
import base64 import base64
import gtkgui_helpers import gtkgui_helpers
@ -640,7 +641,7 @@ class SingleForm(Gtk.Table, object):
dialogs.ErrorDialog( dialogs.ErrorDialog(
_('Jabber ID already in list'), _('Jabber ID already in list'),
_('The Jabber ID you entered is already in the list. Choose another one.')) _('The Jabber ID you entered is already in the list. Choose another one.'))
GObject.idle_add(treeview.set_cursor, path) GLib.idle_add(treeview.set_cursor, path)
return return
model[path][0]=newtext model[path][0]=newtext

View file

@ -27,7 +27,7 @@
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GObject from gi.repository import GLib
import time import time
import calendar import calendar
@ -120,7 +120,7 @@ class HistoryWindow:
# This will load history too # This will load history too
task = self._fill_completion_dict() task = self._fill_completion_dict()
GObject.idle_add(next, task) GLib.idle_add(next, task)
if jid: if jid:
self.jid_entry.set_text(jid) self.jid_entry.set_text(jid)
@ -634,7 +634,7 @@ class HistoryWindow:
self.jid_entry.set_text(jid) self.jid_entry.set_text(jid)
if account and account not in self.accounts_seen_online: if account and account not in self.accounts_seen_online:
# Update dict to not only show bare jid # Update dict to not only show bare jid
GObject.idle_add(next, self._fill_completion_dict()) GLib.idle_add(next, self._fill_completion_dict())
else: else:
# Only in that case because it's called by self._fill_completion_dict() # Only in that case because it's called by self._fill_completion_dict()
# otherwise # otherwise

View file

@ -44,6 +44,7 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php}
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
import re import re
import sys import sys
import os import os
@ -367,7 +368,7 @@ class ConsoleView(Gtk.TextView):
self.connect('key-press-event', self.onKeyPress) self.connect('key-press-event', self.onKeyPress)
def write(self, text, editable=False): def write(self, text, editable=False):
GObject.idle_add(self._write, text, editable) GLib.idle_add(self._write, text, editable)
def _write(self, text, editable=False): def _write(self, text, editable=False):
""" """
@ -401,7 +402,7 @@ class ConsoleView(Gtk.TextView):
def showPrompt(self, prompt): def showPrompt(self, prompt):
GObject.idle_add(self._showPrompt, prompt) GLib.idle_add(self._showPrompt, prompt)
def _showPrompt(self, prompt): def _showPrompt(self, prompt):
""" """
@ -415,7 +416,7 @@ class ConsoleView(Gtk.TextView):
self.text_buffer.get_end_iter()) self.text_buffer.get_end_iter())
def changeLine(self, text): def changeLine(self, text):
GObject.idle_add(self._changeLine, text) GLib.idle_add(self._changeLine, text)
def _changeLine(self, text): def _changeLine(self, text):
""" """
@ -442,7 +443,7 @@ class ConsoleView(Gtk.TextView):
return rv return rv
def showReturned(self, text): def showReturned(self, text):
GObject.idle_add(self._showReturned, text) GLib.idle_add(self._showReturned, text)
def _showReturned(self, text): def _showReturned(self, text):
""" """

View file

@ -26,6 +26,7 @@ import gc
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Pango from gi.repository import Pango
import gtkgui_helpers import gtkgui_helpers
@ -284,7 +285,7 @@ class MessageTextView(Gtk.TextView):
return None return None
def destroy(self): def destroy(self):
GObject.idle_add(gc.collect) GLib.idle_add(gc.collect)
def clear(self, widget = None): def clear(self, widget = None):
""" """

View file

@ -26,7 +26,7 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>. ## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
## ##
from gi.repository import GObject from gi.repository import GLib
from gi.repository import Gtk from gi.repository import Gtk
import os import os
import base64 import base64
@ -559,8 +559,8 @@ class SignalObject(dbus.service.Object):
if account not in gajim.connections: if account not in gajim.connections:
return DBUS_BOOLEAN(False) return DBUS_BOOLEAN(False)
status = gajim.SHOW_LIST[gajim.connections[account].connected] status = gajim.SHOW_LIST[gajim.connections[account].connected]
GObject.idle_add(gajim.interface.roster.send_status, account, GLib.idle_add(gajim.interface.roster.send_status, account, status,
status, message) message)
else: else:
# account not specified, so change the status of all accounts # account not specified, so change the status of all accounts
for acc in gajim.contacts.get_accounts(): for acc in gajim.contacts.get_accounts():
@ -573,8 +573,8 @@ class SignalObject(dbus.service.Object):
if acc not in gajim.connections: if acc not in gajim.connections:
continue continue
status_ = gajim.SHOW_LIST[gajim.connections[acc].connected] status_ = gajim.SHOW_LIST[gajim.connections[acc].connected]
GObject.idle_add(gajim.interface.roster.send_status, acc, GLib.idle_add(gajim.interface.roster.send_status, acc, status_,
status_, message) message)
return DBUS_BOOLEAN(False) return DBUS_BOOLEAN(False)
@dbus.service.method(INTERFACE, in_signature='ss', out_signature='') @dbus.service.method(INTERFACE, in_signature='ss', out_signature='')
@ -587,8 +587,8 @@ class SignalObject(dbus.service.Object):
gajim.config.set_per('accounts', account, 'priority', prio) gajim.config.set_per('accounts', account, 'priority', prio)
show = gajim.SHOW_LIST[gajim.connections[account].connected] show = gajim.SHOW_LIST[gajim.connections[account].connected]
status = gajim.connections[account].status status = gajim.connections[account].status
GObject.idle_add(gajim.connections[account].change_status, show, GLib.idle_add(gajim.connections[account].change_status, show,
status) status)
else: else:
# account not specified, so change prio of all accounts # account not specified, so change prio of all accounts
for acc in gajim.contacts.get_accounts(): for acc in gajim.contacts.get_accounts():
@ -600,8 +600,8 @@ class SignalObject(dbus.service.Object):
gajim.config.set_per('accounts', acc, 'priority', prio) gajim.config.set_per('accounts', acc, 'priority', prio)
show = gajim.SHOW_LIST[gajim.connections[acc].connected] show = gajim.SHOW_LIST[gajim.connections[acc].connected]
status = gajim.connections[acc].status status = gajim.connections[acc].status
GObject.idle_add(gajim.connections[acc].change_status, show, GLib.idle_add(gajim.connections[acc].change_status, show,
status) status)
@dbus.service.method(INTERFACE, in_signature='', out_signature='') @dbus.service.method(INTERFACE, in_signature='', out_signature='')
def show_next_pending_event(self): def show_next_pending_event(self):
@ -693,7 +693,7 @@ class SignalObject(dbus.service.Object):
""" """
win = gajim.interface.roster.window win = gajim.interface.roster.window
if win.get_property('visible'): if win.get_property('visible'):
GObject.idle_add(win.hide) GLib.idle_add(win.hide)
else: else:
win.present() win.present()
# preserve the 'steal focus preservation' # preserve the 'steal focus preservation'
@ -723,7 +723,7 @@ class SignalObject(dbus.service.Object):
win = gajim.ipython_window win = gajim.ipython_window
if win: if win:
if win.window.is_visible(): if win.window.is_visible():
GObject.idle_add(win.hide) GLib.idle_add(win.hide)
else: else:
win.show_all() win.show_all()
win.present() win.present()