default status message are now used (if enabled) instead of asking status message. Fixes #2069
This commit is contained in:
parent
eacbec78d1
commit
07f5b39e58
|
@ -18,6 +18,7 @@
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="focus_on_map">True</property>
|
<property name="focus_on_map">True</property>
|
||||||
|
<property name="urgency_hint">False</property>
|
||||||
<signal name="key_press_event" handler="on_preferences_window_key_press_event" last_modification_time="Fri, 08 Apr 2005 01:08:08 GMT"/>
|
<signal name="key_press_event" handler="on_preferences_window_key_press_event" last_modification_time="Fri, 08 Apr 2005 01:08:08 GMT"/>
|
||||||
<signal name="destroy" handler="on_preferences_window_destroy" last_modification_time="Sun, 05 Mar 2006 11:50:52 GMT"/>
|
<signal name="destroy" handler="on_preferences_window_destroy" last_modification_time="Sun, 05 Mar 2006 11:50:52 GMT"/>
|
||||||
|
|
||||||
|
@ -2537,6 +2538,68 @@ Disabled</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkExpander" id="expander1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="expanded">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow24">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTreeView" id="default_msg_treeview">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="headers_visible">True</property>
|
||||||
|
<property name="rules_hint">False</property>
|
||||||
|
<property name="reorderable">False</property>
|
||||||
|
<property name="enable_search">True</property>
|
||||||
|
<property name="fixed_height_mode">False</property>
|
||||||
|
<property name="hover_selection">False</property>
|
||||||
|
<property name="hover_expand">False</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label384">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>Default Status Messages</b></property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">label_item</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkFrame" id="frame22">
|
<widget class="GtkFrame" id="frame22">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -3245,7 +3308,6 @@ Custom</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -249,6 +249,10 @@ class Config:
|
||||||
'statusmsg': ({
|
'statusmsg': ({
|
||||||
'message': [ opt_str, '' ],
|
'message': [ opt_str, '' ],
|
||||||
}, {}),
|
}, {}),
|
||||||
|
'defaultstatusmsg': ({
|
||||||
|
'enabled': [ opt_bool, False ],
|
||||||
|
'message': [ opt_str, '' ],
|
||||||
|
}, {}),
|
||||||
'soundevents': ({
|
'soundevents': ({
|
||||||
'enabled': [ opt_bool, True ],
|
'enabled': [ opt_bool, True ],
|
||||||
'path': [ opt_str, '' ],
|
'path': [ opt_str, '' ],
|
||||||
|
@ -321,6 +325,16 @@ class Config:
|
||||||
_('Out'): _("I'm out enjoying life"),
|
_('Out'): _("I'm out enjoying life"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultstatusmsg_default = {
|
||||||
|
'online': [ False, _("I'm avavilable") ],
|
||||||
|
'chat': [ False, _("I'm free for chat") ],
|
||||||
|
'away': [ False, _('Be right back') ],
|
||||||
|
'xa': [ False, _("I'm not available") ],
|
||||||
|
'dnd': [ False, _('Do not disturb') ],
|
||||||
|
'invisible': [ False, _('Bye !') ],
|
||||||
|
'offline': [ False, _('Bye !') ],
|
||||||
|
}
|
||||||
|
|
||||||
soundevents_default = {
|
soundevents_default = {
|
||||||
'first_message_received': [ True, '../data/sounds/message1.wav' ],
|
'first_message_received': [ True, '../data/sounds/message1.wav' ],
|
||||||
'next_message_received': [ True, '../data/sounds/message2.wav' ],
|
'next_message_received': [ True, '../data/sounds/message2.wav' ],
|
||||||
|
@ -534,3 +548,8 @@ class Config:
|
||||||
self.set_per('soundevents', event, 'enabled', default[0])
|
self.set_per('soundevents', event, 'enabled', default[0])
|
||||||
self.set_per('soundevents', event, 'path', default[1])
|
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])
|
||||||
|
|
|
@ -376,6 +376,32 @@ class PreferencesWindow:
|
||||||
self.xml.get_widget('prompt_offline_status_message_checkbutton').\
|
self.xml.get_widget('prompt_offline_status_message_checkbutton').\
|
||||||
set_active(st)
|
set_active(st)
|
||||||
|
|
||||||
|
# Default Status messages
|
||||||
|
self.default_msg_tree = self.xml.get_widget('default_msg_treeview')
|
||||||
|
# (status, translated_status, message, enabled)
|
||||||
|
model = gtk.ListStore(str, str, str, bool)
|
||||||
|
self.default_msg_tree.set_model(model)
|
||||||
|
col = gtk.TreeViewColumn('Status')
|
||||||
|
self.default_msg_tree.append_column(col)
|
||||||
|
renderer = gtk.CellRendererText()
|
||||||
|
col.pack_start(renderer, False)
|
||||||
|
col.set_attributes(renderer, text = 1)
|
||||||
|
col = gtk.TreeViewColumn('Message')
|
||||||
|
self.default_msg_tree.append_column(col)
|
||||||
|
renderer = gtk.CellRendererText()
|
||||||
|
col.pack_start(renderer, True)
|
||||||
|
col.set_attributes(renderer, text = 2)
|
||||||
|
renderer.connect('edited', self.on_default_msg_cell_edited)
|
||||||
|
renderer.set_property('editable', True)
|
||||||
|
col = gtk.TreeViewColumn('Enabled')
|
||||||
|
self.default_msg_tree.append_column(col)
|
||||||
|
renderer = gtk.CellRendererToggle()
|
||||||
|
col.pack_start(renderer, False)
|
||||||
|
col.set_attributes(renderer, active = 3)
|
||||||
|
renderer.set_property('activatable', True)
|
||||||
|
renderer.connect('toggled', self.default_msg_toggled_cb)
|
||||||
|
self.fill_default_msg_treeview()
|
||||||
|
|
||||||
#Status messages
|
#Status messages
|
||||||
self.msg_tree = self.xml.get_widget('msg_treeview')
|
self.msg_tree = self.xml.get_widget('msg_treeview')
|
||||||
model = gtk.ListStore(str, str)
|
model = gtk.ListStore(str, str)
|
||||||
|
@ -456,6 +482,8 @@ class PreferencesWindow:
|
||||||
self.on_msg_treemodel_row_changed)
|
self.on_msg_treemodel_row_changed)
|
||||||
self.msg_tree.get_model().connect('row-deleted',
|
self.msg_tree.get_model().connect('row-deleted',
|
||||||
self.on_msg_treemodel_row_deleted)
|
self.on_msg_treemodel_row_deleted)
|
||||||
|
self.default_msg_tree.get_model().connect('row-changed',
|
||||||
|
self.on_default_msg_treemodel_row_changed)
|
||||||
|
|
||||||
self.theme_preferences = None
|
self.theme_preferences = None
|
||||||
|
|
||||||
|
@ -789,6 +817,35 @@ class PreferencesWindow:
|
||||||
def on_auto_xa_message_entry_changed(self, widget):
|
def on_auto_xa_message_entry_changed(self, widget):
|
||||||
gajim.config.set('autoxa_message', widget.get_text().decode('utf-8'))
|
gajim.config.set('autoxa_message', widget.get_text().decode('utf-8'))
|
||||||
|
|
||||||
|
def fill_default_msg_treeview(self):
|
||||||
|
model = self.default_msg_tree.get_model()
|
||||||
|
model.clear()
|
||||||
|
status = []
|
||||||
|
for status_ in gajim.config.get_per('defaultstatusmsg'):
|
||||||
|
status.append(status_)
|
||||||
|
status.sort()
|
||||||
|
for status_ in status:
|
||||||
|
msg = gajim.config.get_per('defaultstatusmsg', status_, 'message')
|
||||||
|
enabled = gajim.config.get_per('defaultstatusmsg', status_, 'enabled')
|
||||||
|
iter = model.append()
|
||||||
|
model.set(iter, 0, status_, 1, _(status_), 2, msg, 3, enabled)
|
||||||
|
|
||||||
|
def on_default_msg_cell_edited(self, cell, row, new_text):
|
||||||
|
model = self.default_msg_tree.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[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].decode('utf-8')
|
||||||
|
gajim.config.set_per('defaultstatusmsg', status, 'enabled',
|
||||||
|
model[iter][3])
|
||||||
|
gajim.config.set_per('defaultstatusmsg', status, 'message', message)
|
||||||
|
|
||||||
def save_status_messages(self, model):
|
def save_status_messages(self, model):
|
||||||
for msg in gajim.config.get_per('statusmsg'):
|
for msg in gajim.config.get_per('statusmsg'):
|
||||||
gajim.config.del_per('statusmsg', msg)
|
gajim.config.del_per('statusmsg', msg)
|
||||||
|
|
|
@ -2221,6 +2221,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
gajim.connections[account].change_status(status, txt, auto)
|
gajim.connections[account].change_status(status, txt, auto)
|
||||||
|
|
||||||
def get_status_message(self, show):
|
def get_status_message(self, show):
|
||||||
|
if show in gajim.config.get_per('defaultstatusmsg'):
|
||||||
|
if gajim.config.get_per('defaultstatusmsg', show, 'enabled'):
|
||||||
|
return gajim.config.get_per('defaultstatusmsg', show, 'message')
|
||||||
if (show == 'online' and not gajim.config.get('ask_online_status')) or \
|
if (show == 'online' and not gajim.config.get('ask_online_status')) or \
|
||||||
(show == 'offline' and not gajim.config.get('ask_offline_status')) or \
|
(show == 'offline' and not gajim.config.get('ask_offline_status')) or \
|
||||||
show == 'invisible':
|
show == 'invisible':
|
||||||
|
|
Loading…
Reference in New Issue