Commit f828118f authored by Daniel Brötzmann's avatar Daniel Brötzmann

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
parent 835cf86c
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment