From acf44ab843cdf576d94ce32d74ba78bb2a63c73d Mon Sep 17 00:00:00 2001 From: Leo Date: Sun, 11 Jun 2023 01:12:45 +0900 Subject: [PATCH] Preparations for Gtk4 (#360) --- data/EntryPopover.css | 25 ++----- meson.build | 2 +- src/MainWindow.vala | 64 +++++++----------- src/Widgets/EditableLabel.vala | 38 +++-------- src/Widgets/EntryPopover/DateTime.vala | 50 ++++++-------- src/Widgets/EntryPopover/Generic.vala | 22 ++---- src/Widgets/EntryPopover/Location.vala | 18 ++--- src/Widgets/ListSettingsPopover.vala | 67 ++++++++----------- src/Widgets/ScheduledRow.vala | 30 ++------- ...istGrid.vala => ScheduledTaskListBox.vala} | 39 ++++------- src/Widgets/SourceRow.vala | 32 +++------ src/Widgets/TaskListGrid.vala | 24 ++----- src/Widgets/TaskRow.vala | 53 ++++++--------- 13 files changed, 154 insertions(+), 310 deletions(-) rename src/Widgets/{ScheduledTaskListGrid.vala => ScheduledTaskListBox.vala} (91%) diff --git a/data/EntryPopover.css b/data/EntryPopover.css index 4c024df936..9341cde330 100644 --- a/data/EntryPopover.css +++ b/data/EntryPopover.css @@ -1,24 +1,9 @@ /* -* Copyright 2020 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2020-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ -entry-popover grid { +entry-popover box { border-radius: 3px; background: @SILVER_300; } @@ -29,7 +14,7 @@ entry-popover button { font-weight: 600; } -entry-popover.error grid { +entry-popover.error box { background: alpha (@error_color, 0.2); } diff --git a/meson.build b/meson.build index 22aafc0643..e6197e170d 100644 --- a/meson.build +++ b/meson.build @@ -72,7 +72,7 @@ executable( 'src/Widgets/EntryPopover/Location.vala', 'src/Widgets/ScheduledRow.vala', 'src/Widgets/SourceRow.vala', - 'src/Widgets/ScheduledTaskListGrid.vala', + 'src/Widgets/ScheduledTaskListBox.vala', 'src/Widgets/TaskListGrid.vala', 'src/Widgets/TaskRow.vala', 'src/Widgets/ListSettingsPopover.vala', diff --git a/src/MainWindow.vala b/src/MainWindow.vala index c220c7a1cc..821a322f55 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.MainWindow : Hdy.ApplicationWindow { public const string ACTION_GROUP_PREFIX = "win"; @@ -95,7 +80,8 @@ public class Tasks.MainWindow : Hdy.ApplicationWindow { listbox.add (scheduled_row); var scrolledwindow = new Gtk.ScrolledWindow (null, null) { - expand = true, + hexpand = true, + vexpand = true, hscrollbar_policy = Gtk.PolicyType.NEVER }; scrolledwindow.add (listbox); @@ -108,18 +94,17 @@ public class Tasks.MainWindow : Hdy.ApplicationWindow { text = _("Online Accounts Settings…") }; - var add_tasklist_grid = new Gtk.Grid () { + var add_tasklist_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 3) { margin_top = 3, - margin_bottom = 3, - row_spacing = 3 + margin_bottom = 3 }; - add_tasklist_grid.attach (add_tasklist_buttonbox, 0, 0); - add_tasklist_grid.attach (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, 1); - add_tasklist_grid.attach (online_accounts_button, 0, 2); - add_tasklist_grid.show_all (); + add_tasklist_box.add (add_tasklist_buttonbox); + add_tasklist_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); + add_tasklist_box.add (online_accounts_button); + add_tasklist_box.show_all (); var add_tasklist_popover = new Gtk.Popover (null); - add_tasklist_popover.add (add_tasklist_grid); + add_tasklist_popover.add (add_tasklist_box); var add_tasklist_button = new Gtk.MenuButton () { label = _("Add Task List…"), @@ -134,24 +119,23 @@ public class Tasks.MainWindow : Hdy.ApplicationWindow { unowned Gtk.StyleContext actionbar_style_context = actionbar.get_style_context (); actionbar_style_context.add_class (Gtk.STYLE_CLASS_FLAT); - var sidebar = new Gtk.Grid (); - sidebar.attach (sidebar_header, 0, 0); - sidebar.attach (scrolledwindow, 0, 1); - sidebar.attach (actionbar, 0, 2); + var sidebar = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); + sidebar.get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR); + sidebar.add (sidebar_header); + sidebar.add (scrolledwindow); + sidebar.add (actionbar); - unowned Gtk.StyleContext sidebar_style_context = sidebar.get_style_context (); - sidebar_style_context.add_class (Gtk.STYLE_CLASS_SIDEBAR); task_list_grid_stack = new Gtk.Stack (); - var main_grid = new Gtk.Grid (); - main_grid.get_style_context ().add_class (Gtk.STYLE_CLASS_BACKGROUND); - main_grid.attach (main_header, 0, 0); - main_grid.attach (task_list_grid_stack, 0, 1); + var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); + main_box.get_style_context ().add_class (Gtk.STYLE_CLASS_BACKGROUND); + main_box.add (main_header); + main_box.add (task_list_grid_stack); var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); paned.pack1 (sidebar, false, false); - paned.pack2 (main_grid, true, false); + paned.pack2 (main_box, true, false); add (paned); @@ -207,9 +191,9 @@ public class Tasks.MainWindow : Hdy.ApplicationWindow { ((SimpleAction) lookup_action (ACTION_DELETE_SELECTED_LIST)).set_enabled (Tasks.Application.model.is_remove_task_list_supported (source)); } else if (row is Tasks.Widgets.ScheduledRow) { - var scheduled_task_list_grid = (Tasks.Widgets.ScheduledTaskListGrid) task_list_grid_stack.get_child_by_name (SCHEDULED_LIST_UID); + var scheduled_task_list_grid = (Tasks.Widgets.ScheduledTaskListBox) task_list_grid_stack.get_child_by_name (SCHEDULED_LIST_UID); if (scheduled_task_list_grid == null) { - scheduled_task_list_grid = new Tasks.Widgets.ScheduledTaskListGrid (Tasks.Application.model); + scheduled_task_list_grid = new Tasks.Widgets.ScheduledTaskListBox (Tasks.Application.model); task_list_grid_stack.add_named (scheduled_task_list_grid, SCHEDULED_LIST_UID); } diff --git a/src/Widgets/EditableLabel.vala b/src/Widgets/EditableLabel.vala index c3eea22939..ba3538dc5f 100644 --- a/src/Widgets/EditableLabel.vala +++ b/src/Widgets/EditableLabel.vala @@ -1,23 +1,8 @@ /* -* Copyright (c) 2016 elementary LLC. (https://github.com/elementary/photos) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -* Authored by: Corentin Noël -*/ + * Copyright 2016-2023 elementary, Inc. (https://elementary.io) + * Copyright 2016 Corentin Noël + * SPDX-License-Identifier: LGPL-2.1-or-later + */ public class Tasks.Widgets.EditableLabel : Gtk.EventBox { public signal void changed (); @@ -27,7 +12,7 @@ public class Tasks.Widgets.EditableLabel : Gtk.EventBox { private Gtk.Label title; private Gtk.Entry entry; private Gtk.Stack stack; - private Gtk.Grid grid; + private Gtk.Box box; public string text { get; set; } @@ -44,7 +29,7 @@ public class Tasks.Widgets.EditableLabel : Gtk.EventBox { changed (); } - stack.set_visible_child (grid); + stack.set_visible_child (box); } } } @@ -81,12 +66,11 @@ public class Tasks.Widgets.EditableLabel : Gtk.EventBox { }; button_revealer.add (edit_button); - grid = new Gtk.Grid () { - valign = Gtk.Align.CENTER, - column_spacing = 12 + box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12) { + valign = Gtk.Align.CENTER }; - grid.add (title); - grid.add (button_revealer); + box.add (title); + box.add (button_revealer); entry = new Gtk.Entry () { hexpand = true @@ -97,7 +81,7 @@ public class Tasks.Widgets.EditableLabel : Gtk.EventBox { hhomogeneous = false, transition_type = Gtk.StackTransitionType.CROSSFADE }; - stack.add (grid); + stack.add (box); stack.add (entry); add (stack); diff --git a/src/Widgets/EntryPopover/DateTime.vala b/src/Widgets/EntryPopover/DateTime.vala index 6b9a9012b5..e74fb968c7 100644 --- a/src/Widgets/EntryPopover/DateTime.vala +++ b/src/Widgets/EntryPopover/DateTime.vala @@ -1,21 +1,7 @@ /* -* Copyright 2021 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -*/ + * Copyright 2021-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.EntryPopover.DateTime : Generic { private Gtk.Calendar calendar; @@ -31,18 +17,22 @@ public class Tasks.Widgets.EntryPopover.DateTime : Generic { construct { calendar = new Gtk.Calendar () { - margin = 6 + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6 }; calendar.get_style_context ().add_class (Gtk.STYLE_CLASS_BACKGROUND); timepicker = new Granite.Widgets.TimePicker () { - margin = 12, - margin_top = 0 + margin_top = 0, + margin_bottom = 12, + margin_start = 12, + margin_end = 12 }; timepicker_revealer = new Gtk.Revealer () { - reveal_child = true, - margin = 0 + reveal_child = true }; timepicker_revealer.add (timepicker); @@ -56,16 +46,16 @@ public class Tasks.Widgets.EntryPopover.DateTime : Generic { text = _("Today") }; - var grid = new Gtk.Grid () { - margin_top= 3 + var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) { + margin_top = 3 }; - grid.attach (today_button, 0, 0); - grid.attach (today_separator, 0, 1); - grid.attach (calendar, 0, 2); - grid.attach (timepicker_revealer, 0, 3); - grid.show_all (); + box.add (today_button); + box.add (today_separator); + box.add (calendar); + box.add (timepicker_revealer); + box.show_all (); - popover.add (grid); + popover.add (box); popover.show.connect (on_popover_show); diff --git a/src/Widgets/EntryPopover/Generic.vala b/src/Widgets/EntryPopover/Generic.vala index 06740be456..492f97fcf8 100644 --- a/src/Widgets/EntryPopover/Generic.vala +++ b/src/Widgets/EntryPopover/Generic.vala @@ -1,21 +1,7 @@ /* -* Copyright 2021 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -*/ + * Copyright 2021-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public abstract class Tasks.Widgets.EntryPopover.Generic : Gtk.EventBox { public signal string? value_format (T value); @@ -77,7 +63,7 @@ public abstract class Tasks.Widgets.EntryPopover.Generic : Gtk.EventBox { }; delete_button_revealer.add (delete_button); - var button_box = new Gtk.Grid (); + var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); button_box.add (popover_button); button_box.add (delete_button_revealer); button_box.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); diff --git a/src/Widgets/EntryPopover/Location.vala b/src/Widgets/EntryPopover/Location.vala index e24bed151f..bc2a2d210f 100644 --- a/src/Widgets/EntryPopover/Location.vala +++ b/src/Widgets/EntryPopover/Location.vala @@ -61,17 +61,19 @@ public class Tasks.Widgets.EntryPopover.Location : Generic { hexpand = true }; - var grid = new Gtk.Grid () { - margin = 12, - row_spacing = 12 + var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 12) { + margin_top = 12, + margin_bottom = 12, + margin_start = 12, + margin_end = 12 }; - grid.attach (search_entry, 0, 0); - grid.attach (location_mode, 0, 1); - grid.attach (map_frame, 0, 2); - grid.show_all (); + box.add (search_entry); + box.add (location_mode); + box.add (map_frame); + box.show_all (); - popover.add (grid); + popover.add (box); popover.show.connect (on_popover_show); notify["value"].connect (on_value_changed); diff --git a/src/Widgets/ListSettingsPopover.vala b/src/Widgets/ListSettingsPopover.vala index 04ce2e39a4..dc7fd4ee5f 100644 --- a/src/Widgets/ListSettingsPopover.vala +++ b/src/Widgets/ListSettingsPopover.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.ListSettingsPopover : Gtk.Popover { public E.Source source { get; set; } @@ -96,20 +81,22 @@ public class Tasks.Widgets.ListSettingsPopover : Gtk.Popover { color_button_none = new Gtk.RadioButton.from_widget (color_button_blue); - var color_grid = new Gtk.Grid () { - column_spacing = 6, - margin = 12 + var color_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { + margin_top = 12, + margin_bottom = 12, + margin_start = 12, + margin_end = 12 }; - color_grid.add (color_button_blue); - color_grid.add (color_button_mint); - color_grid.add (color_button_green); - color_grid.add (color_button_yellow); - color_grid.add (color_button_orange); - color_grid.add (color_button_red); - color_grid.add (color_button_pink); - color_grid.add (color_button_purple); - color_grid.add (color_button_brown); - color_grid.add (color_button_slate); + color_box.add (color_button_blue); + color_box.add (color_button_mint); + color_box.add (color_button_green); + color_box.add (color_button_yellow); + color_box.add (color_button_orange); + color_box.add (color_button_red); + color_box.add (color_button_pink); + color_box.add (color_button_purple); + color_box.add (color_button_brown); + color_box.add (color_button_slate); var show_completed_button = new Granite.SwitchModelButton (_("Show Completed")) { margin_top = 3 @@ -126,17 +113,17 @@ public class Tasks.Widgets.ListSettingsPopover : Gtk.Popover { delete_list_menuitem.add (delete_list_accel_label); delete_list_menuitem.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); - var grid = new Gtk.Grid () { - orientation = Gtk.Orientation.VERTICAL, - margin_top = margin_bottom = 3 + var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) { + margin_top = 3, + margin_bottom = 3 }; - grid.add (color_grid); - grid.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); - grid.add (show_completed_button); - grid.add (delete_list_menuitem); - grid.show_all (); + box.add (color_box); + box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); + box.add (show_completed_button); + box.add (delete_list_menuitem); + box.show_all (); - add (grid); + add (box); color_button_red.toggled.connect (() => { if (color_button_red.active) { diff --git a/src/Widgets/ScheduledRow.vala b/src/Widgets/ScheduledRow.vala index 3c79403f48..c4059c707a 100644 --- a/src/Widgets/ScheduledRow.vala +++ b/src/Widgets/ScheduledRow.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.ScheduledRow : Gtk.ListBoxRow { @@ -30,14 +15,13 @@ public class Tasks.Widgets.ScheduledRow : Gtk.ListBoxRow { margin_end = 9 }; - var grid = new Gtk.Grid () { - column_spacing = 6, + var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { margin_start = 12, margin_end = 6 }; - grid.add (icon); - grid.add (display_name_label); + box.add (icon); + box.add (display_name_label); - add (grid); + add (box); } } diff --git a/src/Widgets/ScheduledTaskListGrid.vala b/src/Widgets/ScheduledTaskListBox.vala similarity index 91% rename from src/Widgets/ScheduledTaskListGrid.vala rename to src/Widgets/ScheduledTaskListBox.vala index 053f1094f6..d24ac8464f 100644 --- a/src/Widgets/ScheduledTaskListGrid.vala +++ b/src/Widgets/ScheduledTaskListBox.vala @@ -1,24 +1,9 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ - -public class Tasks.Widgets.ScheduledTaskListGrid : Gtk.Grid { + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +public class Tasks.Widgets.ScheduledTaskListBox : Gtk.Box { private Gee.Map views; private const string QUERY = "AND (NOT is-completed?) (has-start?)"; @@ -66,7 +51,7 @@ public class Tasks.Widgets.ScheduledTaskListGrid : Gtk.Grid { private Gtk.Label scheduled_title; private Gtk.ListBox task_list; - public ScheduledTaskListGrid (Tasks.TaskModel model) { + public ScheduledTaskListBox (Tasks.TaskModel model) { Object (model: model); } @@ -101,19 +86,19 @@ public class Tasks.Widgets.ScheduledTaskListGrid : Gtk.Grid { task_list.get_style_context ().add_class (Gtk.STYLE_CLASS_BACKGROUND); var scrolled_window = new Gtk.ScrolledWindow (null, null) { - expand = true, + hexpand = true, + vexpand = true, hscrollbar_policy = Gtk.PolicyType.NEVER }; scrolled_window.add (task_list); - column_spacing = 12; - attach (scheduled_title, 0, 0); - attach (scrolled_window, 0, 1); + orientation = Gtk.Orientation.VERTICAL; + add (scheduled_title); + add (scrolled_window); + show_all (); task_list.row_activated.connect (on_row_activated); - show_all (); - model.task_list_added.connect (add_task_list); model.task_list_modified.connect (modify_task_list); model.task_list_removed.connect (remove_task_list); diff --git a/src/Widgets/SourceRow.vala b/src/Widgets/SourceRow.vala index 889377db94..d889d38237 100644 --- a/src/Widgets/SourceRow.vala +++ b/src/Widgets/SourceRow.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.SourceRow : Gtk.ListBoxRow { public E.Source source { get; construct; } @@ -67,19 +52,18 @@ public class Tasks.Widgets.SourceRow : Gtk.ListBoxRow { status_stack.add_named (status_image, "image"); status_stack.add_named (spinner, "spinner"); - var grid = new Gtk.Grid () { - column_spacing = 6, + var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { margin_start = 12, margin_end = 6 }; - grid.add (source_color); - grid.add (display_name_label); - grid.add (status_stack); + box.add (source_color); + box.add (display_name_label); + box.add (status_stack); revealer = new Gtk.Revealer () { reveal_child = true }; - revealer.add (grid); + revealer.add (box); add (revealer); get_style_context ().add_provider (listrow_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); diff --git a/src/Widgets/TaskListGrid.vala b/src/Widgets/TaskListGrid.vala index 944a9d6d7d..11ee20d5b3 100644 --- a/src/Widgets/TaskListGrid.vala +++ b/src/Widgets/TaskListGrid.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { public E.Source source { get; construct; } @@ -109,7 +94,8 @@ public class Tasks.Widgets.TaskListGrid : Gtk.Grid { task_list.get_style_context ().add_class (Gtk.STYLE_CLASS_BACKGROUND); var scrolled_window = new Gtk.ScrolledWindow (null, null) { - expand = true, + hexpand = true, + vexpand = true, hscrollbar_policy = Gtk.PolicyType.NEVER }; scrolled_window.add (task_list); diff --git a/src/Widgets/TaskRow.vala b/src/Widgets/TaskRow.vala index 5970a13d3b..0313e5eb4c 100644 --- a/src/Widgets/TaskRow.vala +++ b/src/Widgets/TaskRow.vala @@ -1,22 +1,7 @@ /* -* Copyright 2019 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 3 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -* -*/ + * Copyright 2019-2023 elementary, Inc. (https://elementary.io) + * SPDX-License-Identifier: GPL-3.0-or-later + */ public class Tasks.Widgets.TaskRow : Gtk.ListBoxRow { @@ -212,15 +197,15 @@ public class Tasks.Widgets.TaskRow : Gtk.ListBoxRow { }; description_label_revealer.add (description_label); - var task_grid = new Gtk.Grid (); - task_grid.add (due_datetime_popover_revealer); - task_grid.add (location_popover_revealer); - task_grid.add (description_label_revealer); + var task_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + task_box.add (due_datetime_popover_revealer); + task_box.add (location_popover_revealer); + task_box.add (description_label_revealer); task_detail_revealer = new Gtk.Revealer () { transition_type = Gtk.RevealerTransitionType.SLIDE_UP }; - task_detail_revealer.add (task_grid); + task_detail_revealer.add (task_box); var description_textview = new Granite.HyperTextView () { border_width = 12, @@ -251,22 +236,23 @@ public class Tasks.Widgets.TaskRow : Gtk.ListBoxRow { button_box.add (cancel_button); button_box.add (save_button); - var form_grid = new Gtk.Grid () { - column_spacing = 12, - row_spacing = 12, - margin_top = margin_bottom = 6 + var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 12) { + margin_top = 6, + margin_bottom = 6 }; - form_grid.attach (description_frame, 0, 0); - form_grid.attach (button_box, 0, 1); + form_box.add (description_frame); + form_box.add (button_box); task_form_revealer = new Gtk.Revealer () { transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN }; - task_form_revealer.add (form_grid); + task_form_revealer.add (form_box); var grid = new Gtk.Grid () { - margin = 6, - margin_start = margin_end = 12, + margin_top = 6, + margin_bottom = 6, + margin_start = 12, + margin_end = 12, column_spacing = 6, row_spacing = 3 }; @@ -282,7 +268,8 @@ public class Tasks.Widgets.TaskRow : Gtk.ListBoxRow { revealer.add (grid); event_box = new Gtk.EventBox () { - expand = true, + hexpand = true, + vexpand = true, above_child = false }; event_box.add_events (