Skip to content

Commit 2ef6656

Browse files
committed
Add Nw Side View
1 parent 70513ba commit 2ef6656

32 files changed

+2021
-882
lines changed

core/Objects/Item.vala

+12-9
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ public class Objects.Item : Objects.BaseObject {
4747

4848
public bool activate_name_editable { get; set; default = false; }
4949

50+
string _short_content;
51+
public string short_content {
52+
get {
53+
_short_content = Util.get_default ().get_short_name (content);
54+
return _short_content;
55+
}
56+
}
57+
5058
public string priority_icon {
5159
get {
5260
if (priority == Constants.PRIORITY_1) {
@@ -737,7 +745,7 @@ public class Objects.Item : Objects.BaseObject {
737745
return_value = get_reminder (reminder);
738746
if (return_value == null) {
739747
Services.Database.get_default ().insert_reminder (reminder);
740-
add_reminder (return_value);
748+
add_reminder (reminder);
741749
}
742750
return return_value;
743751
}
@@ -758,11 +766,6 @@ public class Objects.Item : Objects.BaseObject {
758766

759767
private void add_reminder (Objects.Reminder reminder) {
760768
_reminders.add (reminder);
761-
reminder_added (reminder);
762-
}
763-
764-
public void delete_reminder (Objects.Reminder reminder) {
765-
Services.Database.get_default ().delete_reminder (reminder);
766769
}
767770

768771
// Labels
@@ -1393,7 +1396,7 @@ public class Objects.Item : Objects.BaseObject {
13931396
show_item = false;
13941397

13951398
if (project.backend_type == BackendType.LOCAL) {
1396-
_move (project.id, section_id);
1399+
_move (project.id, _section_id);
13971400
} else if (project.backend_type == BackendType.TODOIST) {
13981401
loading = true;
13991402

@@ -1409,7 +1412,7 @@ public class Objects.Item : Objects.BaseObject {
14091412
loading = false;
14101413

14111414
if (response.status) {
1412-
_move (project.id, section_id);
1415+
_move (project.id, _section_id);
14131416
} else {
14141417
show_item = true;
14151418
}
@@ -1422,7 +1425,7 @@ public class Objects.Item : Objects.BaseObject {
14221425
loading = false;
14231426

14241427
if (response.status) {
1425-
_move (project.id, section_id);
1428+
_move (project.id, _section_id);
14261429
} else {
14271430
show_item = true;
14281431
}

core/QuickAdd.vala

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class Layouts.QuickAdd : Adw.Bin {
8484
};
8585

8686
schedule_button = new Widgets.ScheduleButton ();
87-
pin_button = new Widgets.PinButton (item);
87+
pin_button = new Widgets.PinButton ();
8888
priority_button = new Widgets.PriorityButton ();
8989
priority_button.update_from_item (item);
9090
label_button = new Widgets.LabelPicker.LabelButton ();
@@ -388,7 +388,7 @@ public class Layouts.QuickAdd : Adw.Bin {
388388

389389
public void set_pinned (bool pinned) {
390390
item.pinned = pinned;
391-
pin_button.update_request ();
391+
pin_button.update_request (pinned);
392392
}
393393

394394
public void set_priority (int priority) {

core/Widgets/DateTimePicker/ScheduleButton.vala

+126-45
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
*/
2121

2222
public class Widgets.ScheduleButton : Gtk.Grid {
23+
public bool is_board { get; construct; }
24+
2325
private Gtk.Label due_label;
2426

2527
private Gtk.Box schedule_box;
@@ -54,13 +56,29 @@ public class Widgets.ScheduleButton : Gtk.Grid {
5456

5557
public ScheduleButton () {
5658
Object (
59+
is_board: false,
5760
valign: Gtk.Align.CENTER,
5861
halign: Gtk.Align.CENTER,
5962
tooltip_text: _("Schedule")
6063
);
6164
}
6265

66+
public ScheduleButton.for_board () {
67+
Object (
68+
is_board: true,
69+
tooltip_text: _("Schedule")
70+
);
71+
}
72+
6373
construct {
74+
if (is_board) {
75+
build_card_ui ();
76+
} else {
77+
build_ui ();
78+
}
79+
}
80+
81+
private void build_ui () {
6482
datetime_picker = new Widgets.DateTimePicker.DateTimePicker ();
6583

6684
due_image = new Gtk.Image ();
@@ -91,7 +109,7 @@ public class Widgets.ScheduleButton : Gtk.Grid {
91109
};
92110

93111
attach (button, 0, 0);
94-
attach (clear_revealer, 1, 0);
112+
attach (clear_revealer, 1, 0);
95113

96114
datetime_picker.date_changed.connect (() => {
97115
datetime = datetime_picker.datetime;
@@ -118,55 +136,118 @@ public class Widgets.ScheduleButton : Gtk.Grid {
118136
});
119137
}
120138

139+
private void build_card_ui () {
140+
due_image = new Gtk.Image.from_icon_name ("month-symbolic");
141+
142+
var title_label = new Gtk.Label (_("Schedule")) {
143+
halign = START,
144+
css_classes = { "title-4", "small-label" }
145+
};
146+
147+
due_label = new Gtk.Label (_("Set a Due Date")) {
148+
xalign = 0,
149+
use_markup = true,
150+
halign = START,
151+
ellipsize = Pango.EllipsizeMode.END,
152+
css_classes = { "small-label" }
153+
};
154+
155+
var card_grid = new Gtk.Grid () {
156+
column_spacing = 12,
157+
margin_start = 12,
158+
margin_end = 6,
159+
margin_top = 6,
160+
margin_bottom = 6,
161+
vexpand = true,
162+
hexpand = true
163+
};
164+
card_grid.attach (due_image, 0, 0, 1, 2);
165+
card_grid.attach (title_label, 1, 0, 1, 1);
166+
card_grid.attach (due_label, 1, 1, 1, 1);
167+
168+
datetime_picker = new Widgets.DateTimePicker.DateTimePicker () {
169+
position = Gtk.PositionType.BOTTOM,
170+
has_arrow = true
171+
};
172+
datetime_picker.set_parent (card_grid);
173+
174+
css_classes = { "card" };
175+
attach (card_grid, 0, 0);
176+
hexpand = true;
177+
vexpand = true;
178+
179+
var click_gesture = new Gtk.GestureClick ();
180+
card_grid.add_controller (click_gesture);
181+
click_gesture.pressed.connect ((n_press, x, y) => {
182+
datetime_picker.show ();
183+
});
184+
185+
datetime_picker.date_changed.connect (() => {
186+
datetime = datetime_picker.datetime;
187+
date_changed (datetime);
188+
});
189+
}
190+
121191
public void update_from_item (Objects.Item item) {
122-
due_label.label = _("Schedule");
123-
tooltip_text = _("Schedule");
124-
due_image.icon_name = "month-symbolic";
125-
126-
if (item.has_due) {
127-
due_label.label = Util.get_default ().get_relative_date_from_date (item.due.datetime);
128-
129-
datetime = new GLib.DateTime.local (
130-
item.due.datetime.get_year (),
131-
item.due.datetime.get_month (),
132-
item.due.datetime.get_day_of_month (),
133-
item.due.datetime.get_hour (),
134-
item.due.datetime.get_minute (),
135-
item.due.datetime.get_second ()
136-
);
137-
138-
if (Util.get_default ().is_today (item.due.datetime)) {
139-
due_image.icon_name = "star-outline-thick-symbolic";
140-
} else if (Util.get_default ().is_overdue (item.due.datetime)) {
192+
if (is_board) {
193+
due_label.label = _("Set a Due Date");
194+
tooltip_text = _("Schedule");
195+
due_image.icon_name = "month-symbolic";
196+
} else {
197+
due_label.label = _("Schedule");
198+
tooltip_text = _("Schedule");
199+
due_image.icon_name = "month-symbolic";
200+
}
141201

142-
} else {
143-
due_image.icon_name = "month-symbolic";
144-
}
202+
if (!item.has_due) {
203+
return;
204+
}
205+
206+
due_label.label = Util.get_default ().get_relative_date_from_date (item.due.datetime);
207+
due_label.tooltip_text = due_label.label;
208+
209+
datetime = new GLib.DateTime.local (
210+
item.due.datetime.get_year (),
211+
item.due.datetime.get_month (),
212+
item.due.datetime.get_day_of_month (),
213+
item.due.datetime.get_hour (),
214+
item.due.datetime.get_minute (),
215+
item.due.datetime.get_second ()
216+
);
217+
218+
if (Util.get_default ().is_today (item.due.datetime)) {
219+
due_image.icon_name = "star-outline-thick-symbolic";
220+
} else if (Util.get_default ().is_tomorrow (item.due.datetime)) {
221+
due_image.icon_name = "today-calendar-symbolic";
222+
} else if (Util.get_default ().is_overdue (item.due.datetime)) {
223+
due_image.icon_name = "month-symbolic";
224+
} else {
225+
due_image.icon_name = "month-symbolic";
226+
}
145227

146-
if (item.due.is_recurring) {
147-
var end_label = "";
148-
if (item.due.end_type == RecurrencyEndType.ON_DATE) {
149-
var date_label = Util.get_default ().get_default_date_format_from_date (
150-
Util.get_default ().get_format_date (
151-
Utils.Datetime.get_date_from_string (item.due.recurrency_end)
152-
)
153-
);
154-
end_label = _("until") + " " + date_label;
155-
} else if (item.due.end_type == RecurrencyEndType.AFTER) {
156-
int count = item.due.recurrency_count;
157-
end_label = _("for") + " " + "%d %s".printf (count, count > 1 ? _("times") : _("time"));
158-
}
159-
160-
due_image.icon_name = "arrow-circular-top-right-symbolic";
161-
due_label.label += " <small>%s</small>".printf (
162-
Util.get_default ().get_recurrency_weeks (
163-
item.due.recurrency_type,
164-
item.due.recurrency_interval,
165-
item.due.recurrency_weeks,
166-
end_label
228+
if (item.due.is_recurring) {
229+
var end_label = "";
230+
if (item.due.end_type == RecurrencyEndType.ON_DATE) {
231+
var date_label = Util.get_default ().get_default_date_format_from_date (
232+
Util.get_default ().get_format_date (
233+
Utils.Datetime.get_date_from_string (item.due.recurrency_end)
167234
)
168-
);
235+
);
236+
end_label = _("until") + " " + date_label;
237+
} else if (item.due.end_type == RecurrencyEndType.AFTER) {
238+
int count = item.due.recurrency_count;
239+
end_label = _("for") + " " + "%d %s".printf (count, count > 1 ? _("times") : _("time"));
169240
}
241+
242+
due_image.icon_name = "arrow-circular-top-right-symbolic";
243+
due_label.label += " <small>%s</small>".printf (
244+
Util.get_default ().get_recurrency_weeks (
245+
item.due.recurrency_type,
246+
item.due.recurrency_interval,
247+
item.due.recurrency_weeks,
248+
end_label
249+
)
250+
);
170251
}
171252
}
172253

core/Widgets/DateTimePicker/TimePicker.vala

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public class Widgets.DateTimePicker.TimePicker : Adw.Bin {
136136
time_stack.visible_child_name = "time-box";
137137
update_text ();
138138
time_added ();
139+
time_entry.grab_focus ();
139140
});
140141

141142
// Connecting to events allowing manual changes

0 commit comments

Comments
 (0)