Use get_image_button() from gtk.util
This commit is contained in:
parent
3ae03a24b1
commit
7a070a583e
3 changed files with 4 additions and 17 deletions
|
@ -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)
|
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
|
||||||
button.set_image(image)
|
button.set_image(image)
|
||||||
else:
|
else:
|
||||||
button = Gtk.Button.new_from_icon_name(
|
button = Gtk.Button.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
|
||||||
icon_name, Gtk.IconSize.MENU)
|
|
||||||
button.set_tooltip_text(tooltip)
|
button.set_tooltip_text(tooltip)
|
||||||
return button
|
return button
|
||||||
|
|
||||||
|
|
|
@ -86,19 +86,6 @@ if os.name == 'nt':
|
||||||
from gajim.common import helpers
|
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):
|
def get_gtk_builder(file_name, widget=None):
|
||||||
file_path = os.path.join(configpaths.get('GUI'), file_name)
|
file_path = os.path.join(configpaths.get('GUI'), file_name)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from gajim.common.exceptions import GajimGeneralException
|
||||||
from gajim import dialogs
|
from gajim import dialogs
|
||||||
from gajim.gtk.dialogs import ErrorDialog
|
from gajim.gtk.dialogs import ErrorDialog
|
||||||
from gajim.gtk.dialogs import ChangePasswordDialog
|
from gajim.gtk.dialogs import ChangePasswordDialog
|
||||||
|
from gajim.gtk.util import get_image_button
|
||||||
|
|
||||||
|
|
||||||
class OptionsDialog(Gtk.ApplicationWindow):
|
class OptionsDialog(Gtk.ApplicationWindow):
|
||||||
|
@ -398,7 +399,7 @@ class FileChooserOption(GenericOption):
|
||||||
button.set_filename(self.option_value)
|
button.set_filename(self.option_value)
|
||||||
button.connect('selection-changed', self.on_select)
|
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'))
|
'edit-clear-all-symbolic', _('Clear File'))
|
||||||
clear_button.connect('clicked', lambda *args: button.unselect_all())
|
clear_button.connect('clicked', lambda *args: button.unselect_all())
|
||||||
self.option_box.pack_start(button, True, True, 0)
|
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.connect('changed', self.on_value_change)
|
||||||
self.combo.set_valign(Gtk.Align.CENTER)
|
self.combo.set_valign(Gtk.Align.CENTER)
|
||||||
|
|
||||||
button = gtkgui_helpers.get_image_button(
|
button = get_image_button(
|
||||||
'preferences-system-symbolic', _('Manage Proxies'))
|
'preferences-system-symbolic', _('Manage Proxies'))
|
||||||
button.set_action_name('app.manage-proxies')
|
button.set_action_name('app.manage-proxies')
|
||||||
button.set_valign(Gtk.Align.CENTER)
|
button.set_valign(Gtk.Align.CENTER)
|
||||||
|
|
Loading…
Add table
Reference in a new issue