From 0b4ff56fcc6f2caca0ee171d79a5b257e32a4822 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sat, 28 Mar 2020 17:55:44 -0400 Subject: [PATCH 1/3] Update copyright years --- src/usr/bin/diffuse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 0208c17..46768be 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -67,7 +67,7 @@ _ = gettext.gettext APP_NAME = 'Diffuse' VERSION = '0.5.0' COPYRIGHT = _('''Copyright © 2006-2014 Derrick Moser -Copyright © 2015-2016 Romain Failliot''') +Copyright © 2015-2020 Romain Failliot''') WEBSITE = 'https://github.com/MightyCreak/diffuse' # process help options From c1b88634e515ae55af56606ac4ab6e8971ea6e58 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sat, 28 Mar 2020 18:06:23 -0400 Subject: [PATCH 2/3] Fix deprecation warning about Gdk.Screen [Gdk.Screen.width()](https://lazka.github.io/pgi-docs/#Gdk-3.0/classes/Screen.html#Gdk.Screen.width) and [.height()](https://lazka.github.io/pgi-docs/#Gdk-3.0/classes/Screen.html#Gdk.Screen.height) are deprecated since 3.22. The equivalent solution is to get the first monitor of the default display. --- src/usr/bin/diffuse | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 46768be..58412eb 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -7423,11 +7423,14 @@ class Diffuse(Gtk.Window): # number of created viewers (used to label some tabs) self.viewer_count = 0 + # get monitor resolution + monitor_geometry = Gdk.Display.get_default().get_monitor(0).get_geometry() + # state information that should persist across sessions self.bool_state = { 'window_maximized': False, 'search_matchcase': False, 'search_backwards': False } self.int_state = { 'window_width': 1024, 'window_height': 768 } - self.int_state['window_x'] = max(0, (Gdk.Screen.width() - self.int_state['window_width']) / 2) - self.int_state['window_y'] = max(0, (Gdk.Screen.height() - self.int_state['window_height']) / 2) + self.int_state['window_x'] = max(0, (monitor_geometry.width - self.int_state['window_width']) / 2) + self.int_state['window_y'] = max(0, (monitor_geometry.height - self.int_state['window_height']) / 2) self.connect('configure-event', self.configure_cb) self.connect('window-state-event', self.window_state_cb) From ff18e4a342a200e47541acfdcd4fe3a5dce5af06 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sat, 28 Mar 2020 18:10:42 -0400 Subject: [PATCH 3/3] Fix deprecation warnings for Gtk.Widget.render_icon [Gtk.Widget.render_icon](https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Widget.html#Gtk.Widget.render_icon) has been deprecated since 3.0. The replacement solution is to use Gtk.IconTheme.load_icon. Most of `Gtk.STOCK_*` value are deprecated: * `Gtk.STOCK_NEW` is now "document-new" * `Gtk.STOCK_GO_FORWARD` is now "go-next" * `Gtk.STOCK_GO_BACK` is now "go-previous" --- src/usr/bin/diffuse | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 58412eb..398fcb0 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -7450,9 +7450,12 @@ class Diffuse(Gtk.Window): DIFFUSE_STOCK_LEFT_RIGHT = 'diffuse-left-right' DIFFUSE_STOCK_RIGHT_LEFT = 'diffuse-right-left' + default_theme = Gtk.IconTheme.get_default() + icon_size = Gtk.IconSize.lookup(Gtk.IconSize.LARGE_TOOLBAR).height factory = Gtk.IconFactory() + # render the base item used to indicate a new document - p0 = self.render_icon(Gtk.STOCK_NEW, Gtk.IconSize.LARGE_TOOLBAR) + p0 = default_theme.load_icon("document-new", icon_size, 0) w, h = p0.get_width(), p0.get_height() # render new 2-way merge icon @@ -7478,8 +7481,8 @@ class Diffuse(Gtk.Window): factory.add(DIFFUSE_STOCK_NEW_3WAY_MERGE, Gtk.IconSet.new_from_pixbuf(p)) # render the left and right arrow we will use in our custom icons - p0 = self.render_icon(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.LARGE_TOOLBAR) - p1 = self.render_icon(Gtk.STOCK_GO_BACK, Gtk.IconSize.LARGE_TOOLBAR) + p0 = default_theme.load_icon("go-next", icon_size, 0) + p1 = default_theme.load_icon("go-previous", icon_size, 0) w, h, s = p0.get_width(), p0.get_height(), 0.65 sw, sh = int(s * w), int(s * h) w1, h1 = w - sw, h - sh