Dont save Gajim settings in bookmarks

- Remove print status from bookmarks
- Remove minimize on join from bookmarks
- Add options to the groupchat menu for both settings

Fixes #9463
This commit is contained in:
Philipp Hörist 2019-01-05 23:59:30 +01:00
parent 4c17b55a91
commit 55694b60bf
9 changed files with 76 additions and 242 deletions

View file

@ -1065,24 +1065,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
return return
_on_ok(self.contact) _on_ok(self.contact)
def on_minimize_menuitem_toggled(self, widget):
"""
When a groupchat is minimized, unparent the tab, put it in roster etc
"""
old_value = True
non_minimized_gc = app.config.get_per('accounts', self.account,
'non_minimized_gc').split()
if self.contact.jid in non_minimized_gc:
old_value = False
minimize = widget.get_active()
if not minimize and not self.contact.jid in non_minimized_gc:
non_minimized_gc.append(self.contact.jid)
if minimize and self.contact.jid in non_minimized_gc:
non_minimized_gc.remove(self.contact.jid)
if old_value != minimize:
app.config.set_per('accounts', self.account, 'non_minimized_gc',
' '.join(non_minimized_gc))
def on_notify_menuitem_toggled(self, widget): def on_notify_menuitem_toggled(self, widget):
app.config.set_per('rooms', self.contact.jid, 'notify_on_all_messages', app.config.set_per('rooms', self.contact.jid, 'notify_on_all_messages',
widget.get_active()) widget.get_active())

View file

@ -346,7 +346,6 @@ class Config:
'no_log_for': [opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')], 'no_log_for': [opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'sync_logs_with_server': [opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')], 'sync_logs_with_server': [opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')],
'allow_no_log_for': [opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')], 'allow_no_log_for': [opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'non_minimized_gc': [opt_str, ''],
'attached_gpg_keys': [opt_str, ''], 'attached_gpg_keys': [opt_str, ''],
'keep_alives_enabled': [opt_bool, True, _('Whitespace sent after inactivity')], 'keep_alives_enabled': [opt_bool, True, _('Whitespace sent after inactivity')],
'ping_alives_enabled': [opt_bool, True, _('XMPP ping sent after inactivity')], 'ping_alives_enabled': [opt_bool, True, _('XMPP ping sent after inactivity')],
@ -442,6 +441,8 @@ class Config:
'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')], 'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')],
'print_status': [opt_bool, False, _('Show a status message for all status (away, dnd, etc.) changes of users in a group chat')], 'print_status': [opt_bool, False, _('Show a status message for all status (away, dnd, etc.) changes of users in a group chat')],
'print_join_left': [opt_bool, False, _('Show a status message for every join or leave in a group chat')], 'print_join_left': [opt_bool, False, _('Show a status message for every join or leave in a group chat')],
'minimize_on_autojoin': [opt_bool, True, _('If the group chat is minimized into the roster on autojoin')],
'minimize_on_close': [opt_bool, True, _('If the group chat is minimized into the roster on close')],
}, {}), }, {}),
'plugins': ({ 'plugins': ({
'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')], 'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')],

View file

