Replace Gtk.STOCK_ button labels with strings

This commit is contained in:
Teemu Ikonen 2021-08-12 22:31:39 +03:00
parent 282996cd16
commit cb61d76474
6 changed files with 20 additions and 20 deletions

View File

@ -38,8 +38,8 @@ class gPodderExtension:
dlg = Gtk.FileChooserDialog(title=_('Save video'),
parent=self.gpodder.get_dialog_parent(),
action=Gtk.FileChooserAction.SAVE)
dlg.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dlg.add_button(Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
dlg.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dlg.add_button(_('_Save'), Gtk.ResponseType.OK)
if dlg.run() == Gtk.ResponseType.OK:
filename = dlg.get_filename()

View File

@ -202,7 +202,7 @@ class gPodderApplication(Gtk.Application):
def on_about(self, action, param):
dlg = Gtk.Dialog(_('About gPodder'), self.window.gPodder,
Gtk.DialogFlags.MODAL)
dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.OK).show()
dlg.add_button(_('_Close'), Gtk.ResponseType.OK).show()
dlg.set_resizable(True)
bg = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6, margin=16)

View File

@ -112,7 +112,7 @@ class gPodderChannel(BuilderWidget):
def on_button_add_section_clicked(self, widget):
text = self.show_text_edit_dialog(_('Add section'), _('New section:'),
affirmative_text=Gtk.STOCK_ADD)
affirmative_text=_('_Add'))
if text is not None:
for index, (section,) in enumerate(self.section_list):
@ -146,8 +146,8 @@ class gPodderChannel(BuilderWidget):
title=_('Select new podcast cover artwork'),
parent=self.gPodderChannel,
action=Gtk.FileChooserAction.OPEN)
dlg.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dlg.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
dlg.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dlg.add_button(_('_Open'), Gtk.ResponseType.OK)
if dlg.run() == Gtk.ResponseType.OK:
url = dlg.get_uri()

View File

@ -671,8 +671,8 @@ class gPodderPreferences(BuilderWidget):
fs = Gtk.FileChooserDialog(title=_('Select folder for mount point'),
action=Gtk.FileChooserAction.SELECT_FOLDER)
fs.set_local_only(False)
fs.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
fs.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
fs.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
fs.add_button(_('_Open'), Gtk.ResponseType.OK)
fs.set_uri(self.btn_filesystemMountpoint.get_label() or "")
if fs.run() == Gtk.ResponseType.OK:
@ -689,8 +689,8 @@ class gPodderPreferences(BuilderWidget):
fs = Gtk.FileChooserDialog(title=_('Select folder for playlists'),
action=Gtk.FileChooserAction.SELECT_FOLDER)
fs.set_local_only(False)
fs.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
fs.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
fs.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
fs.add_button(_('_Open'), Gtk.ResponseType.OK)
device_folder = util.new_gio_file(self._config.device_sync.device_folder)
playlists_folder = device_folder.resolve_relative_path(self._config.device_sync.playlists.folder)

View File

@ -127,11 +127,11 @@ class BuilderWidget(GtkBuilderWidget):
return response == Gtk.ResponseType.YES
def show_text_edit_dialog(self, title, prompt, text=None, empty=False,
is_url=False, affirmative_text=Gtk.STOCK_OK):
is_url=False, affirmative_text=_('_OK')):
dialog = Gtk.Dialog(title, self.get_dialog_parent(),
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dialog.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dialog.add_button(affirmative_text, Gtk.ResponseType.OK)
dialog.set_default_size(300, -1)
@ -267,8 +267,8 @@ class BuilderWidget(GtkBuilderWidget):
initial_directory = os.path.expanduser('~')
dlg = Gtk.FileChooserDialog(title=title, parent=self.main_window, action=Gtk.FileChooserAction.SELECT_FOLDER)
dlg.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dlg.add_button(Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
dlg.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dlg.add_button(_('_Save'), Gtk.ResponseType.OK)
dlg.set_do_overwrite_confirmation(True)
dlg.set_current_folder(initial_directory)

View File

@ -2839,8 +2839,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
if downloading:
dialog = Gtk.MessageDialog(self.gPodder, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
quit_button = dialog.add_button(Gtk.STOCK_QUIT, Gtk.ResponseType.CLOSE)
dialog.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
quit_button = dialog.add_button(_('_Quit'), Gtk.ResponseType.CLOSE)
title = _('Quit gPodder')
message = _('You are downloading episodes. You can resume downloads the next time you start gPodder. Do you want to quit now?')
@ -3419,8 +3419,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
dlg = Gtk.FileChooserDialog(title=_('Import from OPML'),
parent=self.main_window,
action=Gtk.FileChooserAction.OPEN)
dlg.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dlg.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
dlg.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dlg.add_button(_('_Open'), Gtk.ResponseType.OK)
dlg.set_filter(self.get_opml_filter())
response = dlg.run()
filename = None
@ -3447,8 +3447,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
dlg = Gtk.FileChooserDialog(title=_('Export to OPML'),
parent=self.gPodder,
action=Gtk.FileChooserAction.SAVE)
dlg.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dlg.add_button(Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
dlg.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
dlg.add_button(_('_Save'), Gtk.ResponseType.OK)
dlg.set_filter(self.get_opml_filter())
response = dlg.run()
if response == Gtk.ResponseType.OK: