Skip to content

Commit

Permalink
Use GLib.idle_add() instead of deprecated GObject.idle_add().
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Nov 10, 2024
1 parent 7c9579b commit 617297c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions rednotebook/gui/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
import re

from gi.repository import GObject, Gtk
from gi.repository import GLib, Gtk

from rednotebook import data
from rednotebook.gui import browser
Expand Down Expand Up @@ -105,7 +105,7 @@ def update(self, force_update=False):
if not force_update:
return

GObject.idle_add(self._update)
GLib.idle_add(self._update)

def get_categories_counter(self):
counter = defaultdict(int)
Expand Down
8 changes: 4 additions & 4 deletions rednotebook/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from unittest import mock
import urllib.parse

from gi.repository import Gdk, GdkPixbuf, GObject, Gtk, GtkSource, Pango
from gi.repository import Gdk, GdkPixbuf, GLib, GObject, Gtk, GtkSource, Pango

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

def on_preview_button_clicked(self, button):
self.journal.save_old_day()
Expand Down Expand Up @@ -835,8 +835,8 @@ def show_day(self, new_day):

if self.search_text:
# If a search is currently made, scroll to the text and return.
GObject.idle_add(self.scroll_to_text, self.search_text)
GObject.idle_add(self.highlight, self.search_text)
GLib.idle_add(self.scroll_to_text, self.search_text)
GLib.idle_add(self.highlight, self.search_text)
return

def show_template(self, title, text):
Expand Down
6 changes: 2 additions & 4 deletions rednotebook/gui/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from xml.sax.saxutils import escape

from gi.repository import GObject, Gtk
from gi.repository import GLib, GObject, Gtk

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

# Scroll to query.
if search_text:
GObject.idle_add(
self.main_window.day_text_field.scroll_to_text, search_text
)
GLib.idle_add(self.main_window.day_text_field.scroll_to_text, search_text)

tags = []
queries = []
Expand Down
4 changes: 2 additions & 2 deletions rednotebook/util/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from urllib.request import urlopen
import webbrowser

from gi.repository import GObject, Gtk
from gi.repository import GLib, Gtk

from rednotebook import info
from rednotebook.util import filesystem
Expand Down Expand Up @@ -165,7 +165,7 @@ def _check_new_version(journal, current_version, startup):
)

if newer_version_available or not startup:
GObject.idle_add(
GLib.idle_add(
_show_update_dialog, journal, current_version, new_version, startup
)

Expand Down

0 comments on commit 617297c

Please sign in to comment.