From 89bfa066d4f09ef40a62d78550994a4afbc99003 Mon Sep 17 00:00:00 2001 From: Olivier Duchateau Date: Sun, 28 Jul 2019 12:07:13 +0200 Subject: [PATCH] Fix deprecated methods with Gtk >= 3.22.0 --- README | 4 ++-- catfish/CatfishWindow.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README b/README index 698e264..4fb1000 100644 --- a/README +++ b/README @@ -23,8 +23,8 @@ Dependencies ------------- * Python 2 or 3 -* GLib / GObject Python bindings: GdkPixbuf, GLib, GTK 3, Pango, Cairo -* Pexpect +* GLib / GObject Python bindings: GdkPixbuf, GLib, GTK 3, Pango, Cairo, Wnck +* [Pexpect](https://pypi.org/project/pexpect/) * locate or mlocate Installation and Bugs diff --git a/catfish/CatfishWindow.py b/catfish/CatfishWindow.py index 6d39ac6..4e87a5f 100644 --- a/catfish/CatfishWindow.py +++ b/catfish/CatfishWindow.py @@ -40,6 +40,9 @@ gi.require_version('Gdk', '3.0') gi.require_version('GdkPixbuf', '2.0') gi.require_version('Gtk', '3.0') from gi.repository import GLib, GObject, Pango, Gdk, GdkPixbuf, Gtk +if helpers.check_gobject_version(3, 22, 0): + gi.require_version('Wnck', '3.0') + from gi.repository import Wnck from catfish.AboutCatfishDialog import AboutCatfishDialog from catfish.CatfishSearchEngine import CatfishSearchEngine @@ -324,8 +327,15 @@ class CatfishWindow(Window): self.thumbnailer = Thumbnailer.Thumbnailer() def get_screen_size(self): - s = Gdk.Screen.get_default() - return (s.get_width(), s.get_height()) + if helpers.check_gtk_version(3, 22, 0): + # It is a Wnck.Screen object + s = Wnck.Screen.get_default() + else: + # It is a Gdk.Screen object + s = Gdk.Screen.get_default() + + if s is not None: + return (s.get_width(), s.get_height()) def get_display_size(self): d = Gdk.Display.get_default() -- 2.21.0