Commit fd0ff877 authored by Yann Leboulanger's avatar Yann Leboulanger

GObject.* -> GLib.*

parent 8c7ee7a1
......@@ -25,7 +25,7 @@
# FIXME: think if we need caching command list. it may be wrong if there will
# be entities that often change the list, it may be slow to fetch it every time
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gtk
import nbxmpp
......@@ -555,14 +555,14 @@ class CommandWindow:
return True # important to keep callback be called back!
# 12 times per second (80 miliseconds)
self.pulse_id = GObject.timeout_add(80, callback)
self.pulse_id = GLib.timeout_add(80, callback)
def remove_pulsing(self):
"""
Stop pulsing, useful when especially when removing widget
"""
if self.pulse_id:
GObject.source_remove(self.pulse_id)
GLib.source_remove(self.pulse_id)
self.pulse_id = None
# handling xml stanzas
......
......@@ -25,7 +25,7 @@
from gi.repository import Gtk
import gtkgui_helpers
from gi.repository import GObject
from gi.repository import GLib
from common import gajim
from common import helpers
......@@ -51,12 +51,12 @@ def rate_limit(rate):
timeout = [None]
def f(*args, **kwargs):
if timeout[0] is not None:
GObject.source_remove(timeout[0])
GLib.source_remove(timeout[0])
timeout[0] = None
def timeout_func():
func(*args, **kwargs)
timeout[0] = None
timeout[0] = GObject.timeout_add(int(1000.0 / rate), timeout_func)
timeout[0] = GLib.timeout_add(int(1000.0 / rate), timeout_func)
return f
return decorator
......
......@@ -77,7 +77,7 @@ class CellRendererImage(Gtk.CellRendererPixbuf):
if model:
model.foreach(self.func, (image, tree))
if self.redraw:
GObject.timeout_add(iter_.get_delay_time(),
GLib.timeout_add(iter_.get_delay_time(),
self.animation_timeout, tree, image)
elif image in self.iters:
del self.iters[image]
......@@ -95,8 +95,8 @@ class CellRendererImage(Gtk.CellRendererPixbuf):
timeval.tv_sec = GLib.get_current_time()
iter_ = animation.get_iter(timeval)
self.iters[self.image] = iter_
GObject.timeout_add(iter_.get_delay_time(),
self.animation_timeout, widget, self.image)
GLib.timeout_add(iter_.get_delay_time(), self.animation_timeout,
widget, self.image)
pix = self.iters[self.image].get_pixbuf()
elif self.image.get_storage_type() == Gtk.ImageType.PIXBUF:
......
......@@ -34,6 +34,7 @@ from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
import gtkgui_helpers
import gui_menu_builder
import message_control
......@@ -1286,7 +1287,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
visible_rect = textview.get_visible_rect()
# scroll only if expected end is not visible
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
self.scroll_to_end_id = GObject.idle_add(self.scroll_to_end_iter,
self.scroll_to_end_id = GLib.idle_add(self.scroll_to_end_iter,
textview)
def scroll_to_end_iter(self, textview):
......@@ -1482,7 +1483,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
"""
# make the last message visible, when changing to "full view"
if not state:
GObject.idle_add(self.conv_textview.scroll_to_end_iter)
GLib.idle_add(self.conv_textview.scroll_to_end_iter)
widget.set_no_show_all(state)
if state:
......@@ -2048,8 +2049,8 @@ class ChatControl(ChatControlBase):
if avatar_w > scaled_buf_w or avatar_h > scaled_buf_h:
# wait for 0.5 sec in case we leave earlier
if self.show_bigger_avatar_timeout_id is not None:
GObject.source_remove(self.show_bigger_avatar_timeout_id)
self.show_bigger_avatar_timeout_id = GObject.timeout_add(500,
GLib.source_remove(self.show_bigger_avatar_timeout_id)
self.show_bigger_avatar_timeout_id = GLib.timeout_add(500,
self.show_bigger_avatar, widget)
def on_avatar_eventbox_leave_notify_event(self, widget, event):
......@@ -2058,7 +2059,7 @@ class ChatControl(ChatControlBase):
"""
# did we add a timeout? if yes remove it
if self.show_bigger_avatar_timeout_id is not None:
GObject.source_remove(self.show_bigger_avatar_timeout_id)
GLib.source_remove(self.show_bigger_avatar_timeout_id)
self.show_bigger_avatar_timeout_id = None
def on_avatar_eventbox_button_press_event(self, widget, event):
......@@ -2100,9 +2101,9 @@ class ChatControl(ChatControlBase):
self.mouse_over_in_last_30_secs = True
def _schedule_activity_timers(self):
self.possible_paused_timeout_id = GObject.timeout_add_seconds(5,
self.possible_paused_timeout_id = GLib.timeout_add_seconds(5,
self.check_for_possible_paused_chatstate, None)
self.possible_inactive_timeout_id = GObject.timeout_add_seconds(30,
self.possible_inactive_timeout_id = GLib.timeout_add_seconds(30,
self.check_for_possible_inactive_chatstate, None)
def update_ui(self):
......@@ -2162,7 +2163,7 @@ class ChatControl(ChatControlBase):
name = i18n.direction_mark + _(
'%(nickname)s from group chat %(room_name)s') % \
{'nickname': name, 'room_name': self.room_name}
name = i18n.direction_mark + GObject.markup_escape_text(name)
name = i18n.direction_mark + GLib.markup_escape_text(name)
# We know our contacts nick, but if another contact has the same nick
# in another account we need to also display the account.
......@@ -2179,7 +2180,7 @@ class ChatControl(ChatControlBase):
if other_contact_.get_shown_name() == \
self.contact.get_shown_name():
acct_info = i18n.direction_mark + ' (%s)' % \
GObject.markup_escape_text(self.account)
GLib.markup_escape_text(self.account)
break
status = contact.status
......@@ -2189,7 +2190,7 @@ class ChatControl(ChatControlBase):
status_reduced = helpers.reduce_chars_newlines(status, max_lines=1)
else:
status_reduced = ''
status_escaped = GObject.markup_escape_text(status_reduced)
status_escaped = GLib.markup_escape_text(status_reduced)
font_attrs, font_attrs_small = self.get_font_attrs()
st = gajim.config.get('displayed_chat_state_notifications')
......@@ -2407,8 +2408,8 @@ class ChatControl(ChatControlBase):
chatstate_to_send = 'active'
contact.our_chatstate = 'active'
GObject.source_remove(self.possible_paused_timeout_id)
GObject.source_remove(self.possible_inactive_timeout_id)
GLib.source_remove(self.possible_paused_timeout_id)
GLib.source_remove(self.possible_inactive_timeout_id)
self._schedule_activity_timers()
def _on_sent(msg_stanza, message, encrypted, xhtml, label, old_txt):
......@@ -2671,7 +2672,7 @@ class ChatControl(ChatControlBase):
name = self.contact.get_shown_name()
if self.resource:
name += '/' + self.resource
label_str = GObject.markup_escape_text(name)
label_str = GLib.markup_escape_text(name)
if num_unread: # if unread, text in the label becomes bold
label_str = '<b>' + unread + label_str + '</b>'
return (label_str, color)
......@@ -2809,8 +2810,8 @@ class ChatControl(ChatControlBase):
self.session.control = None
# Disconnect timer callbacks
GObject.source_remove(self.possible_paused_timeout_id)
GObject.source_remove(self.possible_inactive_timeout_id)
GLib.source_remove(self.possible_paused_timeout_id)
GLib.source_remove(self.possible_inactive_timeout_id)
# Remove bigger avatar window
if self.bigger_avatar_window:
self.bigger_avatar_window.destroy()
......@@ -2893,8 +2894,8 @@ class ChatControl(ChatControlBase):
else:
self.send_chatstate('active', self.contact)
self.reset_kbd_mouse_timeout_vars()
GObject.source_remove(self.possible_paused_timeout_id)
GObject.source_remove(self.possible_inactive_timeout_id)
GLib.source_remove(self.possible_paused_timeout_id)
GLib.source_remove(self.possible_inactive_timeout_id)
self._schedule_activity_timers()
else:
self.send_chatstate('inactive', self.contact)
......@@ -3479,6 +3480,6 @@ class ChatControl(ChatControlBase):
self.info_bar.set_no_show_all(True)
self.info_bar.hide()
# show next one?
GObject.idle_add(self._info_bar_show_message)
GLib.idle_add(self._info_bar_show_message)
break
i += 1
......@@ -36,7 +36,7 @@ import sys
import re
import copy
from common import defs
from gi.repository import GObject
from gi.repository import GLib
(
OPT_TYPE,
......@@ -802,7 +802,7 @@ class Config:
def _timeout_save(self):
if self.save_timeout_id:
return
self.save_timeout_id = GObject.timeout_add(1000, self._really_save)
self.save_timeout_id = GLib.timeout_add(1000, self._really_save)
def __init__(self):
#init default values
......
......@@ -33,7 +33,7 @@ import base64
import sys
import operator
import hashlib
from gi.repository import GObject
from gi.repository import GLib
from time import (altzone, daylight, gmtime, localtime, mktime, strftime,
time as time_time, timezone, tzname)
......@@ -560,7 +560,7 @@ class ConnectionVcard:
self.discover_ft_proxies()
gajim.nec.push_incoming_event(RosterReceivedEvent(None,
conn=self))
GObject.timeout_add_seconds(10, self.discover_servers)
GLib.timeout_add_seconds(10, self.discover_servers)
elif self.awaiting_answers[id_][0] == PRIVACY_ARRIVED:
if iq_obj.getType() != 'error':
self.privacy_rules_supported = True
......
......@@ -17,7 +17,7 @@ Handles Jingle RTP sessions (XEP 0167)
from collections import deque
from gi.repository import GObject
from gi.repository import GLib
import socket
import nbxmpp
......@@ -130,13 +130,13 @@ class JingleRTPContent(JingleContent):
events = deque(events)
self._dtmf_running = True
self._start_dtmf(events.popleft())
GObject.timeout_add(500, self._next_dtmf, events)
GLib.timeout_add(500, self._next_dtmf, events)
def _next_dtmf(self, events):
self._stop_dtmf()
if events:
self._start_dtmf(events.popleft())
GObject.timeout_add(500, self._next_dtmf, events)
GLib.timeout_add(500, self._next_dtmf, events)
else:
self._dtmf_running = False
......
......@@ -34,7 +34,7 @@ import time
import datetime
from gzip import GzipFile
from io import BytesIO
from gi.repository import GObject
from gi.repository import GLib
from common import exceptions
from common import gajim
......@@ -177,7 +177,7 @@ class Logger:
def _timeout_commit(self):
if self.commit_timout_id:
return
self.commit_timout_id = GObject.timeout_add(500, self._really_commit)
self.commit_timout_id = GLib.timeout_add(500, self._really_commit)
def simple_commit(self, sql_to_commit):
"""
......
......@@ -317,7 +317,7 @@ class NsLookup(IdleCommand):
# below lines is on how to use API and assist in testing
if __name__ == '__main__':
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gtk
from nbxmpp import idlequeue
......@@ -342,7 +342,7 @@ if __name__ == '__main__':
but.connect('clicked', clicked)
win.add(hbox)
win.show_all()
GObject.timeout_add(200, idlequeue.process)
GLib.timeout_add(200, idlequeue.process)
if USE_LIBASYNCNS:
GObject.timeout_add(200, resolver.process)
GLib.timeout_add(200, resolver.process)
Gtk.main()
......@@ -35,6 +35,7 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
import os, sys
import common.config
import common.sleepy
......@@ -588,7 +589,7 @@ class PreferencesWindow:
gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
def on_preferences_notebook_switch_page(self, widget, page, page_num):
GObject.idle_add(self.xml.get_object('close_button').grab_focus)
GLib.idle_add(self.xml.get_object('close_button').grab_focus)
def on_preferences_window_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
......@@ -1661,7 +1662,7 @@ class AccountsWindow:
status_before = gajim.connections[account].status
gajim.interface.roster.send_status(account, 'offline',
_('Be right back.'))
GObject.timeout_add(500, login, account, show_before, status_before)
GLib.timeout_add(500, login, account, show_before, status_before)
def on_yes(checked, account):
relog(account)
......@@ -2162,7 +2163,7 @@ class AccountsWindow:
if not widget.is_focus():
pritext = _('Invalid Jabber ID')
dialogs.ErrorDialog(pritext, str(s))
GObject.idle_add(lambda: widget.grab_focus())
GLib.idle_add(lambda: widget.grab_focus())
return True
jid_splited = jid.split('@', 1)
......@@ -2172,7 +2173,7 @@ class AccountsWindow:
pritext = _('Invalid Jabber ID')
sectext = _('A Jabber ID must be in the form "user@servername".')
dialogs.ErrorDialog(pritext, sectext)
GObject.idle_add(lambda: widget.grab_focus())
GLib.idle_add(lambda: widget.grab_focus())
return True
......@@ -2237,7 +2238,7 @@ class AccountsWindow:
if not widget.is_focus():
pritext = _('Invalid Jabber ID')
dialogs.ErrorDialog(pritext, str(s))
GObject.idle_add(lambda: widget.grab_focus())
GLib.idle_add(lambda: widget.grab_focus())
return True
if self.option_changed('resource', resource):
......@@ -2393,7 +2394,7 @@ class AccountsWindow:
if not widget.is_focus():
dialogs.ErrorDialog(_('Invalid entry'),
_('Custom port must be a port number.'))
GObject.idle_add(lambda: widget.grab_focus())
GLib.idle_add(lambda: widget.grab_focus())
return True
if self.option_changed('custom_port', custom_port):
self.need_relogin = True
......@@ -3701,7 +3702,7 @@ class AccountCreationWizardWindow:
self.notebook.set_current_page(5) # show creating page
self.back_button.hide()
self.forward_button.hide()
self.update_progressbar_timeout_id = GObject.timeout_add(100,
self.update_progressbar_timeout_id = GLib.timeout_add(100,
self.update_progressbar)
# Get form from serveur
con = connection.Connection(self.account)
......@@ -3743,7 +3744,7 @@ class AccountCreationWizardWindow:
self.notebook.set_current_page(5) # show creating page
self.back_button.hide()
self.forward_button.hide()
self.update_progressbar_timeout_id = GObject.timeout_add(100,
self.update_progressbar_timeout_id = GLib.timeout_add(100,
self.update_progressbar)
def update_proxy_list(self):
......@@ -3779,7 +3780,7 @@ class AccountCreationWizardWindow:
if obj.conn.name != self.account:
return
if self.update_progressbar_timeout_id is not None:
GObject.source_remove(self.update_progressbar_timeout_id)
GLib.source_remove(self.update_progressbar_timeout_id)
self.back_button.show()
self.forward_button.show()
self.is_form = obj.is_form
......@@ -3837,7 +3838,7 @@ class AccountCreationWizardWindow:
if self.account not in gajim.connections:
return
if self.update_progressbar_timeout_id is not None:
GObject.source_remove(self.update_progressbar_timeout_id)
GLib.source_remove(self.update_progressbar_timeout_id)
del gajim.connections[self.account]
if self.account in gajim.config.get_per('accounts'):
gajim.config.del_per('accounts', self.account)
......@@ -3863,7 +3864,7 @@ class AccountCreationWizardWindow:
self.show_finish_page()
if self.update_progressbar_timeout_id is not None:
GObject.source_remove(self.update_progressbar_timeout_id)
GLib.source_remove(self.update_progressbar_timeout_id)
def _nec_acc_is_not_ok(self, obj):
"""
......@@ -3887,7 +3888,7 @@ class AccountCreationWizardWindow:
self.notebook.set_current_page(6) # show finish page
if self.update_progressbar_timeout_id is not None:
GObject.source_remove(self.update_progressbar_timeout_id)
GLib.source_remove(self.update_progressbar_timeout_id)
def on_advanced_button_clicked(self, widget):
if 'accounts' in gajim.interface.instances:
......
......@@ -34,6 +34,7 @@ from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
import time
import os
import tooltips
......@@ -404,14 +405,14 @@ class ConversationTextview(GObject.GObject):
return True
def smooth_scroll_timeout(self):
GObject.idle_add(self.do_smooth_scroll_timeout)
GLib.idle_add(self.do_smooth_scroll_timeout)
return
def do_smooth_scroll_timeout(self):
if not self.smooth_id:
# we finished scrolling
return
GObject.source_remove(self.smooth_id)
GLib.source_remove(self.smooth_id)
self.smooth_id = None
parent = self.tv.get_parent()
if parent:
......@@ -423,7 +424,7 @@ class ConversationTextview(GObject.GObject):
def smooth_scroll_to_end(self):
if None != self.smooth_id: # already scrolling
return False
self.smooth_id = GObject.timeout_add(self.SCROLL_DELAY,
self.smooth_id = GLib.timeout_add(self.SCROLL_DELAY,
self.smooth_scroll)
self.smooth_scroll_timer = Timer(self.MAX_SCROLL_TIME,
self.smooth_scroll_timeout)
......@@ -453,9 +454,9 @@ class ConversationTextview(GObject.GObject):
# scroll only if expected end is not visible
if end_rect.y >= (visible_rect.y + visible_rect.height + diff_y):
if use_smooth:
GObject.idle_add(self.smooth_scroll_to_end)
GLib.idle_add(self.smooth_scroll_to_end)
else:
GObject.idle_add(self.scroll_to_end_iter)
GLib.idle_add(self.scroll_to_end_iter)
def scroll_to_end_iter(self):
buffer_ = self.tv.get_buffer()
......@@ -467,7 +468,7 @@ class ConversationTextview(GObject.GObject):
def stop_scrolling(self):
if self.smooth_id:
GObject.source_remove(self.smooth_id)
GLib.source_remove(self.smooth_id)
self.smooth_id = None
self.smooth_scroll_timer.cancel()
......@@ -548,7 +549,7 @@ class ConversationTextview(GObject.GObject):
self.xep0184_shown[id_] = SHOWN
return False
GObject.timeout_add_seconds(3, show_it)
GLib.timeout_add_seconds(3, show_it)
buffer_.end_user_action()
......@@ -647,7 +648,7 @@ class ConversationTextview(GObject.GObject):
if scroll:
# scroll to the end (via idle in case the scrollbar has
# appeared)
GObject.idle_add(self.scroll_to_end)
GLib.idle_add(self.scroll_to_end)
def show_xep0184_warning_tooltip(self):
pointer = self.tv.get_pointer()
......@@ -751,13 +752,13 @@ class ConversationTextview(GObject.GObject):
if not xep0184_warning:
self.xep0184_warning_tooltip.hide_tooltip()
if over_line and not self.line_tooltip.win:
self.line_tooltip.timeout = GObject.timeout_add(500,
self.line_tooltip.timeout = GLib.timeout_add(500,
self.show_line_tooltip)
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
self.change_cursor = True
if xep0184_warning and not self.xep0184_warning_tooltip.win:
self.xep0184_warning_tooltip.timeout = GObject.timeout_add(500,
self.xep0184_warning_tooltip.timeout = GLib.timeout_add(500,
self.show_xep0184_warning_tooltip)
self.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
......@@ -1384,9 +1385,9 @@ class ConversationTextview(GObject.GObject):
# we are at the end or we are sending something
# scroll to the end (via idle in case the scrollbar has appeared)
if gajim.config.get('use_smooth_scrolling'):
GObject.idle_add(self.smooth_scroll_to_end)
GLib.idle_add(self.smooth_scroll_to_end)
else:
GObject.idle_add(self.scroll_to_end)
GLib.idle_add(self.scroll_to_end)
self.just_cleared = False
buffer_.end_user_action()
......
......@@ -33,6 +33,7 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
from gi.repository import GLib
import cairo
import os
......@@ -566,7 +567,7 @@ class TimeoutDialog:
def run_timeout(self):
if self.countdown_left > 0:
self.countdown()
GObject.timeout_add_seconds(1, self.countdown)
GLib.timeout_add_seconds(1, self.countdown)
def on_timeout():
"""
......@@ -2871,7 +2872,7 @@ class PopupNotificationWindow:
event_type_label.set_markup(
'<span foreground="black" weight="bold">%s</span>' %
GObject.markup_escape_text(title))
GLib.markup_escape_text(title))
# set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ]
self.window.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('black'))
......@@ -2904,7 +2905,7 @@ class PopupNotificationWindow:
close_button.modify_bg(Gtk.StateType.NORMAL, popup_bg_color)
eventbox.modify_bg(Gtk.StateType.NORMAL, popup_bg_color)
event_description_label.set_markup('<span foreground="black">%s</span>' %
GObject.markup_escape_text(text))
GLib.markup_escape_text(text))
# set the image
image.set_from_file(path_to_image)
......@@ -2924,7 +2925,7 @@ class PopupNotificationWindow:
xml.connect_signals(self)
self.window.show_all()
if timeout > 0:
GObject.timeout_add_seconds(timeout, self.on_timeout)
GLib.timeout_add_seconds(timeout, self.on_timeout)
def on_close_button_clicked(self, widget):
self.adjust_height_and_move_popup_notification_windows()
......@@ -3122,7 +3123,7 @@ class SingleMessageWindow:
self.cancel_button.hide()
self.close_button.show()
self.message_tv_buffer.set_text(self.message)
GObject.idle_add(self.set_cursor_to_end)
GLib.idle_add(self.set_cursor_to_end)
else: # we write a new message (not from reply)
self.close_button.hide()
if self.to: # do we already have jid?
......@@ -3400,7 +3401,7 @@ class XMLConsoleWindow:
buffer.insert_with_tags_by_name(end_iter, stanza.replace('><', '>\n<') \
+ '\n\n', type_)
if at_the_end:
GObject.idle_add(self.scroll_to_end)
GLib.idle_add(self.scroll_to_end)
def _nec_stanza_received(self, obj):
if obj.conn.name != self.account:
......@@ -3782,8 +3783,8 @@ class ItemArchivingPreferencesWindow:
def launch_progressbar(self):
self.progressbar.show()
self.update_progressbar_timeout_id = GObject.timeout_add(
100, self.update_progressbar)
self.update_progressbar_timeout_id = GLib.timeout_add(100,
self.update_progressbar)
def response_arrived(self, data):
if self.waiting:
......@@ -4082,7 +4083,7 @@ class PrivacyListWindow:
self.privacy_lists_title_label.set_label(
_('Privacy List <b><i>%s</i></b>') % \
GObject.markup_escape_text(self.privacy_list_name))
GLib.markup_escape_text(self.privacy_list_name))
if len(gajim.connections) > 1:
title = _('Privacy List for %s') % self.account
......@@ -4566,7 +4567,7 @@ class InvitationReceivedDialog:
sectext = sectext.replace('$Contact', contact_text)
if comment: # only if not None and not ''
comment = GObject.markup_escape_text(comment)
comment = GLib.markup_escape_text(comment)
comment = _('Comment: %s') % comment
sectext += '\n\n%s' % comment
sectext += '\n\n' + _('Do you want to accept the invitation?')
......@@ -4605,7 +4606,7 @@ class ProgressDialog:
self.dialog.show_all()
self.xml.connect_signals(self)
self.update_progressbar_timeout_id = GObject.timeout_add(100,
self.update_progressbar_timeout_id = GLib.timeout_add(100,
self.update_progressbar)
def update_progressbar(self):
......
......@@ -47,7 +47,7 @@
import os
import types
import weakref
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
......@@ -153,7 +153,7 @@ class CacheDictionary:
for key in list(self.cache.keys()):
item = self.cache[key]
if item.source:
GObject.source_remove(item.source)
GLib.source_remove(item.source)
del self.cache[key]
def _expire_timeout(self, key):
......@@ -170,9 +170,9 @@ class CacheDictionary:
"""
item = self.cache[key]
if item.source:
GObject.source_remove(item.source)
GLib.source_remove(item.source)
if self.lifetime:
source = GObject.timeout_add_seconds(int(self.lifetime/1000), self._expire_timeout, key)
source = GLib.timeout_add_seconds(int(self.lifetime/1000), self._expire_timeout, key)
item.source = source
def __getitem__(self, key):
......@@ -189,7 +189,7 @@ class CacheDictionary:
def __delitem__(self, key):
item = self.cache[key]
if item.source:
GObject.source_remove(item.source)
GLib.source_remove(item.source)
del self.cache[key]
def __contains__(self, key):
......@@ -1059,7 +1059,7 @@ class AgentBrowser:
self.model.clear()
self._total_items = self._progress = 0
self.window.progressbar.show()
self._pulse_timeout = GObject.timeout_add(250, self._pulse_timeout_cb)
self._pulse_timeout = GLib.timeout_add(250, self._pulse_timeout_cb)
self.cache.get_items(self.jid, self.node, self._agent_items,
force=force, args=(force,))
......@@ -1098,7 +1098,7 @@ class AgentBrowser:
self.model.clear()
self.add_self_line()
self._total_items = 0
GObject.source_remove(self._pulse_timeout)
GLib.source_remove(self._pulse_timeout)
self.window.progressbar.hide()
# The server returned an error
if items == 0:
......@@ -1311,8 +1311,8 @@ class ToplevelAgentBrowser(AgentBrowser):
if jid and state > 0 and \
(self.tooltip.timeout == 0 or self.tooltip.id != props[0]):
self.tooltip.id = row
self.tooltip.timeout = GObject.timeout_add(500,
self._show_tooltip, state)
self.tooltip.timeout = GLib.timeout_add(500, self._show_tooltip,
state)
def on_treeview_event_hide_tooltip(self, widget, event):
"""
......@@ -1586,7 +1586,7 @@ class ToplevelAgentBrowser(AgentBrowser):
# self.expanding = False
# return False
#self.expanding = True
#GObject.idle_add(expand_all)
#GLib.idle_add(expand_all)
self.window.services_treeview.expand_all()
def _update_progressbar(self):
......@@ -1595,7 +1595,7 @@ class ToplevelAgentBrowser(AgentBrowser):
"""
# Refresh this every update
if self._progressbar_sourceid: