2727 # auto-backend selection logic correctly skips.
2828 raise ImportError from e
2929
30- from gi .repository import GLib , GObject , Gtk , Gdk
30+ from gi .repository import Gio , GLib , GObject , Gtk , Gdk
3131
3232
3333_log = logging .getLogger (__name__ )
@@ -464,9 +464,11 @@ def __init__(self, canvas, window):
464464 if text is None :
465465 self .insert (Gtk .SeparatorToolItem (), - 1 )
466466 continue
467- image = Gtk .Image ()
468- image .set_from_file (
469- str (cbook ._get_data_path ('images' , image_file + '.png' )))
467+ image = Gtk .Image .new_from_gicon (
468+ Gio .Icon .new_for_string (
469+ str (cbook ._get_data_path ('images' ,
470+ f'{ image_file } -symbolic.svg' ))),
471+ Gtk .IconSize .LARGE_TOOLBAR )
470472 self ._gtk_ids [text ] = tbutton = (
471473 Gtk .ToggleToolButton () if callback in ['zoom' , 'pan' ] else
472474 Gtk .ToolButton ())
@@ -623,7 +625,7 @@ def set_history_buttons(self):
623625
624626
625627class ToolbarGTK3 (ToolContainerBase , Gtk .Box ):
626- _icon_extension = '.png '
628+ _icon_extension = '-symbolic.svg '
627629
628630 def __init__ (self , toolmanager ):
629631 ToolContainerBase .__init__ (self , toolmanager )
@@ -644,8 +646,9 @@ def add_toolitem(self, name, group, position, image_file, description,
644646 tbutton .set_label (name )
645647
646648 if image_file is not None :
647- image = Gtk .Image ()
648- image .set_from_file (image_file )
649+ image = Gtk .Image .new_from_gicon (
650+ Gio .Icon .new_for_string (image_file ),
651+ Gtk .IconSize .LARGE_TOOLBAR )
649652 tbutton .set_icon_widget (image )
650653
651654 if position is None :
0 commit comments