diff --git a/gajim/common/app.py b/gajim/common/app.py index e293b37c6..0fd18d923 100644 --- a/gajim/common/app.py +++ b/gajim/common/app.py @@ -389,20 +389,34 @@ def get_connected_accounts(): account_list.append(account) return account_list -def get_enabled_accounts_with_labels(exclude_local=True): +def get_enabled_accounts_with_labels(exclude_local=True, connected_only=False, + private_storage_only=False): """ Returns a list with [account, account_label] entries. Order by account_label """ accounts = [] for acc in connections: - if not exclude_local or acc != 'Local': - acc_label = config.get_per( - 'accounts', acc, 'account_label') or acc - accounts.append([acc, acc_label]) + if exclude_local and account_is_zeroconf(acc): + continue + if connected_only and not account_is_connected(acc): + continue + if private_storage_only and not account_supports_private_storage(acc): + continue + + acc_label = config.get_per( + 'accounts', acc, 'account_label') or acc + accounts.append([acc, acc_label]) + accounts.sort(key=lambda xs: str.lower(xs[1])) return accounts +def account_is_zeroconf(account): + return connections[account].is_zeroconf + +def account_supports_private_storage(account): + return connections[account].private_storage_supported + def account_is_connected(account): if account not in connections: return False diff --git a/gajim/config.py b/gajim/config.py index 7a0175547..e203edfd2 100644 --- a/gajim/config.py +++ b/gajim/config.py @@ -1886,19 +1886,14 @@ class ManageBookmarksWindow: # Account-JID, RoomName, Room-JID, Autojoin, Minimize, Password, Nick, # Show_Status - self.treestore = Gtk.TreeStore(str, str, str, bool, 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) # Store bookmarks in treeview. - for account in app.connections: - if app.connections[account].connected <= 1: - continue - if app.connections[account].is_zeroconf: - continue - if not app.connections[account].private_storage_supported: - continue + for account, account_label in app.get_enabled_accounts_with_labels( + connected_only=True, private_storage_only=True): iter_ = self.treestore.append(None, [None, account, None, None, - None, None, None, None]) + None, None, None, None, account_label]) con = app.connections[account] bookmarks = con.get_module('Bookmarks').bookmarks @@ -1927,7 +1922,8 @@ class ManageBookmarksWindow: minimize, bookmark['password'], bookmark['nick'], - print_status ]) + print_status, + bookmark['name'] ]) self.print_status_combobox = self.xml.get_object('print_status_combobox') model = Gtk.ListStore(str, str) @@ -1935,9 +1931,8 @@ class ManageBookmarksWindow: self.option_list = {'': _('Default'), 'all': Q_('?print_status:All'), 'in_and_out': _('Enter and leave only'), 'none': Q_('?print_status:None')} - opts = sorted(self.option_list.keys()) - for opt in opts: - model.append([self.option_list[opt], opt]) + 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) @@ -1947,7 +1942,7 @@ class ManageBookmarksWindow: self.view.expand_all() renderer = Gtk.CellRendererText() - column = Gtk.TreeViewColumn('Bookmarks', renderer, text=1) + column = Gtk.TreeViewColumn('Bookmarks', renderer, text=8) self.view.append_column(column) self.selection = self.view.get_selection() @@ -1968,6 +1963,8 @@ class ManageBookmarksWindow: self.pass_entry.connect('changed', self.on_pass_entry_changed) 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.remove_bookmark_button = self.xml.get_object('remove_bookmark_button') self.xml.connect_signals(self) self.window.show_all() @@ -2001,8 +1998,9 @@ class ManageBookmarksWindow: account = model[add_to][1] nick = app.nicks[account] - iter_ = self.treestore.append(add_to, [account, _('New Group Chat'), - '@', False, False, '', nick, 'in_and_out']) + label = _('New Group Chat') + iter_ = self.treestore.append(add_to, [account, label, + '@', False, False, '', nick, 'in_and_out', label]) self.view.expand_row(model.get_path(add_to), True) self.view.set_cursor(model.get_path(iter_)) @@ -2023,6 +2021,7 @@ class ManageBookmarksWindow: model.remove(iter_) self.selection.unselect_all() self.clear_fields() + self.set_sensitive_all(False) self.ignore_events = False def check_valid_bookmark(self): @@ -2099,20 +2098,16 @@ class ManageBookmarksWindow: # this will be None, so we will just: return - widgets = [ self.title_entry, self.nick_entry, self.room_entry, - self.server_entry, self.pass_entry, self.autojoin_checkbutton, - self.minimize_checkbutton, self.print_status_combobox] + if model.iter_parent(iter_): # make the fields sensitive - for field in widgets: - field.set_sensitive(True) + self.set_sensitive_all(True) else: # Top-level has no data (it's the account fields) # clear fields & make them insensitive self.clear_fields() - for field in widgets: - field.set_sensitive(False) + self.set_sensitive_all(False) return # Fill in the data for childs @@ -2238,7 +2233,7 @@ class ManageBookmarksWindow: if iter_: model[iter_][5] = self.pass_entry.get_text() - def on_autojoin_checkbutton_toggled(self, widget): + def on_autojoin_checkbutton_toggled(self, widget, *args): if self.ignore_events: return (model, iter_) = self.selection.get_selected() @@ -2246,7 +2241,7 @@ class ManageBookmarksWindow: model[iter_][3] = self.autojoin_checkbutton.get_active() self.minimize_checkbutton.set_sensitive(model[iter_][3]) - def on_minimize_checkbutton_toggled(self, widget): + def on_minimize_checkbutton_toggled(self, widget, *args): if self.ignore_events: return (model, iter_) = self.selection.get_selected() @@ -2272,6 +2267,13 @@ class ManageBookmarksWindow: self.minimize_checkbutton.set_active(False) self.print_status_combobox.set_active(1) + def set_sensitive_all(self, sensitive): + widgets = [ self.title_entry, self.nick_entry, self.room_entry, + self.server_entry, self.pass_entry, self.settings_box, + self.remove_bookmark_button ] + for field in widgets: + field.set_sensitive(sensitive) + class AccountCreationWizardWindow: def __init__(self): self.xml = gtkgui_helpers.get_gtk_builder( diff --git a/gajim/data/gui/join_groupchat_window.ui b/gajim/data/gui/join_groupchat_window.ui index c51e33336..b4b0cbe6d 100644 --- a/gajim/data/gui/join_groupchat_window.ui +++ b/gajim/data/gui/join_groupchat_window.ui @@ -110,7 +110,7 @@ False end center - Autojoin + Auto Join right - - True - True - 0 - - - - - True - False - 6 - start - - - gtk-add - True - True - True - False - True - - - - False - False - 0 - - - - - gtk-remove - True - True - True - False - True - - - - False - False - 1 - - - - - False - True - 1 - @@ -108,214 +56,40 @@ - + True False - 6 - 6 + False + 1 - + True False - _Title: True - 0 + list-add-symbolic + - 0 - 0 + False + False - + True False - _Nickname: True - 0 + list-remove-symbolic + - 0 - 1 - - - - - True - False - Roo_m: - True - 0 - - - 0 - 2 - - - - - True - False - _Server: - True - 0 - - - 0 - 3 - - - - - True - False - _Password: - True - 0 - - - 0 - 4 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - A_uto join - True - False - True - False - If checked, Gajim will join this group chat on startup - True - 0 - True - - - - False - True - 0 - - - - - Minimi_ze on Auto Join - True - False - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 - True - - - - False - True - 1 - - - - - 0 - 5 - 2 - - - - - True - False - Pr_int status: - True - 0 - - - 0 - 6 - - - - - True - False - True - - - 1 - 0 - - - - - True - False - True - - - 1 - 1 - - - - - True - False - True - - - 1 - 2 - - - - - True - False - True - - - 1 - 3 - - - - - True - False - True - False - - - 1 - 4 - - - - - True - False - False - liststore1 - - - - - 0 - - - - - 1 - 6 + False + False + False @@ -331,43 +105,373 @@ - + True False - 12 - end + vertical + 18 - - gtk-cancel + True - True - True - False - True - + False + 6 + 6 + 12 + + + True + False + end + Name + True + 0 + + + + 0 + 0 + + + + + 230 + True + False + True + Bookmark Name + True + True + + + 1 + 0 + + + + + True + False + end + 12 + _Server + True + 0 + + + + 0 + 1 + + + + + True + False + True + 12 + True + + + 1 + 1 + + + + + True + False + end + 12 + _Nickname + True + 0 + + + + 0 + 4 + + + + + True + False + True + 12 + True + + + 1 + 4 + + + + + True + False + end + Roo_m + True + 0 + + + + 0 + 2 + + + + + True + False + True + True + + + 1 + 2 + + + + + True + False + end + _Password + True + 0 + + + + 0 + 3 + + + + + True + False + True + False + True + + + 1 + 3 + + False - False + True 0 - - gtk-ok + True - True - True - False - True - + False + none + + + True + True + + + True + False + Join chat when connected + center + 12 + + + True + False + start + Auto Join + + + False + True + 0 + + + + + True + True + end + + + + False + True + end + 1 + + + + + + + + + True + True + + + True + False + center + 12 + + + True + False + start + Minimize on Auto Join + + + False + True + 0 + + + + + True + True + end + + + + False + True + end + 1 + + + + + + + + + True + True + + + True + False + Status messages displayed in chat window + center + 18 + + + True + False + start + Status Messages + + + False + True + 0 + + + + + True + False + liststore1 + + + + + 0 + + + + + False + True + end + 1 + + + + + + + False - False + True 1 + + + True + False + end + True + 12 + end + + + Cancel + True + True + True + False + + + + False + False + 0 + + + + + OK + True + True + True + True + False + + + + + False + False + 1 + + + + + False + True + 2 + + False @@ -377,5 +481,8 @@ + + + diff --git a/gajim/data/style/gajim.css b/gajim/data/style/gajim.css index f78e23ffe..d607d1086 100644 --- a/gajim/data/style/gajim.css +++ b/gajim/data/style/gajim.css @@ -74,6 +74,19 @@ popover#EmoticonPopover flowboxchild { padding-top: 5px; padding-bottom: 5px; } .PopoverButtonListbox > list > row { padding: 10px 20px 10px 20px; } .PopoverButtonListbox > list > row.activatable:active { box-shadow: none; background-color: @theme_selected_bg_color } +/* Settings ListBox */ + +list.settings { + border: @borders 1px solid; +} +list.settings > row:not(:last-child) { + border-bottom: @theme_unfocused_bg_color 1px solid; +} +list.settings row { min-height: 52px; } +list.settings > row > box { + margin: 6px 18px; +} + /* Accounts Window */ #AccountsWindow > box > stack { padding:30px 30px 30px 30px;} #AccountsWindow scrolledwindow {border: none;} @@ -102,6 +115,10 @@ popover#EmoticonPopover flowboxchild { padding-top: 5px; padding-bottom: 5px; } .status-dnd { color: #e62e00;} .status-online { color: #66bf10;} +/* Treeview */ + +treeview.space { padding: 6px; } + /*MessageWindow Notebook*/ .notebook-tab-label {min-width: 80px}