From e9177cf1d49d91d8f2960e8a5adc2d5ddcb42593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 16 May 2024 12:09:02 -0700 Subject: [PATCH 1/2] TaskListGrid: use toolbarview --- meson.build | 1 + src/MainWindow.vala | 15 +-------------- src/Widgets/TaskListGrid.vala | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index ea235673f..483c61a3c 100644 --- a/meson.build +++ b/meson.build @@ -33,6 +33,7 @@ tasks_deps = [ dependency('granite-7', version: '>=7.0.0'), dependency('gtk4'), libecal_dep, + dependency('libadwaita-1'), dependency('libedataserver-1.2'), dependency('libgeoclue-2.0'), dependency('shumate-1.0'), diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ef32a2fb3..8aa6dfc6a 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -53,14 +53,6 @@ public class Tasks.MainWindow : Gtk.ApplicationWindow { sidebar_header.add_css_class (Granite.STYLE_CLASS_FLAT); sidebar_header.pack_start (new Gtk.WindowControls (Gtk.PackType.START)); - var main_header = new Gtk.HeaderBar () { - title_widget = new Gtk.Label (null), - show_title_buttons = false - }; - main_header.add_css_class (Granite.STYLE_CLASS_DEFAULT_DECORATION); - main_header.add_css_class (Granite.STYLE_CLASS_FLAT); - main_header.pack_end (new Gtk.WindowControls (Gtk.PackType.END)); - listbox = new Gtk.ListBox (); listbox.set_sort_func (sort_function); @@ -115,14 +107,9 @@ public class Tasks.MainWindow : Gtk.ApplicationWindow { task_list_grid_stack = new Gtk.Stack (); - var main_box = new Gtk.Box (VERTICAL, 0); - main_box.add_css_class (Granite.STYLE_CLASS_BACKGROUND); - main_box.append (main_header); - main_box.append (task_list_grid_stack); - var paned = new Gtk.Paned (HORIZONTAL) { start_child = sidebar, - end_child = main_box, + end_child = task_list_grid_stack, resize_start_child = false, shrink_end_child = false, shrink_start_child = false diff --git a/src/Widgets/TaskListGrid.vala b/src/Widgets/TaskListGrid.vala index 8becac481..b7aa3057f 100644 --- a/src/Widgets/TaskListGrid.vala +++ b/src/Widgets/TaskListGrid.vala @@ -95,11 +95,23 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { child = task_list }; - column_spacing = 12; - attach (editable_title, 0, 0); - attach (settings_button, 1, 0); - attach (add_task_list, 0, 1, 2); - attach (scrolled_window, 0, 2, 2); + var main_box = new Gtk.Box (VERTICAL, 12); + main_box.append (add_task_list); + main_box.append (scrolled_window); + + var window_controls = new Gtk.WindowControls (END); + + var header_box = new Gtk.Box (HORIZONTAL, 0); + header_box.append (editable_title); + header_box.append (settings_button); + header_box.append (window_controls); + + var toolbar_view = new Adw.ToolbarView () { + content = main_box + }; + toolbar_view.add_top_bar (header_box); + + attach (toolbar_view, 0, 0); Application.settings.changed["show-completed"].connect (() => { on_show_completed_changed (Application.settings.get_boolean ("show-completed")); From 9a136cb69b9efaa6ce407bc344a5fc96731a99dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 16 May 2024 12:22:50 -0700 Subject: [PATCH 2/2] Fix up --- src/Widgets/TaskListGrid.vala | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Widgets/TaskListGrid.vala b/src/Widgets/TaskListGrid.vala index b7aa3057f..a55d59194 100644 --- a/src/Widgets/TaskListGrid.vala +++ b/src/Widgets/TaskListGrid.vala @@ -26,10 +26,7 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { warning ("unable to get the registry, assuming task list is not from gtasks"); } - editable_title = new EditableLabel () { - margin_start = 24, - hexpand = true - }; + editable_title = new EditableLabel (); editable_title.add_css_class (Granite.STYLE_CLASS_H1_LABEL); editable_title.add_css_class (Granite.STYLE_CLASS_ACCENT); @@ -37,13 +34,25 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { var settings_button = new Gtk.MenuButton () { popover = list_settings_popover, - margin_end = 24, - valign = Gtk.Align.CENTER, - hexpand = false, + valign = START, + halign = END, + hexpand = true, icon_name = "view-more-symbolic", tooltip_text = _("Edit Name and Appearance") }; - settings_button.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + + var window_controls = new Gtk.WindowControls (END) { + valign = START + }; + + var header_box = new Gtk.Box (HORIZONTAL, 0) { + margin_top = 6, + margin_end = 6, + margin_start = 24 + }; + header_box.append (editable_title); + header_box.append (settings_button); + header_box.append (window_controls); add_task_list = new Gtk.ListBox () { margin_top = 24, @@ -99,13 +108,6 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { main_box.append (add_task_list); main_box.append (scrolled_window); - var window_controls = new Gtk.WindowControls (END); - - var header_box = new Gtk.Box (HORIZONTAL, 0); - header_box.append (editable_title); - header_box.append (settings_button); - header_box.append (window_controls); - var toolbar_view = new Adw.ToolbarView () { content = main_box };