Philipp Hörist pushed to branch master at gajim / gajim


Commits:
f828118f by Daniel Brötzmann at 2019-06-18T10:40:23Z
FileChooser: Fix deprecation warnings

Fixes PyGIDeprecationWarning: GObject.GError is deprecated
and button initialization, see: 
https://wiki.gnome.org/action/show/Projects/PyGObject/
InitializerDeprecations?action=show&redirect=PyGObject%2FInitializerDeprecations

- - - - -


1 changed file:

- gajim/gtk/filechoosers.py


Changes:

=====================================
gajim/gtk/filechoosers.py
=====================================
@@ -21,7 +21,7 @@ from pathlib import Path
 
 from gi.repository import Gtk
 from gi.repository import GdkPixbuf
-from gi.repository import GObject
+from gi.repository import GLib
 
 from gajim.common import app
 from gajim.common.i18n import _
@@ -76,7 +76,7 @@ class BaseFileChooser:
         try:
             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                 path_to_file, *self._preivew_size)
-        except GObject.GError:
+        except GLib.GError:
             preview.clear()
             return
         filechooser.get_preview_widget().set_from_pixbuf(pixbuf)
@@ -173,10 +173,12 @@ class GtkFileChooserDialog(Gtk.FileChooserDialog, 
BaseFileChooser):
             self,
             title=self._title,
             action=self._action,
-            buttons=[Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
-                     Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT],
             transient_for=transient_for)
 
+        self.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
+        open_button = self.add_button(_('_Open'), Gtk.ResponseType.ACCEPT)
+        open_button.get_style_context().add_class('suggested-action')
+
         self.set_current_folder(path or str(Path.home()))
         if file_name is not None:
             self.set_current_name(file_name)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/f828118f2af25c2fa8d3d2c5054a00c840e7aed2

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/f828118f2af25c2fa8d3d2c5054a00c840e7aed2
You're receiving this email because of your account on dev.gajim.org.

_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to