@@ -57,13 +57,13 @@ class NotebookTab(Gtk.EventBox):
5757 signals can be connected for MMB and RMB button presses.
5858 """
5959
60- def __init__ (self , name : str , stock : str ) -> None :
60+ def __init__ (self , name : str , icon_name : str ) -> None :
6161 Gtk .EventBox .__init__ (self )
6262 self .set_visible_window (False )
6363 hbox = Gtk .Box (orientation = Gtk .Orientation .HORIZONTAL , spacing = 0 )
64- if stock is not None :
64+ if icon_name is not None :
6565 image = Gtk .Image ()
66- image .set_from_stock ( stock , Gtk .IconSize .MENU )
66+ image .set_from_icon_name ( icon_name , Gtk .IconSize .MENU )
6767 hbox .pack_start (image , False , False , 5 )
6868 image .show ()
6969
@@ -78,7 +78,7 @@ def __init__(self, name: str, stock: str) -> None:
7878 button = Gtk .Button ()
7979 button .set_relief (Gtk .ReliefStyle .NONE )
8080 image = Gtk .Image ()
81- image .set_from_stock ( Gtk . STOCK_CLOSE , Gtk .IconSize .MENU )
81+ image .set_from_icon_name ( 'window-close-symbolic' , Gtk .IconSize .MENU )
8282 button .add (image )
8383 image .show ()
8484 button .set_tooltip_text (_ ('Close Tab' ))
@@ -124,10 +124,10 @@ class PaneHeader(Gtk.Box):
124124 def __init__ (self ) -> None :
125125 Gtk .Box .__init__ (self , orientation = Gtk .Orientation .HORIZONTAL , spacing = 0 )
126126 button_specs = [
127- [Gtk . STOCK_OPEN , self .button_cb , 'open' , _ ('Open File...' )],
128- [Gtk . STOCK_REFRESH , self .button_cb , 'reload' , _ ('Reload File' )],
129- [Gtk . STOCK_SAVE , self .button_cb , 'save' , _ ('Save File' )],
130- [Gtk . STOCK_SAVE_AS , self .button_cb , 'save_as' , _ ('Save File As...' )]
127+ ['document-open-symbolic' , self .button_cb , 'open' , _ ('Open File...' )],
128+ ['view-refresh-symbolic' , self .button_cb , 'reload' , _ ('Reload File' )],
129+ ['document-save-symbolic' , self .button_cb , 'save' , _ ('Save File' )],
130+ ['document-save-as-symbolic' , self .button_cb , 'save_as' , _ ('Save File As...' )]
131131 ]
132132 _append_buttons (self , Gtk .IconSize .MENU , button_specs )
133133
@@ -307,9 +307,9 @@ def loadFromInfo(self, f: int, info: FileInfo) -> None:
307307 Gtk .ButtonsType .NONE , _ ('Save changes before loading the new file?' )
308308 )
309309 dialog .set_title (constants .APP_NAME )
310- dialog .add_button (Gtk . STOCK_CANCEL , Gtk .ResponseType .CANCEL )
311- dialog .add_button (Gtk . STOCK_NO , Gtk .ResponseType .REJECT )
312- dialog .add_button (Gtk . STOCK_YES , Gtk .ResponseType .OK )
310+ dialog .add_button (_ ( '_Cancel' ) , Gtk .ResponseType .CANCEL )
311+ dialog .add_button (_ ( '_No' ) , Gtk .ResponseType .REJECT )
312+ dialog .add_button (_ ( '_Yes' ) , Gtk .ResponseType .OK )
313313 dialog .set_default_response (Gtk .ResponseType .CANCEL )
314314 response = dialog .run ()
315315 dialog .destroy ()
@@ -444,7 +444,7 @@ def open_file(self, f: int, reload: bool = False) -> None:
444444 self .get_toplevel (),
445445 self .prefs ,
446446 Gtk .FileChooserAction .OPEN ,
447- Gtk . STOCK_OPEN ,
447+ _ ( '_Open' ) ,
448448 True
449449 )
450450 if info .name is not None :
@@ -497,7 +497,7 @@ def save_file(self, f: int, save_as: bool = False) -> bool:
497497 self .get_toplevel (),
498498 self .prefs ,
499499 Gtk .FileChooserAction .SAVE ,
500- Gtk . STOCK_SAVE
500+ _ ( '_Save' )
501501 )
502502 if name is not None :
503503 dialog .set_filename (os .path .abspath (name ))
@@ -917,25 +917,25 @@ def __init__(self, rc_dir, **kwargs):
917917 [DIFFUSE_STOCK_NEW_2WAY_MERGE , self .new_2_way_file_merge_cb , None , _ ('New 2-Way File Merge' )], # noqa: E501
918918 [DIFFUSE_STOCK_NEW_3WAY_MERGE , self .new_3_way_file_merge_cb , None , _ ('New 3-Way File Merge' )], # noqa: E501
919919 [],
920- [Gtk . STOCK_EXECUTE , self .button_cb , 'realign-all' , _ ('Realign All' )],
921- [Gtk . STOCK_GOTO_TOP , self .button_cb , 'first-difference' , _ ('First Difference' )],
922- [Gtk . STOCK_GO_UP , self .button_cb , 'previous-difference' , _ ('Previous Difference' )],
923- [Gtk . STOCK_GO_DOWN , self .button_cb , 'next-difference' , _ ('Next Difference' )],
924- [Gtk . STOCK_GOTO_BOTTOM , self .button_cb , 'last-difference' , _ ('Last Difference' )],
920+ ['system-run-symbolic' , self .button_cb , 'realign-all' , _ ('Realign All' )],
921+ ['go-top-symbolic' , self .button_cb , 'first-difference' , _ ('First Difference' )],
922+ ['go-up-symbolic' , self .button_cb , 'previous-difference' , _ ('Previous Difference' )],
923+ ['go-down-symbolic' , self .button_cb , 'next-difference' , _ ('Next Difference' )],
924+ ['go-bottom-symbolic' , self .button_cb , 'last-difference' , _ ('Last Difference' )],
925925 [],
926- [Gtk . STOCK_GOTO_LAST , self .button_cb , 'copy-selection-right' , _ ('Copy Selection Right' )], # noqa: E501
927- [Gtk . STOCK_GOTO_FIRST , self .button_cb , 'copy-selection-left' , _ ('Copy Selection Left' )],
928- [Gtk . STOCK_GO_FORWARD , self .button_cb , 'copy-left-into-selection' , _ ('Copy Left Into Selection' )], # noqa: E501
929- [Gtk . STOCK_GO_BACK , self .button_cb , 'copy-right-into-selection' , _ ('Copy Right Into Selection' )], # noqa: E501
926+ ['go-last-symbolic' , self .button_cb , 'copy-selection-right' , _ ('Copy Selection Right' )], # noqa: E501
927+ ['go-first-symbolic' , self .button_cb , 'copy-selection-left' , _ ('Copy Selection Left' )],
928+ ['go-next-symbolic' , self .button_cb , 'copy-left-into-selection' , _ ('Copy Left Into Selection' )], # noqa: E501
929+ ['go-previous-symbolic' , self .button_cb , 'copy-right-into-selection' , _ ('Copy Right Into Selection' )], # noqa: E501
930930 [DIFFUSE_STOCK_LEFT_RIGHT , self .button_cb , 'merge-from-left-then-right' , _ ('Merge From Left Then Right' )], # noqa: E501
931931 [DIFFUSE_STOCK_RIGHT_LEFT , self .button_cb , 'merge-from-right-then-left' , _ ('Merge From Right Then Left' )], # noqa: E501
932932 [],
933- [Gtk . STOCK_UNDO , self .button_cb , 'undo' , _ ('Undo' )],
934- [Gtk . STOCK_REDO , self .button_cb , 'redo' , _ ('Redo' )],
935- [Gtk . STOCK_CUT , self .button_cb , 'cut' , _ ('Cut' )],
936- [Gtk . STOCK_COPY , self .button_cb , 'copy' , _ ('Copy' )],
937- [Gtk . STOCK_PASTE , self .button_cb , 'paste' , _ ('Paste' )],
938- [Gtk . STOCK_CLEAR , self .button_cb , 'clear-edits' , _ ('Clear Edits' )]
933+ ['edit-undo-symbolic' , self .button_cb , 'undo' , _ ('Undo' )],
934+ ['edit-redo-symbolic' , self .button_cb , 'redo' , _ ('Redo' )],
935+ ['edit-cut-symbolic' , self .button_cb , 'cut' , _ ('Cut' )],
936+ ['edit-copy-symbolic' , self .button_cb , 'copy' , _ ('Copy' )],
937+ ['edit-paste-symbolic' , self .button_cb , 'paste' , _ ('Paste' )],
938+ ['edit-clear-symbolic' , self .button_cb , 'clear-edits' , _ ('Clear Edits' )]
939939 ]
940940 _append_buttons (hbox , Gtk .IconSize .LARGE_TOOLBAR , button_specs )
941941 # avoid the button bar from dictating the minimum window size
@@ -1170,11 +1170,11 @@ def confirmCloseViewers(self, viewers: List[FileDiffViewer]) -> bool:
11701170 dialog .vbox .pack_start (sw , True , True , 0 )
11711171 sw .show ()
11721172 # add custom set of action buttons
1173- dialog .add_button (Gtk . STOCK_CANCEL , Gtk .ResponseType .CANCEL )
1173+ dialog .add_button (_ ( '_Cancel' ) , Gtk .ResponseType .CANCEL )
11741174 button = Gtk .Button .new_with_mnemonic (_ ('Close _Without Saving' ))
11751175 dialog .add_action_widget (button , Gtk .ResponseType .REJECT )
11761176 button .show ()
1177- dialog .add_button (Gtk . STOCK_SAVE , Gtk .ResponseType .OK )
1177+ dialog .add_button (_ ( '_Save' ) , Gtk .ResponseType .OK )
11781178 dialog .set_default_response (Gtk .ResponseType .CANCEL )
11791179 response = dialog .run ()
11801180 dialog .destroy ()
@@ -1288,7 +1288,7 @@ def syntax_changed_cb(self, widget, s):
12881288 def newFileDiffViewer (self , n : int ) -> FileDiffViewer :
12891289 self .viewer_count += 1
12901290 tabname = _ ('File Merge %d' ) % (self .viewer_count , )
1291- tab = NotebookTab (tabname , Gtk . STOCK_FILE )
1291+ tab = NotebookTab (tabname , 'text-x-generic-symbolic' )
12921292 viewer = FileDiffViewer (n , self .prefs , tabname )
12931293 tab .button .connect ('clicked' , self .remove_tab_cb , viewer )
12941294 tab .connect ('button-press-event' , self .notebooktab_button_press_cb , viewer )
@@ -1476,7 +1476,7 @@ def open_file_in_new_tab_cb(self, widget, data):
14761476 self .get_toplevel (),
14771477 self .prefs ,
14781478 Gtk .FileChooserAction .OPEN ,
1479- Gtk . STOCK_OPEN ,
1479+ _ ( '_Open' ) ,
14801480 True
14811481 )
14821482 dialog .set_default_response (Gtk .ResponseType .OK )
@@ -1499,7 +1499,7 @@ def open_modified_files_cb(self, widget, data):
14991499 parent ,
15001500 self .prefs ,
15011501 Gtk .FileChooserAction .SELECT_FOLDER ,
1502- Gtk . STOCK_OPEN
1502+ _ ( '_Open' )
15031503 )
15041504 dialog .set_default_response (Gtk .ResponseType .OK )
15051505 accept = (dialog .run () == Gtk .ResponseType .OK )
@@ -1522,7 +1522,7 @@ def open_commit_cb(self, widget, data):
15221522 _ ('Choose Folder With Commit' ),
15231523 parent , self .prefs ,
15241524 Gtk .FileChooserAction .SELECT_FOLDER ,
1525- Gtk . STOCK_OPEN ,
1525+ _ ( '_Open' ) ,
15261526 True
15271527 )
15281528 dialog .set_default_response (Gtk .ResponseType .OK )
@@ -1806,12 +1806,15 @@ def _append_buttons(box, size, specs):
18061806 """Convenience method for packing buttons into a container."""
18071807 for spec in specs :
18081808 if len (spec ) > 0 :
1809- (stock_id , cb , cb_data , label ) = spec
1809+ (icon_name , cb , cb_data , label ) = spec
18101810 button = Gtk .Button ()
18111811 button .set_relief (Gtk .ReliefStyle .NONE )
18121812 button .set_can_focus (False )
18131813 image = Gtk .Image ()
1814- image .set_from_stock (stock_id , size )
1814+ if icon_name .startswith ('diffuse' ):
1815+ image .set_from_stock (icon_name , size )
1816+ else :
1817+ image .set_from_icon_name (icon_name , size )
18151818 button .add (image )
18161819 image .show ()
18171820 button .connect ('clicked' , cb , cb_data )
0 commit comments