Skip to content

Commit 0c6f0b7

Browse files
committed
Add tomorrow view
1 parent 84fc5bf commit 0c6f0b7

23 files changed

+239
-160
lines changed

core/Constants.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Constants {
55
public const string BACKUP_VERSION = "1.0";
66
public const int UPDATE_TIMEOUT = 1500;
77
public const int DESTROY_TIMEOUT = 750;
8-
public const int DRAG_TIMEOUT = 225;
8+
public const int DRAG_TIMEOUT = 250;
99
public const int SYNC_TIMEOUT = 2500;
1010
public const int SHORT_NAME_SIZE = 20;
1111
public const int PRIORITY_1 = 4;

core/Enum.vala

+7-7
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ public enum ProjectIconStyle {
6767
}
6868

6969
public enum FilterType {
70-
TODAY = 0,
71-
INBOX = 1,
70+
INBOX = 0,
71+
TODAY = 1,
7272
SCHEDULED = 2,
7373
PINBOARD = 3,
74-
LABEL = 4,
75-
LABELS = 5;
74+
LABELS = 4,
75+
COMPLETED = 5;
7676

7777
public string to_string () {
7878
switch (this) {
@@ -88,12 +88,12 @@ public enum FilterType {
8888
case PINBOARD:
8989
return "pinboard";
9090

91-
case LABEL:
92-
return "label";
93-
9491
case LABELS:
9592
return "labels";
9693

94+
case COMPLETED:
95+
return "completed";
96+
9797
default:
9898
assert_not_reached ();
9999
}

core/Objects/BaseObject.vala

+2-15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class Objects.BaseObject : GLib.Object {
2323
public string id { get; set; default = ""; }
2424
public string name { get; set; default = ""; }
2525
public string keywords { get; set; default = ""; }
26+
public string icon_name { get; set; default = ""; }
2627
public signal void deleted ();
2728
public signal void updated ();
2829

@@ -117,21 +118,7 @@ public class Objects.BaseObject : GLib.Object {
117118
}
118119
}
119120
}
120-
121-
public string icon_name {
122-
get {
123-
if (this is Objects.Today) {
124-
return "star-outline-thick-symbolic";
125-
} else if (this is Objects.Scheduled) {
126-
return "month-symbolic";
127-
} else if (this is Objects.Pinboard) {
128-
return "pin-symbolic";
129-
} else {
130-
return "";
131-
}
132-
}
133-
}
134-
121+
135122
public string table_name {
136123
get {
137124
if (this is Objects.Item) {

core/Objects/Filters/Completed.vala

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Authored by: Alain M. <alainmh23@gmail.com>
2020
*/
2121

22-
public class Objects.Completed : Objects.BaseObject {
22+
public class Objects.Filters.Completed : Objects.BaseObject {
2323
private static Completed? _instance;
2424
public static Completed get_default () {
2525
if (_instance == null) {
@@ -32,7 +32,7 @@ public class Objects.Completed : Objects.BaseObject {
3232
string _view_id;
3333
public string view_id {
3434
get {
35-
_view_id = "completed-view";
35+
_view_id = FilterType.COMPLETED.to_string ();
3636
return _view_id;
3737
}
3838
}
@@ -57,6 +57,7 @@ public class Objects.Completed : Objects.BaseObject {
5757
construct {
5858
name = _("Completed");
5959
keywords = "%s;%s".printf (_("completed"), _("logbook"));
60+
icon_name = "check-round-outline-symbolic";
6061

6162
Services.Database.get_default ().item_added.connect (() => {
6263
_count = Services.Database.get_default ().get_items_completed ().size;

core/Objects/Filters/Labels.vala

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class Objects.Filters.Labels : Objects.BaseObject {
3232
string _view_id;
3333
public string view_id {
3434
get {
35-
_view_id = "labels-view";
35+
_view_id = FilterType.LABELS.to_string ();
3636
return _view_id;
3737
}
3838
}
@@ -57,6 +57,7 @@ public class Objects.Filters.Labels : Objects.BaseObject {
5757
construct {
5858
name = _("Labels");
5959
keywords = "%s".printf (_("labels"));
60+
icon_name = "tag-outline-symbolic";
6061

6162
Services.Database.get_default ().label_added.connect (() => {
6263
_count = Services.Database.get_default ().get_labels_collection ().size;

core/Objects/Filters/Pinboard.vala

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Authored by: Alain M. <alainmh23@gmail.com>
2020
*/
2121

22-
public class Objects.Pinboard : Objects.BaseObject {
22+
public class Objects.Filters.Pinboard : Objects.BaseObject {
2323
private static Pinboard? _instance;
2424
public static Pinboard get_default () {
2525
if (_instance == null) {
@@ -49,6 +49,7 @@ public class Objects.Pinboard : Objects.BaseObject {
4949
construct {
5050
name = ("Pinboard");
5151
keywords = _("pinboard");
52+
icon_name = "pin-symbolic";
5253

5354
Services.Database.get_default ().item_added.connect (() => {
5455
_pinboard_count = Services.Database.get_default ().get_items_pinned (false).size;

core/Objects/Filters/Priority.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Authored by: Alain M. <alainmh23@gmail.com>
2020
*/
2121

22-
public class Objects.Priority : Objects.BaseObject {
22+
public class Objects.Filters.Priority : Objects.BaseObject {
2323
public int priority { get; construct; }
2424

2525
private static Priority? _instance;

core/Objects/Filters/Scheduled.vala

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Authored by: Alain M. <alainmh23@gmail.com>
2020
*/
2121

22-
public class Objects.Scheduled : Objects.BaseObject {
22+
public class Objects.Filters.Scheduled : Objects.BaseObject {
2323
private static Scheduled? _instance;
2424
public static Scheduled get_default () {
2525
if (_instance == null) {
@@ -49,7 +49,8 @@ public class Objects.Scheduled : Objects.BaseObject {
4949
construct {
5050
name = _("Scheduled");
5151
keywords = "%s;%s".printf (_("scheduled"), _("upcoming"));
52-
52+
icon_name = "month-symbolic";
53+
5354
Services.Database.get_default ().item_added.connect (() => {
5455
_scheduled_count = Services.Database.get_default ().get_items_by_scheduled (false).size;
5556
scheduled_count_updated ();

core/Objects/Filters/Today.vala

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Authored by: Alain M. <alainmh23@gmail.com>
2020
*/
2121

22-
public class Objects.Today : Objects.BaseObject {
22+
public class Objects.Filters.Today : Objects.BaseObject {
2323
private static Today? _instance;
2424
public static Today get_default () {
2525
if (_instance == null) {
@@ -65,7 +65,8 @@ public class Objects.Today : Objects.BaseObject {
6565
construct {
6666
name = _("Today");
6767
keywords = _("today");
68-
68+
icon_name = "star-outline-thick-symbolic";
69+
6970
Services.Database.get_default ().item_added.connect (() => {
7071
_today_count = Services.Database.get_default ().get_items_by_date (
7172
new GLib.DateTime.now_local (), false).size;

core/Objects/Filters/Tomorrow.vala

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
3+
*
4+
* This program is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 3 of the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public
15+
* License along with this program; if not, write to the
16+
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17+
* Boston, MA 02110-1301 USA
18+
*
19+
* Authored by: Alain M. <alainmh23@gmail.com>
20+
*/
21+
22+
public class Objects.Filters.Tomorrow : Objects.BaseObject {
23+
private static Tomorrow? _instance;
24+
public static Tomorrow get_default () {
25+
if (_instance == null) {
26+
_instance = new Tomorrow ();
27+
}
28+
29+
return _instance;
30+
}
31+
32+
string _view_id;
33+
public string view_id {
34+
get {
35+
_view_id = "tomorrow-view";
36+
return _view_id;
37+
}
38+
}
39+
40+
construct {
41+
name = _("Tomorrow");
42+
keywords = "%s;%s".printf (_("tomorrow"), _("date"));
43+
icon_name = "today-calendar-symbolic";
44+
}
45+
}

core/QuickAdd.vala

+4-14
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ public class Layouts.QuickAdd : Adw.Bin {
9191
label_button.backend_type = item.project.backend_type;
9292

9393
var action_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12) {
94-
margin_top = 6
94+
margin_start = 3,
95+
margin_end = 3,
96+
margin_bottom = 3
9597
};
9698

9799
var action_box_right = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
98100
hexpand = true,
99-
halign = Gtk.Align.END,
100-
margin_end = 3
101+
halign = Gtk.Align.END
101102
};
102103

103104
action_box_right.append (label_button);
@@ -119,17 +120,6 @@ public class Layouts.QuickAdd : Adw.Bin {
119120
quick_add_content.append (description_textview);
120121
quick_add_content.append (item_labels);
121122
quick_add_content.append (action_box);
122-
123-
// Alert Box
124-
var error_icon = new Gtk.Image.from_icon_name ("dialog-warning-symbolic");
125-
var error_label = new Gtk.Label ("Error de casa");
126-
127-
var error_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
128-
vexpand = true
129-
};
130-
131-
error_box.append (error_icon);
132-
error_box.append (error_label);
133123

134124
submit_button = new Widgets.LoadingButton (LoadingButtonType.LABEL, _("Add To-Do")) {
135125
valign = CENTER,

core/Util/Util.vala

+4-4
Original file line numberDiff line numberDiff line change
@@ -923,17 +923,17 @@ public class Util : GLib.Object {
923923
}
924924
}
925925

926-
private Gee.HashMap<string, Objects.Priority> priority_views;
927-
public Objects.Priority get_priority_filter (string view_id) {
926+
private Gee.HashMap<string, Objects.Filters.Priority> priority_views;
927+
public Objects.Filters.Priority get_priority_filter (string view_id) {
928928
if (priority_views == null) {
929-
priority_views = new Gee.HashMap<string, Objects.Priority> ();
929+
priority_views = new Gee.HashMap<string, Objects.Filters.Priority> ();
930930
}
931931

932932
if (priority_views.has_key (view_id)) {
933933
return priority_views[view_id];
934934
} else {
935935
int priority = int.parse (view_id.split ("-")[1]);
936-
priority_views[view_id] = new Objects.Priority (priority);
936+
priority_views[view_id] = new Objects.Filters.Priority (priority);
937937
return priority_views[view_id];
938938
}
939939
}

core/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ core_files = files(
7070
'Objects/Filters/Priority.vala',
7171
'Objects/Filters/Completed.vala',
7272
'Objects/Filters/Labels.vala',
73+
'Objects/Filters/Tomorrow.vala'
7374
)
7475

7576
core_deps = [

data/io.github.alainm23.planify.gschema.xml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<value nick="Scheduled" value="2" />
1414
<value nick="Labels" value="3" />
1515
<value nick="Pinboard" value="4" />
16+
<value nick="Completed" value="5" />
1617
</enum>
1718

1819
<enum id="io.github.alainm23.planify.appearance">

data/resources/stylesheet/stylesheet.css

+7-12
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,13 @@ entry.flat:focus-within {
302302
}
303303

304304
.priority-color check:checked {
305-
background-image: linear-gradient(to bottom, shade(#1e63ec, 1.2), #1e63ec);
306-
border-color: shade(#1e63ec, 0.9);
307-
box-shadow: inset 0 0 0 1px shade(#1e63ec, 1.15),
308-
inset 0 1px 0 0 shade(#1e63ec, 1.3), 0 1px 1px 0 shade(@bg_color, 0.85);
305+
background-image: linear-gradient(to bottom, shade(#ff7800, 1.2), #ff7800);
306+
border-color: shade(#ff7800, 0.9);
307+
box-shadow: inset 0 0 0 1px shade(#ff7800, 1.15),
308+
inset 0 1px 0 0 shade(#ff7800, 1.3), 0 1px 1px 0 shade(@bg_color, 0.85);
309309
color: #fff;
310310
-gtk-icon-source: -gtk-icontheme("checkmark-small-symbolic");
311-
-gtk-icon-shadow: 0 1px 1px shade(#1e63ec, 0.85);
311+
-gtk-icon-shadow: 0 1px 1px shade(#ff7800, 0.85);
312312
}
313313

314314
.today-grid {
@@ -336,9 +336,9 @@ entry.flat:focus-within {
336336
}
337337

338338
.completed-grid {
339-
background-color: alpha(#1e63ec, 0.15);
339+
background-color: alpha(#ff7800, 0.15);
340340
border-radius: 6px;
341-
color: #1e63ec;
341+
color: #ff7800;
342342
padding: 3px 6px;
343343
font-weight: bold;
344344
}
@@ -365,11 +365,6 @@ entry.flat:focus-within {
365365
border-radius: 6px;
366366
}
367367

368-
.quickfind-item:selected {
369-
background: @shade_color;
370-
color: @text_color;
371-
}
372-
373368
.item-label-child {
374369
background-color: alpha(@colorAccent, 0.125);
375370
border-radius: 6px;

src/Dialogs/Preferences/Pages/Sidebar.vala

+10-3
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ public class Dialogs.Preferences.Pages.Sidebar : Adw.Bin {
3838
var scheduled_row = new Widgets.SidebarRow (FilterType.SCHEDULED, _("Scheduled"), "month-symbolic");
3939
var pinboard_row = new Widgets.SidebarRow (FilterType.PINBOARD, _("Pinboard"), "pin-symbolic");
4040
var labels_row = new Widgets.SidebarRow (FilterType.LABELS, _("Labels"), "tag-outline-symbolic");
41+
var completed_row = new Widgets.SidebarRow (FilterType.COMPLETED, _("Completed"), "check-round-outline-symbolic");
4142

4243
views_group.add_child (inbox_row);
4344
views_group.add_child (today_row);
4445
views_group.add_child (scheduled_row);
4546
views_group.add_child (pinboard_row);
4647
views_group.add_child (labels_row);
48+
views_group.add_child (completed_row);
4749

4850
var show_count_row = new Adw.SwitchRow ();
4951
show_count_row.title = _("Show Task Count");
@@ -97,9 +99,14 @@ public class Dialogs.Preferences.Pages.Sidebar : Adw.Bin {
9799
Services.Settings.get_default ().settings.bind ("show-tasks-count", show_count_row, "active", GLib.SettingsBindFlags.DEFAULT);
98100

99101
views_group.set_sort_func ((child1, child2) => {
100-
int item1 = ((Widgets.SidebarRow) child1).item_order ();
101-
int item2 = ((Widgets.SidebarRow) child2).item_order ();
102-
return item1 - item2;
102+
Widgets.SidebarRow item1 = ((Widgets.SidebarRow) child1);
103+
Widgets.SidebarRow item2 = ((Widgets.SidebarRow) child2);
104+
105+
if (item1.visible) {
106+
return -1;
107+
}
108+
109+
return item1.item_order () - item2.item_order ();
103110
});
104111
views_group.set_sort_func (null);
105112

0 commit comments

Comments
 (0)