Switch deprecated GObject functions to GLib.

This commit is contained in:
auouymous 2022-08-13 00:33:28 -06:00
parent fdc2bb2eb9
commit f05ce1fc0a
6 changed files with 19 additions and 19 deletions

View File

@ -13,7 +13,7 @@ from gpodder import util
import gi # isort:skip
gi.require_version('Unity', '7.0') # isort:skip
from gi.repository import GObject, Unity # isort:skip
from gi.repository import GLib, Unity # isort:skip
_ = gpodder.gettext
@ -59,4 +59,4 @@ class gPodderExtension:
self.launcher_entry = None
def on_download_progress(self, progress):
GObject.idle_add(self.launcher_entry.set_progress, float(progress))
GLib.idle_add(self.launcher_entry.set_progress, float(progress))

View File

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from gi.repository import GObject, Gtk, Pango
from gi.repository import GLib, Gtk, Pango
import gpodder
from gpodder.gtkui.widgets import SpinningProgressIndicator
@ -43,7 +43,7 @@ class ProgressIndicator(object):
self._initial_message = None
self._initial_progress = None
self._progress_set = False
self.source_id = GObject.timeout_add(self.DELAY, self._create_progress)
self.source_id = GLib.timeout_add(self.DELAY, self._create_progress)
def _on_delete_event(self, window, event):
if self.cancellable:
@ -83,8 +83,8 @@ class ProgressIndicator(object):
self.dialog.set_image(self.indicator)
self.dialog.show_all()
GObject.source_remove(self.source_id)
self.source_id = GObject.timeout_add(self.INTERVAL, self._update_gui)
GLib.source_remove(self.source_id)
self.source_id = GLib.timeout_add(self.INTERVAL, self._update_gui)
return False
def _update_gui(self):
@ -110,4 +110,4 @@ class ProgressIndicator(object):
def on_finished(self):
if self.dialog is not None:
self.dialog.destroy()
GObject.source_remove(self.source_id)
GLib.source_remove(self.source_id)

View File

@ -20,7 +20,7 @@
import html
from gi.repository import GObject, Gtk
from gi.repository import GLib, GObject, Gtk
class TagCloud(Gtk.Layout):
@ -100,7 +100,7 @@ class TagCloud(Gtk.Layout):
def unrelayout():
self._in_relayout = False
return False
GObject.idle_add(unrelayout)
GLib.idle_add(unrelayout)
GObject.type_register(TagCloud)

View File

@ -60,7 +60,7 @@ from .widgets import SimpleMessageArea
import gi # isort:skip
gi.require_version('Gtk', '3.0') # isort:skip
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk, Pango # isort:skip
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, Gtk, Pango # isort:skip
logger = logging.getLogger(__name__)
@ -1124,7 +1124,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
self.things_adding_tasks -= 1
if not self.download_list_update_enabled:
self.update_downloads_list()
GObject.timeout_add(1500, self.update_downloads_list)
GLib.timeout_add(1500, self.update_downloads_list)
self.download_list_update_enabled = True
def cleanup_downloads(self):
@ -2350,7 +2350,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
if remaining_seconds > 3600:
# timeout an hour early in the event daylight savings changes the clock forward
remaining_seconds = remaining_seconds - 3600
GObject.timeout_add(remaining_seconds * 1000, self.refresh_episode_dates)
GLib.timeout_add(remaining_seconds * 1000, self.refresh_episode_dates)
def update_podcast_list_model(self, urls=None, selected=False, select_url=None,
sections_changed=False):
@ -3697,7 +3697,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
def restart_auto_update_timer(self):
if self._auto_update_timer_source_id is not None:
logger.debug('Removing existing auto update timer.')
GObject.source_remove(self._auto_update_timer_source_id)
GLib.source_remove(self._auto_update_timer_source_id)
self._auto_update_timer_source_id = None
if (self.config.auto_update_feeds and
@ -3705,7 +3705,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
interval = 60 * 1000 * self.config.auto_update_frequency
logger.debug('Setting up auto update timer with interval %d.',
self.config.auto_update_frequency)
self._auto_update_timer_source_id = GObject.timeout_add(
self._auto_update_timer_source_id = GLib.timeout_add(
interval, self._on_auto_update_timer)
def _on_auto_update_timer(self):

View File

@ -30,7 +30,7 @@ import re
import time
from itertools import groupby
from gi.repository import GdkPixbuf, GObject, Gtk
from gi.repository import GdkPixbuf, GLib, GObject, Gtk
import gpodder
from gpodder import coverart, model, query, util
@ -329,10 +329,10 @@ class EpisodeListModel(Gtk.ListStore):
def _update_from_episodes(self, episodes, include_description):
if self.background_update_tag is not None:
GObject.source_remove(self.background_update_tag)
GLib.source_remove(self.background_update_tag)
self.background_update = BackgroundUpdate(self, episodes, include_description)
self.background_update_tag = GObject.idle_add(self._update_background)
self.background_update_tag = GLib.idle_add(self._update_background)
def _update_background(self):
if self.background_update is not None:

View File

@ -1318,8 +1318,8 @@ def idle_add(func, *args):
as possible from the main UI thread.
"""
if gpodder.ui.gtk:
from gi.repository import GObject
GObject.idle_add(func, *args)
from gi.repository import GLib
GLib.idle_add(func, *args)
else:
func(*args)