From 7a070a583ec2ad16391a8a0fe8140c090d7a9343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 28 Oct 2018 23:19:24 +0100 Subject: [PATCH] Use get_image_button() from gtk.util --- gajim/gtk/util.py | 3 +-- gajim/gtkgui_helpers.py | 13 ------------- gajim/options_dialog.py | 5 +++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/gajim/gtk/util.py b/gajim/gtk/util.py index 44bbf653f..11b9b445b 100644 --- a/gajim/gtk/util.py +++ b/gajim/gtk/util.py @@ -246,8 +246,7 @@ def get_image_button(icon_name, tooltip, toggle=False): image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU) button.set_image(image) else: - button = Gtk.Button.new_from_icon_name( - icon_name, Gtk.IconSize.MENU) + button = Gtk.Button.new_from_icon_name(icon_name, Gtk.IconSize.MENU) button.set_tooltip_text(tooltip) return button diff --git a/gajim/gtkgui_helpers.py b/gajim/gtkgui_helpers.py index 8562a9dcd..5b2c3fc77 100644 --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -86,19 +86,6 @@ if os.name == 'nt': from gajim.common import helpers -def get_image_button(icon_name, tooltip, toggle=False): - if toggle: - button = Gtk.ToggleButton() - icon = get_icon_pixmap(icon_name) - image = Gtk.Image() - image.set_from_pixbuf(icon) - button.set_image(image) - else: - button = Gtk.Button.new_from_icon_name( - icon_name, Gtk.IconSize.MENU) - button.set_tooltip_text(tooltip) - return button - def get_gtk_builder(file_name, widget=None): file_path = os.path.join(configpaths.get('GUI'), file_name) diff --git a/gajim/options_dialog.py b/gajim/options_dialog.py index 1cd2b9692..c623a7779 100644 --- a/gajim/options_dialog.py +++ b/gajim/options_dialog.py @@ -8,6 +8,7 @@ from gajim.common.exceptions import GajimGeneralException from gajim import dialogs from gajim.gtk.dialogs import ErrorDialog from gajim.gtk.dialogs import ChangePasswordDialog +from gajim.gtk.util import get_image_button class OptionsDialog(Gtk.ApplicationWindow): @@ -398,7 +399,7 @@ class FileChooserOption(GenericOption): button.set_filename(self.option_value) button.connect('selection-changed', self.on_select) - clear_button = gtkgui_helpers.get_image_button( + clear_button = get_image_button( 'edit-clear-all-symbolic', _('Clear File')) clear_button.connect('clicked', lambda *args: button.unselect_all()) self.option_box.pack_start(button, True, True, 0) @@ -480,7 +481,7 @@ class ProxyComboOption(GenericOption): self.combo.connect('changed', self.on_value_change) self.combo.set_valign(Gtk.Align.CENTER) - button = gtkgui_helpers.get_image_button( + button = get_image_button( 'preferences-system-symbolic', _('Manage Proxies')) button.set_action_name('app.manage-proxies') button.set_valign(Gtk.Align.CENTER)