Commit 19146706 authored by Joanmarie Diggs's avatar Joanmarie Diggs Committed by Javier Hernández

Fix for bug 691136 - Replace deprecated GObject methods with their GLib equivalents

parent cd16b656
......@@ -17,7 +17,7 @@ Headers in this file shall remain intact.
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import GLib
import pyatspi
from sequence_step import AtomicAction
......@@ -170,15 +170,15 @@ class KeyComboAction(AtomicAction):
interval = 0
mod_hw_codes = map(mod_key_code_mappings.get, modifiers.value_names)
for mod_hw_code in mod_hw_codes:
GObject.timeout_add(interval, self._keyPress, mod_hw_code)
GLib.timeout_add(interval, self._keyPress, mod_hw_code)
interval += keystroke_interval
GObject.timeout_add(interval, self._keyPressRelease, key_code)
GLib.timeout_add(interval, self._keyPressRelease, key_code)
interval += keystroke_interval
mod_hw_codes.reverse()
for mod_hw_code in mod_hw_codes:
GObject.timeout_add(interval, self._keyRelease, mod_hw_code)
GLib.timeout_add(interval, self._keyRelease, mod_hw_code)
interval += keystroke_interval
GObject.timeout_add(interval, self.stepDone)
GLib.timeout_add(interval, self.stepDone)
def _keyPress(self, hw_code):
'''
......@@ -258,10 +258,10 @@ class TypeAction(AtomicAction):
'''
interval = 0
for char in string_to_type:
GObject.timeout_add(interval, self._charType,
GLib.timeout_add(interval, self._charType,
Gdk.unicode_to_keyval(ord(char)))
interval += self.interval
GObject.timeout_add(interval, self.stepDone)
GLib.timeout_add(interval, self.stepDone)
def _charType(self, keyval):
'''
......
......@@ -112,7 +112,7 @@ class MacroSequence(GObject.GObject):
*self._anticipated_event_types)
self._current_handler = action.connect('done', self._onStepDone)
GObject.timeout_add(action.delta_time, self._doAction, action)
GLib.timeout_add(action.delta_time, self._doAction, action)
def _onAnticipatedEvent(self, event):
'''
......
......@@ -15,7 +15,7 @@ See "COPYING" in the source distribution for more information.
Headers in this file shall remain intact.
'''
from gi.repository import GObject
from gi.repository import GLib
import pyatspi
import re
......@@ -78,7 +78,7 @@ class WaitAction(SequenceStep):
self._cached_events = cached_events
if self.checkExistingState(): return
pyatspi.Registry.registerEventListener(self.onEvent, *self.wait_for)
GObject.timeout_add(self._timeout, self._onTimeout)
GLib.timeout_add(self._timeout, self._onTimeout)
def checkExistingState(self):
'''
......
......@@ -14,7 +14,7 @@ import gi
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Pango
import pyatspi
......@@ -122,7 +122,7 @@ class EventMonitor(ViewportPlugin):
events.extend(sub_events)
events = list(set([event.strip(':') for event in events]))
events.sort()
GObject.idle_add(self._appendChildren, None, '', 0, events)
GLib.idle_add(self._appendChildren, None, '', 0, events)
def _initTextView(self):
'''
......@@ -161,7 +161,7 @@ class EventMonitor(ViewportPlugin):
iter = self.events_model.append(parent_iter,
[event.split(':')[-1],
event, False, False])
GObject.idle_add(self._appendChildren, iter, event, level + 1, events)
GLib.idle_add(self._appendChildren, iter, event, level + 1, events)
return False
def _onToggled(self, renderer_toggle, path):
......
......@@ -16,7 +16,7 @@ import gi
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Pango
import re
......@@ -365,7 +365,7 @@ class ConsoleView(gtk.TextView):
self.connect('key-press-event', self.onKeyPress)
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):
'''
......@@ -399,7 +399,7 @@ class ConsoleView(gtk.TextView):
def showPrompt(self, prompt):
GObject.idle_add(self._showPrompt, prompt)
GLib.idle_add(self._showPrompt, prompt)
def _showPrompt(self, prompt):
'''
......@@ -413,7 +413,7 @@ class ConsoleView(gtk.TextView):
self.text_buffer.get_end_iter())
def changeLine(self, text):
GObject.idle_add(self._changeLine, text)
GLib.idle_add(self._changeLine, text)
def _changeLine(self, text):
'''
......@@ -440,7 +440,7 @@ class ConsoleView(gtk.TextView):
return rv
def showReturned(self, text):
GObject.idle_add(self._showReturned, text)
GLib.idle_add(self._showReturned, text)
def _showReturned(self, text):
'''
......
......@@ -308,7 +308,7 @@ class ValidatorViewport(ViewportPlugin):
response = save_dialog.run()
if response == gtk.ResponseType.OK:
self.save_to = open(save_dialog.get_filename(), 'w')
GObject.idle_add(self._writeFile)
GLib.idle_add(self._writeFile)
save_dialog.destroy()
def _onClear(self, button):
......@@ -346,7 +346,7 @@ class ValidatorViewport(ViewportPlugin):
self.write_in_progress = True
self._setDefaultSaveVars()
# register an idle callback
self.idle_save_id = GObject.idle_add(self._onSaveIdle)
self.idle_save_id = GLib.idle_add(self._onSaveIdle)
self.progress.set_text(_('Saving'))
# disable controls
self.validate.set_sensitive(False)
......@@ -358,7 +358,7 @@ class ValidatorViewport(ViewportPlugin):
components to their enabled states.
'''
# stop callbacks
GObject.source_remove(self.idle_save_id)
GLib.source_remove(self.idle_save_id)
# reset progress
self.progress.set_fraction(0.0)
self.progress.set_text(_('Idle'))
......@@ -394,7 +394,7 @@ class ValidatorViewport(ViewportPlugin):
# build our walk generator
self.walk = self._traverse(self.acc, state)
# register an idle callback
self.idle_validate_id = GObject.idle_add(self._onValidateIdle)
self.idle_validate_id = GLib.idle_add(self._onValidateIdle)
self.progress.set_text(_('Validating'))
# disable controls
self.schema.set_sensitive(False)
......@@ -408,7 +408,7 @@ class ValidatorViewport(ViewportPlugin):
various UI components to their enabled states.
'''
# stop callbacks
GObject.source_remove(self.idle_validate_id)
GLib.source_remove(self.idle_validate_id)
# destroy generator
self.walk = None
# reset progress
......
......@@ -17,7 +17,7 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php}
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import Wnck as wnck
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Atk as atk
import os, sys, locale
......@@ -100,7 +100,7 @@ class Main(Tools):
'''
Runs the app.
'''
GObject.timeout_add(200, self._pumpEvents)
GLib.timeout_add(200, self._pumpEvents)
try:
pyatspi.Registry.start(async=True, gil=False)
except KeyboardInterrupt:
......
......@@ -15,6 +15,7 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php}
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from gi.repository import GObject
import pyatspi
......@@ -222,7 +223,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
self._populating_tasks += 1
if self._populating_tasks == 1:
self.emit('start-populating')
GObject.idle_add(self._popOnIdle, row_reference)
GLib.idle_add(self._popOnIdle, row_reference)
def _childrenIndexesInParent(self, accessible):
'''
......@@ -754,7 +755,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
# We do this because an application won't have an icon loaded in
# the window manager when it is first registered to at-spi
if new_child == new_child.getApplication():
GObject.timeout_add(1000, self._refreshIcon, new_child)
GLib.timeout_add(1000, self._refreshIcon, new_child)
def _refreshIcon(self, app):
'''
......@@ -947,7 +948,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
@type iter: L{gtk.TreeIter}
'''
# TODO: Remove idle_add when at-spi2 reentrancy issues are fixed
GObject.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter_id)
GLib.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter_id)
def _accCellDataFuncReal(self, tvc, cellrenderer, model, iter_id):
'''
......
......@@ -15,6 +15,7 @@ import gi
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GLib
from gi.repository import GObject
from gi.repository.Gio import Settings as GSettings
#from gi.repository import cairo
......@@ -156,7 +157,7 @@ class Node(GObject.GObject, Tools):
gdk.CapStyle.BUTT, gdk.JoinStyle.MITER)
self.inv = gtk.Invisible()
self.inv.set_screen(screen)
GObject.timeout_add(30, self._drawRectangle)
GLib.timeout_add(30, self._drawRectangle)
def _drawRectangle(self):
'''
......@@ -244,7 +245,7 @@ class _HighLight(gtk.Window):
def highlight(self, duration=500):
if duration > 0:
GObject.timeout_add(duration, lambda w: w.destroy(), self)
GLib.timeout_add(duration, lambda w: w.destroy(), self)
self.show_all()
else:
self.destroy()
......@@ -341,7 +342,7 @@ class _HighLight(gtk.Window):
#
# def highlight(self, duration=500):
# if duration > 0:
# GObject.timeout_add(duration, lambda w: w.destroy(), self)
# GLib.timeout_add(duration, lambda w: w.destroy(), self)
# self.show_all()
# else:
# self.destroy()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment