Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskListGrid: use toolbarview #384

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
15 changes: 1 addition & 14 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
40 changes: 27 additions & 13 deletions src/Widgets/TaskListGrid.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,33 @@ 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);

var list_settings_popover = new Tasks.Widgets.ListSettingsPopover (source);

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,
Expand Down Expand Up @@ -95,11 +104,16 @@ 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 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"));
Expand Down
Loading