gajim.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2026
October
September
August
July
June
May
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
List overview
Download
Commits
----- 2026 -----
October 2026
September 2026
August 2026
July 2026
June 2026
May 2026
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
commits@gajim.org
17632 discussions
Start a n
N
ew thread
[Git][gajim/gajim][master] Add chatstate setting per contact
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: 5f84dffc by Philipp Hörist at 2019-04-20T15:43:54Z Add chatstate setting per contact - - - - - 8 changed files: - gajim/chat_control.py - gajim/common/app.py - gajim/common/config.py - gajim/common/helpers.py - gajim/common/modules/chatstates.py - gajim/data/gui/preferences_window.ui - gajim/gtk/preferences.py - gajim/gui_menu_builder.py Changes: ===================================== gajim/chat_control.py ===================================== @@ -289,6 +289,16 @@ class ChatControl(ChatControlBase): self.video_action.connect('change-state', self._on_video) self.parent_win.window.add_action(self.video_action) + chatstate = app.config.get_per( + 'contacts', self.contact.jid, 'send_chatstate', 'composing_only') + + act = Gio.SimpleAction.new_stateful( + 'send-chatstate-' + self.control_id, + GLib.VariantType.new("s"), + GLib.Variant("s", chatstate)) + act.connect('change-state', self._on_send_chatstate) + self.parent_win.window.add_action(act) + def update_actions(self): win = self.parent_win.window online = app.account_is_connected(self.account) @@ -376,6 +386,11 @@ class ChatControl(ChatControlBase): state = param.get_boolean() self.on_jingle_button_toggled(state, 'video') + def _on_send_chatstate(self, action, param): + action.set_state(param) + app.config.set_per('contacts', self.contact.jid, + 'send_chatstate', param.get_string()) + def subscribe_events(self): """ Register listeners to the events class ===================================== gajim/common/app.py ===================================== @@ -156,6 +156,7 @@ gajim_common_features = [ nbxmpp.NS_DATA, nbxmpp.NS_ENCRYPTED, nbxmpp.NS_PING, + nbxmpp.NS_CHATSTATES, nbxmpp.NS_TIME_REVISED, nbxmpp.NS_VERSION, nbxmpp.NS_ROSTERX, ===================================== gajim/common/config.py ===================================== @@ -183,7 +183,6 @@ class Config: 'always_english_wikipedia': [opt_bool, False], 'always_english_wiktionary': [opt_bool, True], 'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], - 'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')], 'autodetect_browser_mailer': [opt_bool, True, '', True], 'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')], 'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], @@ -421,9 +420,9 @@ class Config: 'bosh_http_pipelining': [opt_bool, False], 'bosh_wait_for_restart_response': [opt_bool, False], }, {}), - 'contacts': ({ 'speller_language': [opt_str, '', _('Language for which misspelled words will be checked')], + 'send_chatstate': [opt_str, 'composing_only', _('Chat state notifications that are sent to contacts. Possible values: all, composing_only, disabled')], }, {}), 'encryption': ({ 'encryption': [opt_str, '', _('The currently active encryption for that contact')], ===================================== gajim/common/helpers.py ===================================== @@ -1127,8 +1127,6 @@ def update_optional_features(account=None): features.append(nbxmpp.NS_NICK + '+notify') if app.config.get_per('accounts', account_, 'subscribe_location'): features.append(nbxmpp.NS_LOCATION + '+notify') - if app.config.get('outgoing_chat_state_notifactions') != 'disabled': - features.append(nbxmpp.NS_CHATSTATES) if not app.config.get('ignore_incoming_xhtml'): features.append(nbxmpp.NS_XHTML_IM) if app.config.get_per('accounts', account_, 'answer_receipts'): ===================================== gajim/common/modules/chatstates.py ===================================== @@ -358,7 +358,8 @@ class Chatstate(BaseModule): if contact.is_groupchat(): return app.config.get_per( 'rooms', contact.jid, 'send_chatstate', 'composing_only') - return app.config.get('outgoing_chat_state_notifications') + return app.config.get_per( + 'contacts', contact.jid, 'send_chatstate', 'composing_only') def remove_delay_timeout(self, contact): timeout = self._delay_timeout_ids.get(contact.jid) ===================================== gajim/data/gui/preferences_window.ui ===================================== @@ -42,23 +42,6 @@ <column type="gboolean"/> </columns> </object> - <object class="GtkListStore" id="display_chat_state_notifications_liststore"> - <columns> - <!-- column-name item --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">All chat states</col> - </row> - <row> - <col id="0" translatable="yes">Composing only</col> - </row> - <row> - <col id="0" translatable="yes">Disabled</col> - </row> - </data> - </object> <object class="GtkListStore" id="on_event_received_liststore"> <columns> <!-- column-name item --> @@ -127,23 +110,6 @@ </row> </data> </object> - <object class="GtkListStore" id="send_chatstate_notifications_liststore"> - <columns> - <!-- column-name item --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">All chat states</col> - </row> - <row> - <col id="0" translatable="yes">Composing only</col> - </row> - <row> - <col id="0" translatable="yes">Disabled</col> - </row> - </data> - </object> <object class="GtkListStore" id="show_roster_on_startup_liststore"> <columns> <!-- column-name item --> @@ -756,7 +722,6 @@ <property name="label" translatable="yes">Default Sync Threshold</property> <property name="use_underline">True</property> <property name="justify">right</property> - <property name="mnemonic_widget">outgoing_chat_states_combobox</property> <style> <class name="dim-label"/> </style> @@ -1754,107 +1719,6 @@ $T will be replaced by auto-not-available timeout.</property> <property name="position">3</property> </packing> </child> - <child> - <object class="GtkBox" id="privacy_tab"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">18</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">6</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party.</property> - <property name="halign">start</property> - <property name="label" translatable="yes">S_end chat state notifications</property> - <property name="use_underline">True</property> - <property name="justify">right</property> - <property name="mnemonic_widget">outgoing_chat_states_combobox</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="outgoing_chat_states_combobox"> - <property name="width_request">200</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="model">send_chatstate_notifications_liststore</property> - <signal name="changed" handler="on_outgoing_chat_states_combobox_changed" swapped="no"/> - <child> - <object class="GtkCellRendererText"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Privacy</property> - <style> - <class name="bold"/> - <class name="margin-top6"/> - </style> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="name">privacy</property> - <property name="title" translatable="yes">Privacy</property> - <property name="position">4</property> - </packing> - </child> <child> <object class="GtkBox" id="style_tab"> <property name="visible">True</property> @@ -2169,7 +2033,7 @@ $T will be replaced by auto-not-available timeout.</property> <packing> <property name="name">style</property> <property name="title" translatable="yes">Style</property> - <property name="position">5</property> + <property name="position">4</property> </packing> </child> <child> @@ -2479,7 +2343,7 @@ to discover one from the server. (Example:
stun.iptel.org
)</property> <packing> <property name="name">audio_video</property> <property name="title" translatable="yes">Audio/Video</property> - <property name="position">6</property> + <property name="position">5</property> </packing> </child> <child> @@ -2875,7 +2739,7 @@ to discover one from the server. (Example:
stun.iptel.org
)</property> <packing> <property name="name">advanced</property> <property name="title" translatable="yes">Advanced</property> - <property name="position">7</property> + <property name="position">6</property> </packing> </child> <style> ===================================== gajim/gtk/preferences.py ===================================== @@ -281,16 +281,6 @@ class Preferences(Gtk.ApplicationWindow): buf = self._ui.msg_textview.get_buffer() buf.connect('end-user-action', self.on_msg_textview_changed) - ### Privacy tab ### - # Outgoing chat state notifications - st = app.config.get('outgoing_chat_state_notifications') - if st == 'all': - self._ui.outgoing_chat_states_combobox.set_active(0) - elif st == 'composing_only': - self._ui.outgoing_chat_states_combobox.set_active(1) - else: # disabled - self._ui.outgoing_chat_states_combobox.set_active(2) - ### Style tab ### # Themes self.changed_id = self._ui.theme_combobox.connect( @@ -858,20 +848,6 @@ class Preferences(Gtk.ApplicationWindow): widget.set_inconsistent(False) self.on_per_account_checkbutton_toggled(widget, 'ignore_unknown_contacts') - def on_outgoing_chat_states_combobox_changed(self, widget): - active = widget.get_active() - old_value = app.config.get('outgoing_chat_state_notifications') - if active == 0: # all - app.config.set('outgoing_chat_state_notifications', 'all') - elif active == 1: # only composing - app.config.set('outgoing_chat_state_notifications', 'composing_only') - else: # disabled - app.config.set('outgoing_chat_state_notifications', 'disabled') - new_value = app.config.get('outgoing_chat_state_notifications') - if 'disabled' in (old_value, new_value): - # We changed from disabled to sth else or vice versa - helpers.update_optional_features() - ### Style ### @staticmethod def on_theme_combobox_changed(combobox): ===================================== gajim/gui_menu_builder.py ===================================== @@ -609,6 +609,7 @@ def get_singlechat_menu(control_id, account, jid): ('win.send-file-httpupload-', _('Upload File…')), ('win.send-file-jingle-', _('Send File Directly…')), ]), + (_('Send Chatstate'), ['chatstate']), ('win.invite-contacts-', _('Invite Contacts')), ('win.add-to-roster-', _('Add to Roster')), ('win.toggle-audio-', _('Audio Session')), @@ -617,6 +618,20 @@ def get_singlechat_menu(control_id, account, jid): ('app.browse-history', _('History')), ] + def build_chatstate_menu(): + menu = Gio.Menu() + entrys = [ + (_('Disabled'), 'disabled'), + (_('Composing only'), 'composing_only'), + (_('All chat states'), 'all') + ] + + for entry in entrys: + label, setting = entry + action = 'win.send-chatstate-%s::%s' % (control_id, setting) + menu.append(label, action) + return menu + def build_menu(preset): menu = Gio.Menu() for item in preset: @@ -634,8 +649,10 @@ def get_singlechat_menu(control_id, account, jid): menu.append(label, action_name + control_id) else: label, sub_menu = item - # This is a submenu - submenu = build_menu(sub_menu) + if 'chatstate' in sub_menu: + submenu = build_chatstate_menu() + else: + submenu = build_menu(sub_menu) menu.append_submenu(label, submenu) return menu View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/5f84dffca6ead2c410e4388b0762b490e7…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/5f84dffca6ead2c410e4388b0762b490e7…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Make setting description smaller
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: df13aa4b by Philipp Hörist at 2019-04-20T15:03:23Z Make setting description smaller - - - - - 1 changed file: - gajim/data/style/gajim.css Changes: ===================================== gajim/data/style/gajim.css ===================================== @@ -91,7 +91,7 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_ #SettingsBox > row:not(.activatable) label { color: @insensitive_fg_color } /* GenericSetting */ -#SubDescription { color: @insensitive_fg_color;} +#SubDescription { color: @insensitive_fg_color; font-size: small;} #GenericSettingBox { margin-left: 30px; } #GenericSettingBox > label { padding-right: 3px; } View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/df13aa4b2265719418357e7465c3b5d1a7…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/df13aa4b2265719418357e7465c3b5d1a7…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Move account specific settings
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: b134fccf by Philipp Hörist at 2019-04-20T14:57:56Z Move account specific settings Move some settings from Prefrences to Accounts - - - - - 3 changed files: - gajim/data/gui/preferences_window.ui - gajim/gtk/accounts.py - gajim/gtk/preferences.py Changes: ===================================== gajim/data/gui/preferences_window.ui ===================================== @@ -1774,78 +1774,6 @@ $T will be replaced by auto-not-available timeout.</property> <property name="margin_top">6</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <child> - <object class="GtkCheckButton" id="send_idle_time_checkbutton"> - <property name="label" translatable="yes">Allow my idle _time to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the idle time of your system</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_idle_time_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="send_time_info_checkbutton"> - <property name="label" translatable="yes">_Allow local system time information to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the local time on your system</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_time_info_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="send_os_info_checkbutton"> - <property name="label" translatable="yes">Allow client / _OS information to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the operating system you are using</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_os_info_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="ignore_events_from_unknown_contacts_checkbutton"> - <property name="label" translatable="yes">_Ignore events from contacts not in the roster</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, incoming events from unauthorized contacts will be ignored. Use with caution, because it blocks all messages from any contact that is not in the roster.</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ignore_events_from_unknown_contacts_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> <child> <object class="GtkBox"> <property name="visible">True</property> @@ -1897,7 +1825,7 @@ $T will be replaced by auto-not-available timeout.</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">0</property> </packing> </child> </object> ===================================== gajim/gtk/accounts.py ===================================== @@ -575,9 +575,13 @@ class AccountPage(GenericSettingPage): general = partial( self.set_page, GeneralPage(account, self), 'general') + connection = partial( self.set_page, ConnectionPage(account, self), 'connection') + privacy = partial( + self.set_page, PrivacyPage(account, self), 'privacy') + settings = [ Setting(SettingKind.ENTRY, _('Label'), SettingType.ACCOUNT_CONFIG, 'account_label', @@ -592,6 +596,9 @@ class AccountPage(GenericSettingPage): Setting(SettingKind.CALLBACK, _('General'), name='general', props={'callback': general}), + Setting(SettingKind.CALLBACK, _('Privacy'), + name='privacy', props={'callback': privacy}), + Setting(SettingKind.CALLBACK, _('Connection'), name='connection', props={'callback': connection}), @@ -644,6 +651,33 @@ class GeneralPage(GenericSettingPage): GenericSettingPage.__init__(self, account, parent, settings) +class PrivacyPage(GenericSettingPage): + def __init__(self, account, parent=None): + + settings = [ + Setting(SettingKind.SWITCH, _('Idle Time'), + SettingType.ACCOUNT_CONFIG, 'send_idle_time', + desc=_('Disclose the time of your last activity')), + + Setting(SettingKind.SWITCH, _('Local System Time'), + SettingType.ACCOUNT_CONFIG, 'send_time_info', + desc=_('Disclose the local system time of the ' + 'device Gajim runs on')), + + Setting(SettingKind.SWITCH, _('Client / Operating System'), + SettingType.ACCOUNT_CONFIG, 'send_os_info', + desc=_('Disclose informations about the client ' + 'and operating system you currently use')), + + Setting(SettingKind.SWITCH, _('Ignore Unknown Contacts'), + SettingType.ACCOUNT_CONFIG, 'ignore_unknown_contacts', + desc=_('Ignore everything from contacts not in your ' + 'Roster')), + + ] + GenericSettingPage.__init__(self, account, parent, settings) + + class ConnectionPage(GenericSettingPage): def __init__(self, account, parent=None): ===================================== gajim/gtk/preferences.py ===================================== @@ -282,34 +282,6 @@ class Preferences(Gtk.ApplicationWindow): buf.connect('end-user-action', self.on_msg_textview_changed) ### Privacy tab ### - # Send idle time - st = self.get_per_account_option('send_idle_time') - if st == 'mixed': - self._ui.send_idle_time_checkbutton.set_inconsistent(True) - else: - self._ui.send_idle_time_checkbutton.set_active(st) - - # Send absolute time info - st = self.get_per_account_option('send_time_info') - if st == 'mixed': - self._ui.send_time_info_checkbutton.set_inconsistent(True) - else: - self._ui.send_time_info_checkbutton.set_active(st) - - # Send OS info - st = self.get_per_account_option('send_os_info') - if st == 'mixed': - self._ui.send_os_info_checkbutton.set_inconsistent(True) - else: - self._ui.send_os_info_checkbutton.set_active(st) - - # Ignore messages from unknown contacts - st = self.get_per_account_option('ignore_unknown_contacts') - if st == 'mixed': - self._ui.ignore_events_from_unknown_contacts_checkbutton.set_inconsistent(True) - else: - self._ui.ignore_events_from_unknown_contacts_checkbutton.set_active(st) - # Outgoing chat state notifications st = app.config.get('outgoing_chat_state_notifications') if st == 'all': View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/b134fccf94c224b64b564fd879b2307d87…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/b134fccf94c224b64b564fd879b2307d87…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] 3 commits: Refactor OptionsDialog
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: c3437464 by Philipp Hörist at 2019-04-20T11:18:25Z Refactor OptionsDialog - Rename Option to Setting, it fits better - Settings inherit from Gtk.ListBoxRow - - - - - e495617d by Philipp Hörist at 2019-04-20T12:19:22Z Settings: Add ComboSetting - - - - - e34886ae by Philipp Hörist at 2019-04-20T12:58:22Z Add custom MaxWidthComboBoxText - - - - - 7 changed files: - gajim/common/const.py - gajim/data/style/gajim.css - gajim/gtk/accounts.py - gajim/gtk/const.py - gajim/options_dialog.py → gajim/gtk/settings.py - gajim/gtk/util.py - gajim/gtk/xml_console.py Changes: ===================================== gajim/common/const.py ===================================== @@ -3,36 +3,9 @@ from collections import namedtuple from gajim.common.i18n import _ -Option = namedtuple('Option', 'kind label type value name callback data desc enabledif props') -Option.__new__.__defaults__ = (None,) * len(Option._fields) # type: ignore - EncryptionData = namedtuple('EncryptionData', 'additional_data') EncryptionData.__new__.__defaults__ = (None,) # type: ignore -@unique -class OptionKind(IntEnum): - ENTRY = 0 - SWITCH = 1 - SPIN = 2 - ACTION = 3 - LOGIN = 4 - DIALOG = 5 - CALLBACK = 6 - PROXY = 7 - HOSTNAME = 8 - PRIORITY = 9 - FILECHOOSER = 10 - CHANGEPASSWORD = 11 - - -@unique -class OptionType(IntEnum): - ACCOUNT_CONFIG = 0 - CONFIG = 1 - VALUE = 2 - ACTION = 3 - DIALOG = 4 - class AvatarSize(IntEnum): TAB = 16 ===================================== gajim/data/style/gajim.css ===================================== @@ -83,17 +83,17 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_ #FeaturesInfoGrid > list > label { padding:10px; color: @insensitive_fg_color; font-weight: bold; } #FeaturesInfoGrid > list > row.activatable:active { box-shadow: none; } -/* OptionsBox */ -#OptionsBox > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; } -#OptionsBox > row:last-child { border-bottom: 0px} -#OptionsBox > row.activatable:active { box-shadow: none; } -#OptionsBox > row { padding: 10px 20px 10px 10px; } -#OptionsBox > row:not(.activatable) label { color: @insensitive_fg_color } - -/* GenericOption */ +/* SettingsBox */ +#SettingsBox > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; } +#SettingsBox > row:last-child { border-bottom: 0px} +#SettingsBox > row.activatable:active { box-shadow: none; } +#SettingsBox > row { padding: 10px 20px 10px 10px; } +#SettingsBox > row:not(.activatable) label { color: @insensitive_fg_color } + +/* GenericSetting */ #SubDescription { color: @insensitive_fg_color;} -#GenericOptionBox { margin-left: 30px; } -#GenericOptionBox > label { padding-right: 3px; } +#GenericSettingBox { margin-left: 30px; } +#GenericSettingBox > label { padding-right: 3px; } /* Generic Popover Menu with Buttons */ .PopoverButtonListbox { padding-left: 0px; padding-right: 0px; } ===================================== gajim/gtk/accounts.py ===================================== @@ -25,16 +25,12 @@ from gajim.common import ged from gajim.common.i18n import _ from gajim.common.connection import Connection from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf -from gajim.common.const import Option -from gajim.common.const import OptionKind -from gajim.common.const import OptionType from gajim import gui_menu_builder from gajim.dialogs import PassphraseDialog -from gajim.options_dialog import OptionsDialog -from gajim.options_dialog import OptionsBox - +from gajim.gtk.settings import SettingsDialog +from gajim.gtk.settings import SettingsBox from gajim.gtk.dialogs import ConfirmationDialog from gajim.gtk.dialogs import ConfirmationDialogDoubleRadio from gajim.gtk.dialogs import ErrorDialog @@ -43,6 +39,9 @@ from gajim.gtk.dialogs import DialogButton from gajim.gtk.dialogs import NewConfirmationDialog from gajim.gtk.util import get_icon_name from gajim.gtk.util import get_builder +from gajim.gtk.const import Setting +from gajim.gtk.const import SettingKind +from gajim.gtk.const import SettingType class AccountsWindow(Gtk.ApplicationWindow): @@ -67,7 +66,7 @@ class AccountsWindow(Gtk.ApplicationWindow): accounts = app.config.get_per('accounts') accounts.sort() for account in accounts: - self.need_relogin[account] = self.get_relogin_options(account) + self.need_relogin[account] = self.get_relogin_settings(account) account_item = Account(account, self) self._ui.account_list.add(account_item) account_item.set_activatable() @@ -135,14 +134,14 @@ class AccountsWindow(Gtk.ApplicationWindow): page = self._ui.stack.get_child_by_name('connection') if page is None: return - page.listbox.get_option('proxy').update_values() + page.listbox.get_setting('proxy').update_values() def check_relogin(self): for account in self.need_relogin: - options = self.get_relogin_options(account) + settings = self.get_relogin_settings(account) active = app.config.get_per('accounts', account, 'active') - if options != self.need_relogin[account]: - self.need_relogin[account] = options + if settings != self.need_relogin[account]: + self.need_relogin[account] = settings if active: self.relog(account) break @@ -180,17 +179,17 @@ class AccountsWindow(Gtk.ApplicationWindow): on_response_yes=lambda *args: relog(account)) @staticmethod - def get_relogin_options(account): + def get_relogin_settings(account): if account == app.ZEROCONF_ACC_NAME: - options = ['zeroconf_first_name', 'zeroconf_last_name', - 'zeroconf_jabber_id', 'zeroconf_email'] + settings = ['zeroconf_first_name', 'zeroconf_last_name', + 'zeroconf_jabber_id', 'zeroconf_email'] else: - options = ['client_cert', 'proxy', 'resource', - 'use_custom_host', 'custom_host', 'custom_port'] + settings = ['client_cert', 'proxy', 'resource', + 'use_custom_host', 'custom_host', 'custom_port'] values = [] - for option in options: - values.append(app.config.get_per('accounts', account, option)) + for setting in settings: + values.append(app.config.get_per('accounts', account, setting)) return values def on_remove_account(self, button, account): @@ -248,7 +247,7 @@ class AccountsWindow(Gtk.ApplicationWindow): account_item.set_activatable() self._ui.account_list.show_all() self._ui.stack.show_all() - self.need_relogin[account] = self.get_relogin_options(account) + self.need_relogin[account] = self.get_relogin_settings(account) def select_account(self, account): for row in self._ui.account_list.get_children(): @@ -365,7 +364,7 @@ class Preferences(Gtk.Box): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=12) - self.options = PreferencesPage() + self.settings = PreferencesPage() self.parent = parent self.account = None @@ -383,8 +382,8 @@ class Preferences(Gtk.Box): pass def on_row_activated(self): - self.options.update_states() - self.parent.set_page(self.options, 'pref') + self.settings.update_states() + self.parent.set_page(self.settings, 'pref') def update(self): pass @@ -396,9 +395,9 @@ class Account(Gtk.Box): spacing=12) self.account = account if account == app.ZEROCONF_ACC_NAME: - self.options = ZeroConfPage(account, parent) + self.settings = ZeroConfPage(account, parent) else: - self.options = AccountPage(account, parent) + self.settings = AccountPage(account, parent) self.parent = parent self.label = Gtk.Label(label=app.get_account_label(account)) @@ -421,8 +420,8 @@ class Account(Gtk.Box): _('Please check if Avahi or Bonjour is installed.')) def on_row_activated(self): - self.options.update_states() - self.parent.set_page(self.options, 'account') + self.settings.update_states() + self.parent.set_page(self.settings, 'account') def update(self): self.label.set_text(app.get_account_label(self.account)) @@ -434,8 +433,8 @@ class Account(Gtk.Box): self.image.set_from_icon_name(icon, Gtk.IconSize.MENU) -class GenericOptionPage(Gtk.Box): - def __init__(self, account, parent, options): +class GenericSettingPage(Gtk.Box): + def __init__(self, account, parent, settings): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=12) self.account = account self.parent = parent @@ -447,13 +446,13 @@ class GenericOptionPage(Gtk.Box): if not isinstance(self, (AccountPage, PreferencesPage, ZeroConfPage)): self.pack_start(button, False, True, 0) - self.listbox = OptionsBox(account) + self.listbox = SettingsBox(account) self.listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.listbox.set_vexpand(False) self.listbox.set_valign(Gtk.Align.END) - for option in options: - self.listbox.add_option(option) + for setting in settings: + self.listbox.add_setting(setting) self.listbox.update_states() self.pack_end(self.listbox, True, True, 0) @@ -471,7 +470,7 @@ class GenericOptionPage(Gtk.Box): self.listbox.update_states() def on_row_activated(self, listbox, row): - row.get_child().on_row_activated() + row.on_row_activated() def set_entry_text(self, toggle, update=False): account_label = app.get_account_label(self.account) @@ -495,9 +494,9 @@ class GenericOptionPage(Gtk.Box): def update(self): pass - def set_page(self, options, name): - options.update_states() - self.get_toplevel().set_page(options, name) + def set_page(self, settings, name): + settings.update_states() + self.get_toplevel().set_page(settings, name) def _add_top_buttons(self, parent): # This adds the Account enable switch and the back button @@ -560,18 +559,18 @@ class GenericOptionPage(Gtk.Box): app.config.set_per('accounts', account, 'active', state) -class PreferencesPage(GenericOptionPage): +class PreferencesPage(GenericSettingPage): def __init__(self): - options = [ - Option(OptionKind.SWITCH, _('Merge Accounts'), - OptionType.ACTION, 'merge'), + settings = [ + Setting(SettingKind.SWITCH, _('Merge Accounts'), + SettingType.ACTION, 'merge'), ] - GenericOptionPage.__init__(self, None, None, options) + GenericSettingPage.__init__(self, None, None, settings) -class AccountPage(GenericOptionPage): +class AccountPage(GenericSettingPage): def __init__(self, account, parent=None): general = partial( @@ -579,152 +578,150 @@ class AccountPage(GenericOptionPage): connection = partial( self.set_page, ConnectionPage(account, self), 'connection') - options = [ - Option(OptionKind.ENTRY, _('Label'), - OptionType.ACCOUNT_CONFIG, 'account_label', - callback=self._on_account_name_change), + settings = [ + Setting(SettingKind.ENTRY, _('Label'), + SettingType.ACCOUNT_CONFIG, 'account_label', + callback=self._on_account_name_change), - Option(OptionKind.LOGIN, _('Login'), OptionType.DIALOG, - props={'dialog': LoginDialog}), + Setting(SettingKind.LOGIN, _('Login'), SettingType.DIALOG, + props={'dialog': LoginDialog}), - Option(OptionKind.ACTION, _('Profile'), OptionType.ACTION, - '-profile', props={'action_args': account}), + Setting(SettingKind.ACTION, _('Profile'), SettingType.ACTION, + '-profile', props={'action_args': account}), - Option(OptionKind.CALLBACK, _('General'), - name='general', props={'callback': general}), + Setting(SettingKind.CALLBACK, _('General'), + name='general', props={'callback': general}), - Option(OptionKind.CALLBACK, _('Connection'), - name='connection', props={'callback': connection}), + Setting(SettingKind.CALLBACK, _('Connection'), + name='connection', props={'callback': connection}), - Option(OptionKind.ACTION, _('Import Contacts'), OptionType.ACTION, - '-import-contacts', props={'action_args': account}), + Setting(SettingKind.ACTION, _('Import Contacts'), SettingType.ACTION, + '-import-contacts', props={'action_args': account}), - Option(OptionKind.DIALOG, _('Client Certificate'), - OptionType.DIALOG, props={'dialog': CertificateDialog}), + Setting(SettingKind.DIALOG, _('Client Certificate'), + SettingType.DIALOG, props={'dialog': CertificateDialog}), ] - GenericOptionPage.__init__(self, account, parent, options) + GenericSettingPage.__init__(self, account, parent, settings) self._add_top_buttons(parent) def _on_account_name_change(self, account_name, *args): self.parent.update_accounts() -class GeneralPage(GenericOptionPage): +class GeneralPage(GenericSettingPage): def __init__(self, account, parent=None): - options = [ - Option(OptionKind.SWITCH, _('Connect on startup'), - OptionType.ACCOUNT_CONFIG, 'autoconnect'), + settings = [ + Setting(SettingKind.SWITCH, _('Connect on startup'), + SettingType.ACCOUNT_CONFIG, 'autoconnect'), - Option(OptionKind.SWITCH, _('Reconnect when connection is lost'), - OptionType.ACCOUNT_CONFIG, 'autoreconnect'), + Setting(SettingKind.SWITCH, _('Reconnect when connection is lost'), + SettingType.ACCOUNT_CONFIG, 'autoreconnect'), - Option(OptionKind.SWITCH, _('Save conversations for all contacts'), - OptionType.ACCOUNT_CONFIG, 'no_log_for', - desc=_('Store conversations on the harddrive')), + Setting(SettingKind.SWITCH, _('Save conversations for all contacts'), + SettingType.ACCOUNT_CONFIG, 'no_log_for', + desc=_('Store conversations on the harddrive')), - Option(OptionKind.SWITCH, _('Server Message Archive'), - OptionType.ACCOUNT_CONFIG, 'sync_logs_with_server', - desc=_('Messages get stored on the server.\n' - 'The archive is used to sync messages\n' - 'between multiple devices.\n' - 'XEP-0313')), + Setting(SettingKind.SWITCH, _('Server Message Archive'), + SettingType.ACCOUNT_CONFIG, 'sync_logs_with_server', + desc=_('Messages get stored on the server. ' + 'The archive is used to sync messages ' + 'between multiple devices. (XEP-0313)')), - Option(OptionKind.SWITCH, _('Global Status'), - OptionType.ACCOUNT_CONFIG, 'sync_with_global_status', - desc=_('Synchronise the status of all accounts')), + Setting(SettingKind.SWITCH, _('Global Status'), + SettingType.ACCOUNT_CONFIG, 'sync_with_global_status', + desc=_('Synchronise the status of all accounts')), - Option(OptionKind.SWITCH, _('Message Carbons'), - OptionType.ACCOUNT_CONFIG, 'enable_message_carbons', - desc=_('All your other online devices get copies\n' - 'of sent and received messages.\n' - 'XEP-0280')), + Setting(SettingKind.SWITCH, _('Message Carbons'), + SettingType.ACCOUNT_CONFIG, 'enable_message_carbons', + desc=_('All your other online devices get copies ' + 'of sent and received messages. XEP-0280')), - Option(OptionKind.SWITCH, _('Use file transfer proxies'), - OptionType.ACCOUNT_CONFIG, 'use_ft_proxies'), + Setting(SettingKind.SWITCH, _('Use file transfer proxies'), + SettingType.ACCOUNT_CONFIG, 'use_ft_proxies'), ] - GenericOptionPage.__init__(self, account, parent, options) + GenericSettingPage.__init__(self, account, parent, settings) -class ConnectionPage(GenericOptionPage): +class ConnectionPage(GenericSettingPage): def __init__(self, account, parent=None): - options = [ - Option(OptionKind.SWITCH, 'HTTP_PROXY', - OptionType.ACCOUNT_CONFIG, 'use_env_http_proxy', - desc=_('Use environment variable')), + settings = [ + Setting(SettingKind.SWITCH, 'HTTP_PROXY', + SettingType.ACCOUNT_CONFIG, 'use_env_http_proxy', + desc=_('Use environment variable')), - Option(OptionKind.PROXY, _('Proxy'), - OptionType.ACCOUNT_CONFIG, 'proxy', name='proxy'), + Setting(SettingKind.PROXY, _('Proxy'), + SettingType.ACCOUNT_CONFIG, 'proxy', name='proxy'), - Option(OptionKind.SWITCH, _('Warn on insecure connection'), - OptionType.ACCOUNT_CONFIG, - 'warn_when_insecure_ssl_connection'), + Setting(SettingKind.SWITCH, _('Warn on insecure connection'), + SettingType.ACCOUNT_CONFIG, + 'warn_when_insecure_ssl_connection'), - Option(OptionKind.SWITCH, _('Send keep-alive packets'), - OptionType.ACCOUNT_CONFIG, 'keep_alives_enabled'), + Setting(SettingKind.SWITCH, _('Send keep-alive packets'), + SettingType.ACCOUNT_CONFIG, 'keep_alives_enabled'), - Option(OptionKind.HOSTNAME, _('Hostname'), OptionType.DIALOG, - desc=_('Manually set the hostname for the server'), - props={'dialog': CutstomHostnameDialog}), + Setting(SettingKind.HOSTNAME, _('Hostname'), SettingType.DIALOG, + desc=_('Manually set the hostname for the server'), + props={'dialog': CutstomHostnameDialog}), - Option(OptionKind.ENTRY, _('Resource'), - OptionType.ACCOUNT_CONFIG, 'resource'), + Setting(SettingKind.ENTRY, _('Resource'), + SettingType.ACCOUNT_CONFIG, 'resource'), - Option(OptionKind.PRIORITY, _('Priority'), - OptionType.DIALOG, props={'dialog': PriorityDialog}), + Setting(SettingKind.PRIORITY, _('Priority'), + SettingType.DIALOG, props={'dialog': PriorityDialog}), ] - GenericOptionPage.__init__(self, account, parent, options) + GenericSettingPage.__init__(self, account, parent, settings) -class ZeroConfPage(GenericOptionPage): +class ZeroConfPage(GenericSettingPage): def __init__(self, account, parent=None): - options = [ - Option(OptionKind.DIALOG, _('Profile'), - OptionType.DIALOG, props={'dialog': ZeroconfProfileDialog}), + settings = [ + Setting(SettingKind.DIALOG, _('Profile'), + SettingType.DIALOG, props={'dialog': ZeroconfProfileDialog}), - Option(OptionKind.SWITCH, _('Connect on startup'), - OptionType.ACCOUNT_CONFIG, 'autoconnect', - desc=_('Use environment variable')), + Setting(SettingKind.SWITCH, _('Connect on startup'), + SettingType.ACCOUNT_CONFIG, 'autoconnect', + desc=_('Use environment variable')), - Option(OptionKind.SWITCH, _('Save conversations for all contacts'), - OptionType.ACCOUNT_CONFIG, 'no_log_for', - desc=_('Store conversations on the harddrive')), + Setting(SettingKind.SWITCH, _('Save conversations for all contacts'), + SettingType.ACCOUNT_CONFIG, 'no_log_for', + desc=_('Store conversations on the harddrive')), - Option(OptionKind.SWITCH, _('Global Status'), - OptionType.ACCOUNT_CONFIG, 'sync_with_global_status', - desc=_('Synchronize the status of all accounts')), + Setting(SettingKind.SWITCH, _('Global Status'), + SettingType.ACCOUNT_CONFIG, 'sync_with_global_status', + desc=_('Synchronize the status of all accounts')), ] - GenericOptionPage.__init__(self, account, parent, options) + GenericSettingPage.__init__(self, account, parent, settings) self._add_top_buttons(None) -class ZeroconfProfileDialog(OptionsDialog): +class ZeroconfProfileDialog(SettingsDialog): def __init__(self, account, parent): - options = [ - Option(OptionKind.ENTRY, _('First Name'), - OptionType.ACCOUNT_CONFIG, 'zeroconf_first_name'), + settings = [ + Setting(SettingKind.ENTRY, _('First Name'), + SettingType.ACCOUNT_CONFIG, 'zeroconf_first_name'), - Option(OptionKind.ENTRY, _('Last Name'), - OptionType.ACCOUNT_CONFIG, 'zeroconf_last_name'), + Setting(SettingKind.ENTRY, _('Last Name'), + SettingType.ACCOUNT_CONFIG, 'zeroconf_last_name'), - Option(OptionKind.ENTRY, _('Jabber ID'), - OptionType.ACCOUNT_CONFIG, 'zeroconf_jabber_id'), + Setting(SettingKind.ENTRY, _('Jabber ID'), + SettingType.ACCOUNT_CONFIG, 'zeroconf_jabber_id'), - Option(OptionKind.ENTRY, _('Email'), - OptionType.ACCOUNT_CONFIG, 'zeroconf_email'), + Setting(SettingKind.ENTRY, _('Email'), + SettingType.ACCOUNT_CONFIG, 'zeroconf_email'), ] - OptionsDialog.__init__(self, parent, _('Profile'), - Gtk.DialogFlags.MODAL, options, account) + SettingsDialog.__init__(self, parent, _('Profile'), + Gtk.DialogFlags.MODAL, settings, account) -class PriorityDialog(OptionsDialog): +class PriorityDialog(SettingsDialog): def __init__(self, account, parent): neg_priority = app.config.get('enable_negative_priority') @@ -733,18 +730,18 @@ class PriorityDialog(OptionsDialog): else: range_ = (0, 127) - options = [ - Option(OptionKind.SWITCH, _('Adjust to status'), - OptionType.ACCOUNT_CONFIG, 'adjust_priority_with_status', - 'adjust'), + settings = [ + Setting(SettingKind.SWITCH, _('Adjust to status'), + SettingType.ACCOUNT_CONFIG, 'adjust_priority_with_status', + 'adjust'), - Option(OptionKind.SPIN, _('Priority'), - OptionType.ACCOUNT_CONFIG, 'priority', - enabledif=('adjust', False), props={'range_': range_}), + Setting(SettingKind.SPIN, _('Priority'), + SettingType.ACCOUNT_CONFIG, 'priority', + enabledif=('adjust', False), props={'range_': range_}), ] - OptionsDialog.__init__(self, parent, _('Priority'), - Gtk.DialogFlags.MODAL, options, account) + SettingsDialog.__init__(self, parent, _('Priority'), + Gtk.DialogFlags.MODAL, settings, account) self.connect('destroy', self.on_destroy) @@ -757,60 +754,60 @@ class PriorityDialog(OptionsDialog): app.connections[self.account].change_status(show, status) -class CutstomHostnameDialog(OptionsDialog): +class CutstomHostnameDialog(SettingsDialog): def __init__(self, account, parent): - options = [ - Option(OptionKind.SWITCH, _('Enable'), - OptionType.ACCOUNT_CONFIG, 'use_custom_host', name='custom'), + settings = [ + Setting(SettingKind.SWITCH, _('Enable'), + SettingType.ACCOUNT_CONFIG, 'use_custom_host', name='custom'), - Option(OptionKind.ENTRY, _('Hostname'), - OptionType.ACCOUNT_CONFIG, 'custom_host', - enabledif=('custom', True)), + Setting(SettingKind.ENTRY, _('Hostname'), + SettingType.ACCOUNT_CONFIG, 'custom_host', + enabledif=('custom', True)), - Option(OptionKind.ENTRY, _('Port'), - OptionType.ACCOUNT_CONFIG, 'custom_port', - enabledif=('custom', True)), + Setting(SettingKind.ENTRY, _('Port'), + SettingType.ACCOUNT_CONFIG, 'custom_port', + enabledif=('custom', True)), ] - OptionsDialog.__init__(self, parent, _('Connection Options'), - Gtk.DialogFlags.MODAL, options, account) + SettingsDialog.__init__(self, parent, _('Connection Settings'), + Gtk.DialogFlags.MODAL, settings, account) -class CertificateDialog(OptionsDialog): +class CertificateDialog(SettingsDialog): def __init__(self, account, parent): - options = [ - Option(OptionKind.FILECHOOSER, _('Client Certificate'), - OptionType.ACCOUNT_CONFIG, 'client_cert', - props={'filefilter': (_('PKCS12 Files'), '*.p12')}), + Settings = [ + Setting(SettingKind.FILECHOOSER, _('Client Certificate'), + SettingType.ACCOUNT_CONFIG, 'client_cert', + props={'filefilter': (_('PKCS12 Files'), '*.p12')}), - Option(OptionKind.SWITCH, _('Encrypted Certificate'), - OptionType.ACCOUNT_CONFIG, 'client_cert_encrypted'), + Setting(SettingKind.SWITCH, _('Encrypted Certificate'), + SettingType.ACCOUNT_CONFIG, 'client_cert_encrypted'), ] - OptionsDialog.__init__(self, parent, _('Certificate Options'), - Gtk.DialogFlags.MODAL, options, account) + SettingsDialog.__init__(self, parent, _('Certificate Settings'), + Gtk.DialogFlags.MODAL, Settings, account) -class LoginDialog(OptionsDialog): +class LoginDialog(SettingsDialog): def __init__(self, account, parent): - options = [ - Option(OptionKind.ENTRY, _('Password'), - OptionType.ACCOUNT_CONFIG, 'password', name='password', - enabledif=('savepass', True)), + settings = [ + Setting(SettingKind.ENTRY, _('Password'), + SettingType.ACCOUNT_CONFIG, 'password', name='password', + enabledif=('savepass', True)), - Option(OptionKind.SWITCH, _('Save Password'), - OptionType.ACCOUNT_CONFIG, 'savepass', name='savepass'), + Setting(SettingKind.SWITCH, _('Save Password'), + SettingType.ACCOUNT_CONFIG, 'savepass', name='savepass'), - Option(OptionKind.CHANGEPASSWORD, _('Change Password'), - OptionType.DIALOG, callback=self.on_password_change, - props={'dialog': None}), + Setting(SettingKind.CHANGEPASSWORD, _('Change Password'), + SettingType.DIALOG, callback=self.on_password_change, + props={'dialog': None}), ] - OptionsDialog.__init__(self, parent, _('Login Options'), - Gtk.DialogFlags.MODAL, options, account) + SettingsDialog.__init__(self, parent, _('Login Settings'), + Gtk.DialogFlags.MODAL, settings, account) self.connect('destroy', self.on_destroy) ===================================== gajim/gtk/const.py ===================================== @@ -21,6 +21,9 @@ from enum import unique Filter = namedtuple('Filter', 'name pattern default') +Setting = namedtuple('Setting', 'kind label type value name callback data desc enabledif props') +Setting.__new__.__defaults__ = (None,) * len(Setting._fields) # type: ignore + @unique class Theme(IntEnum): NOT_DARK = 0 @@ -36,3 +39,29 @@ class GajimIconSet(Enum): JABBERBULB = 'jabberbulb' SUN = 'sun' WROOP = 'wroop' + + +@unique +class SettingKind(IntEnum): + ENTRY = 0 + SWITCH = 1 + SPIN = 2 + ACTION = 3 + LOGIN = 4 + DIALOG = 5 + CALLBACK = 6 + PROXY = 7 + HOSTNAME = 8 + PRIORITY = 9 + FILECHOOSER = 10 + CHANGEPASSWORD = 11 + COMBO = 12 + + +@unique +class SettingType(IntEnum): + ACCOUNT_CONFIG = 0 + CONFIG = 1 + VALUE = 2 + ACTION = 3 + DIALOG = 4 ===================================== gajim/options_dialog.py → gajim/gtk/settings.py ===================================== @@ -1,16 +1,42 @@ -from gi.repository import Gtk, GLib, Gdk, GObject +# Copyright (C) 2018 Philipp Hörist <philipp AT
hoerist.com
> +# +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + +from gi.repository import Gtk +from gi.repository import GLib +from gi.repository import Gdk +from gi.repository import GObject +from gi.repository import Pango + from gajim.common import app from gajim.common import passwords from gajim.common.i18n import _ -from gajim import gtkgui_helpers -from gajim.common.const import OptionKind, OptionType + from gajim.common.exceptions import GajimGeneralException + +from gajim import gtkgui_helpers + from gajim.gtk.dialogs import ChangePasswordDialog from gajim.gtk.util import get_image_button +from gajim.gtk.util import MaxWidthComboBoxText +from gajim.gtk.const import SettingKind +from gajim.gtk.const import SettingType -class OptionsDialog(Gtk.ApplicationWindow): - def __init__(self, parent, title, flags, options, account, +class SettingsDialog(Gtk.ApplicationWindow): + def __init__(self, parent, title, flags, settings, account, extend=None): Gtk.ApplicationWindow.__init__(self) self.set_application(app.app) @@ -26,12 +52,12 @@ class OptionsDialog(Gtk.ApplicationWindow): elif flags == Gtk.DialogFlags.DESTROY_WITH_PARENT: self.set_destroy_with_parent(True) - self.listbox = OptionsBox(account, extend) + self.listbox = SettingsBox(account, extend) self.listbox.set_hexpand(True) self.listbox.set_selection_mode(Gtk.SelectionMode.NONE) - for option in options: - self.listbox.add_option(option) + for setting in settings: + self.listbox.add_setting(setting) self.listbox.update_states() self.add(self.listbox) @@ -46,78 +72,82 @@ class OptionsDialog(Gtk.ApplicationWindow): @staticmethod def on_row_activated(listbox, row): - row.get_child().on_row_activated() + row.on_row_activated() - def get_option(self, name): - return self.listbox.get_option(name) + def get_setting(self, name): + return self.listbox.get_setting(name) -class OptionsBox(Gtk.ListBox): +class SettingsBox(Gtk.ListBox): def __init__(self, account, extend=None): Gtk.ListBox.__init__(self) - self.set_name('OptionsBox') + self.set_name('SettingsBox') self.account = account - self.named_options = {} + self.named_settings = {} self.map = { - OptionKind.SWITCH: SwitchOption, - OptionKind.SPIN: SpinOption, - OptionKind.DIALOG: DialogOption, - OptionKind.ENTRY: EntryOption, - OptionKind.ACTION: ActionOption, - OptionKind.LOGIN: LoginOption, - OptionKind.FILECHOOSER: FileChooserOption, - OptionKind.CALLBACK: CallbackOption, - OptionKind.PROXY: ProxyComboOption, - OptionKind.PRIORITY: PriorityOption, - OptionKind.HOSTNAME: CutstomHostnameOption, - OptionKind.CHANGEPASSWORD: ChangePasswordOption, + SettingKind.SWITCH: SwitchSetting, + SettingKind.SPIN: SpinSetting, + SettingKind.DIALOG: DialogSetting, + SettingKind.ENTRY: EntrySetting, + SettingKind.ACTION: ActionSetting, + SettingKind.LOGIN: LoginSetting, + SettingKind.FILECHOOSER: FileChooserSetting, + SettingKind.CALLBACK: CallbackSetting, + SettingKind.PROXY: ProxyComboSetting, + SettingKind.PRIORITY: PrioritySetting, + SettingKind.HOSTNAME: CutstomHostnameSetting, + SettingKind.CHANGEPASSWORD: ChangePasswordSetting, + SettingKind.COMBO: ComboSetting, } if extend is not None: - for option, callback in extend: - self.map[option] = callback - - def add_option(self, option): - if option.props is not None: - listitem = self.map[option.kind]( - self.account, *option[1:-1], **option.props) - else: - listitem = self.map[option.kind](self.account, *option[1:-1]) - listitem.connect('notify::option-value', self.on_option_changed) - if option.name is not None: - self.named_options[option.name] = listitem + for setting, callback in extend: + self.map[setting] = callback + + def add_setting(self, setting): + if not isinstance(setting, Gtk.ListBoxRow): + if setting.props is not None: + listitem = self.map[setting.kind]( + self.account, *setting[1:-1], **setting.props) + else: + listitem = self.map[setting.kind](self.account, *setting[1:-1]) + listitem.connect('notify::setting-value', self.on_setting_changed) + if setting.name is not None: + self.named_settings[setting.name] = listitem self.add(listitem) - def get_option(self, name): - return self.named_options[name] + def get_setting(self, name): + return self.named_settings[name] def update_states(self): values = [] values.append((None, None)) for row in self.get_children(): - name = row.get_child().name + name = row.name if name is None: continue - value = row.get_child().get_property('option-value') + value = row.get_property('setting-value') values.append((name, value)) for name, value in values: for row in self.get_children(): - row.get_child().set_activatable(name, value) + row.update_activatable(name, value) - def on_option_changed(self, widget, *args): - value = widget.get_property('option-value') + def on_setting_changed(self, widget, *args): + value = widget.get_property('setting-value') for row in self.get_children(): - row.get_child().set_activatable(widget.name, value) + row.update_activatable(widget.name, value) -class GenericOption(Gtk.Grid): +class GenericSetting(Gtk.ListBoxRow): def __init__(self, account, label, type_, value, name, callback, data, desc, enabledif): - Gtk.Grid.__init__(self) - self.set_column_spacing(12) - self.set_size_request(-1, 25) + Gtk.ListBoxRow.__init__(self) + self._grid = Gtk.Grid() + self._grid.set_size_request(-1, 30) + self._grid.set_column_spacing(12) + self.callback = callback self.type_ = type_ self.value = value @@ -126,18 +156,18 @@ class GenericOption(Gtk.Grid): self.account = account self.name = name self.enabledif = enabledif - self.option_value = self.get_value() + self.setting_value = self.get_value() description_box = Gtk.Box( orientation=Gtk.Orientation.VERTICAL, spacing=0) description_box.set_valign(Gtk.Align.CENTER) - optiontext = Gtk.Label(label=label) - optiontext.set_hexpand(True) - optiontext.set_halign(Gtk.Align.START) - optiontext.set_valign(Gtk.Align.CENTER) - optiontext.set_vexpand(True) - description_box.add(optiontext) + settingtext = Gtk.Label(label=label) + settingtext.set_hexpand(True) + settingtext.set_halign(Gtk.Align.START) + settingtext.set_valign(Gtk.Align.CENTER) + settingtext.set_vexpand(True) + description_box.add(settingtext) if desc is not None: description = Gtk.Label(label=desc) @@ -145,24 +175,29 @@ class GenericOption(Gtk.Grid): description.set_hexpand(True) description.set_halign(Gtk.Align.START) description.set_valign(Gtk.Align.CENTER) + description.set_xalign(0) + description.set_line_wrap(True) + description.set_line_wrap_mode(Pango.WrapMode.WORD) + description.set_max_width_chars(40) description_box.add(description) - self.add(description_box) + self._grid.add(description_box) - self.option_box = Gtk.Box(spacing=6) - self.option_box.set_size_request(200, -1) - self.option_box.set_valign(Gtk.Align.CENTER) - self.option_box.set_name('GenericOptionBox') - self.add(self.option_box) + self.setting_box = Gtk.Box(spacing=6) + self.setting_box.set_size_request(200, -1) + self.setting_box.set_valign(Gtk.Align.CENTER) + self.setting_box.set_name('GenericSettingBox') + self._grid.add(self.setting_box) + self.add(self._grid) def do_get_property(self, prop): - if prop.name == 'option-value': - return self.option_value + if prop.name == 'setting-value': + return self.setting_value raise AttributeError('unknown property %s' % prop.name) def do_set_property(self, prop, value): - if prop.name == 'option-value': - self.option_value = value + if prop.name == 'setting-value': + self.setting_value = value else: raise AttributeError('unknown property %s' % prop.name) @@ -173,13 +208,13 @@ class GenericOption(Gtk.Grid): def __get_value(type_, value, account): if value is None: return - if type_ == OptionType.VALUE: + if type_ == SettingType.VALUE: return value - if type_ == OptionType.CONFIG: + if type_ == SettingType.CONFIG: return app.config.get(value) - if type_ == OptionType.ACCOUNT_CONFIG: + if type_ == SettingType.ACCOUNT_CONFIG: if value == 'password': return passwords.get_password(account) if value == 'no_log_for': @@ -188,17 +223,17 @@ class GenericOption(Gtk.Grid): return account not in no_log return app.config.get_per('accounts', account, value) - if type_ == OptionType.ACTION: + if type_ == SettingType.ACTION: if value.startswith('-'): return account + value return value - raise ValueError('Wrong OptionType?') + raise ValueError('Wrong SettingType?') def set_value(self, state): - if self.type_ == OptionType.CONFIG: + if self.type_ == SettingType.CONFIG: app.config.set(self.value, state) - if self.type_ == OptionType.ACCOUNT_CONFIG: + if self.type_ == SettingType.ACCOUNT_CONFIG: if self.value == 'password': passwords.save_password(self.account, state) if self.value == 'no_log_for': @@ -209,7 +244,7 @@ class GenericOption(Gtk.Grid): if self.callback is not None: self.callback(state, self.data) - self.set_property('option-value', state) + self.set_property('setting-value', state) @staticmethod def set_no_log_for(account, state): @@ -223,36 +258,36 @@ class GenericOption(Gtk.Grid): def on_row_activated(self): raise NotImplementedError - def set_activatable(self, name, value): + def update_activatable(self, name, value): if self.enabledif is None or self.enabledif[0] != name: return activatable = (name, value) == self.enabledif - self.get_parent().set_activatable(activatable) + self.set_activatable(activatable) self.set_sensitive(activatable) -class SwitchOption(GenericOption): +class SwitchSetting(GenericSetting): __gproperties__ = { - "option-value": (bool, 'Switch Value', '', False, + "setting-value": (bool, 'Switch Value', '', False, GObject.ParamFlags.READWRITE),} def __init__(self, *args): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) self.switch = Gtk.Switch() - if self.type_ == OptionType.ACTION: - self.switch.set_action_name('app.%s' % self.option_value) - state = app.app.get_action_state(self.option_value) + if self.type_ == SettingType.ACTION: + self.switch.set_action_name('app.%s' % self.setting_value) + state = app.app.get_action_state(self.setting_value) self.switch.set_active(state.get_boolean()) else: - self.switch.set_active(self.option_value) + self.switch.set_active(self.setting_value) self.switch.connect('notify::active', self.on_switch) self.switch.set_hexpand(True) self.switch.set_halign(Gtk.Align.END) self.switch.set_valign(Gtk.Align.CENTER) - self.option_box.add(self.switch) + self.setting_box.add(self.switch) self.show_all() @@ -265,17 +300,17 @@ class SwitchOption(GenericOption): self.set_value(value) -class EntryOption(GenericOption): +class EntrySetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Entry Value', '', '', + "setting-value": (str, 'Entry Value', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) self.entry = Gtk.Entry() - self.entry.set_text(str(self.option_value)) + self.entry.set_text(str(self.setting_value)) self.entry.connect('notify::text', self.on_text_change) self.entry.set_valign(Gtk.Align.CENTER) self.entry.set_alignment(1) @@ -284,7 +319,7 @@ class EntryOption(GenericOption): self.entry.set_invisible_char('*') self.entry.set_visibility(False) - self.option_box.pack_end(self.entry, True, True, 0) + self.setting_box.pack_end(self.entry, True, True, 0) self.show_all() @@ -296,20 +331,20 @@ class EntryOption(GenericOption): self.entry.grab_focus() -class DialogOption(GenericOption): +class DialogSetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Dummy', '', '', + "setting-value": (str, 'Dummy', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args, dialog): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) self.dialog = dialog - self.option_value = Gtk.Label() - self.option_value.set_text(self.get_option_value()) - self.option_value.set_halign(Gtk.Align.END) - self.option_box.pack_start(self.option_value, True, True, 0) + self.setting_value = Gtk.Label() + self.setting_value.set_text(self.get_setting_value()) + self.setting_value.set_halign(Gtk.Align.END) + self.setting_box.pack_start(self.setting_value, True, True, 0) self.show_all() @@ -319,38 +354,43 @@ class DialogOption(GenericOption): dialog.connect('destroy', self.on_destroy) def on_destroy(self, *args): - self.option_value.set_text(self.get_option_value()) + self.setting_value.set_text(self.get_setting_value()) - def get_option_value(self): - self.option_value.hide() + def get_setting_value(self): + self.setting_value.hide() return '' def on_row_activated(self): self.show_dialog(self.get_toplevel()) -class SpinOption(GenericOption): +class SpinSetting(GenericSetting): __gproperties__ = { - "option-value": (int, 'Priority', '', -128, 127, 0, + "setting-value": (int, 'Priority', '', -128, 127, 0, GObject.ParamFlags.READWRITE),} def __init__(self, *args, range_): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) lower, upper = range_ - adjustment = Gtk.Adjustment(0, lower, upper, 1, 10, 0) + adjustment = Gtk.Adjustment(value=0, + lower=lower, + upper=upper, + step_increment=1, + page_increment=10, + page_size=0) self.spin = Gtk.SpinButton() self.spin.set_adjustment(adjustment) self.spin.set_numeric(True) self.spin.set_update_policy(Gtk.SpinButtonUpdatePolicy.IF_VALID) - self.spin.set_value(self.option_value) + self.spin.set_value(self.setting_value) self.spin.set_halign(Gtk.Align.END) self.spin.set_valign(Gtk.Align.CENTER) self.spin.connect('notify::value', self.on_value_change) - self.option_box.pack_start(self.spin, True, True, 0) + self.setting_box.pack_start(self.spin, True, True, 0) self.show_all() @@ -362,14 +402,14 @@ class SpinOption(GenericOption): self.set_value(value) -class FileChooserOption(GenericOption): +class FileChooserSetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Certificate Path', '', '', + "setting-value": (str, 'Certificate Path', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args, filefilter): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) button = Gtk.FileChooserButton(title=self.label, action=Gtk.FileChooserAction.OPEN) @@ -393,15 +433,15 @@ class FileChooserOption(GenericOption): filter_.add_pattern('*') button.add_filter(filter_) - if self.option_value: - button.set_filename(self.option_value) + if self.setting_value: + button.set_filename(self.setting_value) button.connect('selection-changed', self.on_select) 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) - self.option_box.pack_start(clear_button, False, False, 0) + self.setting_box.pack_start(button, True, True, 0) + self.setting_box.pack_start(clear_button, False, False, 0) self.show_all() @@ -412,14 +452,14 @@ class FileChooserOption(GenericOption): pass -class CallbackOption(GenericOption): +class CallbackSetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Dummy', '', '', + "setting-value": (str, 'Dummy', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args, callback): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) self.callback = callback self.show_all() @@ -427,15 +467,15 @@ class CallbackOption(GenericOption): self.callback() -class ActionOption(GenericOption): +class ActionSetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Dummy', '', '', + "setting-value": (str, 'Dummy', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args, action_args): - GenericOption.__init__(self, *args) - self.action = gtkgui_helpers.get_action(self.option_value) + GenericSetting.__init__(self, *args) + self.action = gtkgui_helpers.get_action(self.setting_value) self.variant = GLib.Variant.new_string(action_args) self.on_enable() @@ -449,32 +489,65 @@ class ActionOption(GenericOption): self.action.activate(self.variant) -class LoginOption(DialogOption): +class LoginSetting(DialogSetting): def __init__(self, *args, **kwargs): - DialogOption.__init__(self, *args, **kwargs) - self.option_value.set_selectable(True) + DialogSetting.__init__(self, *args, **kwargs) + self.setting_value.set_selectable(True) - def get_option_value(self): + def get_setting_value(self): jid = app.get_jid_from_account(self.account) return jid - def set_activatable(self, name, value): - DialogOption.set_activatable(self, name, value) + def update_activatable(self, name, value): + super().update_activatable(name, value) anonym = app.config.get_per('accounts', self.account, 'anonymous_auth') - self.get_parent().set_activatable(not anonym) + self.set_activatable(not anonym) + + +class ComboSetting(GenericSetting): + + __gproperties__ = { + "setting-value": (str, 'Proxy', '', '', + GObject.ParamFlags.READWRITE),} + + def __init__(self, *args, combo_items): + GenericSetting.__init__(self, *args) + + self.combo = MaxWidthComboBoxText() + self.combo.set_valign(Gtk.Align.CENTER) + text_renderer = self.combo.get_cells()[0] + text_renderer.set_property('ellipsize', Pango.EllipsizeMode.END) + for index, value in enumerate(combo_items): + if isinstance(value, tuple): + value, label = value + self.combo.append(value, _(label)) + else: + self.combo.append(value, value) + if value == self.setting_value or index == 0: + self.combo.set_active(index) + + self.combo.connect('changed', self.on_value_change) + + self.setting_box.pack_start(self.combo, True, True, 0) + self.show_all() + + def on_value_change(self, combo): + self.set_value(combo.get_active_id()) -class ProxyComboOption(GenericOption): +class ProxyComboSetting(GenericSetting): __gproperties__ = { - "option-value": (str, 'Proxy', '', '', + "setting-value": (str, 'Proxy', '', '', GObject.ParamFlags.READWRITE),} def __init__(self, *args): - GenericOption.__init__(self, *args) + GenericSetting.__init__(self, *args) - self.combo = Gtk.ComboBoxText() + self.combo = MaxWidthComboBoxText() self.combo.set_valign(Gtk.Align.CENTER) + text_renderer = self.combo.get_cells()[0] + text_renderer.set_property('ellipsize', Pango.EllipsizeMode.END) self._signal_id = None self.update_values() @@ -484,8 +557,8 @@ class ProxyComboOption(GenericOption): button.set_action_name('app.manage-proxies') button.set_valign(Gtk.Align.CENTER) - self.option_box.pack_start(self.combo, True, True, 0) - self.option_box.pack_start(button, False, True, 0) + self.setting_box.pack_start(self.combo, True, True, 0) + self.setting_box.pack_start(button, False, True, 0) self.show_all() def _block_signal(self, state): @@ -505,7 +578,7 @@ class ProxyComboOption(GenericOption): self.combo.remove_all() for index, value in enumerate(proxies): self.combo.insert_text(-1, value) - if value == self.option_value or index == 0: + if value == self.setting_value or index == 0: self.combo.set_active(index) self._block_signal(False) @@ -519,11 +592,11 @@ class ProxyComboOption(GenericOption): pass -class PriorityOption(DialogOption): +class PrioritySetting(DialogSetting): def __init__(self, *args, **kwargs): - DialogOption.__init__(self, *args, **kwargs) + DialogSetting.__init__(self, *args, **kwargs) - def get_option_value(self): + def get_setting_value(self): adjust = app.config.get_per( 'accounts', self.account, 'adjust_priority_with_status') if adjust: @@ -533,18 +606,18 @@ class PriorityOption(DialogOption): return str(priority) -class CutstomHostnameOption(DialogOption): +class CutstomHostnameSetting(DialogSetting): def __init__(self, *args, **kwargs): - DialogOption.__init__(self, *args, **kwargs) + DialogSetting.__init__(self, *args, **kwargs) - def get_option_value(self): + def get_setting_value(self): custom = app.config.get_per('accounts', self.account, 'use_custom_host') return _('On') if custom else _('Off') -class ChangePasswordOption(DialogOption): +class ChangePasswordSetting(DialogSetting): def __init__(self, *args, **kwargs): - DialogOption.__init__(self, *args, **kwargs) + DialogSetting.__init__(self, *args, **kwargs) def show_dialog(self, parent): try: @@ -557,9 +630,9 @@ class ChangePasswordOption(DialogOption): def on_changed(self, new_password): self.set_value(new_password) - def set_activatable(self, name, value): + def update_activatable(self, name, value): activatable = False if self.account in app.connections: con = app.connections[self.account] activatable = con.connected >= 2 and con.register_supported - self.get_parent().set_activatable(activatable) + self.set_activatable(activatable) ===================================== gajim/gtk/util.py ===================================== @@ -623,3 +623,21 @@ class MultiLineLabel(Gtk.Label): self.set_line_wrap(True) self.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) self.set_single_line_mode(False) + + +class MaxWidthComboBoxText(Gtk.ComboBoxText): + def __init__(self, *args, **kwargs): + Gtk.ComboBoxText.__init__(self, *args, **kwargs) + self._max_width = 100 + + def set_max_size(self, size): + self._max_width = size + + def do_get_preferred_width(self): + minimum_width, natural_width = Gtk.ComboBoxText.do_get_preferred_width(self) + + if natural_width > self._max_width: + natural_width = self._max_width + if minimum_width > self._max_width: + minimum_width = self._max_width + return minimum_width, natural_width ===================================== gajim/gtk/xml_console.py ===================================== @@ -22,17 +22,16 @@ from gi.repository import GLib from gajim.common import app from gajim.common import ged from gajim.common.i18n import _ -from gajim.common.const import Option -from gajim.common.const import OptionKind -from gajim.common.const import OptionType from gajim.common.const import StyleAttr from gajim.gtk import util from gajim.gtk.util import get_builder from gajim.gtk.util import get_image_button from gajim.gtk.dialogs import ErrorDialog - -from gajim.options_dialog import OptionsDialog +from gajim.gtk.settings import SettingsDialog +from gajim.gtk.const import Setting +from gajim.gtk.const import SettingKind +from gajim.gtk.const import SettingType UNDECLARED = '
http://www.gajim.org/xmlns/undeclared
' @@ -191,31 +190,31 @@ class XMLConsoleWindow(Gtk.Window): self.filter_dialog.present() return options = [ - Option(OptionKind.SWITCH, 'Presence', - OptionType.VALUE, self.presence, - callback=self.on_option, data='presence'), + Setting(SettingKind.SWITCH, 'Presence', + SettingType.VALUE, self.presence, + callback=self.on_option, data='presence'), - Option(OptionKind.SWITCH, 'Message', - OptionType.VALUE, self.message, - callback=self.on_option, data='message'), + Setting(SettingKind.SWITCH, 'Message', + SettingType.VALUE, self.message, + callback=self.on_option, data='message'), - Option(OptionKind.SWITCH, 'Iq', OptionType.VALUE, self.iq, - callback=self.on_option, data='iq'), + Setting(SettingKind.SWITCH, 'Iq', SettingType.VALUE, self.iq, + callback=self.on_option, data='iq'), - Option(OptionKind.SWITCH, 'Stream\nManagement', - OptionType.VALUE, self.stream, - callback=self.on_option, data='stream'), + Setting(SettingKind.SWITCH, 'Stream\nManagement', + SettingType.VALUE, self.stream, + callback=self.on_option, data='stream'), - Option(OptionKind.SWITCH, 'In', OptionType.VALUE, self.incoming, - callback=self.on_option, data='incoming'), + Setting(SettingKind.SWITCH, 'In', SettingType.VALUE, self.incoming, + callback=self.on_option, data='incoming'), - Option(OptionKind.SWITCH, 'Out', OptionType.VALUE, self.outgoing, - callback=self.on_option, data='outgoing'), + Setting(SettingKind.SWITCH, 'Out', SettingType.VALUE, self.outgoing, + callback=self.on_option, data='outgoing'), ] - self.filter_dialog = OptionsDialog(self, 'Filter', - Gtk.DialogFlags.DESTROY_WITH_PARENT, - options, self.account) + self.filter_dialog = SettingsDialog(self, 'Filter', + Gtk.DialogFlags.DESTROY_WITH_PARENT, + options, self.account) self.filter_dialog.connect('destroy', self.on_filter_destroyed) def on_filter_destroyed(self, win): View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/cc3750711de40e6cfdd9aecdc83fd0a66…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/cc3750711de40e6cfdd9aecdc83fd0a66…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] 2 commits: Remove unused code
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: 6e7f53df by Philipp Hörist at 2019-04-20T06:37:48Z Remove unused code - - - - - cc375071 by Philipp Hörist at 2019-04-20T07:47:34Z Add copy menu to Search dialog - - - - - 6 changed files: - gajim/app_actions.py - gajim/application.py - − gajim/data/gui/progress_dialog.ui - gajim/dialogs.py - gajim/gtk/search.py - gajim/gui_menu_builder.py Changes: ===================================== gajim/app_actions.py ===================================== @@ -355,7 +355,7 @@ def open_link(_action, param): helpers.launch_browser_mailer(kind, link) -def copy_link(_action, param): +def copy_text(_action, param): text = param.get_string() clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clip.set_text(text, -1) ===================================== gajim/application.py ===================================== @@ -416,8 +416,8 @@ class GajimApplication(Gtk.Application): act.connect("activate", app_actions.on_add_contact_jid) self.add_action(act) - act = Gio.SimpleAction.new('copy-link', GLib.VariantType.new('s')) - act.connect("activate", app_actions.copy_link) + act = Gio.SimpleAction.new('copy-text', GLib.VariantType.new('s')) + act.connect("activate", app_actions.copy_text) self.add_action(act) act = Gio.SimpleAction.new('open-link', GLib.VariantType.new('as')) ===================================== gajim/data/gui/progress_dialog.ui deleted ===================================== @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> -<interface> - <requires lib="gtk+" version="3.12"/> - <object class="GtkDialog" id="progress_dialog"> - <property name="can_focus">False</property> - <property name="type_hint">dialog</property> - <signal name="delete-event" handler="on_progress_dialog_delete_event" swapped="no"/> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area11"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="close_button"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkProgressBar" id="progressbar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pulse_step">0.10000000149</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-7">close_button</action-widget> - </action-widgets> - </object> -</interface> ===================================== gajim/dialogs.py ===================================== @@ -1159,35 +1159,6 @@ class RosterItemExchangeWindow: self.window.destroy() -class ProgressDialog: - def __init__(self, title_text, during_text, messages_queue): - """ - During text is what to show during the procedure, messages_queue has the - message to show in the textview - """ - self.xml = get_builder('progress_dialog.ui') - self.dialog = self.xml.get_object('progress_dialog') - self.label = self.xml.get_object('label') - self.label.set_markup('<big>' + during_text + '</big>') - self.progressbar = self.xml.get_object('progressbar') - self.dialog.set_title(title_text) - self.dialog.set_default_size(450, 250) - self.window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT) - self.dialog.show_all() - self.xml.connect_signals(self) - - self.update_progressbar_timeout_id = GLib.timeout_add(100, - self.update_progressbar) - - def update_progressbar(self): - if self.dialog: - self.progressbar.pulse() - return True # loop forever - return False - - def on_progress_dialog_delete_event(self, widget, event): - return True # WM's X button or Escape key should not destroy the window - class TransformChatToMUC: # Keep a reference on windows so garbage collector don't restroy them instances = [] # type: List[TransformChatToMUC] ===================================== gajim/gtk/search.py ===================================== @@ -26,6 +26,8 @@ from gajim.common.i18n import _ from gajim.common.modules import dataforms +from gajim.gui_menu_builder import SearchMenu + from gajim.gtk.dataform import DataFormWidget from gajim.gtk.util import ensure_not_destroyed from gajim.gtk.util import find_widget @@ -259,6 +261,7 @@ class Completed(Gtk.Box): self._scrolled.get_style_context().add_class('search-scrolled') self._scrolled.set_no_show_all(True) self._treeview = None + self._menu = None self.add(self._label) self.add(self._scrolled) self.show_all() @@ -268,6 +271,7 @@ class Completed(Gtk.Box): self._scrolled.remove(self._treeview) self._treeview.destroy() self._treeview = None + self._menu = None self._label.hide() self._scrolled.hide() @@ -303,6 +307,8 @@ class Completed(Gtk.Box): self._treeview.set_hexpand(True) self._treeview.set_vexpand(True) self._treeview.get_style_context().add_class('search-treeview') + self._treeview.connect('button-press-event', self._on_button_press) + self._menu = SearchMenu(self._treeview) for field, counter in zip(form.reported.iter_fields(), itertools.count()): @@ -316,6 +322,19 @@ class Completed(Gtk.Box): self._scrolled.add(self._treeview) self._scrolled.show() + def _on_button_press(self, treeview, event): + if event.button != 3: + return + path, _column, _x, _y = treeview.get_path_at_pos(event.x, event.y) + if path is None: + return + store = treeview.get_model() + iter_ = store.get_iter(path) + column_values = store[iter_] + text = ' '.join(column_values) + self._menu.set_copy_text(text) + self._menu.popup_at_pointer() + class Error(Gtk.Box): ===================================== gajim/gui_menu_builder.py ===================================== @@ -905,31 +905,31 @@ def get_conv_context_menu(account, kind, text): if kind == 'xmpp': if '?join' in text: context_menu = [ - ('copy-link', _('Copy JID')), + ('copy-text', _('Copy JID')), ('-join-groupchat', _('Join Groupchat')), ] else: context_menu = [ - ('copy-link', _('Copy JID')), + ('copy-text', _('Copy JID')), ('-start-chat', _('Start Chat')), ('-add-contact', _('Add to Roster…')), ] elif kind == 'url': context_menu = [ - ('copy-link', _('Copy Link Location')), + ('copy-text', _('Copy Link Location')), ('open-link', _('Open Link in Browser')), ] elif kind == 'mail': context_menu = [ - ('copy-link', _('Copy Email Address')), + ('copy-text', _('Copy Email Address')), ('open-link', _('Open Email Composer')), ] elif kind == 'sth_at_sth': context_menu = [ - ('copy-link', _('Copy JID/Email')), + ('copy-text', _('Copy JID/Email')), ('open-link', _('Open Email Composer')), ('-start-chat', _('Start Chat')), ('-join-groupchat', _('Join Groupchat')), @@ -954,7 +954,7 @@ def get_conv_context_menu(account, kind, text): if action == 'app.open-link': value = GLib.Variant.new_strv([kind, text]) - elif action == 'app.copy-link': + elif action == 'app.copy-text': value = GLib.Variant.new_string(text) else: value = GLib.Variant.new_strv([account, text]) @@ -964,6 +964,20 @@ def get_conv_context_menu(account, kind, text): return menu +class SearchMenu(Gtk.Menu): + def __init__(self, treeview): + Gtk.Menu.__init__(self) + self._copy_item = Gtk.MenuItem(label=_('Copy')) + self._copy_item.set_action_name('app.copy-text') + self.set_copy_text('') + self._copy_item.show() + self.append(self._copy_item) + self.attach_to_widget(treeview, None) + + def set_copy_text(self, text): + self._copy_item.set_action_target_value(GLib.Variant('s', text)) + + def escape_mnemonic(label): if label is None: return View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/cbb1918bce8cd7fc70f2c8bb08c0e7cde…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/cbb1918bce8cd7fc70f2c8bb08c0e7cde…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Update CONTRIBUTING.md
by Philipp Hörist
20 Apr '19
20 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: cbb1918b by Philipp Hörist at 2019-04-20T06:13:56Z Update CONTRIBUTING.md - - - - - 1 changed file: - CONTRIBUTING.md Changes: ===================================== CONTRIBUTING.md ===================================== @@ -6,4 +6,6 @@ If you want to create a fork and use an external account (Github, Google) drop u - gajim_1.0 - Stable Gajim 1.0.x branch - gajim_0.16 - Stable Gajim 0.16.x branch -If you are not familiar with Git please read the [
HowTo](https://dev.gajim.org/gajim/gajim/wikis/development/howtogit)
\ No newline at end of file +If you are not familiar with Git please read the [
HowTo](https://dev.gajim.org/gajim/gajim/wikis/development/howtogit)
+ +A good article regarding [good commit messages](https://chris.beams.io/posts/git-commit/) View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/cbb1918bce8cd7fc70f2c8bb08c0e7cde3…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/cbb1918bce8cd7fc70f2c8bb08c0e7cde3…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Remove unused glade file
by Philipp Hörist
19 Apr '19
19 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: eb6d324e by Philipp Hörist at 2019-04-19T22:26:41Z Remove unused glade file - - - - - 1 changed file: - − gajim/data/gui/adhoc_commands_window.ui Changes: ===================================== gajim/data/gui/adhoc_commands_window.ui deleted ===================================== @@ -1,378 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> -<interface> - <requires lib="gtk+" version="3.12"/> - <object class="GtkWindow" id="adhoc_commands_window"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">6</property> - <property name="title" translatable="yes">Ad-hoc Commands - Gajim</property> - <property name="type_hint">dialog</property> - <signal name="destroy" handler="on_adhoc_commands_window_destroy" swapped="no"/> - <child> - <object class="GtkBox" id="vbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkNotebook" id="stages_notebook"> - <property name="width_request">400</property> - <property name="height_request">400</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <child> - <object class="GtkBox" id="retrieving_commands_stage_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="label247"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Please wait while retrieving command list...</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinner" id="retrieving_commands_spinner"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - <child> - <object class="GtkBox" id="command_list_stage_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="label253"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Choose command to execute:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="padding">5</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="margin_left">1</property> - <property name="margin_right">1</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="command_treeview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection"> - <property name="mode">browse</property> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="padding">5</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox2957"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkButton" id="check_commands_1_button"> - <property name="label" translatable="yes">Check once more</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_check_commands_1_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">2</property> - <property name="pack_type">end</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="sending_form_stage_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="notes_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Please wait while the command is being sent...</property> - <property name="selectable">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinner" id="sending_form_spinner"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkBox" id="no_commands_stage_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="label263"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">This jabber entity does not expose any commands.</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox2956"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkButton" id="check_commands_2_button"> - <property name="label" translatable="yes">Check once more</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_check_commands_2_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkBox" id="error_stage_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="label257"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>An error has occurred:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="error_description_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">Error description...</property> - <property name="wrap">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">4</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">12</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="restart_button"> - <property name="label">gtk-goto-first</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_restart_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="back_button"> - <property name="label">gtk-go-back</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_back_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="forward_button"> - <property name="label">gtk-go-forward</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_forward_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="execute_button"> - <property name="label">gtk-execute</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_execute_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="finish_button"> - <property name="label" translatable="yes">F_inish</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_finish_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="close_button"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_close_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">5</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> -</interface> View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/eb6d324ec579594abc1931218b94792158…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/eb6d324ec579594abc1931218b94792158…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Rework Search dialog
by Philipp Hörist
19 Apr '19
19 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: a27599c6 by Philipp Hörist at 2019-04-19T21:57:55Z Rework Search dialog - Make it a proper Gtk.Assistant - - - - - 6 changed files: - gajim/common/modules/dataforms.py - − gajim/data/gui/search_window.ui - gajim/data/style/gajim.css - gajim/gtk/discovery.py - − gajim/gtk/discovery_search.py - + gajim/gtk/search.py Changes: ===================================== gajim/common/modules/dataforms.py ===================================== @@ -665,6 +665,10 @@ class DataForm(ExtendedNode): for value in self.getTags('instructions'): self.delChild(value) + @property + def is_reported(self): + return self.getTag('reported') is not None + class SimpleDataForm(DataForm, DataRecord): def __init__(self, type_=None, title=None, instructions=None, fields=None, @@ -744,12 +748,6 @@ class MultipleDataForm(DataForm): for record in self.getTags('item'): yield record -# @property -# def reported(self): -# """ -# DataRecord that contains descriptions of fields in records -# """ -# return self.getTag('reported') # # @reported.setter # def reported(self, record): ===================================== gajim/data/gui/search_window.ui deleted ===================================== @@ -1,157 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> -<interface> - <requires lib="gtk+" version="3.12"/> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-add</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-find</property> - </object> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-dialog-info</property> - </object> - <object class="GtkWindow" id="search_window"> - <property name="can_focus">False</property> - <property name="border_width">12</property> - <property name="title" translatable="yes">Search</property> - <property name="type_hint">dialog</property> - <signal name="destroy" handler="on_search_window_destroy" swapped="no"/> - <signal name="key-press-event" handler="on_search_window_key_press_event" swapped="no"/> - <child> - <object class="GtkBox" id="vbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkBox" id="search_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Please wait while retrieving search form...</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkProgressBar" id="progressbar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pulse_step">0.10000000149</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="add_contact_button"> - <property name="label" translatable="yes">_Add contact</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="no_show_all">True</property> - <property name="image">image1</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_add_contact_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="information_button"> - <property name="label" translatable="yes">_Information</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="no_show_all">True</property> - <property name="image">image3</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_information_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="search_button"> - <property name="label" translatable="yes">_Search</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="image">image2</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="on_search_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="close_button"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_close_button_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> -</interface> ===================================== gajim/data/style/gajim.css ===================================== @@ -256,3 +256,7 @@ button.flat.link { padding: 0; border: 0; } /* Treeview */ .adhoc-treeview { padding: 5px; } .adhoc-scrolled { border: 1px solid; border-color:@unfocused_borders; } + +/* Search Dialog */ +.search-treeview { padding: 5px; } +.search-scrolled { border: 1px solid; border-color:@unfocused_borders; } ===================================== gajim/gtk/discovery.py ===================================== @@ -58,7 +58,7 @@ from gajim.common.const import StyleAttr from gajim.gtk.dialogs import ErrorDialog from gajim.gtk.dialogs import InformationDialog from gajim.gtk.service_registration import ServiceRegistration -from gajim.gtk.discovery_search import SearchWindow +from gajim.gtk.search import Search from gajim.gtk.adhoc import AdHocCommand from gajim.gtk.util import icon_exists from gajim.gtk.util import get_builder @@ -1284,12 +1284,7 @@ class ToplevelAgentBrowser(AgentBrowser): if not iter_: return service = model[iter_][0] - if service in app.interface.instances[self.account]['search']: - app.interface.instances[self.account]['search'][service].window.\ - present() - else: - app.interface.instances[self.account]['search'][service] = \ - SearchWindow(self.account, service) + Search(self.account, service, self.window.window) def cleanup(self): AgentBrowser.cleanup(self) ===================================== gajim/gtk/discovery_search.py deleted ===================================== @@ -1,244 +0,0 @@ -# Copyright (C) 2007 Stephan Erb <steve-e AT h3c.de> -# Copyright (C) 2007-2014 Yann Leboulanger <asterix AT
lagaule.org
> -# -# This file is part of Gajim. -# -# Gajim is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation; version 3 only. -# -# Gajim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. - -from gi.repository import GLib -from gi.repository import Gtk -from gi.repository import Gdk - -from gajim.common import app -from gajim.common import ged -from gajim.common.modules import dataforms -from gajim.common.i18n import _ - -from gajim import vcard -from gajim import dataforms_widget - -from gajim.gtk.util import get_builder -from gajim.gtk.add_contact import AddNewContactWindow -from gajim.gtk.dataform import FakeDataFormWidget - - -class SearchWindow: - def __init__(self, account, jid): - self.account = account - self.jid = jid - - self._ui = get_builder('search_window.ui') - self.window = self._ui.search_window - - self._ui.search_button.set_sensitive(False) - - self._ui.connect_signals(self) - self.window.show_all() - self.request_form() - self.pulse_id = GLib.timeout_add(80, self.pulse_callback) - - self.is_form = None - - # Is there a jid column in results ? if -1: no, else column number - self.jid_column = -1 - - app.ged.register_event_handler('search-form-received', - ged.GUI1, - self._nec_search_form_received) - app.ged.register_event_handler('search-result-received', - ged.GUI1, - self._nec_search_result_received) - - def request_form(self): - con = app.connections[self.account] - con.get_module('Search').request_search_fields(self.jid) - - def pulse_callback(self): - self._ui.progressbar.pulse() - return True - - def on_search_window_key_press_event(self, _widget, event): - if event.keyval == Gdk.KEY_Escape: - self.window.destroy() - - def on_search_window_destroy(self, _widget): - if self.pulse_id: - GLib.source_remove(self.pulse_id) - del app.interface.instances[self.account]['search'][self.jid] - app.ged.remove_event_handler('search-form-received', - ged.GUI1, - self._nec_search_form_received) - app.ged.remove_event_handler('search-result-received', - ged.GUI1, - self._nec_search_result_received) - - def on_close_button_clicked(self, _button): - self.window.destroy() - - def on_search_button_clicked(self, _button): - con = app.connections[self.account] - if self.is_form: - self.data_form_widget.data_form.type_ = 'submit' - con.get_module('Search').send_search_form( - self.jid, self.data_form_widget.data_form.get_purged(), True) - else: - infos = self.data_form_widget.get_submit_form() - if 'instructions' in infos: - del infos['instructions'] - con.get_module('Search').send_search_form(self.jid, infos, False) - - self._ui.search_vbox.remove(self.data_form_widget) - - self._ui.progressbar.show() - self._ui.label.set_text(_('Waiting for results')) - self._ui.label.show() - self.pulse_id = GLib.timeout_add(80, self.pulse_callback) - self._ui.search_button.hide() - - def on_add_contact_button_clicked(self, _widget): - (model, iter_) = self.result_treeview.get_selection().get_selected() - if not iter_: - return - jid = model[iter_][self.jid_column] - AddNewContactWindow(self.account, jid) - - def on_information_button_clicked(self, _widget): - (model, iter_) = self.result_treeview.get_selection().get_selected() - if not iter_: - return - jid = model[iter_][self.jid_column] - if jid in app.interface.instances[self.account]['infos']: - app.interface.instances[self.account]['infos'][jid].window.present() - else: - contact = app.contacts.create_contact(jid=jid, account=self.account) - app.interface.instances[self.account]['infos'][jid] = \ - vcard.VcardWindow(contact, self.account) - - def _nec_search_form_received(self, obj): - if self.pulse_id: - GLib.source_remove(self.pulse_id) - self._ui.progressbar.hide() - self._ui.label.hide() - - if obj.is_dataform: - self.is_form = True - self.data_form_widget = dataforms_widget.DataFormWidget() - self.dataform = dataforms.extend_form(node=obj.data) - self.data_form_widget.set_sensitive(True) - try: - self.data_form_widget.data_form = self.dataform - except dataforms.Error: - self._ui.label.set_text(_('Error in received dataform')) - self._ui.label.show() - return - if self.data_form_widget.title: - self.window.set_title( - '%s - Search - Gajim' % self.data_form_widget.title) - else: - self.is_form = False - self.data_form_widget = FakeDataFormWidget(obj.data) - - self.data_form_widget.show_all() - self._ui.search_vbox.pack_start(self.data_form_widget, True, True, 0) - self._ui.search_button.set_sensitive(True) - - def on_result_treeview_cursor_changed(self, treeview): - if self.jid_column == -1: - return - (model, iter_) = treeview.get_selection().get_selected() - if not iter_: - return - if model[iter_][self.jid_column]: - self._ui.add_contact_button.set_sensitive(True) - self._ui.information_button.set_sensitive(True) - else: - self._ui.add_contact_button.set_sensitive(False) - self._ui.information_button.set_sensitive(False) - - def _nec_search_result_received(self, obj): - if self.pulse_id: - GLib.source_remove(self.pulse_id) - self._ui.progressbar.hide() - self._ui.label.hide() - - if not obj.is_dataform: - if not obj.data: - self._ui.label.set_text(_('No result')) - self._ui.label.show() - return - # We suppose all items have the same fields - sw = Gtk.ScrolledWindow() - sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - self.result_treeview = Gtk.TreeView() - self.result_treeview.connect( - 'cursor-changed', self.on_result_treeview_cursor_changed) - sw.add(self.result_treeview) - # Create model - fieldtypes = [str]*len(obj.data[0]) - model = Gtk.ListStore(*fieldtypes) - # Copy data to model - for item in obj.data: - model.append(item.values()) - # Create columns - counter = 0 - for field in obj.data[0].keys(): - self.result_treeview.append_column( - Gtk.TreeViewColumn(field, - Gtk.CellRendererText(), - text=counter)) - if field == 'jid': - self.jid_column = counter - counter += 1 - self.result_treeview.set_model(model) - sw.show_all() - self._ui.search_vbox.pack_start(sw, True, True, 0) - if self.jid_column > -1: - self._ui.add_contact_button.show() - self._ui.information_button.show() - return - - self.dataform = dataforms.extend_form(node=obj.data) - if not self.dataform.items: - # No result - self._ui.label.set_text(_('No result')) - self._ui.label.show() - return - - self.data_form_widget.set_sensitive(True) - try: - self.data_form_widget.data_form = self.dataform - except dataforms.Error: - self._ui.label.set_text(_('Error in received dataform')) - self._ui.label.show() - return - - self.result_treeview = self.data_form_widget.records_treeview - selection = self.result_treeview.get_selection() - selection.set_mode(Gtk.SelectionMode.SINGLE) - self.result_treeview.connect( - 'cursor-changed', self.on_result_treeview_cursor_changed) - - counter = 0 - for field in self.dataform.reported.iter_fields(): - if field.var == 'jid': - self.jid_column = counter - break - counter += 1 - self._ui.search_vbox.pack_start(self.data_form_widget, True, True, 0) - self.data_form_widget.show() - if self.jid_column > -1: - self._ui.add_contact_button.show() - self._ui.information_button.show() - if self.data_form_widget.title: - self.window.set_title( - '%s - Search - Gajim' % self.data_form_widget.title) ===================================== gajim/gtk/search.py ===================================== @@ -0,0 +1,344 @@ +# Copyright (C) 2019 Philipp Hörist <philipp AT
hoerist.com
> +# +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + +import logging +import itertools +from enum import IntEnum + +from gi.repository import Gtk + +from gajim.common import app +from gajim.common import ged +from gajim.common.i18n import _ + +from gajim.common.modules import dataforms + +from gajim.gtk.dataform import DataFormWidget +from gajim.gtk.util import ensure_not_destroyed +from gajim.gtk.util import find_widget + +log = logging.getLogger('gajim.gtk.search') + + +class Page(IntEnum): + REQUEST_FORM = 0 + FORM = 1 + REQUEST_RESULT = 2 + COMPLETED = 3 + ERROR = 4 + + +class Search(Gtk.Assistant): + def __init__(self, account, jid, transient_for=None): + Gtk.Assistant.__init__(self) + + self._con = app.connections[account] + self._account = account + self._jid = jid + self._destroyed = False + + self.set_application(app.app) + self.set_resizable(True) + self.set_position(Gtk.WindowPosition.CENTER) + if transient_for is not None: + self.set_transient_for(transient_for) + + self.set_size_request(500, 400) + self.get_style_context().add_class('dialog-margin') + + self._add_page(RequestForm()) + self._add_page(Form()) + self._add_page(RequestResult()) + self._add_page(Completed()) + self._add_page(Error()) + + self.connect('prepare', self._on_page_change) + self.connect('cancel', self._on_cancel) + self.connect('close', self._on_cancel) + self.connect('destroy', self._on_destroy) + + self._remove_sidebar() + + self._buttons = {} + self._add_custom_buttons() + + self.show() + app.ged.register_event_handler('search-form-received', + ged.GUI1, + self._search_form_received) + app.ged.register_event_handler('search-result-received', + ged.GUI1, + self._search_result_received) + + self._request_search_fields() + + def _add_custom_buttons(self): + action_area = find_widget('action_area', self) + for button in list(action_area.get_children()): + self.remove_action_widget(button) + + search = Gtk.Button(label=_('Search')) + search.connect('clicked', self._execute_search) + search.get_style_context().add_class('suggested-action') + self._buttons['search'] = search + self.add_action_widget(search) + + new_search = Gtk.Button(label=_('New Search')) + new_search.get_style_context().add_class('suggested-action') + new_search.connect('clicked', + lambda *args: self.set_current_page(Page.FORM)) + self._buttons['new-search'] = new_search + self.add_action_widget(new_search) + + def _set_button_visibility(self, page): + for button in self._buttons.values(): + button.hide() + + if page == Page.FORM: + self._buttons['search'].show() + + elif page in (Page.ERROR, Page.COMPLETED): + self._buttons['new-search'].show() + + def _add_page(self, page): + self.append_page(page) + self.set_page_type(page, page.type_) + self.set_page_title(page, page.title) + self.set_page_complete(page, page.complete) + + def set_stage_complete(self, is_valid): + self._buttons['search'].set_sensitive(is_valid) + + def _request_search_fields(self): + self._con.get_module('Search').request_search_fields(self._jid) + + def _execute_search(self, *args): + self.set_current_page(Page.REQUEST_RESULT) + form = self.get_nth_page(Page.FORM).get_submit_form() + self._con.get_module('Search').send_search_form(self._jid, form, True) + + @ensure_not_destroyed + def _search_form_received(self, event): + if not event.is_dataform: + self.set_current_page(Page.ERROR) + return + + self.get_nth_page(Page.FORM).process_search_form(event.data) + self.set_current_page(Page.FORM) + + @ensure_not_destroyed + def _search_result_received(self, event): + if event.data is None: + self._on_error('') + return + self.get_nth_page(Page.COMPLETED).process_result(event.data) + self.set_current_page(Page.COMPLETED) + + def _remove_sidebar(self): + main_box = self.get_children()[0] + sidebar = main_box.get_children()[0] + main_box.remove(sidebar) + + def _on_page_change(self, _assistant, _page): + self._set_button_visibility(self.get_current_page()) + + def _on_error(self, error_text): + log.info('Show Error page') + page = self.get_nth_page(Page.ERROR) + page.set_text(error_text) + self.set_current_page(Page.ERROR) + + def _on_cancel(self, _widget): + app.ged.remove_event_handler('search-form-received', + ged.GUI1, + self._search_form_received) + app.ged.remove_event_handler('search-result-received', + ged.GUI1, + self._search_result_received) + self.destroy() + + def _on_destroy(self, *args): + self._destroyed = True + + +class RequestForm(Gtk.Box): + + type_ = Gtk.AssistantPageType.CUSTOM + title = _('Request Search Form') + complete = False + + def __init__(self): + super().__init__(orientation=Gtk.Orientation.VERTICAL) + self.set_spacing(18) + spinner = Gtk.Spinner() + self.pack_start(spinner, True, True, 0) + spinner.start() + self.show_all() + + +class Form(Gtk.Box): + + type_ = Gtk.AssistantPageType.CUSTOM + title = _('Search') + complete = True + + def __init__(self): + super().__init__(orientation=Gtk.Orientation.VERTICAL) + self.set_spacing(18) + self._dataform_widget = None + self.show_all() + + @property + def search_form(self): + return self._dataform_widget.get_submit_form() + + def clear(self): + self._show_form(None) + + def process_search_form(self, form): + self._show_form(form) + + def _show_form(self, form): + if self._dataform_widget is not None: + self.remove(self._dataform_widget) + self._dataform_widget.destroy() + if form is None: + return + + options = {'form-width': 350} + + form = dataforms.extend_form(node=form) + self._dataform_widget = DataFormWidget(form, options=options) + self._dataform_widget.connect('is-valid', self._on_is_valid) + self._dataform_widget.validate() + self._dataform_widget.show_all() + self.add(self._dataform_widget) + + def _on_is_valid(self, _widget, is_valid): + self.get_toplevel().set_stage_complete(is_valid) + + def get_submit_form(self): + return self._dataform_widget.get_submit_form() + + +class RequestResult(RequestForm): + + type_ = Gtk.AssistantPageType.CUSTOM + title = _('Search…') + complete = False + + +class Completed(Gtk.Box): + + type_ = Gtk.AssistantPageType.CUSTOM + title = _('Search Result') + complete = True + + def __init__(self): + super().__init__(orientation=Gtk.Orientation.VERTICAL) + self.set_spacing(12) + self.show_all() + self._label = Gtk.Label(label=_('No results found')) + self._label.get_style_context().add_class('bold16') + self._label.set_no_show_all(True) + self._label.set_halign(Gtk.Align.CENTER) + self._scrolled = Gtk.ScrolledWindow() + self._scrolled.get_style_context().add_class('search-scrolled') + self._scrolled.set_no_show_all(True) + self._treeview = None + self.add(self._label) + self.add(self._scrolled) + self.show_all() + + def process_result(self, form): + if self._treeview is not None: + self._scrolled.remove(self._treeview) + self._treeview.destroy() + self._treeview = None + self._label.hide() + self._scrolled.hide() + + if not form: + self._label.show() + return + + form = dataforms.extend_form(node=form) + + fieldtypes = [] + fieldvars = [] + for field in form.reported.iter_fields(): + if field.type_ == 'boolean': + fieldtypes.append(bool) + elif field.type_ in ('jid-single', 'text-single'): + fieldtypes.append(str) + else: + log.warning('Not supported field received: %s', field.type_) + continue + fieldvars.append(field.var) + + liststore = Gtk.ListStore(*fieldtypes) + + for item in form.iter_records(): + iter_ = liststore.append() + for field in item.iter_fields(): + if field.var in fieldvars: + liststore.set_value(iter_, + fieldvars.index(field.var), + field.value) + + self._treeview = Gtk.TreeView() + self._treeview.set_hexpand(True) + self._treeview.set_vexpand(True) + self._treeview.get_style_context().add_class('search-treeview') + + for field, counter in zip(form.reported.iter_fields(), + itertools.count()): + self._treeview.append_column( + Gtk.TreeViewColumn(field.label, + Gtk.CellRendererText(), + text=counter)) + + self._treeview.set_model(liststore) + self._treeview.show() + self._scrolled.add(self._treeview) + self._scrolled.show() + + +class Error(Gtk.Box): + + type_ = Gtk.AssistantPageType.CUSTOM + title = _('Error') + complete = True + + def __init__(self): + super().__init__(orientation=Gtk.Orientation.VERTICAL) + self.set_spacing(12) + self.set_homogeneous(True) + + icon = Gtk.Image.new_from_icon_name('dialog-error-symbolic', + Gtk.IconSize.DIALOG) + icon.get_style_context().add_class('error-color') + icon.set_valign(Gtk.Align.END) + self._label = Gtk.Label() + self._label.get_style_context().add_class('bold16') + self._label.set_valign(Gtk.Align.START) + + self.add(icon) + self.add(self._label) + self.show_all() + + def set_text(self, text): + self._label.set_text(text) View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/a27599c63b5f8cbbd8e6e77097943c6bff…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/a27599c63b5f8cbbd8e6e77097943c6bff…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] 2 commits: Fix deprecation warning
by Philipp Hörist
19 Apr '19
19 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: 9f4adbdd by Philipp Hörist at 2019-04-19T17:36:43Z Fix deprecation warning - - - - - 8bfe90c5 by Philipp Hörist at 2019-04-19T17:36:43Z Refactor FakeDataFormWidget - Add test - Support oob redirect url - - - - - 8 changed files: - gajim/common/modules/register.py - − gajim/config.py - gajim/gtk/account_wizard.py - gajim/gtk/dataform.py - gajim/gtk/discovery_search.py - gajim/gtk/service_registration.py - gajim/roster_window.py - + test/gtk/fake_dataform.py Changes: ===================================== gajim/common/modules/register.py ===================================== @@ -134,9 +134,14 @@ class Register(BaseModule): is_form = form is not None if not is_form: form = {} + oob = stanza.getQuery().getTag('x', namespace=nbxmpp.NS_X_OOB) + if oob is not None: + form['redirect-url'] = oob.getTagData('url') for field in stanza.getQueryPayload(): if not isinstance(field, nbxmpp.Node): continue + if field.getName() == 'x': + continue form[field.getName()] = field.getData() return form, is_form ===================================== gajim/config.py deleted ===================================== @@ -1,83 +0,0 @@ -# Copyright (C) 2003-2005 Vincent Hanquez <tab AT
snarc.org
> -# Copyright (C) 2003-2014 Yann Leboulanger <asterix AT
lagaule.org
> -# Copyright (C) 2005 Alex Podaras <bigpod AT
gmail.com
> -# Stéphan Kochen <stephan AT kochen.nl> -# Copyright (C) 2005-2006 Dimitur Kirov <dkirov AT
gmail.com
> -# Nikos Kouremenos <kourem AT
gmail.com
> -# Copyright (C) 2006 Junglecow J <junglecow AT
gmail.com
> -# Copyright (C) 2006-2007 Travis Shirk <travis AT
pobox.com
> -# Stefan Bethge <stefan AT lanpartei.de> -# Copyright (C) 2006-2008 Jean-Marie Traissard <jim AT
lapin.org
> -# Copyright (C) 2007 James Newton <redshodan AT
gmail.com
> -# Julien Pivotto <roidelapluie AT
gmail.com
> -# Copyright (C) 2007-2008 Stephan Erb <steve-e AT h3c.de> -# Copyright (C) 2008 Jonathan Schleifer <js-gajim AT
webkeks.org
> -# -# This file is part of Gajim. -# -# Gajim is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation; version 3 only. -# -# Gajim is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. - -from gi.repository import Gtk -from gi.repository import GObject - - -class FakeDataForm(Gtk.Table): - """ - Class for forms that are in XML format <entry1>value1</entry1> infos in a - table {entry1: value1} - """ - - def __init__(self, infos, selectable=False): - GObject.GObject.__init__(self) - self.infos = infos - self.selectable = selectable - self.entries = {} - self._draw_table() - - def _draw_table(self): - """ - Draw the table - """ - nbrow = 0 - if 'instructions' in self.infos: - nbrow = 1 - self.resize(rows=nbrow, columns=2) - label = Gtk.Label(label=self.infos['instructions']) - if self.selectable: - label.set_selectable(True) - self.attach(label, 0, 2, 0, 1, 0, 0, 0, 0) - for name in self.infos.keys(): - if name in ('key', 'instructions', 'x', 'registered'): - continue - if not name: - continue - - nbrow = nbrow + 1 - self.resize(rows=nbrow, columns=2) - label = Gtk.Label(label=name.capitalize() + ':') - self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0) - entry = Gtk.Entry() - entry.set_activates_default(True) - if self.infos[name]: - entry.set_text(self.infos[name]) - if name == 'password': - entry.set_visibility(False) - self.attach(entry, 1, 2, nbrow - 1, nbrow, 0, 0, 0, 0) - self.entries[name] = entry - if nbrow == 1: - entry.grab_focus() - - def get_infos(self): - for name in self.entries: - self.infos[name] = self.entries[name].get_text() - return self.infos ===================================== gajim/gtk/account_wizard.py ===================================== @@ -29,11 +29,10 @@ from gajim.common.modules import dataforms from gajim import dataforms_widget from gajim import gui_menu_builder -from gajim.config import FakeDataForm - from gajim.gtk.util import get_builder from gajim.gtk.dialogs import ErrorDialog from gajim.gtk.proxies import ManageProxies +from gajim.gtk.dataform import FakeDataFormWidget class AccountCreationWizard: @@ -325,7 +324,7 @@ class AccountCreationWizard: if self.is_form: form = self.data_form_widget.data_form else: - form = self.data_form_widget.get_infos() + form = self.data_form_widget.get_submit_form() app.connections[self.account].send_new_account_infos( form, self.is_form) self.xml.get_object('form_vbox').remove(self.data_form_widget) @@ -381,7 +380,7 @@ class AccountCreationWizard: self.data_form_widget.set_data_form(dataform) empty_config = False else: - self.data_form_widget = FakeDataForm(obj.config, selectable=True) + self.data_form_widget = FakeDataFormWidget(obj.config) for field in obj.config: if field in ('key', 'instructions', 'x', 'registered'): continue ===================================== gajim/gtk/dataform.py ===================================== @@ -21,6 +21,7 @@ from gajim.gtkgui_helpers import scale_pixbuf_from_data from gajim.common import app from gajim.common.i18n import _ +from gajim.common.helpers import launch_browser_mailer from gajim.common.modules.dataforms import extend_form from gajim.gtk.util import MultiLineLabel @@ -554,6 +555,76 @@ class ImageMediaField(): form_grid.attach(self._image, 1, row_number, 1, 1) +class FakeDataFormWidget(Gtk.ScrolledWindow): + def __init__(self, fields): + Gtk.ScrolledWindow.__init__(self) + self.set_hexpand(True) + self.set_vexpand(True) + self.set_overlay_scrolling(False) + self.get_style_context().add_class('data-form-widget') + + self._grid = Gtk.Grid() + self._grid.set_column_spacing(12) + self._grid.set_row_spacing(12) + self._grid.set_halign(Gtk.Align.CENTER) + + self._fields = fields + self._entries = {} + self._row_count = 0 + + instructions = fields.pop('instructions', None) + if instructions is not None: + label = Gtk.Label(label=instructions) + label.set_justify(Gtk.Justification.CENTER) + label.set_max_width_chars(40) + label.set_line_wrap(True) + label.set_line_wrap_mode(Pango.WrapMode.WORD) + self._grid.attach(label, 0, self._row_count, 2, 1) + self._row_count += 1 + + redirect_url = fields.pop('redirect-url', None) + if not fields and redirect_url is not None: + # Server wants to redirect registration + button = Gtk.Button(label='Register') + button.set_halign(Gtk.Align.CENTER) + button.get_style_context().add_class('suggested-action') + button.connect('clicked', + lambda *args: launch_browser_mailer('url', + redirect_url)) + self._grid.attach(button, 0, self._row_count, 2, 1) + else: + self._add_fields() + self.add(self._grid) + self.show_all() + + def _add_fields(self): + for name, value in self._fields.items(): + if name in ('key', 'x', 'registered'): + continue + + label = Gtk.Label(label=name.capitalize()) + label.set_xalign(1) + self._grid.attach(label, 0, self._row_count, 1, 1) + self._row_count += 1 + + entry = Gtk.Entry() + entry.set_text(value) + if name == 'password': + entry.set_input_purpose(Gtk.InputPurpose.PASSWORD) + entry.set_visibility(False) + self._entries[name] = entry + + self._grid.attach_next_to(entry, label, + Gtk.PositionType.RIGHT, 1, 1) + + def get_submit_form(self): + fields = {} + for name, entry in self._entries.items(): + fields[name] = entry.get_text() + return fields + + + class DataFormDialog(Gtk.Dialog): def __init__(self, title, transient_for, form, node, submit_callback): Gtk.Dialog.__init__(self, ===================================== gajim/gtk/discovery_search.py ===================================== @@ -25,11 +25,11 @@ from gajim.common.modules import dataforms from gajim.common.i18n import _ from gajim import vcard -from gajim import config from gajim import dataforms_widget from gajim.gtk.util import get_builder from gajim.gtk.add_contact import AddNewContactWindow +from gajim.gtk.dataform import FakeDataFormWidget class SearchWindow: @@ -92,7 +92,7 @@ class SearchWindow: con.get_module('Search').send_search_form( self.jid, self.data_form_widget.data_form.get_purged(), True) else: - infos = self.data_form_widget.get_infos() + infos = self.data_form_widget.get_submit_form() if 'instructions' in infos: del infos['instructions'] con.get_module('Search').send_search_form(self.jid, infos, False) @@ -146,7 +146,7 @@ class SearchWindow: '%s - Search - Gajim' % self.data_form_widget.title) else: self.is_form = False - self.data_form_widget = config.FakeDataForm(obj.data) + self.data_form_widget = FakeDataFormWidget(obj.data) self.data_form_widget.show_all() self._ui.search_vbox.pack_start(self.data_form_widget, True, True, 0) ===================================== gajim/gtk/service_registration.py ===================================== @@ -22,6 +22,7 @@ from gajim.common.modules import dataforms from gajim.common.i18n import _ from gajim.gtk.dataform import DataFormWidget +from gajim.gtk.dataform import FakeDataFormWidget log = logging.getLogger('gajim.gtk.registration') @@ -77,8 +78,7 @@ class ServiceRegistration(Gtk.Assistant): def _build_dataform(self, form, is_form): if not is_form: - from gajim import config - return config.FakeDataForm(form) + return FakeDataFormWidget(form) dataform = dataforms.extend_form(node=form) @@ -122,15 +122,7 @@ class ServiceRegistration(Gtk.Assistant): def _register(self): log.info('Show Sending page') - if self._is_form: - form = self._data_form_widget.get_submit_form() - else: - form = self._data_form_widget.get_infos() - if 'instructions' in form: - del form['instructions'] - if 'registered' in form: - del form['registered'] - + form = self._data_form_widget.get_submit_form() self._con.get_module('Register').register_agent( self._agent, form, ===================================== gajim/roster_window.py ===================================== @@ -4823,7 +4823,7 @@ class RosterWindow: pep_submenu = Gtk.Menu() pep_menuitem.set_submenu(pep_submenu) - item = Gtk.CheckMenuItem(_('Publish Tune')) + item = Gtk.CheckMenuItem(label=_('Publish Tune')) pep_submenu.append(item) if sys.platform in ('win32', 'darwin'): item.set_sensitive(False) @@ -4834,7 +4834,7 @@ class RosterWindow: item.connect('toggled', self.on_publish_tune_toggled, account) - item = Gtk.CheckMenuItem(_('Publish Location')) + item = Gtk.CheckMenuItem(label=_('Publish Location')) pep_submenu.append(item) if not app.is_installed('GEOCLUE'): item.set_sensitive(False) ===================================== test/gtk/fake_dataform.py ===================================== @@ -0,0 +1,47 @@ +from gi.repository import Gtk + +from gajim.gtk.dataform import FakeDataFormWidget +from gajim.common.const import CSSPriority + +from test.gtk import util +util.load_style('gajim.css', CSSPriority.APPLICATION) + + +fake_form = { + 'instructions': 'This is the a long long long long long long test instruction', + 'username': '', + 'nick': '', + 'password': '', + 'name': '', + 'first': '', + 'last': '', + 'email': '', + 'address': '', + 'city': '', + 'state': '', + 'zip': '', + 'phone': '', + 'url': '', + 'date': '', + 'misc': '', + 'text': '', + 'key': '', +} + +fake_form2 = { + 'instructions': 'To register, visit
https://jabber.at/account/register/
', + 'redirect-url': '
https://jabber.at/account/register/
' +} + +class DataFormWindow(Gtk.Window): + def __init__(self): + Gtk.Window.__init__(self, title="Data Form Test") + self.set_default_size(600, 600) + self._widget = FakeDataFormWidget(fake_form2) + self.add(self._widget) + self.show() + +win = DataFormWindow() +win.connect("destroy", Gtk.main_quit) +win.show_all() +Gtk.main() View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/bd75c78b825eb45b2b1858cd1a56e66eb…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/bd75c78b825eb45b2b1858cd1a56e66eb…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Revert destructive-action on SubRequest deny
by Philipp Hörist
19 Apr '19
19 Apr '19
Philipp Hörist pushed to branch master at gajim / gajim Commits: bd75c78b by Daniel Brötzmann at 2019-04-19T15:04:16Z Revert destructive-action on SubRequest deny - - - - - 1 changed file: - gajim/data/gui/subscription_request_window.ui Changes: ===================================== gajim/data/gui/subscription_request_window.ui ===================================== @@ -31,6 +31,9 @@ <property name="can_focus">False</property> <property name="halign">start</property> <property name="label"><XMPP address></property> + <property name="wrap">True</property> + <property name="wrap_mode">word-char</property> + <property name="max_width_chars">50</property> <property name="xalign">0</property> <style> <class name="large-header"/> @@ -48,6 +51,7 @@ <property name="halign">start</property> <property name="label"><subscription request></property> <property name="wrap">True</property> + <property name="max_width_chars">50</property> <property name="xalign">0</property> <style> <class name="dim-label"/> @@ -67,6 +71,7 @@ <property name="label"><subscription text> </property> <property name="wrap">True</property> + <property name="max_width_chars">50</property> <property name="xalign">0</property> <property name="yalign">0</property> <attributes> @@ -148,9 +153,6 @@ <property name="tooltip_text" translatable="yes">Deny authorization from contact so the contact cannot know if you are connected</property> <property name="use_underline">True</property> <signal name="clicked" handler="on_deny_button_clicked" swapped="no"/> - <style> - <class name="destructive-action"/> - </style> </object> <packing> <property name="expand">False</property> View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/bd75c78b825eb45b2b1858cd1a56e66eb7…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/bd75c78b825eb45b2b1858cd1a56e66eb7…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
← Newer
1
...
432
433
434
435
436
437
438
...
1764
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
Results per page:
10
25
50
100
200