Commit 24abd478 authored by Philipp Hörist's avatar Philipp Hörist

Remove default status settings

Presets can be used instead
parent ab799177
Pipeline #5973 passed with stages
in 5 minutes and 9 seconds
......@@ -337,10 +337,6 @@ class Config:
'mood': [opt_str, ''],
'mood_text': [opt_str, ''],
}, {}),
'defaultstatusmsg': ({
'enabled': [opt_bool, False],
'message': [opt_str, ''],
}, {}),
'soundevents': ({
'enabled': [opt_bool, True],
'path': [opt_str, ''],
......@@ -390,14 +386,6 @@ class Config:
'_last_offline': ['', '', '', '', '', ''],
}
defaultstatusmsg_default = {
'online': [False, _('I’m available.')],
'away': [False, _('Be right back.')],
'xa': [False, _('I’m not available.')],
'dnd': [False, _('Do not disturb.')],
'offline': [False, _('Bye!')],
}
soundevents_default = {
'attention_received': [True, 'attention.wav'],
'first_message_received': [True, 'message1.wav'],
......@@ -691,9 +679,3 @@ class Config:
self.add_per('soundevents', event)
self.set_per('soundevents', event, 'enabled', default[0])
self.set_per('soundevents', event, 'path', default[1])
for status in self.defaultstatusmsg_default:
default = self.defaultstatusmsg_default[status]
self.add_per('defaultstatusmsg', status)
self.set_per('defaultstatusmsg', status, 'enabled', default[0])
self.set_per('defaultstatusmsg', status, 'message', default[1])
......@@ -1258,6 +1258,7 @@
<object class="GtkBox" id="status_tab">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="border_width">18</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
......@@ -1436,6 +1437,7 @@ $T will be replaced by auto-not-available timeout.</property>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
......@@ -1443,6 +1445,7 @@ $T will be replaced by auto-not-available timeout.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="valign">start</property>
<property name="margin_top">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
......@@ -1536,74 +1539,6 @@ $T will be replaced by auto-not-available timeout.</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="default_message_scrolledwindow">
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">If enabled, Gajim will not ask for a status message. The specified default message will be used instead.</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="default_msg_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">default_message_liststore</property>
<property name="search_column">0</property>
<signal name="cursor-changed" handler="on_msg_treeview_cursor_changed" swapped="no"/>
<signal name="key-press-event" handler="on_msg_treeview_key_press_event" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="status">
<property name="resizable">True</property>
<property name="title" translatable="yes">Status</property>
<child>
<object class="GtkCellRendererText" id="statustext"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="defaultmsg">
<property name="resizable">True</property>
<property name="title" translatable="yes">Default Message</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="defaultmessage">
<property name="editable">True</property>
<signal name="edited" handler="on_default_msg_cell_edited" swapped="no"/>
</object>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="enabled">
<property name="title" translatable="yes">Enabled</property>
<child>
<object class="GtkCellRendererToggle" id="enable">
<signal name="toggled" handler="default_msg_toggled_cb" swapped="no"/>
</object>
<attributes>
<attribute name="active">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
......@@ -1640,6 +1575,7 @@ $T will be replaced by auto-not-available timeout.</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">250</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......
......@@ -278,9 +278,6 @@ class Preferences(Gtk.ApplicationWindow):
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)
......@@ -442,8 +439,6 @@ class Preferences(Gtk.ApplicationWindow):
self.on_msg_treemodel_row_changed)
self._ui.msg_treeview.get_model().connect('row-deleted',
self.on_msg_treemodel_row_deleted)
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
......@@ -704,38 +699,6 @@ class Preferences(Gtk.ApplicationWindow):
def on_prompt_offline_status_message_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'ask_offline_status')
def fill_default_msg_treeview(self):
model = self._ui.default_msg_treeview.get_model()
model.clear()
status = []
for status_ in app.config.get_per('defaultstatusmsg'):
status.append(status_)
status.sort()
for status_ in status:
msg = app.config.get_per('defaultstatusmsg', status_, 'message')
msg = helpers.from_one_line(msg)
enabled = app.config.get_per('defaultstatusmsg', status_, 'enabled')
iter_ = model.append()
uf_show = helpers.get_uf_show(status_)
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._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._ui.default_msg_treeview.get_model()
model[path][3] = not model[path][3]
def on_default_msg_treemodel_row_changed(self, model, path, iter_):
status = model[iter_][0]
message = model[iter_][2]
message = helpers.to_one_line(message)
app.config.set_per('defaultstatusmsg', status, 'enabled',
model[iter_][3])
app.config.set_per('defaultstatusmsg', status, 'message', message)
def save_status_messages(self, model):
for msg in app.config.get_per('statusmsg'):
app.config.del_per('statusmsg', msg)
......
......@@ -2160,23 +2160,19 @@ class RosterWindow:
self._status_selector.update()
def get_status_message(self, show, on_response, show_pep=True,
always_ask=False):
always_ask=False):
"""
Get the status message by:
1/ looking in default status message
2/ asking to user if needed depending on ask_on(ff)line_status and
always_ask
asking to user if needed depending on ask_on(ff)line_status and
always_ask
show_pep can be False to hide pep things from status message or True
"""
empty_pep = {'activity': '', 'subactivity': '', 'activity_text': '',
'mood': '', 'mood_text': ''}
if show in app.config.get_per('defaultstatusmsg'):
if app.config.get_per('defaultstatusmsg', show, 'enabled'):
msg = app.config.get_per('defaultstatusmsg', show, 'message')
msg = helpers.from_one_line(msg)
on_response(msg, empty_pep)
return
empty_pep = {'activity': '',
'subactivity': '',
'activity_text': '',
'mood': '',
'mood_text': ''}
if not always_ask and ((show == 'online' and not app.config.get(
'ask_online_status')) or (show == 'offline' and not \
app.config.get('ask_offline_status'))):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment