Skip to content

Commit 617297c

Browse files
committed
Use GLib.idle_add() instead of deprecated GObject.idle_add().
1 parent 7c9579b commit 617297c

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

rednotebook/gui/clouds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import logging
2222
import re
2323

24-
from gi.repository import GObject, Gtk
24+
from gi.repository import GLib, Gtk
2525

2626
from rednotebook import data
2727
from rednotebook.gui import browser
@@ -105,7 +105,7 @@ def update(self, force_update=False):
105105
if not force_update:
106106
return
107107

108-
GObject.idle_add(self._update)
108+
GLib.idle_add(self._update)
109109

110110
def get_categories_counter(self):
111111
counter = defaultdict(int)

rednotebook/gui/main_window.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from unittest import mock
2424
import urllib.parse
2525

26-
from gi.repository import Gdk, GdkPixbuf, GObject, Gtk, GtkSource, Pango
26+
from gi.repository import Gdk, GdkPixbuf, GLib, GObject, Gtk, GtkSource, Pango
2727

2828
from rednotebook.gui.options import OptionsManager
2929
from rednotebook import info, templates
@@ -446,7 +446,7 @@ def on_edit_button_clicked(self, button):
446446
self.change_mode(preview=False)
447447
# Select (not only highlight) previously selected text by giving focus
448448
# to the day editor.
449-
GObject.idle_add(self.day_text_field.day_text_view.grab_focus)
449+
GLib.idle_add(self.day_text_field.day_text_view.grab_focus)
450450

451451
def on_preview_button_clicked(self, button):
452452
self.journal.save_old_day()
@@ -835,8 +835,8 @@ def show_day(self, new_day):
835835

836836
if self.search_text:
837837
# If a search is currently made, scroll to the text and return.
838-
GObject.idle_add(self.scroll_to_text, self.search_text)
839-
GObject.idle_add(self.highlight, self.search_text)
838+
GLib.idle_add(self.scroll_to_text, self.search_text)
839+
GLib.idle_add(self.highlight, self.search_text)
840840
return
841841

842842
def show_template(self, title, text):

rednotebook/gui/search.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from xml.sax.saxutils import escape
2020

21-
from gi.repository import GObject, Gtk
21+
from gi.repository import GLib, GObject, Gtk
2222

2323
from rednotebook.gui.customwidgets import CustomComboBoxEntry, CustomListView
2424
from rednotebook.util import dates
@@ -65,9 +65,7 @@ def search(self, search_text):
6565

6666
# Scroll to query.
6767
if search_text:
68-
GObject.idle_add(
69-
self.main_window.day_text_field.scroll_to_text, search_text
70-
)
68+
GLib.idle_add(self.main_window.day_text_field.scroll_to_text, search_text)
7169

7270
tags = []
7371
queries = []

rednotebook/util/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from urllib.request import urlopen
2626
import webbrowser
2727

28-
from gi.repository import GObject, Gtk
28+
from gi.repository import GLib, Gtk
2929

3030
from rednotebook import info
3131
from rednotebook.util import filesystem
@@ -165,7 +165,7 @@ def _check_new_version(journal, current_version, startup):
165165
)
166166

167167
if newer_version_available or not startup:
168-
GObject.idle_add(
168+
GLib.idle_add(
169169
_show_update_dialog, journal, current_version, new_version, startup
170170
)
171171

0 commit comments

Comments
 (0)