Skip to content

Commit f86c202

Browse files
author
Alain M
committed
Release 2.3.5
1 parent dba6c85 commit f86c202

File tree

13 files changed

+91
-61
lines changed

13 files changed

+91
-61
lines changed

data/com.github.alainm23.planner.appdata.xml.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
<binary>com.github.alainm23.planner</binary>
4747
</provides>
4848
​<releases>
49-
<release version="2.3.4" date="2020-04-14">
49+
<release version="2.3.5" date="2020-04-30">
5050
<description>
5151
<p>Bug fixes and performance improvements</p>
5252
<ul>
5353
<li>Sort your folders by dragging and dropping.</li>
5454
<li>[GitHub #337] - The error that does not allow creating tasks in the Inbox has been fixed.</li>
5555
<li>[GitHub #334] - Overdue tasks are now counted in badge count.</li>
5656
<li>[GitHub #333] - Today's tasks are displayed correctly.</li>
57-
<li>[GitHub #331 #330] - The progress indicator in the project view now has a tolltip.</li>
57+
<li>[GitHub #331 #330] - The progress indicator in the project view now has a tooltip.</li>
5858
<li></li>
5959
</ul>
6060
</description>

data/com.github.alainm23.planner.gschema.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,7 @@
144144
<summary>homepage-item</summary>
145145
<description>homepage-item</description>
146146
</key>
147-
148-
<key name="inbox-project-sync" type="b">
149-
<default>false</default>
150-
<summary>Inbox Project Sync</summary>
151-
<description>Inbox Project Sync</description>
152-
</key>
153-
147+
154148
<key name="inbox-show-completed" type="b">
155149
<default>false</default>
156150
<summary>Inbox Show Completed</summary>

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('com.github.alainm23.planner',
22
'vala', 'c',
3-
version: '2.3.4')
3+
version: '2.3.5')
44

55
gnome = import('gnome')
66
i18n = import('i18n')

src/Dialogs/Preferences/Preferences.vala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,6 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
10331033
var inbox_project = Planner.database.create_inbox_project ();
10341034

10351035
// Set settings
1036-
Planner.settings.set_boolean ("inbox-project-sync", false);
10371036
Planner.settings.set_int64 ("inbox-project", inbox_project.id);
10381037

10391038
destroy ();

src/MainWindow.vala

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ public class MainWindow : Gtk.Window {
179179
Planner.utils.create_default_labels ();
180180

181181
// Set settings
182-
Planner.settings.set_boolean ("inbox-project-sync", false);
183182
Planner.settings.set_int64 ("inbox-project", inbox_project.id);
184183

185184
stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
@@ -237,15 +236,10 @@ public class MainWindow : Gtk.Window {
237236

238237
magic_button.clicked.connect (() => {
239238
if (stack.visible_child_name == "inbox-view") {
240-
int is_todoist = 0;
241-
if (Planner.settings.get_boolean ("inbox-project-sync")) {
242-
is_todoist = 1;
243-
}
244-
245239
Planner.utils.magic_button_activated (
246240
Planner.settings.get_int64 ("inbox-project"),
247241
0,
248-
is_todoist,
242+
Planner.database.get_project_by_id (Planner.settings.get_int64 ("inbox-project")).is_todoist,
249243
true
250244
);
251245
} else if (stack.visible_child_name == "today-view") {
@@ -602,15 +596,10 @@ public class MainWindow : Gtk.Window {
602596

603597
public void add_task_action (bool last) {
604598
if (stack.visible_child_name == "inbox-view") {
605-
int is_todoist = 0;
606-
if (Planner.settings.get_boolean ("inbox-project-sync")) {
607-
is_todoist = 1;
608-
}
609-
610599
Planner.utils.magic_button_activated (
611600
Planner.settings.get_int64 ("inbox-project"),
612601
0,
613-
is_todoist,
602+
Planner.database.get_project_by_id (Planner.settings.get_int64 ("inbox-project")).is_todoist,
614603
last
615604
);
616605
} else if (stack.visible_child_name == "today-view") {

src/QuickAdd/Database.vala

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class Database : GLib.Object {
6767
int res;
6868

6969
sql = """
70-
SELECT * FROM Projects ORDER BY item_order;
70+
SELECT * FROM Projects WHERE inbox_project = 0 ORDER BY item_order;
7171
""";
7272

7373
res = db.prepare_v2 (sql, -1, out stmt);
@@ -101,6 +101,46 @@ public class Database : GLib.Object {
101101
return all;
102102
}
103103

104+
public Project? get_project_by_id (int64 id) {
105+
Sqlite.Statement stmt;
106+
string sql;
107+
int res;
108+
109+
sql = """
110+
SELECT * FROM Projects WHERE id = ?;
111+
""";
112+
113+
res = db.prepare_v2 (sql, -1, out stmt);
114+
assert (res == Sqlite.OK);
115+
116+
res = stmt.bind_int64 (1, id);
117+
assert (res == Sqlite.OK);
118+
119+
var p = new Project ();
120+
121+
if (stmt.step () == Sqlite.ROW) {
122+
p.id = stmt.column_int64 (0);
123+
p.area_id = stmt.column_int64 (1);
124+
p.name = stmt.column_text (2);
125+
p.note = stmt.column_text (3);
126+
p.due_date = stmt.column_text (4);
127+
p.color = stmt.column_int (5);
128+
p.is_todoist = stmt.column_int (6);
129+
p.inbox_project = stmt.column_int (7);
130+
p.team_inbox = stmt.column_int (8);
131+
p.item_order = stmt.column_int (9);
132+
p.is_deleted = stmt.column_int (10);
133+
p.is_archived = stmt.column_int (11);
134+
p.is_favorite = stmt.column_int (12);
135+
p.is_sync = stmt.column_int (13);
136+
p.shared = stmt.column_int (14);
137+
p.is_kanban = stmt.column_int (15);
138+
p.show_completed = stmt.column_int (16);
139+
}
140+
141+
return p;
142+
}
143+
104144
public bool insert_item (Item item) {
105145
Sqlite.Statement stmt;
106146
string sql;

src/QuickAdd/MainWindow.vala

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,33 +100,33 @@ public class MainWindow : Gtk.Window {
100100
project_combobox.get_style_context ().add_class ("quick-add-combobox");
101101
project_combobox.valign = Gtk.Align.CENTER;
102102

103+
Gtk.TreeIter inbox_iter;
104+
list_store.append (out inbox_iter);
105+
106+
var inbox_project = PlannerQuickAdd.database.get_project_by_id (PlannerQuickAdd.settings.get_int64 ("inbox-project"));
107+
list_store.@set (inbox_iter,
108+
0, inbox_project,
109+
1, " " + _("Inbox"),
110+
2, "planner-inbox"
111+
);
112+
113+
if (PlannerQuickAdd.settings.get_boolean ("quick-add-save-last-project") == false) {
114+
project_combobox.set_active_iter (inbox_iter);
115+
}
116+
103117
Gtk.TreeIter iter;
104-
string icon_name;
105118
foreach (var project in PlannerQuickAdd.database.get_all_projects ()) {
106119
list_store.append (out iter);
107120

108-
if (project.inbox_project == 1) {
109-
icon_name = "planner-inbox";
110-
} else {
111-
icon_name = "color-%i".printf (project.color);
112-
}
113-
114121
list_store.@set (iter,
115122
0, project,
116123
1, " " + project.name,
117-
2, icon_name
124+
2, "color-%i".printf (project.color)
118125
);
119126

120127
if (PlannerQuickAdd.settings.get_boolean ("quick-add-save-last-project") == true &&
121128
PlannerQuickAdd.settings.get_int64 ("quick-add-project-selected") == 0) {
122-
if (project.inbox_project == 1) {
123-
project_combobox.set_active_iter (iter);
124-
}
125-
}
126-
127-
if (PlannerQuickAdd.settings.get_boolean ("quick-add-save-last-project") == false &&
128-
project.inbox_project == 1) {
129-
project_combobox.set_active_iter (iter);
129+
project_combobox.set_active_iter (inbox_iter);
130130
}
131131

132132
if (PlannerQuickAdd.settings.get_boolean ("quick-add-save-last-project") == true &&
@@ -279,9 +279,9 @@ public class MainWindow : Gtk.Window {
279279
item.project_id = project.id;
280280
item.content = content_entry.text;
281281
item.is_todoist = project.is_todoist;
282-
282+
283283
if (project.inbox_project == 1) {
284-
if (PlannerQuickAdd.settings.get_boolean ("inbox-project-sync")) {
284+
if (PlannerQuickAdd.database.get_project_by_id (PlannerQuickAdd.settings.get_int64 ("inbox-project")).is_todoist == 1) {
285285
PlannerQuickAdd.database.add_todoist_item (item);
286286
} else {
287287
PlannerQuickAdd.database.insert_item (item);

src/QuickAdd/Project.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ public class Project : GLib.Object {
3838
public int64 is_sync { get; set; default = 0; }
3939
public int shared { get; set; default = 0; }
4040
public int is_kanban { get; set; default = 0; }
41+
public int show_completed { get; set; default = 0; }
4142
}

src/Services/Todoist.vala

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ public class Services.Todoist : GLib.Object {
233233
}
234234

235235
// Set Inbox Project
236-
Planner.settings.set_boolean ("inbox-project-sync", true);
237236
Planner.settings.set_int64 ("inbox-project", user_object.get_int_member ("inbox_project"));
238237

239238

@@ -2073,6 +2072,19 @@ public class Services.Todoist : GLib.Object {
20732072
builder.add_int_value (item.section_id);
20742073
}
20752074

2075+
if (item.due_date != "") {
2076+
builder.set_member_name ("due");
2077+
builder.begin_object ();
2078+
2079+
builder.set_member_name ("date");
2080+
builder.add_string_value (new GLib.DateTime.from_iso8601 (
2081+
item.due_date,
2082+
new GLib.TimeZone.local ()).format ("%F")
2083+
);
2084+
2085+
builder.end_object ();
2086+
}
2087+
20762088
builder.end_object ();
20772089
builder.end_object ();
20782090
builder.end_array ();

src/Views/Today.vala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,15 @@ public class Views.Today : Gtk.EventBox {
9090
view_stack.add_named (listbox, "listbox");
9191
view_stack.add_named (placeholder_view, "placeholder");
9292

93-
int is_todoist = 0;
94-
if (Planner.settings.get_boolean ("inbox-project-sync")) {
95-
is_todoist = 1;
96-
}
97-
9893
new_item = new Widgets.NewItem (
9994
Planner.settings.get_int64 ("inbox-project"),
10095
0,
101-
is_todoist
96+
Planner.database.get_project_by_id (Planner.settings.get_int64 ("inbox-project")).is_todoist
10297
);
10398
new_item.margin_top = 6;
10499
new_item.margin_start = 36;
105100
new_item.margin_end = 32;
101+
new_item.due_date = new GLib.DateTime.now_local ().to_string ();
106102

107103
new_item_revealer = new Gtk.Revealer ();
108104
new_item_revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN;
@@ -415,7 +411,6 @@ public class Views.Today : Gtk.EventBox {
415411
if (new_item_revealer.reveal_child) {
416412
new_item_revealer.reveal_child = false;
417413
} else {
418-
new_item.due_date = new GLib.DateTime.now_local ().to_string ();
419414
new_item_revealer.reveal_child = true;
420415
new_item.entry_grab_focus ();
421416

0 commit comments

Comments
 (0)