Rework Accounts Window

- Every account row has now a submenu
- Moved Remove, Back and Pages into the submenu
This commit is contained in:
Philipp Hörist 2019-04-22 01:10:46 +02:00
parent 8c03d37217
commit b306a7e05f
5 changed files with 521 additions and 440 deletions

View File

@ -409,6 +409,16 @@ def get_connected_accounts():
account_list.append(account)
return account_list
def get_accounts_sorted():
'''
Get all accounts alphabetically sorted with Local first
'''
account_list = config.get_per('accounts')
account_list.sort(key=str.lower)
account_list.remove('Local')
account_list.insert(0, 'Local')
return account_list
def get_enabled_accounts_with_labels(exclude_local=True, connected_only=False,
private_storage_only=False):
"""

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.21.0 -->
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="max_content_height">400</property>
<property name="propagate_natural_height">True</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="account_list">
<property name="name">OptionsBox1</property>
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="vexpand">True</property>
<signal name="row-activated" handler="on_row_activated" swapped="no"/>
<style>
<class name="account-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hhomogeneous">False</property>
<property name="vhomogeneous">False</property>
<signal name="notify::visible-child-name" handler="on_child_visible" swapped="no"/>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>

View File

@ -84,11 +84,11 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_
#FeaturesInfoGrid > list > row.activatable:active { box-shadow: none; }
/* SettingsBox */
#SettingsBox > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; }
#SettingsBox > row:last-child { border-bottom: 0px}
#SettingsBox > row.activatable:active { box-shadow: none; }
#SettingsBox > row { padding: 10px 20px 10px 10px; }
#SettingsBox > row:not(.activatable) label { color: @insensitive_fg_color }
.settings-box > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; }
.settings-box > row:last-child { border-bottom: 0px}
.settings-box > row.activatable:active { box-shadow: none; }
.settings-box > row { padding: 10px 20px 10px 10px; }
.settings-box > row:not(.activatable) label { color: @insensitive_fg_color }
/* GenericSetting */
#SubDescription { color: @insensitive_fg_color; font-size: small;}
@ -119,13 +119,15 @@ list.settings > row > box {
.PreferencesStack { background-color: @theme_bg_color; }
/* Accounts Window */
#AccountsWindow > box > stack { padding:30px 30px 30px 30px;}
#AccountsWindow scrolledwindow {border: none;}
#AccountsWindow stack list {border: 1px solid; border-color: @borders;}
#AccountsWindow > box > box { border-right: 1px solid; border-color: @borders; }
.account-list > row { padding: 20px 20px 20px 10px; }
.accounts-menu { border-right: 1px solid; border-color: @borders;}
.accounts-settings-border {border: 1px solid; border-color: @borders;}
.accounts-settings stack > box { margin:30px; }
.accounts-label-row {
padding-top: 10px;
padding-bottom: 10px;
font-size: 18px;
font-weight: bold;
color: @insensitive_fg_color;}
/* StartChatListBox */
#StartChatListBox > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; }
@ -214,6 +216,7 @@ list.settings > row > box {
.status-away { color: #ff8533;}
.status-dnd { color: #e62e00;}
.status-online { color: #66bf10;}
.insensitive-fg-color {color: @insensitive_fg_color;}
/* Padding/Margins */
.margin-top6 { margin-top: 6px; }

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ class SettingsDialog(Gtk.ApplicationWindow):
class SettingsBox(Gtk.ListBox):
def __init__(self, account, extend=None):
Gtk.ListBox.__init__(self)
self.set_name('SettingsBox')
self.get_style_context().add_class('settings-box')
self.account = account
self.named_settings = {}
@ -179,7 +179,7 @@ class GenericSetting(Gtk.ListBoxRow):
description.set_xalign(0)
description.set_line_wrap(True)
description.set_line_wrap_mode(Pango.WrapMode.WORD)
description.set_max_width_chars(40)
description.set_max_width_chars(50)
description_box.add(description)
self._grid.add(description_box)
@ -474,10 +474,11 @@ class ActionSetting(GenericSetting):
"setting-value": (str, 'Dummy', '', '',
GObject.ParamFlags.READWRITE),}
def __init__(self, *args, action_args):
def __init__(self, *args, account):
GenericSetting.__init__(self, *args)
self.action = gtkgui_helpers.get_action(self.setting_value)
self.variant = GLib.Variant.new_string(action_args)
action_name = '%s%s' % (account, self.value)
self.action = gtkgui_helpers.get_action(action_name)
self.variant = GLib.Variant.new_string(account)
self.on_enable()
self.show_all()