Skip to content

Commit

Permalink
TaskListGrid: use toolbarview
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed May 16, 2024
1 parent 854caec commit cf25dc8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
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
22 changes: 17 additions & 5 deletions src/Widgets/TaskListGrid.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit cf25dc8

Please sign in to comment.