From 5d2e83394bd6e5331503fc9f539a7697c3d40bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Fri, 26 Oct 2018 00:18:06 +0200 Subject: [PATCH] Rework Preferences Window --- gajim/data/gui/preferences_window.ui | 4608 ++++++++++++++------------ gajim/data/style/gajim.css | 4 + gajim/gtk/preferences.py | 1079 +++--- 3 files changed, 2970 insertions(+), 2721 deletions(-) diff --git a/gajim/data/gui/preferences_window.ui b/gajim/data/gui/preferences_window.ui index 075f57f29..618c17fda 100644 --- a/gajim/data/gui/preferences_window.ui +++ b/gajim/data/gui/preferences_window.ui @@ -2,33 +2,21 @@ - - 1 - 1440 - 20 - 1 - 10 - - + 1 720 12 1 10 - - - - - - - - - - - + + 1 + 1440 + 20 + 1 + 10 - + @@ -42,7 +30,19 @@ - + + + + + + + + + + + + + @@ -59,41 +59,7 @@ - - - - - - - - All chat states - - - Composing only - - - Disabled - - - - - - - - - - - Never - - - Only when pending events - - - Always - - - - + @@ -110,7 +76,7 @@ - + @@ -133,7 +99,52 @@ - + + + + + + + + No status messages + + + All status messages + + + Only enter/leave messages + + + + + + + + + + + None + + + + + + + + + + + All chat states + + + Composing only + + + Disabled + + + + @@ -150,17 +161,6 @@ - - - - - - - - None - - - @@ -179,1028 +179,282 @@ - + + + + + + + + Never + + + Only when pending events + + + Always + + + + + + + + + + + Top + + + Bottom + + + Left + + + Right + + + + True - True - False + False - + + 180 True False - 18 - 18 - 18 - 18 - vertical - 18 + stack + + + False + True + 0 + + + + + 560 + True + False + crossfade - + True False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none + 18 + vertical + 6 - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - 6 - vertical - 6 + 0 + none - - Display a_vatars of contacts in roster - True - True - False - If checked, Gajim will display avatars of contacts in roster window and in group chats - start - True - True - - - - False - False - 0 - - - - - Display status _messages of contacts in roster - True - True - False - If checked, Gajim will display status messages of contacts under the contact name, in roster window and in group chats - start - True - True - - - - False - False - 1 - - - - - Display e_xtra information of contacts in roster (mood, activity, ...) - True - True - False - If checked, Gajim will display the mood of contacts in the roster window - start - True - True - - - - False - False - 2 - - - - + True False + 6 + 6 + 12 + + + True + False + end + _Window behavior + True + right + one_window_type_combobox + + + + 0 + 0 + + + + + 300 + True + False + one_window_type_liststore + + + + + 0 + + + + + 1 + 0 + + + + + True + False + show_roster_on_startup_liststore + + + + + 0 + + + + + 1 + 1 + + + + + True + False + end + _Show roster on startup + True + right + show_roster_on_startup + + + + 0 + 1 + + + + + Show _avatar in chat tabs + True + True + False + If checked, the contact's avatar will be shown in chat tabs + start + True + True + + + + 1 + 4 + + + + + True + False + tabs_placement_liststore + + + + + 0 + + + + + 1 + 3 + + + + + True + False + end + _Tabs placement + True + right + + + + 0 + 3 + + + + + _Quit Gajim when closing roster window + True + True + False + If enabled, Gajim will quit when closing the roster window instead of minimizing to the system's notification area + start + True + True + + + + 1 + 2 + + + + + + + + + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Behavior of Windows and Tabs + True + + + + + + False + True + 0 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + vertical 6 - - True - False - Sort contacts by status - - - False - True - 0 - - - - - in _roster + + Show a_vatars of contacts in roster True True False + If checked, avatars of contacts will be shown in the roster window and in group chats start True True - - - - False - True - 1 - - - - - in _group chats - True - True - False - start - True - True - - - - True - True - 2 - - - - - True - True - 3 - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Roster Appearance</b> - True - - - - - False - True - 0 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - False - 12 - 6 - 6 - 12 - - - Spell _checker - True - False - If checked, Gajim will highlight spelling errors in input fields of chat windows. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. - start - True - True - - - - 0 - 3 - 2 - - - - - Show message recei_pts - True - True - False - start - True - True - - - - 0 - 4 - 2 - - - - - Show _avatar in chat tabs - True - True - False - start - True - True - - - - 0 - 6 - 2 - - - - - True - False - end - _Window behavior - True - right - one_window_type_combobox - - - - 0 - 0 - - - - - 50 - True - False - liststore6 - - - - - 0 - - - - - 1 - 0 - - - - - 50 - True - False - liststore7 - - - - - 0 - - - - - 1 - 1 - - - - - True - False - end - _Show roster on startup - True - right - show_roster_on_startup - - - - 0 - 1 - - - - - _Ignore rich content in incoming messages - True - True - False - Some messages may include rich content (formatting, colors etc). If checked, Gajim will just display the raw message text. - start - 18 - True - True - - - - 0 - 2 - 2 - - - - - Show subject after joining a group chat - True - True - False - True - - - - 0 - 5 - 2 - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Chat Appearance</b> - True - - - - - False - True - 1 - - - - - - - True - False - General - - - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 18 - - - True - False - 0 - none - - - True - False - 12 - 6 - vertical - 6 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - end - When new event is received - right - - - - False - True - 0 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - liststore5 - - - - - 0 - - - - - False - True - 1 - - - - - False - True - 0 - - - - - Notify me about contacts that sign _in - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - start - True - True - - - - False - False - 1 - - - - - Notify me about contacts that sign _out - True - True - False - Gajim will notify you via a popup window in the bottom right of the screen about contacts that just signed out - start - True - True - - - - False - False - 2 - - - - - Allow popup/notifications when I'm _away/na/busy/invisible - True - True - False - start - True - True - - - - False - False - 3 - - - - - Allow popup/notifications when a chat window is opened - True - True - False - start - True - True - - - - False - False - 4 - - - - - True - False - 12 - - - True - False - end - Show notification area icon - right - - - - False - True - 0 - - - - - True - False - liststore4 - - - - - 0 - - - - - False - True - 1 - - - - - False - True - 5 - - - - - - - True - False - <b>Visual Notifications</b> - True - - - - - False - True - 0 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none - - - True - False - 12 - 6 - vertical - 6 - - - True - False - 12 - - - Play _sounds - True - True - False - start - True - True - - - - False - True - 0 - - - - - Ma_nage... - 120 - True - True - True - True - - - - False - True - 1 - - - - - False - True - 0 - - - - - Allow sound when I'm _busy - True - True - False - start - True - True - - - - False - True - 1 - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Sounds</b> - True - - - - - False - True - 1 - - - - - 1 - - - - - True - False - True - Notifications - - - 1 - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 12 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 0 - none - - - True - False - 12 - 6 - 6 - 12 - - - True - False - 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 display in chat windows. - - - True - False - end - _Display chat state notifications - True - right - displayed_chat_states_combobox - - - - - - 0 - 1 - - - - - True - False - liststore2 - - - - - 0 - - - - - 1 - 0 - - - - - True - False - liststore3 - - - - - 0 - - - - - 1 - 1 - - - - - True - False - 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. - - - True - False - end - _Send chat state notifications - True - right - outgoing_chat_states_combobox - - - - - - 0 - 0 - - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Chat state notifications</b> - True - - - - - False - True - 0 - - - - - 2 - False - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Personal Events - - - 2 - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 18 - - - True - False - True - 0 - none - - - True - False - 12 - 6 - 6 - 12 - - - _Away after - True - True - False - If checked, Gajim will change status to Away when the computer is unused. - start - True - True - - - - 0 - 0 - - - - - _Not available after - True - True - False - If checked, Gajim will change status to Not Available when the computer has not been used even longer - start - True - True - - - - 0 - 1 - - - - - True - False - start - minutes - - - 2 - 0 - - - - - True - False - start - minutes - - - 2 - 1 - - - - - True - True - The auto away status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-away timeout - True - - - - 3 - 0 - - - - - True - True - The auto not available status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-not-available timeout - - - - 3 - 1 - - - - - 50 - True - True - 12 - adjustment2 - 1 - 12 - - - - 1 - 0 - - - - - 50 - True - True - 20 - adjustment1 - 1 - 20 - - - - 1 - 1 - - - - - - - True - False - <b>Auto Status</b> - True - - - - - False - False - 0 - - - - - True - False - 0 - none - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - 6 - vertical - 6 - - - True - False - 12 - - - True - False - end - Ask status message when I - right + False @@ -1209,20 +463,879 @@ $T will be replaced by auto-not-available timeout - + + Show status _messages of contacts in roster + True + True + False + If checked, status messages of contacts will be shown under the contact's name, in the roster window, and in group chats + start + True + True + + + + False + False + 1 + + + + + Show e_xtra information of contacts in roster (mood, activity, ...) + True + True + False + If checked, additional info published by the contact will be shown in roster. Additional infos (published via PEP) may include e.g. mood, activity, tune, location, ... + start + True + True + + + + False + False + 2 + + + + True False 12 - - Sign _in + + True + False + Sort contacts by status + + + False + True + 0 + + + + + in _roster True True False start True True - + + + False + True + 1 + + + + + in _group chats + True + True + False + start + True + True + + + True + True + 2 + + + + + True + True + 3 + + + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Roster Appearance + True + + + + + + False + True + 1 + + + + + general + General + + + + + True + False + 18 + vertical + 6 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + vertical + 6 + + + Enable spell _checking + True + False + If checked, spelling errors in input fields of chat windows will be highlighted. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. Needs gspell to be installed. + start + True + True + + + + False + True + 0 + + + + + Show message recei_pts (✔) + True + True + False + If checked, a small checkmark will be shown after each message when it was received. Note that this is not supported by all clients and therefore could be misleading. + start + True + True + + + + False + True + 1 + + + + + _Ignore formatting of incoming messages + True + True + False + Some messages may include rich content (xhtml formatting, colors etc). If checked, Gajim will just display the plain message text. + start + True + True + + + + False + True + 2 + + + + + Display status messages in _single chats + True + True + False + If checked, status lines will be shown in 1 on 1 chats when a contact changes their status or status message + start + True + True + + + + False + True + 3 + + + + + Show subject after _joining a group chat + True + True + False + If checked, the room subject will be shown when joining a group chat + start + True + True + + + + False + True + 4 + + + + + True + False + 6 + 12 + + + True + False + These status messages are displayed when a room occupant changes status (this includes entering/leaving the room) + end + Displa_y status messages in group chats + True + print_status_in_muc_combobox + + + + 0 + 0 + + + + + 200 + True + False + start + print_status_in_muc_liststore + + + + + 0 + + + + + 1 + 0 + + + + + True + False + 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 display in chat windows. + end + _Display chat state notifications + True + right + displayed_chat_states_combobox + + + + 0 + 1 + + + + + True + False + display_chat_state_notifications_liststore + + + + + 0 + + + + + 1 + 1 + + + + + False + True + 5 + + + + + + + True + False + Chat Settings + True + + + + + + False + True + 0 + + + + + chat + Chat + 1 + + + + + True + False + 18 + vertical + 6 + + + True + False + 0 + none + + + True + False + 6 + vertical + 6 + + + True + False + 6 + 12 + + + 200 + True + False + systray_combobox_liststore + + + + + 0 + + + + + 1 + 0 + + + + + True + False + end + Show _notification area icon + True + right + systray_combobox + + + + 0 + 0 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + end + _When new event is received + True + right + on_event_received_combobox + + + + 0 + 1 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + on_event_received_liststore + + + + + 0 + + + + + 1 + 1 + + + + + False + True + 0 + + + + + Show popups/notifications when a chat window is already _open + True + True + False + start + True + True + + + + False + False + 1 + + + + + Allow popups/notifications when I'm _away, not available, busy, or invisible + True + True + False + start + True + True + + + + False + False + 3 + + + + + Notify me about contacts that sign _in + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + A popup window about contacts that just signed in will be shown in the bottom right of the screen + start + True + True + + + + False + False + 4 + + + + + Notify me about contacts that sign _out + True + True + False + A popup window about contacts that just signed out will be shown in the bottom right of the screen + start + True + True + + + + False + False + 4 + + + + + + + True + False + Visual Notifications + True + + + + + + False + True + 0 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + False + 6 + vertical + 6 + + + True + False + 12 + + + Play _sounds + True + True + False + start + True + True + + + + False + True + 0 + + + + + Ma_nage... + 120 + True + True + True + True + + + + False + True + 1 + + + + + False + True + 0 + + + + + Allow playing sounds when I'm _busy + True + True + False + start + True + True + + + + False + True + 1 + + + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Sounds + True + + + + + + False + True + 1 + + + + + notifications + Notifications + 2 + + + + + True + False + 18 + vertical + 6 + + + True + False + True + 0 + none + + + True + False + 6 + 6 + 12 + + + No_t Available + True + True + False + If checked, the status will be changed to Not Available when the computer has not been used for the specified time + end + True + True + + + + 0 + 2 + + + + + A_way + True + True + False + If checked, the status will be changed to Away when the computer has not been used for the specified time + start + True + True + + + + 0 + 1 + + + + + True + True + 20 + adjustment_status_auto_xa + 1 + 20 + + + + 1 + 2 + + + + + 50 + True + True + 12 + adjustment_status_auto_away + 1 + 12 + + + + 1 + 1 + + + + + True + True + The automatic away status message. If empty, the current status message will not be changed. +$S will be replaced by previous status message. +$T will be replaced by auto-away timeout. + True + + + + 2 + 1 + + + + + True + True + The automatic not available status message. If empty, the current status message will not be changed. +$S will be replaced by previous status message. +$T will be replaced by auto-not-available timeout. + + + + 2 + 2 + + + + + True + False + Minutes + + + + 1 + 0 + + + + + True + False + Message + + + + 2 + 0 + + + + + True + False + Status + + + + 0 + 0 + + + + + + + True + False + Automatic Status + True + + + + + + False + False + 0 + + + + + True + False + 0 + none + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + vertical + 6 + + + _Remember and restore status of the last session + True + True + False + If checked, the status and status message used in the last session will be restored + start + True + True + + + + False + True + 0 + + + + + True + False + 12 + + + True + False + end + Ask for status message when I + right False @@ -1231,15 +1344,44 @@ $T will be replaced by auto-not-available timeout - - Sign _out + True - True - False - start - True - True - + False + 12 + + + Sign _in + True + True + False + start + True + True + + + + False + False + 0 + + + + + Sign _out + True + True + False + start + True + True + + + + False + False + 1 + + False @@ -1254,628 +1396,755 @@ $T will be replaced by auto-not-available timeout 1 - - - False - False - 0 - - - - - True - True - If enabled, Gajim will not ask for a status message. The specified default message will be used instead. - in - + + 150 True True - default_message_liststore - - - + If enabled, Gajim will not ask for a status message. The specified default message will be used instead. + in - - Status - - - - 1 - + + True + True + default_message_liststore + 0 + + + + - - - - - Default Message - True - - True - + + True + Status + + + + 1 + + - - 2 - - - - - - Enabled - - + + True + Default Message + True + + + True + + + + 2 + + + + + + + Enabled + + + + + + 3 + + - - 3 - + + True + True + 2 + - - True - True - 1 - + + + + True + False + Status Messages + True + + + + True + True + 1 + - - + + True False - <b>Status Messages</b> - True + 0 + none + + + True + False + 6 + 6 + 12 + + + True + True + True + True + in + + + True + True + status_message_liststore + False + 0 + + + + + + + + + + 0 + 0 + + + + + True + True + True + never + never + in + + + 21 + True + True + word + + + + + 0 + 1 + + + + + True + False + start + start + vertical + 12 + start + + + gtk-new + True + True + True + False + True + + + + False + False + 0 + + + + + gtk-delete + True + True + True + False + True + + + + False + False + 1 + + + + + 1 + 0 + + + + + + + + + + True + False + Preset Status Messages + True + + + + + True + True + 2 + - True - True - 1 + status + Status + 3 - + True False - 0 - none + 18 + vertical + 6 - + True False - 12 - 6 - 6 - 12 + 0 + none - - True - True - True - True - in - - - True - True - status_message_liststore - False - 0 - - - - - - - - - - 0 - 0 - - - - - True - True - True - never - never - in - - - 21 - True - True - word - - - - - 0 - 1 - - - - + True False - start - 12 - start + 6 + vertical + 6 - - gtk-new + + Allow my idle _time to be sent True True - True False - True - + If checked, others will be allowed to detect the idle time of your system + start + True + True + False - False + True 0 - - gtk-delete + + _Allow local system time information to be sent True True - True False - True - + If checked, others will be allowed to detect the local time on your system + start + True + True + False - False + True 1 + + + Allow client / _OS information to be sent + True + True + False + If checked, others will be allowed to detect the operating system you are using + start + True + True + + + + False + True + 2 + + + + + _Ignore events from contacts not in the roster + True + True + False + 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. + start + True + True + + + + False + True + 3 + + + + + True + False + start + 12 + + + True + False + 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. + start + S_end chat state notifications + True + right + outgoing_chat_states_combobox + + + + False + True + 0 + + + + + 200 + True + False + start + send_chatstate_notifications_liststore + + + + + 0 + + + + + False + True + 1 + + + + + False + True + 4 + + + + + + + True + False + Privacy + + + + + + False + True + 0 + + + + + privacy + Privacy + 4 + + + + + True + False + 18 + vertical + 6 + + + True + False + 6 + 12 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + start + Themes + + + + 0 + 0 + 2 + + + + + True + False + end + _Theme + True + right + theme_combobox + 1 - 0 + 1 + + + + + 200 + True + False + + + 2 + 1 + + + + + Ma_nage... + 120 + True + True + False + Configure color and font of the interface + True + + + + 3 + 1 + + + + + True + False + end + _Dark Theme + True + right + dark_theme_combobox + + + + 1 + 2 + + + + + True + False + + System + Enabled + Disabled + + + + + 2 + 2 + + + + + True + False + start + Emojis + + + + 0 + 3 + 2 + + + + + True + False + end + _Emoji Theme + True + right + emoticons_combobox + + + + 1 + 4 + + + + + True + False + + + + 2 + 4 + + + + + True + False + start + Icons + + + + 0 + 6 + 2 + + + + + True + False + end + _Status iconset + True + right + iconset_combobox + + + + 1 + 7 + + + + + True + False + + + + 2 + 7 + + + + + Use transports _icons + True + True + False + If checked, protocol-specific status icons will be used (e.g. a contact from ICQ will have the equivalent ICQ icon for status online, away, busy, etc...) + start + True + True + + + + 2 + 8 + + + + + True + False + end + + + + 1 + 5 + + + + + _Convert ASCII Emojis + True + True + False + start + True + True + + + + 2 + 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - True - False - <b>Preset Status Messages</b> - True - + + False + True + 0 + - True - True - 2 + style + Style + 5 - - - 3 - - - - - True - False - Status - - - 3 - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 12 - + True False - 6 - 12 + 18 + vertical + 6 - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - start - Themes - - - - 0 - 0 - 2 - - - - - True - False - end - _Theme - True - right - theme_combobox - - - - 1 - 1 - - - - - 200 - True - False - - - 2 - 1 - - - - - Ma_nage... - 120 - True - True - False - Configure color and font of the interface - True - - - - 3 - 1 - - - - - True - False - end - _Dark Theme - True - right - dark_theme_combobox - - - - 1 - 2 - - - - - True - False - - System - Enabled - Disabled - - - - - 2 - 2 - - - - + True False start - Emojis - - - - 0 - 3 - 2 - - - - - True - False - end - _Emoji Theme - True - right - emoticons_combobox - - - - 1 - 4 - - - - - True - False - - - - 2 - 4 - - - - - True - False - start - Icons - - - - 0 - 6 - 2 - - - - - True - False - end - _Status iconset - True - right - iconset_combobox - - - - 1 - 7 - - - - - True - False - - - - 2 - 7 - - - - - Use transports _icons - True - True - False - If checked, Gajim will use protocol-specific status icons. (e.g. A contact from ICQ will have the equivalent ICQ icon for status online, away, busy, etc...) - start - True - True - - - - 2 - 8 - - - - - True - False - end - - - - 1 - 5 - - - - - _Convert ASCII Emojis - True - True - False - start - True - True - - - - 2 - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - True - 0 - - - - - 4 - - - - - True - False - Style - - - 4 - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 18 - - - True - False - 0 - 1 - none - - - True - False - 12 - 6 6 12 - + + -1 True False end - Audio input device + A_udio output device + True + audio_output_combobox 0 - 0 - - - - - True - False - end - Audio output device - - - - 0 - 1 - - - - - True - False - - - - 1 - 0 + 2 @@ -1884,96 +2153,68 @@ $T will be replaced by auto-not-available timeout False + + 1 + 2 + + + + + 200 + True + False + + 1 1 - - - - - True - False - <b>Audio</b> - True - - - - - False - True - 0 - - - - - True - False - 0 - 0 - none - - - True - False - 12 - 6 - 6 - 12 - + + -1 True False end - Video input device + _Audio input device + True + audio_input_combobox + + 0 + 1 + + + + + True + False + start + Audio + True + + 0 0 - + True False - end - Video output device + start + Video + True - - - 0 - 1 - - - - - True - False - end - Video framerate - - - - 0 - 2 - - - - - True - False - end - Video size - @@ -1982,19 +2223,20 @@ $T will be replaced by auto-not-available timeout - - View own video source + True - True - False - start - True - + False + end + _Video input device + True + video_input_combobox + 0 4 - 2 @@ -2005,7 +2247,24 @@ $T will be replaced by auto-not-available timeout 1 - 0 + 4 + + + + + True + False + end + V_ideo output device + True + video_output_combobox + + + + 0 + 5 @@ -2016,18 +2275,54 @@ $T will be replaced by auto-not-available timeout 1 - 1 + 5 + + + + + True + False + end + 12 + Video _framerate + True + video_framerate_combobox + + + + 0 + 6 True False + 12 1 - 2 + 6 + + + + + True + False + end + Video si_ze + True + video_size_combobox + + + + 0 + 7 @@ -2038,405 +2333,438 @@ $T will be replaced by auto-not-available timeout 1 - 3 - - - - - - - True - False - <b>Video</b> - True - - - - - False - True - 1 - - - - - True - False - 0 - 0 - none - - - True - False - 12 - 6 - 6 - 12 - - - True - False - start - STUN server - right - - - - 0 - 0 + 7 - + + Vi_ew own video source True True False start + True + True + + + + 1 + 8 + + + + + True + False + start + Connection + True + + + + 0 + 9 + + + + + STU_N server + True + True + False + end + True True - 1 - 0 + 0 + 10 True True - STUN server hostname. If none given, Gajim will try -to discover one from server. + STUN server hostname. If no hostname was given, Gajim will try +to discover one from the server. (Example: stun.iptel.org) - 2 - 0 + 1 + 10 - - True - False - <i>(example: stun.iptel.org)</i> - True - - - 3 - 0 - + + + + + + + + + + - - - - True - False - <b>Connection</b> - True - + + False + True + 0 + - False - True - 2 - - - - - 5 - False - - - - - True - False - Audio/Video - - - 5 - False - - - - - True - False - 18 - 18 - 18 - 18 - vertical - 18 - - - True - False - 0 - none - - - True - False - vertical - 12 - - - 200 - True - False - start - 12 - 6 - liststore1 - - - - - 0 - - - - - False - True - 0 - - - - - False - 0 - none - - - True - False - 12 - 6 - 6 - 12 - - - True - False - end - _Mail client - True - right - - - - 0 - 1 - - - - - True - False - end - _Browser - True - right - - - - 0 - 0 - - - - - True - False - end - _File manager - True - right - - - - 0 - 2 - - - - - True - True - - - - 1 - 0 - - - - - True - True - - - - 1 - 1 - - - - - True - True - - - - 1 - 2 - - - - - - - True - False - <b>Custom</b> - True - - - - - False - True - 1 - - - - - - - True - False - <b>Applications</b> - True - - - - - False - True - 0 + audio_video + Audio/Video + 6 - + True False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - none + 18 + vertical + 6 - + True False - 12 - 6 - vertical - 6 - - - _Ignore events from contacts not in the roster - True - True - False - If checked, Gajim will ignore incoming events from unauthorized contacts. Use with caution, because it blocks all messages from any contact that is not in the roster - start - True - True - - - - False - True - 1 - - - - - Allow client / _OS information to be sent - True - True - False - If checked, Gajim will allow others to detect the operation system you are using - start - True - True - - - - False - True - 2 - - - - - Allow local system time information to be sent - True - True - False - If checked, Gajim will allow others to detect the time on your system - start - True - True - - - - False - True - 3 - - - - - Allow my _idle time to be sent - True - True - False - start - True - True - - - - False - True - 4 - - + 0 + none True False + vertical 12 - + + 200 True False - Global proxy - right - 0.01 + start + 6 + applications_liststore + + + + + 0 + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 6 + 6 + 12 + + + True + False + end + Mail _client + True + right + custom_mail_client_entry + + + + 0 + 1 + + + + + True + False + end + _Browser + True + right + custom_browser_entry + + + + 0 + 0 + + + + + True + False + end + _File manager + True + right + custom_file_manager_entry + + + + 0 + 2 + + + + + 200 + True + True + + + + 1 + 0 + + + + + True + True + + + + 1 + 1 + + + + + True + True + + + + 1 + 2 + + + + + + + True + False + Custom applications + True + + + + + + False + True + 1 + + + + + + + True + False + Applications + True + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 6 + vertical + 6 + + + True + False + 12 + + + True + False + _Global proxy + True + right + proxies_combobox + 0.01 + + + + False + True + 0 + + + + + 200 + True + False + proxies_liststore + + + + + 0 + + + + + False + True + 1 + + + + + _Manage... + 120 + True + True + True + True + + + + False + True + 2 + + + + + False + True + 0 + + + + + _Log status changes of contacts + True + True + False + start + True + True + + + + False + True + 1 + + + + + Enable _debug logging + True + False + True + If checked, Gajim will store a log file for debugging + start + True + True + + + + False + True + 2 + + + + + + + True + False + Miscellaneous + True + + + + + + False + True + 1 + + + + + True + False + 0 + none + + + True + False + 6 + vertical + 6 + + + True + False + start + Attention: Please use these options with caution! @@ -2448,18 +2776,16 @@ to discover one from server. - + + _Open... 120 True - False - liststore8 - - - - - 0 - - + True + False + start + 6 + True + False @@ -2467,162 +2793,46 @@ to discover one from server. 1 - - - _Manage... - 120 - True - True - True - True - - - - False - True - 2 - - - - False - True - 5 - - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Privacy</b> - True - - - - - False - True - 1 - - - - - True - False - 0 - none - - - True - False - 12 - 6 - vertical - 6 - - - _Log status changes of contacts + + True - True - False - start - True - True - + False + Advanced Configuration Editor (ACE) + True + - - False - True - 0 - - - - - Enable debug logging - True - False - True - start - True - True - - - - False - True - 1 - - - - - True - False - <b>Miscellaneous</b> - True - + + False + True + 2 + - False - True - 2 - - - - - True - False - 0 - none - - - _Open... - 120 - True - True - False - start - 12 - 6 - True - - - - - - True - False - <b>Advanced Configuration Editor</b> - True - - - - - False - True - 3 + advanced + Advanced + 7 + - 6 - - - - - True - False - Advanced - - - 6 - False + False + True + 1 + diff --git a/gajim/data/style/gajim.css b/gajim/data/style/gajim.css index f95340fd7..43d2a4623 100644 --- a/gajim/data/style/gajim.css +++ b/gajim/data/style/gajim.css @@ -119,6 +119,10 @@ list.settings > row > box { margin: 6px 18px; } +/* Preferences Window */ +.PreferencesWindow { background-color: @theme_base_color; } +.PreferencesStack { background-color: @theme_bg_color; } + /* Accounts Window */ #AccountsWindow > box > stack { padding:30px 30px 30px 30px;} #AccountsWindow scrolledwindow {border: none;} diff --git a/gajim/gtk/preferences.py b/gajim/gtk/preferences.py index b4b2f4ac7..65e6474de 100644 --- a/gajim/gtk/preferences.py +++ b/gajim/gtk/preferences.py @@ -58,123 +58,295 @@ class Preferences(Gtk.ApplicationWindow): self.set_position(Gtk.WindowPosition.CENTER) self.set_show_menubar(False) self.set_title(_('Preferences')) - self.set_default_size(-1, 400) - self.xml = get_builder('preferences_window.ui') - self.notebook = self.xml.get_object('preferences_notebook') - self.add(self.notebook) - - self.one_window_type_combobox = self.xml.get_object( - 'one_window_type_combobox') - self.iconset_combobox = self.xml.get_object('iconset_combobox') - self.notify_on_signin_checkbutton = self.xml.get_object( - 'notify_on_signin_checkbutton') - self.notify_on_signout_checkbutton = self.xml.get_object( - 'notify_on_signout_checkbutton') - self.auto_popup_away_checkbutton = self.xml.get_object( - 'auto_popup_away_checkbutton') - self.auto_popup_chat_opened_checkbutton = self.xml.get_object( - 'auto_popup_chat_opened_checkbutton') - self.sound_dnd_checkbutton = self.xml.get_object('sound_dnd_checkbutton') - self.auto_away_checkbutton = self.xml.get_object('auto_away_checkbutton') - self.auto_away_time_spinbutton = self.xml.get_object( - 'auto_away_time_spinbutton') - self.auto_away_message_entry = self.xml.get_object( - 'auto_away_message_entry') - self.auto_xa_checkbutton = self.xml.get_object('auto_xa_checkbutton') - self.auto_xa_time_spinbutton = self.xml.get_object( - 'auto_xa_time_spinbutton') - self.auto_xa_message_entry = self.xml.get_object('auto_xa_message_entry') + self._ui = get_builder('preferences_window.ui') + self.add(self._ui.preferences_window) ### General tab ### + ## Behavior of Windows and Tabs + # Set default for single window type + choices = c_config.opt_one_window_types + type_ = app.config.get('one_message_window') + if type_ in choices: + self._ui.one_window_type_combobox.set_active(choices.index(type_)) + else: + self._ui.one_window_type_combobox.set_active(0) + + # Show roster on startup + choices = c_config.opt_show_roster_on_startup + type_ = app.config.get('show_roster_on_startup') + if type_ in choices: + self._ui.show_roster_on_startup.set_active(choices.index(type_)) + else: + self._ui.show_roster_on_startup.set_active(0) + + # Quit on roster x + st = app.config.get('quit_on_roster_x_button') + self._ui.quit_on_roster_x_checkbutton.set_active(st) + + # Tab placement + st = app.config.get('tabs_position') + if st == 'top': + self._ui.tabs_placement.set_active(0) + elif st == 'bottom': + self._ui.tabs_placement.set_active(1) + elif st == 'left': + self._ui.tabs_placement.set_active(2) + else: # right + self._ui.tabs_placement.set_active(3) + + # Show avatar in tabs + st = app.config.get('show_avatar_in_tabs') + self._ui.show_avatar_in_tabs_checkbutton.set_active(st) + + ## Roster Appearance # Display avatars in roster st = app.config.get('show_avatars_in_roster') - self.xml.get_object('show_avatars_in_roster_checkbutton'). \ - set_active(st) + self._ui.show_avatars_in_roster_checkbutton.set_active(st) # Display status msg under contact name in roster st = app.config.get('show_status_msgs_in_roster') - self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \ - set_active(st) + self._ui.show_status_msgs_in_roster_checkbutton.set_active(st) # Display PEP in roster st1 = app.config.get('show_mood_in_roster') st2 = app.config.get('show_activity_in_roster') st3 = app.config.get('show_tunes_in_roster') st4 = app.config.get('show_location_in_roster') - w = self.xml.get_object('show_pep_in_roster_checkbutton') if st1 == st2 == st3 == st4: - w.set_active(st1) + self._ui.show_pep_in_roster_checkbutton.set_active(st1) else: - w.set_inconsistent(True) + self._ui.show_pep_in_roster_checkbutton.set_inconsistent(True) # Sort contacts by show st = app.config.get('sort_by_show_in_roster') - self.xml.get_object('sort_by_show_in_roster_checkbutton').set_active(st) + self._ui.sort_by_show_in_roster_checkbutton.set_active(st) st = app.config.get('sort_by_show_in_muc') - self.xml.get_object('sort_by_show_in_muc_checkbutton').set_active(st) + self._ui.sort_by_show_in_muc_checkbutton.set_active(st) - # Set default for single window type - choices = c_config.opt_one_window_types - type_ = app.config.get('one_message_window') - if type_ in choices: - self.one_window_type_combobox.set_active(choices.index(type_)) - else: - self.one_window_type_combobox.set_active(0) - - # Show roster on startup - show_roster_combobox = self.xml.get_object('show_roster_on_startup') - choices = c_config.opt_show_roster_on_startup - type_ = app.config.get('show_roster_on_startup') - if type_ in choices: - show_roster_combobox.set_active(choices.index(type_)) - else: - show_roster_combobox.set_active(0) - - # Ignore XHTML - st = app.config.get('ignore_incoming_xhtml') - self.xml.get_object('xhtml_checkbutton').set_active(st) - - # use speller + ### Chat tab ### + ## Chat Settings + # Use speller if app.is_installed('GSPELL'): st = app.config.get('use_speller') - self.xml.get_object('speller_checkbutton').set_active(st) + self._ui.speller_checkbutton.set_active(st) else: - self.xml.get_object('speller_checkbutton').set_sensitive(False) + self._ui.speller_checkbutton.set_sensitive(False) # XEP-0184 positive ack st = app.config.get('positive_184_ack') - self.xml.get_object('positive_184_ack_checkbutton').set_active(st) + self._ui.positive_184_ack_checkbutton.set_active(st) + # Ignore XHTML + st = app.config.get('ignore_incoming_xhtml') + self._ui.xhtml_checkbutton.set_active(st) + + # Print status messages in single chats + st = app.config.get('print_status_in_chats') + self._ui.print_status_in_chats_checkbutton.set_active(st) + + # Show subject on join st = app.config.get('show_subject_on_join') - self.xml.get_object('subject_on_join').set_active(st) + self._ui.subject_on_join_checkbutton.set_active(st) - # Show avatar in tabs - st = app.config.get('show_avatar_in_tabs') - self.xml.get_object('show_avatar_in_tabs_checkbutton').set_active(st) + # Print status in MUC + st = app.config.get('print_status_in_muc') + if st == 'none': + self._ui.print_status_in_muc_combobox.set_active(0) + elif st == 'all': + self._ui.print_status_in_muc_combobox.set_active(1) + else: # in_and_out + self._ui.print_status_in_muc_combobox.set_active(2) + + # Displayed chat state notifications + st = app.config.get('displayed_chat_state_notifications') + if st == 'all': + self._ui.displayed_chat_states_combobox.set_active(0) + elif st == 'composing_only': + self._ui.displayed_chat_states_combobox.set_active(1) + else: # disabled + self._ui.displayed_chat_states_combobox.set_active(2) + + ### Notifications tab ### + ## Visual Notifications + # Systray icon + if app.config.get('trayicon') == 'never': + self._ui.systray_combobox.set_active(0) + elif app.config.get('trayicon') == 'on_event': + self._ui.systray_combobox.set_active(1) + else: # always + self._ui.systray_combobox.set_active(2) + + # Notify on new event + if app.config.get('autopopup'): + self._ui.on_event_received_combobox.set_active(0) + elif app.config.get('notify_on_new_message'): + self._ui.on_event_received_combobox.set_active(1) + else: # only show in roster + self._ui.on_event_received_combobox.set_active(2) + + # Notify on online statuses + st = app.config.get('notify_on_signin') + self._ui.notify_on_signin_checkbutton.set_active(st) + + # Notify on offline statuses + st = app.config.get('notify_on_signout') + self._ui.notify_on_signout_checkbutton.set_active(st) + + # Auto popup when away + st = app.config.get('autopopupaway') + self._ui.auto_popup_away_checkbutton.set_active(st) + + # Auto popup when chat already open + st = app.config.get('autopopup_chat_opened') + self._ui.auto_popup_chat_opened_checkbutton.set_active(st) + + ## Sounds + # Sounds + if app.config.get('sounds_on'): + self._ui.play_sounds_checkbutton.set_active(True) + else: + self._ui.manage_sounds_button.set_sensitive(False) + + # Allow sounds when dnd + st = app.config.get('sounddnd') + self._ui.sound_dnd_checkbutton.set_active(st) + + #### Status tab ### + # Auto away + st = app.config.get('autoaway') + self._ui.auto_away_checkbutton.set_active(st) + + # Auto away time + st = app.config.get('autoawaytime') + self._ui.auto_away_time_spinbutton.set_value(st) + self._ui.auto_away_time_spinbutton.set_sensitive(app.config.get('autoaway')) + + # Auto away message + st = app.config.get('autoaway_message') + self._ui.auto_away_message_entry.set_text(st) + self._ui.auto_away_message_entry.set_sensitive(app.config.get('autoaway')) + + # Auto xa + st = app.config.get('autoxa') + self._ui.auto_xa_checkbutton.set_active(st) + + # Auto xa time + st = app.config.get('autoxatime') + self._ui.auto_xa_time_spinbutton.set_value(st) + self._ui.auto_xa_time_spinbutton.set_sensitive(app.config.get('autoxa')) + + # Auto xa message + st = app.config.get('autoxa_message') + self._ui.auto_xa_message_entry.set_text(st) + self._ui.auto_xa_message_entry.set_sensitive(app.config.get('autoxa')) + + if not idle.Monitor.is_available(): + self._ui.autoaway_table.set_sensitive(False) + + # Restore last status + st = self.get_per_account_option('restore_last_status') + if st == 'mixed': + self._ui.restore_last_status_checkbutton.set_inconsistent(True) + else: + self._ui.restore_last_status_checkbutton.set_active(st) + + # Ask for status when online/offline + st = app.config.get('ask_online_status') + self._ui.prompt_online_status_message_checkbutton.set_active(st) + st = app.config.get('ask_offline_status') + self._ui.prompt_offline_status_message_checkbutton.set_active(st) + + # Default status messages + self.fill_default_msg_treeview() + + # Status messages + renderer = Gtk.CellRendererText() + renderer.connect('edited', self.on_msg_cell_edited) + renderer.set_property('editable', True) + col = Gtk.TreeViewColumn('name', renderer, text=0) + self._ui.msg_treeview.append_column(col) + self.fill_msg_treeview() + + buf = self._ui.msg_textview.get_buffer() + 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': + 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 - theme_combobox = self.xml.get_object('theme_combobox') - self.changed_id = theme_combobox.connect( + self.changed_id = self._ui.theme_combobox.connect( 'changed', self.on_theme_combobox_changed) self.update_theme_list() - # iconset + # Dark theme + self._ui.dark_theme_combobox.set_active_id(str(app.config.get('dark_theme'))) + + # Emoticons + emoticon_themes = helpers.get_available_emoticon_themes() + + for theme in emoticon_themes: + self._ui.emoticons_combobox.append_text(theme) + + config_theme = app.config.get('emoticons_theme') + if config_theme not in emoticon_themes: + config_theme = 'font' + self._ui.emoticons_combobox.set_id_column(0) + self._ui.emoticons_combobox.set_active_id(config_theme) + + self._ui.ascii_emoticons.set_active(app.config.get('ascii_emoticons')) + + # Iconset iconsets_list = os.listdir( os.path.join(configpaths.get('DATA'), 'iconsets')) if os.path.isdir(configpaths.get('MY_ICONSETS')): iconsets_list += os.listdir(configpaths.get('MY_ICONSETS')) - # new model, image in 0, string in 1 + # New model, image in 0, string in 1 model = Gtk.ListStore(Gtk.Image, str) renderer_image = cell_renderer_image.CellRendererImage(0, 0) renderer_text = Gtk.CellRendererText() renderer_text.set_property('xpad', 5) - self.iconset_combobox.pack_start(renderer_image, False) - self.iconset_combobox.pack_start(renderer_text, True) - self.iconset_combobox.add_attribute(renderer_text, 'text', 1) - self.iconset_combobox.add_attribute(renderer_image, 'image', 0) - self.iconset_combobox.set_model(model) + self._ui.iconset_combobox.pack_start(renderer_image, False) + self._ui.iconset_combobox.pack_start(renderer_text, True) + self._ui.iconset_combobox.add_attribute(renderer_text, 'text', 1) + self._ui.iconset_combobox.add_attribute(renderer_image, 'image', 0) + self._ui.iconset_combobox.set_model(model) dirlist = [] for dir_ in iconsets_list: if not os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', dir_)) \ @@ -196,158 +368,16 @@ class Preferences(Gtk.ApplicationWindow): preview.set_from_file(file_) model.append([preview, dir_]) if app.config.get('iconset') == dir_: - self.iconset_combobox.set_active(index) + self._ui.iconset_combobox.set_active(index) # Use transports iconsets st = app.config.get('use_transports_iconsets') - self.xml.get_object('transports_iconsets_checkbutton').set_active(st) + self._ui.transports_iconsets_checkbutton.set_active(st) - # Dark theme - dark_theme_combo = self.xml.get_object('dark_theme_combobox') - dark_theme_combo.set_active_id(str(app.config.get('dark_theme'))) - - # Emoticons - emoticons_combobox = self.xml.get_object('emoticons_combobox') - emoticon_themes = helpers.get_available_emoticon_themes() - - for theme in emoticon_themes: - emoticons_combobox.append_text(theme) - - config_theme = app.config.get('emoticons_theme') - if config_theme not in emoticon_themes: - config_theme = 'font' - emoticons_combobox.set_id_column(0) - emoticons_combobox.set_active_id(config_theme) - - self.xml.ascii_emoticons.set_active(app.config.get('ascii_emoticons')) - - ### Personal Events tab ### - # outgoing send chat state notifications - st = app.config.get('outgoing_chat_state_notifications') - combo = self.xml.get_object('outgoing_chat_states_combobox') - if st == 'all': - combo.set_active(0) - elif st == 'composing_only': - combo.set_active(1) - else: # disabled - combo.set_active(2) - - # displayed send chat state notifications - st = app.config.get('displayed_chat_state_notifications') - combo = self.xml.get_object('displayed_chat_states_combobox') - if st == 'all': - combo.set_active(0) - elif st == 'composing_only': - combo.set_active(1) - else: # disabled - combo.set_active(2) - - - ### Notifications tab ### - # On new event - on_event_combobox = self.xml.get_object('on_event_combobox') - if app.config.get('autopopup'): - on_event_combobox.set_active(0) - elif app.config.get('notify_on_new_message'): - on_event_combobox.set_active(1) - else: - on_event_combobox.set_active(2) - - # notify on online statuses - st = app.config.get('notify_on_signin') - self.notify_on_signin_checkbutton.set_active(st) - - # notify on offline statuses - st = app.config.get('notify_on_signout') - self.notify_on_signout_checkbutton.set_active(st) - - # autopopupaway - st = app.config.get('autopopupaway') - self.auto_popup_away_checkbutton.set_active(st) - - # autopopup_chat_opened - st = app.config.get('autopopup_chat_opened') - self.auto_popup_chat_opened_checkbutton.set_active(st) - - # sounddnd - st = app.config.get('sounddnd') - self.sound_dnd_checkbutton.set_active(st) - - # Systray - systray_combobox = self.xml.get_object('systray_combobox') - if app.config.get('trayicon') == 'never': - systray_combobox.set_active(0) - elif app.config.get('trayicon') == 'on_event': - systray_combobox.set_active(1) - else: - systray_combobox.set_active(2) - - # sounds - if app.config.get('sounds_on'): - self.xml.get_object('play_sounds_checkbutton').set_active(True) - else: - self.xml.get_object('manage_sounds_button').set_sensitive(False) - - #### Status tab ### - # Autoaway - st = app.config.get('autoaway') - self.auto_away_checkbutton.set_active(st) - - # Autoawaytime - st = app.config.get('autoawaytime') - self.auto_away_time_spinbutton.set_value(st) - self.auto_away_time_spinbutton.set_sensitive(app.config.get('autoaway')) - - # autoaway message - st = app.config.get('autoaway_message') - self.auto_away_message_entry.set_text(st) - self.auto_away_message_entry.set_sensitive(app.config.get('autoaway')) - - # Autoxa - st = app.config.get('autoxa') - self.auto_xa_checkbutton.set_active(st) - - # Autoxatime - st = app.config.get('autoxatime') - self.auto_xa_time_spinbutton.set_value(st) - self.auto_xa_time_spinbutton.set_sensitive(app.config.get('autoxa')) - - # autoxa message - st = app.config.get('autoxa_message') - self.auto_xa_message_entry.set_text(st) - self.auto_xa_message_entry.set_sensitive(app.config.get('autoxa')) - - if not idle.Monitor.is_available(): - self.xml.get_object('autoaway_table').set_sensitive(False) - - # ask_status when online / offline - st = app.config.get('ask_online_status') - self.xml.get_object('prompt_online_status_message_checkbutton').\ - set_active(st) - st = app.config.get('ask_offline_status') - self.xml.get_object('prompt_offline_status_message_checkbutton').\ - set_active(st) - - # Default Status messages - self.default_msg_tree = self.xml.get_object('default_msg_treeview') - self.fill_default_msg_treeview() - - # Status messages - self.msg_tree = self.xml.get_object('msg_treeview') - renderer = Gtk.CellRendererText() - renderer.connect('edited', self.on_msg_cell_edited) - renderer.set_property('editable', True) - col = Gtk.TreeViewColumn('name', renderer, text=0) - self.msg_tree.append_column(col) - self.fill_msg_treeview() - - buf = self.xml.get_object('msg_textview').get_buffer() - buf.connect('end-user-action', self.on_msg_textview_changed) - - ### Audio / Video tab ### + ### Audio/Video tab ### def create_av_combobox(opt_name, device_dict, config_name=None, key=None): - combobox = self.xml.get_object(opt_name + '_combobox') + combobox = self._ui.get_object(opt_name + '_combobox') cell = Gtk.CellRendererText() cell.set_property('ellipsize', Pango.EllipsizeMode.END) cell.set_property('ellipsize-set', True) @@ -383,107 +413,70 @@ class Preferences(Gtk.ApplicationWindow): '320x240': '320x240'}, 'video_size', key=lambda x: -1 if \ not x[1] else int(x[0][:3])) st = app.config.get('video_see_self') - self.xml.get_object('video_see_self_checkbutton').set_active(st) + self._ui.video_see_self_checkbutton.set_active(st) else: for opt_name in ('audio_input', 'audio_output', 'video_input', 'video_output', 'video_framerate', 'video_size'): - combobox = self.xml.get_object(opt_name + '_combobox') + combobox = self._ui.get_object(opt_name + '_combobox') combobox.set_sensitive(False) # STUN - cb = self.xml.get_object('stun_checkbutton') st = app.config.get('use_stun_server') - cb.set_active(st) + self._ui.stun_checkbutton.set_active(st) - entry = self.xml.get_object('stun_server_entry') - entry.set_text(app.config.get('stun_server')) + self._ui.stun_server_entry.set_text(app.config.get('stun_server')) if not st: - entry.set_sensitive(False) + self._ui.stun_server_entry.set_sensitive(False) ### Advanced tab ### - # open links with + ## Applications (open links with) if os.name == 'nt': - applications_frame = self.xml.get_object('applications_frame') - applications_frame.set_no_show_all(True) - applications_frame.hide() + self._ui.custom_apps_frame.set_no_show_all(True) + self._ui.custom_apps_frame.hide() else: - self.applications_combobox = self.xml.get_object( - 'applications_combobox') - self.xml.get_object('custom_apps_frame').hide() - self.xml.get_object('custom_apps_frame').set_no_show_all(True) + self._ui.custom_apps_frame.hide() + self._ui.custom_apps_frame.set_no_show_all(True) if app.config.get('autodetect_browser_mailer'): - self.applications_combobox.set_active(0) + self._ui.applications_combobox.set_active(0) else: - self.applications_combobox.set_active(1) - self.xml.get_object('custom_apps_frame').show() + self._ui.applications_combobox.set_active(1) + self._ui.custom_apps_frame.show() - self.xml.get_object('custom_browser_entry').set_text( - app.config.get('custombrowser')) - self.xml.get_object('custom_mail_client_entry').set_text( - app.config.get('custommailapp')) - self.xml.get_object('custom_file_manager_entry').set_text( - app.config.get('custom_file_manager')) - - # log status changes of contacts - st = app.config.get('log_contact_status_changes') - self.xml.get_object('log_show_changes_checkbutton').set_active(st) - - # send os info - w = self.xml.get_object('send_os_info_checkbutton') - st = self.get_per_account_option('send_os_info') - if st == 'mixed': - w.set_inconsistent(True) - else: - w.set_active(st) - - # send absolute time info - w = self.xml.get_object('send_time_info_checkbutton') - st = self.get_per_account_option('send_time_info') - if st == 'mixed': - w.set_inconsistent(True) - else: - w.set_active(st) - - # send idle time - w = self.xml.get_object('send_idle_time_checkbutton') - st = self.get_per_account_option('send_idle_time') - if st == 'mixed': - w.set_inconsistent(True) - else: - w.set_active(st) + self._ui.custom_browser_entry.set_text( + app.config.get('custombrowser')) + self._ui.custom_mail_client_entry.set_text( + app.config.get('custommailapp')) + self._ui.custom_file_manager_entry.set_text( + app.config.get('custom_file_manager')) + ## Miscellaneous + # Proxy self.update_proxy_list() - # Ignore messages from unknown contacts - w = self.xml.get_object('ignore_events_from_unknown_contacts_checkbutton') - st = self.get_per_account_option('ignore_unknown_contacts') - if st == 'mixed': - w.set_inconsistent(True) - else: - w.set_active(st) + # Log status changes of contacts + st = app.config.get('log_contact_status_changes') + self._ui.log_show_changes_checkbutton.set_active(st) + # Enable debug logging if sys.platform == 'win32': - w = self.xml.get_object('enable_logging') - w.set_active(app.get_win_debug_mode()) - w.show() + self._ui.enable_logging.set_active(app.get_win_debug_mode()) + self._ui.enable_logging.show() - self.xml.connect_signals(self) + self._ui.connect_signals(self) self.connect('key-press-event', self._on_key_press) - self.msg_tree.get_model().connect('row-changed', + self._ui.msg_treeview.get_model().connect('row-changed', self.on_msg_treemodel_row_changed) - self.msg_tree.get_model().connect('row-deleted', + self._ui.msg_treeview.get_model().connect('row-deleted', self.on_msg_treemodel_row_deleted) - self.default_msg_tree.get_model().connect('row-changed', + self._ui.default_msg_treeview.get_model().connect('row-changed', self.on_default_msg_treemodel_row_changed) self.sounds_preferences = None self.theme_preferences = None - self.notebook.set_current_page(0) - self.show_all() def _on_key_press(self, widget, event): @@ -496,7 +489,7 @@ class Preferences(Gtk.ApplicationWindow): returns "mixed" """ if not app.connections: - # a non existent key return default value + # A non existent key return default value return app.config.get_per('accounts', '__default__', opt) val = None for account in app.connections: @@ -507,9 +500,6 @@ class Preferences(Gtk.ApplicationWindow): return 'mixed' return val - def on_subject_on_join_toggled(self, widget): - app.config.set('show_subject_on_join', widget.get_active()) - def on_checkbutton_toggled(self, widget, config_name, change_sensitivity_widgets=None): app.config.set(config_name, widget.get_active()) @@ -541,15 +531,34 @@ class Preferences(Gtk.ApplicationWindow): for ctrl in app.interface.minimized_controls[account].values(): yield ctrl - def on_sort_by_show_in_roster_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'sort_by_show_in_roster') - app.interface.roster.setup_and_draw_roster() + ### General tab ### + def on_one_window_type_combo_changed(self, widget): + active = widget.get_active() + config_type = c_config.opt_one_window_types[active] + app.config.set('one_message_window', config_type) + app.interface.msg_win_mgr.reconfig() - def on_sort_by_show_in_muc_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'sort_by_show_in_muc') - # Redraw groupchats - for ctrl in self._get_all_muc_controls(): - ctrl.draw_roster() + def on_show_roster_on_startup_changed(self, widget): + active = widget.get_active() + config_type = c_config.opt_show_roster_on_startup[active] + app.config.set('show_roster_on_startup', config_type) + + def on_quit_on_roster_x_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'quit_on_roster_x_button') + + def on_tab_placement_changed(self, widget): + active = widget.get_active() + if active == 0: # top + app.config.set('tabs_position', 'top') + elif active == 1: # bottom + app.config.set('tabs_position', 'bottom') + elif active == 2: # left + app.config.set('tabs_position', 'left') + else: # right + app.config.set('tabs_position', 'right') + + def on_show_avatar_in_tabs_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'show_avatar_in_tabs') def on_show_avatars_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_avatars_in_roster') @@ -571,42 +580,17 @@ class Preferences(Gtk.ApplicationWindow): self.on_checkbutton_toggled(widget, 'show_location_in_roster') app.interface.roster.setup_and_draw_roster() - def on_emoticons_combobox_changed(self, widget): - active = widget.get_active() - model = widget.get_model() - emot_theme = model[active][0] - app.config.set('emoticons_theme', emot_theme) - from gajim.gtk.emoji_chooser import emoji_chooser - emoji_chooser.load() - self.toggle_emoticons() + def on_sort_by_show_in_roster_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'sort_by_show_in_roster') + app.interface.roster.setup_and_draw_roster() - def toggle_emoticons(self): - """ - Update emoticons state in Opened Chat Windows - """ - for ctrl in self._get_all_controls(): - ctrl.toggle_emoticons() - - def on_one_window_type_combo_changed(self, widget): - active = widget.get_active() - config_type = c_config.opt_one_window_types[active] - app.config.set('one_message_window', config_type) - app.interface.msg_win_mgr.reconfig() - - def on_show_roster_on_startup_changed(self, widget): - active = widget.get_active() - config_type = c_config.opt_show_roster_on_startup[active] - app.config.set('show_roster_on_startup', config_type) - - def on_xhtml_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'ignore_incoming_xhtml') - helpers.update_optional_features() - - def apply_speller(self): - for ctrl in self._get_all_controls(): - if isinstance(ctrl, ChatControlBase): - ctrl.set_speller() + def on_sort_by_show_in_muc_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'sort_by_show_in_muc') + # Redraw groupchats + for ctrl in self._get_all_muc_controls(): + ctrl.draw_roster() + ### Chat tab ### def on_speller_checkbutton_toggled(self, widget): active = widget.get_active() app.config.set('use_speller', active) @@ -624,70 +608,32 @@ class Preferences(Gtk.ApplicationWindow): app.config.set('speller_language', gspell_lang.get_code()) self.apply_speller() + def apply_speller(self): + for ctrl in self._get_all_controls(): + if isinstance(ctrl, ChatControlBase): + ctrl.set_speller() + def on_positive_184_ack_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'positive_184_ack') - def on_show_avatar_in_tabs_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'show_avatar_in_tabs') + def on_xhtml_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'ignore_incoming_xhtml') + helpers.update_optional_features() - @staticmethod - def on_theme_combobox_changed(combobox): - theme = combobox.get_active_id() - app.config.set('roster_theme', theme) - app.css_config.change_theme(theme) + def on_print_status_in_chats_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'print_status_in_chats') - # begin repainting themed widgets throughout - app.interface.roster.repaint_themed_widgets() - app.interface.roster.change_roster_style(None) + def on_subject_on_join_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'show_subject_on_join') - def update_theme_list(self): - theme_combobox = self.xml.get_object('theme_combobox') - with theme_combobox.handler_block(self.changed_id): - theme_combobox.remove_all() - theme_combobox.append('default', 'default') - for config_theme in app.css_config.themes: - theme_combobox.append(config_theme, config_theme) - - theme_combobox.set_active_id(app.config.get('roster_theme')) - - def on_manage_theme_button_clicked(self, widget): - window = app.get_app_window(Themes) - if window is None: - Themes(self) - else: - window.present() - - def on_iconset_combobox_changed(self, widget): - model = widget.get_model() + def print_status_in_muc_combobox_changed(self, widget): active = widget.get_active() - icon_string = model[active][1] - app.config.set('iconset', icon_string) - gtkgui_helpers.reload_jabber_state_images() - - def on_convert_ascii_toggle(self, widget): - app.config.set('ascii_emoticons', widget.get_active()) - app.interface.make_regexps() - - def on_transports_iconsets_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'use_transports_iconsets') - gtkgui_helpers.reload_jabber_state_images() - - def on_dark_theme_changed(self, widget): - app.css_config.set_dark_theme(int(widget.get_active_id())) - - 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() + if active == 0: # none + app.config.set('print_status_in_muc', 'none') + elif active == 1: # all + app.config.set('print_status_in_muc', 'all') + else: # in_and_out + app.config.set('print_status_in_muc', 'in_and_out') def on_displayed_chat_states_combobox_changed(self, widget): active = widget.get_active() @@ -699,11 +645,23 @@ class Preferences(Gtk.ApplicationWindow): else: # disabled app.config.set('displayed_chat_state_notifications', 'disabled') - def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget): - widget.set_inconsistent(False) - self.on_per_account_checkbutton_toggled(widget, 'ignore_unknown_contacts') + ### Notifications tab ### + def on_systray_combobox_changed(self, widget): + active = widget.get_active() + if active == 0: + app.config.set('trayicon', 'never') + app.interface.systray_enabled = False + app.interface.systray.hide_icon() + elif active == 1: + app.config.set('trayicon', 'on_event') + app.interface.systray_enabled = True + app.interface.systray.show_icon() + else: + app.config.set('trayicon', 'always') + app.interface.systray_enabled = True + app.interface.systray.show_icon() - def on_on_event_combobox_changed(self, widget): + def on_event_received_combobox_changed(self, widget): active = widget.get_active() if active == 0: app.config.set('autopopup', True) @@ -727,27 +685,9 @@ class Preferences(Gtk.ApplicationWindow): def on_auto_popup_chat_opened_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autopopup_chat_opened') - def on_sound_dnd_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'sounddnd') - - def on_systray_combobox_changed(self, widget): - active = widget.get_active() - if active == 0: - app.config.set('trayicon', 'never') - app.interface.systray_enabled = False - app.interface.systray.hide_icon() - elif active == 1: - app.config.set('trayicon', 'on_event') - app.interface.systray_enabled = True - app.interface.systray.show_icon() - else: - app.config.set('trayicon', 'always') - app.interface.systray_enabled = True - app.interface.systray.show_icon() - def on_play_sounds_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sounds_on', - [self.xml.get_object('manage_sounds_button')]) + [self._ui.manage_sounds_button]) def on_manage_sounds_button_clicked(self, widget): if self.sounds_preferences is None: @@ -755,9 +695,14 @@ class Preferences(Gtk.ApplicationWindow): else: self.sounds_preferences.window.present() + def on_sound_dnd_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'sounddnd') + + ### Status tab ### def on_auto_away_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autoaway', - [self.auto_away_time_spinbutton, self.auto_away_message_entry]) + [self._ui.auto_away_time_spinbutton, + self._ui.auto_away_message_entry]) def on_auto_away_time_spinbutton_value_changed(self, widget): aat = widget.get_value_as_int() @@ -770,7 +715,8 @@ class Preferences(Gtk.ApplicationWindow): def on_auto_xa_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autoxa', - [self.auto_xa_time_spinbutton, self.auto_xa_message_entry]) + [self._ui.auto_xa_time_spinbutton, + self._ui.auto_xa_message_entry]) def on_auto_xa_time_spinbutton_value_changed(self, widget): axt = widget.get_value_as_int() @@ -781,6 +727,10 @@ class Preferences(Gtk.ApplicationWindow): def on_auto_xa_message_entry_changed(self, widget): app.config.set('autoxa_message', widget.get_text()) + def on_restore_last_status_checkbutton_toggled(self, widget): + widget.set_inconsistent(False) + self.on_per_account_checkbutton_toggled(widget, 'restore_last_status') + def on_prompt_online_status_message_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'ask_online_status') @@ -788,7 +738,7 @@ class Preferences(Gtk.ApplicationWindow): self.on_checkbutton_toggled(widget, 'ask_offline_status') def fill_default_msg_treeview(self): - model = self.default_msg_tree.get_model() + model = self._ui.default_msg_treeview.get_model() model.clear() status = [] for status_ in app.config.get_per('defaultstatusmsg'): @@ -803,12 +753,12 @@ class Preferences(Gtk.ApplicationWindow): model.set(iter_, 0, status_, 1, uf_show, 2, msg, 3, enabled) def on_default_msg_cell_edited(self, cell, row, new_text): - model = self.default_msg_tree.get_model() + model = self._ui.default_msg_treeview.get_model() iter_ = model.get_iter_from_string(row) model.set_value(iter_, 2, new_text) def default_msg_toggled_cb(self, cell, path): - model = self.default_msg_tree.get_model() + model = self._ui.default_msg_treeview.get_model() model[path][3] = not model[path][3] def on_default_msg_treemodel_row_changed(self, model, path, iter_): @@ -825,14 +775,14 @@ class Preferences(Gtk.ApplicationWindow): iter_ = model.get_iter_first() while iter_: val = model[iter_][0] - if model[iter_][1]: # we have a preset message - if not val: # no title, use message text for title + if model[iter_][1]: # We have a preset message + if not val: # No title, use message text for title val = model[iter_][1] app.config.add_per('statusmsg', val) msg = helpers.to_one_line(model[iter_][1]) app.config.set_per('statusmsg', val, 'message', msg) i = 2 - # store mood / activity + # Store mood / activity for subname in ('activity', 'subactivity', 'activity_text', 'mood', 'mood_text'): val2 = model[iter_][i] @@ -848,6 +798,175 @@ class Preferences(Gtk.ApplicationWindow): def on_msg_treemodel_row_deleted(self, model, path): self.save_status_messages(model) + def fill_msg_treeview(self): + self._ui.delete_msg_button.set_sensitive(False) + model = self._ui.msg_treeview.get_model() + model.clear() + preset_status = [] + for msg_name in app.config.get_per('statusmsg'): + if msg_name.startswith('_last_'): + continue + preset_status.append(msg_name) + preset_status.sort() + for msg_name in preset_status: + msg_text = app.config.get_per('statusmsg', msg_name, 'message') + msg_text = helpers.from_one_line(msg_text) + activity = app.config.get_per('statusmsg', msg_name, 'activity') + subactivity = app.config.get_per('statusmsg', msg_name, + 'subactivity') + activity_text = app.config.get_per('statusmsg', msg_name, + 'activity_text') + mood = app.config.get_per('statusmsg', msg_name, 'mood') + mood_text = app.config.get_per('statusmsg', msg_name, 'mood_text') + iter_ = model.append() + model.set(iter_, 0, msg_name, 1, msg_text, 2, activity, 3, + subactivity, 4, activity_text, 5, mood, 6, mood_text) + + def on_msg_cell_edited(self, cell, row, new_text): + model = self._ui.msg_treeview.get_model() + iter_ = model.get_iter_from_string(row) + model.set_value(iter_, 0, new_text) + + def on_msg_treeview_cursor_changed(self, widget, data=None): + sel = self._ui.msg_treeview.get_selection() + if not sel: + return + (model, iter_) = sel.get_selected() + if not iter_: + return + self._ui.delete_msg_button.set_sensitive(True) + buf = self._ui.msg_textview.get_buffer() + msg = model[iter_][1] + buf.set_text(msg) + + def on_new_msg_button_clicked(self, widget, data=None): + model = self._ui.msg_treeview.get_model() + iter_ = model.append() + model.set( + iter_, 0, _('status message title'), 1, + _('status message text')) + self._ui.msg_treeview.set_cursor(model.get_path(iter_)) + + def on_delete_msg_button_clicked(self, widget, data=None): + sel = self._ui.msg_treeview.get_selection() + if not sel: + return + (model, iter_) = sel.get_selected() + if not iter_: + return + buf = self._ui.msg_textview.get_buffer() + model.remove(iter_) + buf.set_text('') + self._ui.delete_msg_button.set_sensitive(False) + + def on_msg_textview_changed(self, widget, data=None): + sel = self._ui.msg_treeview.get_selection() + if not sel: + return + (model, iter_) = sel.get_selected() + if not iter_: + return + buf = self._ui.msg_textview.get_buffer() + first_iter, end_iter = buf.get_bounds() + model.set_value(iter_, 1, buf.get_text(first_iter, end_iter, True)) + + def on_msg_treeview_key_press_event(self, widget, event): + if event.keyval == Gdk.KEY_Delete: + self.on_delete_msg_button_clicked(widget) + + ### Privacy tab ### + def on_send_idle_time_checkbutton_toggled(self, widget): + widget.set_inconsistent(False) + self.on_per_account_checkbutton_toggled(widget, 'send_idle_time') + + def on_send_time_info_checkbutton_toggled(self, widget): + widget.set_inconsistent(False) + self.on_per_account_checkbutton_toggled(widget, 'send_time_info') + + def on_send_os_info_checkbutton_toggled(self, widget): + widget.set_inconsistent(False) + self.on_per_account_checkbutton_toggled(widget, 'send_os_info') + + def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget): + 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): + theme = combobox.get_active_id() + app.config.set('roster_theme', theme) + app.css_config.change_theme(theme) + + # Begin repainting themed widgets throughout + app.interface.roster.repaint_themed_widgets() + app.interface.roster.change_roster_style(None) + + def update_theme_list(self): + with self._ui.theme_combobox.handler_block(self.changed_id): + self._ui.theme_combobox.remove_all() + self._ui.theme_combobox.append('default', 'default') + for config_theme in app.css_config.themes: + self._ui.theme_combobox.append(config_theme, config_theme) + + self._ui.theme_combobox.set_active_id(app.config.get('roster_theme')) + + def on_manage_theme_button_clicked(self, widget): + window = app.get_app_window(Themes) + if window is None: + Themes(self) + else: + window.present() + + def on_dark_theme_changed(self, widget): + app.css_config.set_dark_theme(int(widget.get_active_id())) + + def on_emoticons_combobox_changed(self, widget): + active = widget.get_active() + model = widget.get_model() + emot_theme = model[active][0] + app.config.set('emoticons_theme', emot_theme) + from gajim.gtk.emoji_chooser import emoji_chooser + emoji_chooser.load() + self.toggle_emoticons() + + def on_convert_ascii_toggle(self, widget): + app.config.set('ascii_emoticons', widget.get_active()) + app.interface.make_regexps() + + def toggle_emoticons(self): + """ + Update emoticons state in Opened Chat Windows + """ + for ctrl in self._get_all_controls(): + ctrl.toggle_emoticons() + + def on_iconset_combobox_changed(self, widget): + model = widget.get_model() + active = widget.get_active() + icon_string = model[active][1] + app.config.set('iconset', icon_string) + gtkgui_helpers.reload_jabber_state_images() + + def on_transports_iconsets_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'use_transports_iconsets') + gtkgui_helpers.reload_jabber_state_images() + + ### Audio/Video tab ### def on_av_combobox_changed(self, combobox, config_name): model = combobox.get_model() active = combobox.get_active() @@ -877,18 +996,20 @@ class Preferences(Gtk.ApplicationWindow): def on_stun_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'use_stun_server', [ - self.xml.get_object('stun_server_entry')]) + self._ui.stun_server_entry]) def stun_server_entry_changed(self, widget): app.config.set('stun_server', widget.get_text()) + ### Advanced tab ### + # Applications def on_applications_combobox_changed(self, widget): if widget.get_active() == 0: app.config.set('autodetect_browser_mailer', True) - self.xml.get_object('custom_apps_frame').hide() + self._ui.custom_apps_frame.hide() elif widget.get_active() == 1: app.config.set('autodetect_browser_mailer', False) - self.xml.get_object('custom_apps_frame').show() + self._ui.custom_apps_frame.show() def on_custom_browser_entry_changed(self, widget): app.config.set('custombrowser', widget.get_text()) @@ -899,103 +1020,12 @@ class Preferences(Gtk.ApplicationWindow): def on_custom_file_manager_entry_changed(self, widget): app.config.set('custom_file_manager', widget.get_text()) - def on_log_show_changes_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'log_contact_status_changes') - - def on_send_os_info_checkbutton_toggled(self, widget): - widget.set_inconsistent(False) - self.on_per_account_checkbutton_toggled(widget, 'send_os_info') - - def on_send_time_info_checkbutton_toggled(self, widget): - widget.set_inconsistent(False) - self.on_per_account_checkbutton_toggled(widget, 'send_time_info') - - def on_send_idle_time_checkbutton_toggled(self, widget): - widget.set_inconsistent(False) - self.on_per_account_checkbutton_toggled(widget, 'send_idle_time') - - def fill_msg_treeview(self): - self.xml.get_object('delete_msg_button').set_sensitive(False) - model = self.msg_tree.get_model() - model.clear() - preset_status = [] - for msg_name in app.config.get_per('statusmsg'): - if msg_name.startswith('_last_'): - continue - preset_status.append(msg_name) - preset_status.sort() - for msg_name in preset_status: - msg_text = app.config.get_per('statusmsg', msg_name, 'message') - msg_text = helpers.from_one_line(msg_text) - activity = app.config.get_per('statusmsg', msg_name, 'activity') - subactivity = app.config.get_per('statusmsg', msg_name, - 'subactivity') - activity_text = app.config.get_per('statusmsg', msg_name, - 'activity_text') - mood = app.config.get_per('statusmsg', msg_name, 'mood') - mood_text = app.config.get_per('statusmsg', msg_name, 'mood_text') - iter_ = model.append() - model.set(iter_, 0, msg_name, 1, msg_text, 2, activity, 3, - subactivity, 4, activity_text, 5, mood, 6, mood_text) - - def on_msg_cell_edited(self, cell, row, new_text): - model = self.msg_tree.get_model() - iter_ = model.get_iter_from_string(row) - model.set_value(iter_, 0, new_text) - - def on_msg_treeview_cursor_changed(self, widget, data=None): - sel = self.msg_tree.get_selection() - if not sel: - return - (model, iter_) = sel.get_selected() - if not iter_: - return - self.xml.get_object('delete_msg_button').set_sensitive(True) - buf = self.xml.get_object('msg_textview').get_buffer() - msg = model[iter_][1] - buf.set_text(msg) - - def on_new_msg_button_clicked(self, widget, data=None): - model = self.msg_tree.get_model() - iter_ = model.append() - model.set( - iter_, 0, _('status message title'), 1, - _('status message text')) - self.msg_tree.set_cursor(model.get_path(iter_)) - - def on_delete_msg_button_clicked(self, widget, data=None): - sel = self.msg_tree.get_selection() - if not sel: - return - (model, iter_) = sel.get_selected() - if not iter_: - return - buf = self.xml.get_object('msg_textview').get_buffer() - model.remove(iter_) - buf.set_text('') - self.xml.get_object('delete_msg_button').set_sensitive(False) - - def on_msg_textview_changed(self, widget, data=None): - sel = self.msg_tree.get_selection() - if not sel: - return - (model, iter_) = sel.get_selected() - if not iter_: - return - buf = self.xml.get_object('msg_textview').get_buffer() - first_iter, end_iter = buf.get_bounds() - model.set_value(iter_, 1, buf.get_text(first_iter, end_iter, True)) - - def on_msg_treeview_key_press_event(self, widget, event): - if event.keyval == Gdk.KEY_Delete: - self.on_delete_msg_button_clicked(widget) - + # Proxies def on_proxies_combobox_changed(self, widget): active = widget.get_active() proxy = widget.get_model()[active][0] if proxy == _('None'): proxy = '' - app.config.set('global_proxy', proxy) def on_manage_proxies_button_clicked(self, widget): @@ -1008,21 +1038,26 @@ class Preferences(Gtk.ApplicationWindow): our_proxy = app.config.get('global_proxy') if not our_proxy: our_proxy = _('None') - proxy_combobox = self.xml.get_object('proxies_combobox') - model = proxy_combobox.get_model() + model = self._ui.proxies_combobox.get_model() model.clear() proxies = app.config.get_per('proxies') proxies.insert(0, _('None')) for index, proxy in enumerate(proxies): model.append([proxy]) if our_proxy == proxy: - proxy_combobox.set_active(index) + self._ui.proxies_combobox.set_active(index) + # Log status changes of contacts + def on_log_show_changes_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'log_contact_status_changes') + + # Enable debug logging + def on_enable_logging_toggled(self, widget): + app.set_win_debug_mode(widget.get_active()) + + # Advanced Config Editor (ACE) def on_open_advanced_editor_button_clicked(self, widget, data=None): if 'advanced_config' in app.interface.instances: app.interface.instances['advanced_config'].window.present() else: app.interface.instances['advanced_config'] = AdvancedConfig(self) - - def on_enable_logging_toggled(self, widget): - app.set_win_debug_mode(widget.get_active())