Commit 1d8d5fbe authored by Alexander's avatar Alexander

[stickers] Lowercase GTK widget IDs and fix translation mistake

parent e3b89945
......@@ -60,16 +60,17 @@ class StickersConfigDialog(GajimPluginConfigDialog):
self._ui.connect_signals(self)
self._list_model = Gio.ListStore()
self._ui.get_object('STICKER_WIDTH').set_range(0, 400)
self._ui.get_object('STICKER_WIDTH').set_increments(1, -1)
self._ui.get_object('sticker_packs_list').bind_model(self._list_model, self._create_sticker_pack_row)
self._ui.sticker_width.set_range(0, 400)
self._ui.sticker_width.set_increments(1, -1)
self._ui.sticker_packs_list.bind_model(self._list_model, self._create_sticker_pack_row)
def set_wrapper(setting):
return lambda widget: self._on_setting_changed(widget, setting)
for setting in ('DOWNLOAD_NEW', 'DOWNLOAD_NEW_SIGNIN', 'UPLOAD_NEW_SIGNIN', 'SHOW_ANIMATED_STICKERS'):
self._ui.get_object(setting).connect('toggled', set_wrapper(setting))
self._ui.get_object('STICKER_WIDTH').connect('value-changed', set_wrapper('STICKER_WIDTH'))
for setting in ('download_new', 'download_new_signin', 'upload_new_signin', 'show_animated_stickers'):
getattr(self._ui, setting).set_active(self.plugin.config[setting.upper()])
getattr(self._ui, setting).connect('toggled', set_wrapper(setting.upper()))
self._ui.sticker_width.connect('value-changed', set_wrapper('STICKER_WIDTH'))
def on_sticker_pack_added(self, pack):
'''
......@@ -96,9 +97,9 @@ class StickersConfigDialog(GajimPluginConfigDialog):
def on_run(self):
# Update all config settings
for setting in ('DOWNLOAD_NEW', 'DOWNLOAD_NEW_SIGNIN', 'UPLOAD_NEW_SIGNIN', 'SHOW_ANIMATED_STICKERS'):
self._ui.get_object(setting).set_active(self.plugin.config[setting])
self._ui.get_object('STICKER_WIDTH').set_value(self.plugin.config['STICKER_WIDTH'])
for setting in ('download_new', 'download_new_signin', 'upload_new_signin', 'show_animated_stickers'):
getattr(self._ui, setting).set_active(self.plugin.config[setting.upper()])
self._ui.sticker_width.set_value(self.plugin.config['STICKER_WIDTH'])
def _on_setting_changed(self, widget, data):
if isinstance(widget, Gtk.CheckButton):
......@@ -122,9 +123,11 @@ class StickersConfigDialog(GajimPluginConfigDialog):
def _create_sticker_pack_row(self, pack):
item = get_builder(self.plugin.local_file_path('gtk/config_stickers_listitem.ui'))
item.get_object('header').set_markup(_('<b>%s</b>') % pack.name)
item.get_object('summary').set_text(pack.summary)
item.get_object('amount').set_text(_('%s stickers') % pack.amount)
item.get_object('delete_button').connect('clicked', lambda x: self._on_delete_button_clicked(pack.id_))
return item.get_object('sticker_pack_list_item')
# TODO: If available, display the localized version of the sticker pack's
# name and summary
item.header.set_markup(f'<b>{pack.name}</b>')
item.summary.set_text(pack.summary)
item.amount.set_text(_('%s stickers') % pack.amount)
item.delete_button.connect('clicked', lambda x: self._on_delete_button_clicked(pack.id_))
return item.sticker_pack_list_item
......@@ -52,7 +52,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckButton" id="DOWNLOAD_NEW">
<object class="GtkCheckButton" id="download_new">
<property name="label" translatable="yes">Download new sticker packs</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
......@@ -66,7 +66,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="DOWNLOAD_NEW_SIGNIN">
<object class="GtkCheckButton" id="download_new_signin">
<property name="label" translatable="yes">Download new stickers on login</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
......@@ -80,7 +80,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="UPLOAD_NEW_SIGNIN">
<object class="GtkCheckButton" id="upload_new_signin">
<property name="label" translatable="yes">Publish new stickers on login</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
......@@ -111,7 +111,7 @@
</packing>
</child>
<child>
<object class="GtkSpinButton" id="STICKER_WIDTH">
<object class="GtkSpinButton" id="sticker_width">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="input-purpose">number</property>
......@@ -130,7 +130,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="SHOW_ANIMATED_STICKERS">
<object class="GtkCheckButton" id="show_animated_stickers">
<property name="label" translatable="yes">Show animated stickers</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment