Commit 1de50614 authored by Michael Gratton's avatar Michael Gratton 🍸
Browse files

Merge branch 'mjog/folder-list-cleanup' into 'mainline'

Folder list fixes

Closes #1177 and #1184

See merge request !686
parents c233efc1 05ea5fbd
Pipeline #273717 passed with stages
in 26 minutes and 21 seconds
......@@ -34,7 +34,10 @@ public class FolderList.AccountBranch : Sidebar.Branch {
public AccountBranch(Geary.Account account) {
base(new Sidebar.Header(account.information.display_name),
Sidebar.Branch.Options.NONE, normal_folder_comparator, special_folder_comparator);
STARTUP_OPEN_GROUPING | STARTUP_EXPAND_TO_FIRST_CHILD,
normal_folder_comparator,
special_folder_comparator
);
this.account = account;
// Translators: The name of the folder group containing
......
......@@ -11,8 +11,11 @@ public class FolderList.InboxesBranch : Sidebar.Branch {
get; private set; default = new Gee.HashMap<Geary.Account, InboxFolderEntry>(); }
public InboxesBranch() {
base(new Sidebar.Header(_("Inboxes")),
Sidebar.Branch.Options.NONE, inbox_comparator);
base(
new Sidebar.Header(_("Inboxes")),
STARTUP_OPEN_GROUPING,
inbox_comparator
);
}
private static int inbox_comparator(Sidebar.Entry a, Sidebar.Entry b) {
......
......@@ -136,7 +136,6 @@ client_vala_sources = files(
'sidebar/sidebar-common.vala',
'sidebar/sidebar-count-cell-renderer.vala',
'sidebar/sidebar-entry.vala',
'sidebar/sidebar-expander-renderer.vala',
'sidebar/sidebar-tree.vala',
'util/util-avatar.vala',
......
/* Copyright © 2020 Purism SPC
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/**
* Cell renderer for the expander in the sidebar.
*/
public class SidebarExpanderRenderer : Gtk.CellRendererPixbuf {
public signal void toggle(Gtk.TreePath path);
public weak Gtk.Widget widget { get; set; }
public SidebarExpanderRenderer(Gtk.Widget widget) {
this.widget = widget;
xalign = 1;
mode = Gtk.CellRendererMode.ACTIVATABLE;
notify["is-expanded"].connect (update_arrow);
update_arrow();
}
private void update_arrow() {
if (is_expanded)
this.icon_name = "go-down-symbolic";
else
this.icon_name = "go-next-symbolic";
}
public override bool activate (Gdk.Event event,
Gtk.Widget widget,
string path,
Gdk.Rectangle background_area,
Gdk.Rectangle cell_area,
Gtk.CellRendererState flags) {
toggle(new Gtk.TreePath.from_string (path));
return true;
}
}
......@@ -115,18 +115,10 @@ public class Sidebar.Tree : Gtk.TreeView {
end_column.set_cell_data_func(unread_renderer, counter_renderer_function);
end_column.pack_start(unread_renderer, false);
end_column.add_attribute(unread_renderer, "counter", Columns.COUNTER);
// Expander arrows.
SidebarExpanderRenderer expander_renderer = new SidebarExpanderRenderer(this);
expander_renderer.toggle.connect(toggle_branch_expansion);
end_column.set_cell_data_func(expander_renderer, expander_renderer_function);
end_column.pack_start(expander_renderer, false);
append_column(end_column);
set_headers_visible(false);
set_enable_search(false);
set_search_column(-1);
set_show_expanders(false);
set_reorderable(false);
set_enable_tree_lines(false);
set_grid_lines(Gtk.TreeViewGridLines.NONE);
......@@ -171,10 +163,6 @@ public class Sidebar.Tree : Gtk.TreeView {
renderer.visible = !(wrapper.entry is Sidebar.Header);
}
public void expander_renderer_function(Gtk.CellLayout layout, Gtk.CellRenderer renderer, Gtk.TreeModel model, Gtk.TreeIter iter) {
renderer.visible = renderer.is_expander;
}
public void counter_renderer_function(Gtk.CellLayout layout, Gtk.CellRenderer renderer, Gtk.TreeModel model, Gtk.TreeIter iter) {
EntryWrapper? wrapper = get_wrapper_at_iter(iter);
if (wrapper == null) {
......@@ -641,8 +629,9 @@ public class Sidebar.Tree : Gtk.TreeView {
associate_entry(insertion_iter, entry);
associate_children(branch, entry, insertion_iter);
if (branch.is_auto_open_on_new_child())
if (branch.is_auto_open_on_new_child() || parent is Grouping) {
expand_to_entry(entry);
}
}
private void on_branch_entry_removed(Sidebar.Branch branch, Sidebar.Entry entry) {
......
......@@ -18,10 +18,6 @@
min-width: 250px;
}
.geary-folder-frame .sidebar .cell {
padding: 9px 6px;
}
.geary-conversation-frame > border {
border-left-width: 0;
border-top-width: 0;
......@@ -29,15 +25,10 @@
min-width: 360px;
}
treeview.sidebar {
border: none;
}
geary-conversation-viewer {
min-width: 360px;
}
/* For 3-pane mode only */
.geary-sidebar-pane-separator.vertical .conversation-frame > border {
border-bottom-width: 0;
}
......@@ -402,6 +393,20 @@ dialog.geary-remove-confirm .dialog-action-box {
/* FolderList.Tree */
treeview.sidebar {
border: none;
}
treeview.sidebar .cell {
padding: 9px 6px;
}
treeview.sidebar .cell:dir(ltr) {
padding-left: 0px;
}
treeview.sidebar .cell:dir(rtl) {
padding-right: 0px;
}
treeview.sidebar:drop(active).after,
treeview.sidebar:drop(active).before,
treeview.sidebar:drop(active).into {
......
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