Skip to content

Commit

Permalink
Revert "TaskListGrid: use toolbarview (#384)"
Browse files Browse the repository at this point in the history
This reverts commit dfa5d7f.
  • Loading branch information
danirabbit committed May 16, 2024
1 parent fa1b06f commit 79f6a5f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ 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: 14 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ 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 @@ -107,9 +115,14 @@ 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 = task_list_grid_stack,
end_child = main_box,
resize_start_child = false,
shrink_end_child = false,
shrink_start_child = false
Expand Down
40 changes: 13 additions & 27 deletions src/Widgets/TaskListGrid.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,24 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid {
warning ("unable to get the registry, assuming task list is not from gtasks");
}

editable_title = new EditableLabel ();
editable_title = new EditableLabel () {
margin_start = 24,
hexpand = true
};
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,
valign = START,
halign = END,
hexpand = true,
margin_end = 24,
valign = Gtk.Align.CENTER,
hexpand = false,
icon_name = "view-more-symbolic",
tooltip_text = _("Edit Name and Appearance")
};

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);
settings_button.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);

add_task_list = new Gtk.ListBox () {
margin_top = 24,
Expand Down Expand Up @@ -104,16 +95,11 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid {
child = task_list
};

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);
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);

Application.settings.changed["show-completed"].connect (() => {
on_show_completed_changed (Application.settings.get_boolean ("show-completed"));
Expand Down

0 comments on commit 79f6a5f

Please sign in to comment.