@ -39,8 +39,6 @@ from gajim.common.modules.util import to_xs_boolean
log = logging.getLogger('gajim.c.m.bookmarks') log = logging.getLogger('gajim.c.m.bookmarks')
NS_GAJIM_BM = 'xmpp:gajim.org/bookmarks'
class BookmarksData(AbstractPEPData): class BookmarksData(AbstractPEPData):
@ -222,18 +220,6 @@ class Bookmarks(AbstractPEPModule):
if not autojoin_val: # not there (it's optional) if not autojoin_val: # not there (it's optional)
autojoin_val = False autojoin_val = False
minimize_val = conf.getTag('minimize', namespace=NS_GAJIM_BM)
if not minimize_val:
minimize_val = False
else:
minimize_val = minimize_val.getData()
print_status = conf.getTag('print_status', namespace=NS_GAJIM_BM)
if not print_status: # not there, try old Gajim behaviour
print_status = None
else:
print_status = print_status.getData()
try: try:
jid = helpers.parse_jid(conf.getAttr('jid')) jid = helpers.parse_jid(conf.getAttr('jid'))
except helpers.InvalidFormat: except helpers.InvalidFormat:
@ -245,12 +231,10 @@ class Bookmarks(AbstractPEPModule):
'name': conf.getAttr('name'), 'name': conf.getAttr('name'),
'password': conf.getTagData('password'), 'password': conf.getTagData('password'),
'nick': conf.getTagData('nick'), 'nick': conf.getTagData('nick'),
'print_status': print_status
} }
try: try:
bookmark['autojoin'] = from_xs_boolean(autojoin_val) bookmark['autojoin'] = from_xs_boolean(autojoin_val)
bookmark['minimize'] = from_xs_boolean(minimize_val)
except ValueError as error: except ValueError as error:
log.warning(error) log.warning(error)
continue continue
@ -269,8 +253,6 @@ class Bookmarks(AbstractPEPModule):
conf_node.setAttr('jid', jid) conf_node.setAttr('jid', jid)
conf_node.setAttr('autojoin', to_xs_boolean(bm['autojoin'])) conf_node.setAttr('autojoin', to_xs_boolean(bm['autojoin']))
conf_node.setAttr('name', bm['name']) conf_node.setAttr('name', bm['name'])
conf_node.setTag('minimize', namespace=NS_GAJIM_BM).setData(
to_xs_boolean(bm['minimize']))
# Only add optional elements if not empty # Only add optional elements if not empty
# Note: need to handle both None and '' as empty # Note: need to handle both None and '' as empty
# thus shouldn't use "is not None" # thus shouldn't use "is not None"
@ -278,10 +260,6 @@ class Bookmarks(AbstractPEPModule):
conf_node.setTagData('nick', bm['nick']) conf_node.setTagData('nick', bm['nick'])
if bm.get('password', None): if bm.get('password', None):
conf_node.setTagData('password', bm['password']) conf_node.setTagData('password', bm['password'])
if bm.get('print_status', None):
conf_node.setTag(
'print_status',
namespace=NS_GAJIM_BM).setData(bm['print_status'])
return storage_node return storage_node
def _build_node(self, _data): def _build_node(self, _data):
@ -351,19 +329,21 @@ class Bookmarks(AbstractPEPModule):
if jid not in app.gc_connected[self._account]: if jid not in app.gc_connected[self._account]:
# we are not already connected # we are not already connected
log.info('Autojoin Bookmark: %s', jid) log.info('Autojoin Bookmark: %s', jid)
minimize = app.config.get_per('rooms', jid,
'minimize_on_autojoin', True)
print(minimize)
app.interface.join_gc_room( app.interface.join_gc_room(
self._account, jid, bookmark['nick'], self._account, jid, bookmark['nick'],
bookmark['password'], minimize=bookmark['minimize']) bookmark['password'], minimize=minimize)
def add_bookmark(self, name, jid, autojoin, def add_bookmark(self, name, jid, autojoin, password, nick):
minimize, password, nick):
self.bookmarks[jid] = { self.bookmarks[jid] = {
'name': name, 'name': name,
'autojoin': autojoin, 'autojoin': autojoin,
'minimize': minimize,
'password': password, 'password': password,
'nick': nick, 'nick': nick,
'print_status': None} }
self.store_bookmarks() self.store_bookmarks()
app.nec.push_incoming_event( app.nec.push_incoming_event(

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkListStore" id="liststore1"> <object class="GtkListStore" id="liststore1">
@ -15,6 +15,9 @@
<property name="default_height">300</property> <property name="default_height">300</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/> <signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child type="titlebar">
<placeholder/>
</child>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
@ -31,7 +34,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow37"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
@ -324,95 +327,6 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Minimize on Auto Join</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="minimize_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<signal name="state-set" handler="on_minimize_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Status messages displayed in chat window</property>
<property name="valign">center</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Status Messages</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="print_status_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore1</property>
<signal name="changed" handler="on_print_status_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<style> <style>
<class name="settings"/> <class name="settings"/>
</style> </style>
@ -481,8 +395,5 @@
</child> </child>
</object> </object>
</child> </child>
<child type="titlebar">
<placeholder/>
</child>
</object> </object>
</interface> </interface>

View file

@ -375,14 +375,22 @@ class GroupchatControl(ChatControlBase):
act.connect("activate", func) act.connect("activate", func)
self.parent_win.window.add_action(act) self.parent_win.window.add_action(act)
non_minimized_gc = app.config.get_per( minimize = app.config.get_per(
'accounts', self.account, 'non_minimized_gc').split() 'rooms', self.contact.jid, 'minimize_on_close', True)
value = self.contact.jid not in non_minimized_gc
act = Gio.SimpleAction.new_stateful( act = Gio.SimpleAction.new_stateful(
'minimize-' + self.control_id, None, 'minimize-on-close-' + self.control_id, None,
GLib.Variant.new_boolean(value)) GLib.Variant.new_boolean(minimize))
act.connect('change-state', self._on_minimize) act.connect('change-state', self._on_minimize_on_close)
self.parent_win.window.add_action(act)
minimize = app.config.get_per(
'rooms', self.contact.jid, 'minimize_on_autojoin', True)
act = Gio.SimpleAction.new_stateful(
'minimize-on-autojoin-' + self.control_id, None,
GLib.Variant.new_boolean(minimize))
act.connect('change-state', self._on_minimize_on_autojoin)
self.parent_win.window.add_action(act) self.parent_win.window.add_action(act)
# Enable notify on all for private rooms # Enable notify on all for private rooms
@ -684,7 +692,6 @@ class GroupchatControl(ChatControlBase):
con.get_module('Bookmarks').add_bookmark(self.name, con.get_module('Bookmarks').add_bookmark(self.name,
self.room_jid, self.room_jid,
True, True,
True,
password, password,
self.nick) self.nick)
self.update_actions() self.update_actions()
@ -696,22 +703,15 @@ class GroupchatControl(ChatControlBase):
con = app.connections[self.account] con = app.connections[self.account]
con.get_module('MUC').request_voice(self.room_jid) con.get_module('MUC').request_voice(self.room_jid)
def _on_minimize(self, action, param): def _on_minimize_on_close(self, action, param):
"""
When a groupchat is minimized, unparent the tab, put it in roster etc
"""
action.set_state(param) action.set_state(param)
non_minimized_gc = app.config.get_per( minimize = app.config.set_per(
'accounts', self.account, 'non_minimized_gc').split() 'rooms', self.contact.jid, 'minimize_on_close', param.get_boolean())
minimize = param.get_boolean() def _on_minimize_on_autojoin(self, action, param):
if minimize: action.set_state(param)
non_minimized_gc.remove(self.contact.jid) minimize = app.config.set_per(
else: 'rooms', self.contact.jid, 'minimize_on_autojoin', param.get_boolean())
non_minimized_gc.append(self.contact.jid)
app.config.set_per('accounts', self.account,
'non_minimized_gc', ' '.join(non_minimized_gc))
def _on_notify_on_all_messages(self, action, param): def _on_notify_on_all_messages(self, action, param):
action.set_state(param) action.set_state(param)
@ -2310,10 +2310,8 @@ class GroupchatControl(ChatControlBase):
def minimizable(self): def minimizable(self):
if self.force_non_minimizable: if self.force_non_minimizable:
return False return False
if self.contact.jid not in app.config.get_per('accounts', self.account, return app.config.get_per('rooms', self.contact.jid,
'non_minimized_gc').split(' '): 'minimize_on_close', True)
return True
return False
def minimize(self, status='offline'): def minimize(self, status='offline'):
# Minimize it # Minimize it

View file

@ -12,6 +12,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from enum import IntEnum
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
@ -26,6 +28,16 @@ from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder from gajim.gtk.util import get_builder
class Row(IntEnum):
ACCOUNT_JID = 0
ROOM_NAME = 1
ROOM_JID = 2
AUTOJOIN = 3
PASSWORD = 4
NICK = 5
LABEL = 6
class ManageBookmarksWindow: class ManageBookmarksWindow:
def __init__(self): def __init__(self):
self.xml = get_builder('manage_bookmarks_window.ui') self.xml = get_builder('manage_bookmarks_window.ui')
@ -34,10 +46,8 @@ class ManageBookmarksWindow:
self.ignore_events = False self.ignore_events = False
# Account-JID, RoomName, Room-JID, Autojoin, Minimize, Password, Nick, # Account-JID, RoomName, Room-JID, Autojoin, Password, Nick, Name
# Show_Status self.treestore = Gtk.TreeStore(str, str, str, bool, str, str, str)
self.treestore = Gtk.TreeStore(str, str, str, bool, bool, str,
str, str, str)
self.treestore.set_sort_column_id(1, Gtk.SortType.ASCENDING) self.treestore.set_sort_column_id(1, Gtk.SortType.ASCENDING)
# Store bookmarks in treeview. # Store bookmarks in treeview.
@ -45,45 +55,26 @@ class ManageBookmarksWindow:
connected_only=True, private_storage_only=True): connected_only=True, private_storage_only=True):
iter_ = self.treestore.append(None, [ iter_ = self.treestore.append(None, [
None, account, None, None, None, account, None, None,
None, None, None, None, account_label]) None, None, account_label])
con = app.connections[account] con = app.connections[account]
bookmarks = con.get_module('Bookmarks').get_sorted_bookmarks() bookmarks = con.get_module('Bookmarks').get_sorted_bookmarks()
for jid, bookmark in bookmarks.items(): for jid, bookmark in bookmarks.items():
print_status = bookmark.get('print_status', '')
if print_status not in ('', 'all', 'in_and_out', 'none'):
print_status = ''
self.treestore.append(iter_, [account, self.treestore.append(iter_, [account,
bookmark['name'], bookmark['name'],
jid, jid,
bookmark['autojoin'], bookmark['autojoin'],
bookmark['minimize'],
bookmark['password'], bookmark['password'],
bookmark['nick'], bookmark['nick'],
print_status,
bookmark['name']]) bookmark['name']])
self.print_status_combobox = self.xml.get_object(
'print_status_combobox')
model = Gtk.ListStore(str, str)
self.option_list = {
'': _('Default'), 'all': Q_('?print_status:All'),
'in_and_out': _('Enter and leave only'),
'none': Q_('?print_status:None')}
for opt, label in sorted(self.option_list.items()):
model.append([label, opt])
self.print_status_combobox.set_model(model)
self.print_status_combobox.set_active(1)
self.view = self.xml.get_object('bookmarks_treeview') self.view = self.xml.get_object('bookmarks_treeview')
self.view.set_model(self.treestore) self.view.set_model(self.treestore)
self.view.expand_all() self.view.expand_all()
renderer = Gtk.CellRendererText() renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn('Bookmarks', renderer, text=8) column = Gtk.TreeViewColumn('Bookmarks', renderer, text=Row.LABEL)
self.view.append_column(column) self.view.append_column(column)
self.selection = self.view.get_selection() self.selection = self.view.get_selection()
@ -103,7 +94,6 @@ class ManageBookmarksWindow:
self.pass_entry = self.xml.get_object('pass_entry') self.pass_entry = self.xml.get_object('pass_entry')
self.pass_entry.connect('changed', self.on_pass_entry_changed) self.pass_entry.connect('changed', self.on_pass_entry_changed)
self.autojoin_checkbutton = self.xml.get_object('autojoin_checkbutton') self.autojoin_checkbutton = self.xml.get_object('autojoin_checkbutton')
self.minimize_checkbutton = self.xml.get_object('minimize_checkbutton')
self.settings_box = self.xml.get_object('settings_box') self.settings_box = self.xml.get_object('settings_box')
self.remove_bookmark_button = self.xml.get_object( self.remove_bookmark_button = self.xml.get_object(
'remove_bookmark_button') 'remove_bookmark_button')
@ -142,7 +132,7 @@ class ManageBookmarksWindow:
nick = app.nicks[account] nick = app.nicks[account]
label = _('New Group Chat') label = _('New Group Chat')
iter_ = self.treestore.append(add_to, [ iter_ = self.treestore.append(add_to, [
account, label, '@', False, False, '', nick, 'in_and_out', label]) account, label, '@', False, '', nick, label])
self.view.expand_row(model.get_path(add_to), True) self.view.expand_row(model.get_path(add_to), True)
self.view.set_cursor(model.get_path(iter_)) self.view.set_cursor(model.get_path(iter_))
@ -208,14 +198,13 @@ class ManageBookmarksWindow:
for bm in account.iterchildren(): for bm in account.iterchildren():
# create the bookmark-dict # create the bookmark-dict
bmdict = { bmdict = {
'name': bm[1], 'name': bm[Row.ROOM_NAME],
'autojoin': bm[3], 'autojoin': bm[Row.AUTOJOIN],
'minimize': bm[4], 'password': bm[Row.PASSWORD],
'password': bm[5], 'nick': bm[Row.NICK],
'nick': bm[6], }
'print_status': bm[7]}
jid = bm[2] jid = bm[Row.ROOM_JID]
con.get_module('Bookmarks').bookmarks[jid] = bmdict con.get_module('Bookmarks').bookmarks[jid] = bmdict
con.get_module('Bookmarks').store_bookmarks() con.get_module('Bookmarks').store_bookmarks()
@ -247,8 +236,8 @@ class ManageBookmarksWindow:
return return
# Fill in the data for childs # Fill in the data for childs
self.title_entry.set_text(model[iter_][1]) self.title_entry.set_text(model[iter_][Row.ROOM_NAME])
room_jid = model[iter_][2] room_jid = model[iter_][Row.ROOM_JID]
room_jid_s = room_jid.split('@') room_jid_s = room_jid.split('@')
if len(room_jid_s) == 1: if len(room_jid_s) == 1:
room = '' room = ''
@ -260,13 +249,11 @@ class ManageBookmarksWindow:
self.room_entry.handler_unblock(self.room_entry_changed_id) self.room_entry.handler_unblock(self.room_entry_changed_id)
self.server_entry.set_text(server) self.server_entry.set_text(server)
self.autojoin_checkbutton.set_active(model[iter_][3]) self.autojoin_checkbutton.set_active(model[iter_][Row.AUTOJOIN])
self.minimize_checkbutton.set_active(model[iter_][4])
# sensitive only if auto join is checked # sensitive only if auto join is checked
self.minimize_checkbutton.set_sensitive(model[iter_][3])
if model[iter_][5] is not None: if model[iter_][Row.PASSWORD] is not None:
password = model[iter_][5] password = model[iter_][Row.PASSWORD]
else: else:
password = None password = None
@ -274,16 +261,12 @@ class ManageBookmarksWindow:
self.pass_entry.set_text(password) self.pass_entry.set_text(password)
else: else:
self.pass_entry.set_text('') self.pass_entry.set_text('')
nick = model[iter_][6] nick = model[iter_][Row.NICK]
if nick: if nick:
self.nick_entry.set_text(nick) self.nick_entry.set_text(nick)
else: else:
self.nick_entry.set_text('') self.nick_entry.set_text('')
print_status = model[iter_][7]
opts = sorted(self.option_list.keys())
self.print_status_combobox.set_active(opts.index(print_status))
def on_title_entry_changed(self, widget): def on_title_entry_changed(self, widget):
if self.ignore_events: if self.ignore_events:
return return
@ -291,7 +274,7 @@ class ManageBookmarksWindow:
if iter_: # After removing a bookmark, we got nothing selected if iter_: # After removing a bookmark, we got nothing selected
if model.iter_parent(iter_): if model.iter_parent(iter_):
# Don't clear the title field for account nodes # Don't clear the title field for account nodes
model[iter_][1] = self.title_entry.get_text() model[iter_][Row.ROOM_NAME] = self.title_entry.get_text()
def on_nick_entry_changed(self, widget): def on_nick_entry_changed(self, widget):
if self.ignore_events: if self.ignore_events:
@ -306,9 +289,9 @@ class ManageBookmarksWindow:
_('Invalid nickname'), _('Invalid nickname'),
_('Character not allowed'), _('Character not allowed'),
transient_for=self.window) transient_for=self.window)
self.nick_entry.set_text(model[iter_][6]) self.nick_entry.set_text(model[iter_][Row.NICK])
return True return True
model[iter_][6] = nick model[iter_][Row.NICK] = nick
def on_server_entry_focus_out(self, widget, event): def on_server_entry_focus_out(self, widget, event):
if self.ignore_events: if self.ignore_events:
@ -337,9 +320,9 @@ class ManageBookmarksWindow:
_('Invalid server'), _('Invalid server'),
_('Character not allowed'), _('Character not allowed'),
transient_for=self.window) transient_for=self.window)
self.server_entry.set_text(model[iter_][2].split('@')[1]) self.server_entry.set_text(model[iter_][Row.ROOM_JID].split('@')[1])
return True return True
model[iter_][2] = room_jid model[iter_][Row.ROOM_JID] = room_jid
def on_room_entry_changed(self, widget): def on_room_entry_changed(self, widget):
if self.ignore_events: if self.ignore_events:
@ -368,39 +351,21 @@ class ManageBookmarksWindow:
_('Character not allowed'), _('Character not allowed'),
transient_for=self.window) transient_for=self.window)
return True return True
model[iter_][2] = room_jid model[iter_][Row.ROOM_JID] = room_jid
def on_pass_entry_changed(self, widget): def on_pass_entry_changed(self, widget):
if self.ignore_events: if self.ignore_events:
return return
(model, iter_) = self.selection.get_selected() (model, iter_) = self.selection.get_selected()
if iter_: if iter_:
model[iter_][5] = self.pass_entry.get_text() model[iter_][Row.PASSWORD] = self.pass_entry.get_text()
def on_autojoin_checkbutton_toggled(self, widget, *args): def on_autojoin_checkbutton_toggled(self, widget, *args):
if self.ignore_events: if self.ignore_events:
return return
(model, iter_) = self.selection.get_selected() (model, iter_) = self.selection.get_selected()
if iter_: if iter_:
model[iter_][3] = self.autojoin_checkbutton.get_active() model[iter_][Row.AUTOJOIN] = self.autojoin_checkbutton.get_active()
self.minimize_checkbutton.set_sensitive(model[iter_][3])
def on_minimize_checkbutton_toggled(self, widget, *args):
if self.ignore_events:
return
(model, iter_) = self.selection.get_selected()
if iter_:
model[iter_][4] = self.minimize_checkbutton.get_active()
def on_print_status_combobox_changed(self, widget):
if self.ignore_events:
return
active = widget.get_active()
model = widget.get_model()
print_status = model[active][1]
(model2, iter_) = self.selection.get_selected()
if iter_:
model2[iter_][7] = print_status
def clear_fields(self): def clear_fields(self):
widgets = [ widgets = [
@ -409,8 +374,6 @@ class ManageBookmarksWindow:
for field in widgets: for field in widgets:
field.set_text('') field.set_text('')
self.autojoin_checkbutton.set_active(False) self.autojoin_checkbutton.set_active(False)
self.minimize_checkbutton.set_active(False)
self.print_status_combobox.set_active(1)
def set_sensitive_all(self, sensitive): def set_sensitive_all(self, sensitive):
widgets = [ widgets = [

View file

@ -1717,7 +1717,6 @@ class MucBrowser(AgentBrowser):
con.get_module('Bookmarks').add_bookmark(room_jid.split('@')[0], con.get_module('Bookmarks').add_bookmark(room_jid.split('@')[0],
room_jid, room_jid,
False, False,
False,
'' ''
'') '')

View file

@ -266,7 +266,6 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
con.get_module('Bookmarks').add_bookmark(name, con.get_module('Bookmarks').add_bookmark(name,
self.room_jid, self.room_jid,
autojoin, autojoin,
True,
password, password,
nickname) nickname)

View file

@ -663,7 +663,8 @@ def get_groupchat_menu(control_id, account, jid):
('win.print-join-left-', _('Show join/leave')), ('win.print-join-left-', _('Show join/leave')),
('win.print-status-', _('Show status changes')), ('win.print-status-', _('Show status changes')),
('win.notify-on-message-', _('Notify on all messages')), ('win.notify-on-message-', _('Notify on all messages')),
('win.minimize-', _('Minimize on close')), ('win.minimize-on-close-', _('Minimize on close')),
('win.minimize-on-autojoin-', _('Minimize on autojoin')),
]), ]),
(_('Sync Threshold'), []), (_('Sync Threshold'), []),
('win.change-nick-', _('Change Nick')), ('win.change-nick-', _('Change Nick')),