From d6c2bdbc442d5874a06cc2521f778b00415a3cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 09:56:33 -0700 Subject: [PATCH 1/8] SourceList: replace install_style, style_get --- src/SourceList/SourceList.vala | 116 ++++++++++----------------------- 1 file changed, 34 insertions(+), 82 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index 300060865..7890cc8b2 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -1070,42 +1070,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { } """; - private const string STYLE_PROP_LEVEL_INDENTATION = "level-indentation"; - private const string STYLE_PROP_LEFT_PADDING = "left-padding"; - private const string STYLE_PROP_EXPANDER_SPACING = "expander-spacing"; - - static construct { - install_style_property (new ParamSpecInt ( - STYLE_PROP_LEVEL_INDENTATION, - "Level Indentation", - "Space to add at the beginning of every indentation level. Must be an even number.", - 1, - 50, - 6, - ParamFlags.READABLE - )); - - install_style_property (new ParamSpecInt ( - STYLE_PROP_LEFT_PADDING, - "Left Padding", - "Padding added to the left side of the tree. Must be an even number.", - 1, - 50, - 4, - ParamFlags.READABLE - )); - - install_style_property (new ParamSpecInt ( - STYLE_PROP_EXPANDER_SPACING, - "Expander Spacing", - "Space added between an item and its expander. Must be an even number.", - 1, - 50, - 4, - ParamFlags.READABLE - )); - } - public Tree (DataModel data_model) { Object (data_model: data_model); } @@ -1113,7 +1077,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { construct { unowned Gtk.StyleContext style_context = get_style_context (); style_context.add_class (Gtk.STYLE_CLASS_SIDEBAR); - style_context.add_class (Granite.STYLE_CLASS_SOURCE_LIST); var css_provider = new Gtk.CssProvider (); try { @@ -1136,54 +1099,55 @@ public class Mail.SourceList : Gtk.ScrolledWindow { expander_column = null; show_expanders = false; - var item_column = new Gtk.TreeViewColumn (); - item_column.expand = true; - - insert_column (item_column, Column.ITEM); - // Now pack the cell renderers. We insert them in reverse order (using pack_end) // because we want to use TreeViewColumn.pack_start exclusively for inserting // spacer cell renderers for level-indentation purposes. // See add_spacer_cell_for_level() for more details. // Second expander. Used for main categories - secondary_expander_cell = new CellRendererExpander (); - secondary_expander_cell.is_category_expander = true; - secondary_expander_cell.xpad = 10; - item_column.pack_end (secondary_expander_cell, false); - item_column.set_cell_data_func (secondary_expander_cell, expander_cell_data_func); + secondary_expander_cell = new CellRendererExpander () { + is_category_expander = true, + xpad = 3 + }; - badge_cell = new CellRendererBadge (); - badge_cell.xpad = 1; - badge_cell.xalign = 1; - item_column.pack_end (badge_cell, false); - item_column.set_cell_data_func (badge_cell, badge_cell_data_func); + badge_cell = new CellRendererBadge () { + xpad = 3, + xalign = 1 + }; - text_cell = new Gtk.CellRendererText (); - text_cell.editable_set = true; - text_cell.editable = false; + text_cell = new Gtk.CellRendererText () { + editable_set = true, + editable = false, + ellipsize = END, + xalign = 0, + xpad = 6 + }; text_cell.editing_started.connect (on_editing_started); text_cell.editing_canceled.connect (on_editing_canceled); - text_cell.ellipsize = Pango.EllipsizeMode.END; - text_cell.xalign = 0; - item_column.pack_end (text_cell, true); - item_column.set_cell_data_func (text_cell, name_cell_data_func); icon_cell = new CellRendererIcon (); - icon_cell.xpad = 2; - item_column.pack_end (icon_cell, false); - item_column.set_cell_data_func (icon_cell, icon_cell_data_func); // First expander. Used for normal expandable items - primary_expander_cell = new CellRendererExpander (); - - int expander_spacing; - style_get (STYLE_PROP_EXPANDER_SPACING, out expander_spacing); - primary_expander_cell.xpad = expander_spacing / 2; + primary_expander_cell = new CellRendererExpander () { + xpad = 3 + }; + var item_column = new Gtk.TreeViewColumn () { + expand = true + }; + item_column.pack_end (secondary_expander_cell, false); + item_column.set_cell_data_func (secondary_expander_cell, expander_cell_data_func); + item_column.pack_end (badge_cell, false); + item_column.set_cell_data_func (badge_cell, badge_cell_data_func); + item_column.pack_end (text_cell, true); + item_column.set_cell_data_func (text_cell, name_cell_data_func); + item_column.pack_end (icon_cell, false); + item_column.set_cell_data_func (icon_cell, icon_cell_data_func); item_column.pack_end (primary_expander_cell, false); item_column.set_cell_data_func (primary_expander_cell, expander_cell_data_func); + insert_column (item_column, Column.ITEM); + // Selection var selection = get_selection (); selection.mode = Gtk.SelectionMode.BROWSE; @@ -1281,8 +1245,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { spacer_cell.level = level; spacer_cells[level] = spacer_cell; - uint cell_xpadding; - // The primary expander is not visible for root-level (i.e. first level) // items, so for the second level of indentation we use a low padding // because the primary expander will add enough space. For the root level, @@ -1291,24 +1253,14 @@ public class Mail.SourceList : Gtk.ScrolledWindow { // so we set the value to a half of actual (desired) value. switch (level) { case 1: // root - int left_padding; - style_get (STYLE_PROP_LEFT_PADDING, out left_padding); - cell_xpadding = left_padding / 2; - break; - case 2: // second level - cell_xpadding = 0; - break; + break; default: // remaining levels - int level_indentation; - style_get (STYLE_PROP_LEVEL_INDENTATION, out level_indentation); - cell_xpadding = level_indentation / 2; - break; + spacer_cell.xpad = 3; + break; } - spacer_cell.xpad = cell_xpadding; - var item_column = get_column (Column.ITEM); item_column.pack_start (spacer_cell, false); item_column.set_cell_data_func (spacer_cell, spacer_cell_data_func); From 46490b41eb4c26e145349d4bf6768c85ca936fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 09:59:08 -0700 Subject: [PATCH 2/8] Fix comment placement --- src/SourceList/SourceList.vala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index 7890cc8b2..47a8897ee 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -1099,11 +1099,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { expander_column = null; show_expanders = false; - // Now pack the cell renderers. We insert them in reverse order (using pack_end) - // because we want to use TreeViewColumn.pack_start exclusively for inserting - // spacer cell renderers for level-indentation purposes. - // See add_spacer_cell_for_level() for more details. - // Second expander. Used for main categories secondary_expander_cell = new CellRendererExpander () { is_category_expander = true, @@ -1132,6 +1127,10 @@ public class Mail.SourceList : Gtk.ScrolledWindow { xpad = 3 }; + // Now pack the cell renderers. We insert them in reverse order (using pack_end) + // because we want to use TreeViewColumn.pack_start exclusively for inserting + // spacer cell renderers for level-indentation purposes. + // See add_spacer_cell_for_level() for more details. var item_column = new Gtk.TreeViewColumn () { expand = true }; From 617528ab899626c2bc26aea35e9edb88e2405d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 10:03:23 -0700 Subject: [PATCH 3/8] remove old/dead css --- src/SourceList/SourceList.vala | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index 47a8897ee..aceec28fb 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -1061,30 +1061,12 @@ public class Mail.SourceList : Gtk.ScrolledWindow { private Gee.HashMap spacer_cells; // cells used for left spacing private bool unselectable_item_clicked = false; - private const string DEFAULT_STYLESHEET = """ - .sidebar.badge { - border-radius: 10px; - border-width: 0; - padding: 1px 2px 1px 2px; - font-weight: bold; - } - """; - public Tree (DataModel data_model) { Object (data_model: data_model); } construct { - unowned Gtk.StyleContext style_context = get_style_context (); - style_context.add_class (Gtk.STYLE_CLASS_SIDEBAR); - - var css_provider = new Gtk.CssProvider (); - try { - css_provider.load_from_data (DEFAULT_STYLESHEET, -1); - style_context.add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); - } catch (Error e) { - warning ("Could not create CSS Provider: %s\nStylesheet:\n%s", e.message, DEFAULT_STYLESHEET); - } + get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR); set_model (data_model); From 971059d348ba77838314d6dbece2bd8e988f133f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 10:05:09 -0700 Subject: [PATCH 4/8] Replace removed constants --- src/SourceList/SourceList.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index aceec28fb..d343b7f0f 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -879,8 +879,8 @@ public class Mail.SourceList : Gtk.ScrolledWindow { } private void resort () { - child_tree.set_sort_column_id (Gtk.SortColumn.UNSORTED, Gtk.SortType.ASCENDING); - child_tree.set_sort_column_id (Gtk.SortColumn.DEFAULT, Gtk.SortType.ASCENDING); + child_tree.set_sort_column_id (Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, Gtk.SortType.ASCENDING); + child_tree.set_sort_column_id (Gtk.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, Gtk.SortType.ASCENDING); } private int child_model_sort_func (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b) { From fd3e0a3cbe320dd684782a62c8d3aed065b81a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 10:06:13 -0700 Subject: [PATCH 5/8] Remove unnecessary stock_size --- src/SourceList/SourceList.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index d343b7f0f..d8e9c5460 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -962,7 +962,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { construct { mode = Gtk.CellRendererMode.ACTIVATABLE; - stock_size = Gtk.IconSize.MENU; } public override bool activate ( From 292d73c2d4d0c50cc0fb85665b1559d96a81e8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 10:08:29 -0700 Subject: [PATCH 6/8] Cleanup expand/fill --- src/SourceList/SourceList.vala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index d8e9c5460..bb3b64fda 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -952,7 +952,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { } } - /** * Class responsible for rendering Item.icon and Item.activatable. It also * notifies about clicks through the activated() signal. @@ -1066,20 +1065,16 @@ public class Mail.SourceList : Gtk.ScrolledWindow { construct { get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR); - - set_model (data_model); - - halign = valign = Gtk.Align.FILL; - expand = true; - + enable_grid_lines = NONE; enable_search = false; headers_visible = false; - enable_grid_lines = Gtk.TreeViewGridLines.NONE; - + vexpand = true; // Deactivate GtkTreeView's built-in expander functionality expander_column = null; show_expanders = false; + set_model (data_model); + // Second expander. Used for main categories secondary_expander_cell = new CellRendererExpander () { is_category_expander = true, From fd1bb3da864311e33cb5b38adc8ecc4919492687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 10:09:32 -0700 Subject: [PATCH 7/8] Don't override menu func --- src/SourceList/SourceList.vala | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index bb3b64fda..91cf65712 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -1619,10 +1619,6 @@ public class Mail.SourceList : Gtk.ScrolledWindow { return min_req.width; } - public override bool popup_menu () { - return popup_context_menu (); - } - private bool popup_context_menu (Item? item = null, Gdk.Event? event = null) { if (item == null) { item = selected_item; From c7f1e0d81864286f519f78b716ede58a7ba5c573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 7 Aug 2026 11:28:34 -0700 Subject: [PATCH 8/8] child = tree --- src/SourceList/SourceList.vala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SourceList/SourceList.vala b/src/SourceList/SourceList.vala index 91cf65712..6ed1ac2aa 100644 --- a/src/SourceList/SourceList.vala +++ b/src/SourceList/SourceList.vala @@ -1888,8 +1888,7 @@ public class Mail.SourceList : Gtk.ScrolledWindow { tree = new Tree (data_model); set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); - add (tree); - show_all (); + child = tree; tree.item_selected.connect ((item) => item_selected (item)); }