Skip to content

Commit bf2181d

Browse files
author
Alain M
committed
Release 2.2.14
1 parent d104c64 commit bf2181d

File tree

7 files changed

+255
-5
lines changed

7 files changed

+255
-5
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@
4747
<binary>com.github.alainm23.planner</binary>
4848
</provides>
4949
​<releases>
50-
<release version="2.2.13" date="2020-03-02">
50+
<release version="2.2.14" date="2020-03-02">
5151
<description>
5252
<p>Improved stability and some bug fixes.</p>
53+
<ul>
54+
<li>Fixed the error showing next week's tasks in today's view</li>
55+
<li>Fix focus when changing views</li>
56+
<li>Updated translations</li>
57+
</ul>
5358
<p>Special thanks to 'Wount' for becoming our new silver tier patrons and supporting the development of Planner.</p>
5459
</description>
5560
</release>

data/stylesheet.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,4 +836,9 @@ paned.horizontal > separator {
836836

837837
.label-select-row:selected label {
838838
color: @text_color;
839+
}
840+
841+
.searchitem-row:selected {
842+
background-color: @pane_selected_color;
843+
color: @text_color;
839844
}

meson.build

Lines changed: 2 additions & 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.2.13')
3+
version: '2.2.14')
44

55
gnome = import('gnome')
66
i18n = import('i18n')
@@ -96,6 +96,7 @@ executable(
9696

9797
'src/Dialogs/TodoistOAuth.vala',
9898
'src/Dialogs/ProjectSettings.vala',
99+
'src/Dialogs/QuickFind.vala',
99100

100101
'src/Dialogs/Preferences/Preferences.vala',
101102
'src/Dialogs/Preferences/ItemSelect.vala',

src/Dialogs/QuickFind.vala

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/*
2+
* Copyright © 2019 Alain M. (https://github.com/alainm23/planner)
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. <[email protected]>
20+
*/
21+
22+
public class Dialogs.QuickFind : Gtk.Dialog {
23+
public QuickFind () {
24+
Object (
25+
transient_for: Planner.instance.main_window,
26+
deletable: false,
27+
destroy_with_parent: true,
28+
window_position: Gtk.WindowPosition.CENTER_ON_PARENT,
29+
modal: false
30+
);
31+
}
32+
33+
construct {
34+
get_style_context ().add_class ("planner-dialog");
35+
width_request = 600;
36+
37+
int window_x, window_y;
38+
int window_width, width_height;
39+
40+
Planner.settings.get ("window-position", "(ii)", out window_x, out window_y);
41+
Planner.settings.get ("window-size", "(ii)", out window_width, out width_height);
42+
43+
move (window_x + ((window_width - width_request) / 2), window_y + 64);
44+
45+
var search_label = new Gtk.Label (_("Search:"));
46+
search_label.get_style_context ().add_class ("h3");
47+
48+
var search_entry = new Gtk.SearchEntry ();
49+
search_entry.hexpand = true;
50+
51+
var top_grid = new Gtk.Grid ();
52+
top_grid.column_spacing = 12;
53+
top_grid.margin_start = 34;
54+
top_grid.margin_end = 16;
55+
top_grid.add (search_label);
56+
top_grid.add (search_entry);
57+
58+
var listbox = new Gtk.ListBox ();
59+
listbox.get_style_context ().add_class ("background");
60+
listbox.hexpand = true;
61+
62+
var listbox_scrolled = new Gtk.ScrolledWindow (null, null);
63+
listbox_scrolled.height_request = 250;
64+
listbox_scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER;
65+
listbox_scrolled.expand = true;
66+
listbox_scrolled.add (listbox);
67+
68+
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
69+
separator.margin_top = 16;
70+
71+
var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
72+
main_box.pack_start (top_grid, false, false, 0);
73+
main_box.pack_start (separator, false, false, 0);
74+
main_box.pack_start (listbox_scrolled, true, true, 0);
75+
76+
get_content_area ().add (main_box);
77+
78+
search_entry.search_changed.connect (() => {
79+
listbox.foreach ((widget) => {
80+
widget.destroy ();
81+
});
82+
83+
if (search_entry.text != "") {
84+
foreach (var item in Planner.database.get_items_by_search (search_entry.text)) {
85+
var row = new SearchItem (
86+
"item",
87+
item.content,
88+
search_entry.text
89+
);
90+
91+
listbox.add (row);
92+
listbox.show_all ();
93+
}
94+
95+
foreach (var project in Planner.database.get_all_projects_by_search (search_entry.text)) {
96+
var row = new SearchItem (
97+
"project",
98+
project.name,
99+
search_entry.text
100+
);
101+
102+
listbox.add (row);
103+
listbox.show_all ();
104+
}
105+
} else {
106+
107+
}
108+
});
109+
}
110+
}
111+
112+
public class SearchItem : Gtk.ListBoxRow {
113+
public string result_type { get; construct; }
114+
public string content { get; construct; }
115+
public string search_text { get; construct; }
116+
117+
public SearchItem (string result_type, string content, string search_text) {
118+
Object (
119+
result_type: result_type,
120+
content: content,
121+
search_text: search_text
122+
);
123+
}
124+
125+
construct {
126+
get_style_context ().add_class ("searchitem-row");
127+
if (result_type == "item") {
128+
var header_label = new Gtk.Label (_("Tasks"));
129+
header_label.get_style_context ().add_class ("h3");
130+
header_label.width_request = 84;
131+
header_label.xalign = 1;
132+
header_label.margin_end = 12;
133+
134+
var checked_button = new Gtk.CheckButton ();
135+
checked_button.valign = Gtk.Align.CENTER;
136+
//checked_button.margin_top = 1;
137+
checked_button.get_style_context ().add_class ("checklist-button");
138+
139+
var content_label = new Gtk.Label (content.replace (search_text, "<b>%s</b>".printf (search_text)));
140+
content_label.wrap = true;
141+
content_label.xalign = 0;
142+
content_label.use_markup = true;
143+
content_label.get_style_context ().add_class ("label");
144+
145+
var grid = new Gtk.Grid ();
146+
grid.margin = 6;
147+
grid.column_spacing = 6;
148+
grid.add (checked_button);
149+
grid.add (content_label);
150+
151+
var main_grid = new Gtk.Grid ();
152+
main_grid.attach (header_label, 0, 0, 1, 1);
153+
main_grid.attach (new Gtk.Separator (Gtk.Orientation.VERTICAL), 1, 0, 1, 1);
154+
main_grid.attach (grid, 2, 0, 1, 1);
155+
156+
add (main_grid);
157+
} else if (result_type == "project") {
158+
var header_label = new Gtk.Label (_("Projects"));
159+
header_label.get_style_context ().add_class ("h3");
160+
header_label.width_request = 84;
161+
header_label.xalign = 1;
162+
header_label.margin_end = 12;
163+
164+
var project_progress = new Widgets.ProjectProgress ();
165+
project_progress.line_cap = Cairo.LineCap.ROUND;
166+
project_progress.radius_filled = true;
167+
project_progress.line_width = 2;
168+
project_progress.valign = Gtk.Align.CENTER;
169+
project_progress.halign = Gtk.Align.CENTER;
170+
project_progress.percentage = 0.5;
171+
//project_progress.progress_fill_color = Planner.utils.get_color (project.color);
172+
173+
var content_label = new Gtk.Label (content.replace (search_text, "<b>%s</b>".printf (search_text)));
174+
content_label.wrap = true;
175+
content_label.xalign = 0;
176+
content_label.use_markup = true;
177+
content_label.get_style_context ().add_class ("label");
178+
179+
var grid = new Gtk.Grid ();
180+
grid.margin = 6;
181+
grid.margin_start = 4;
182+
grid.column_spacing = 3;
183+
grid.add (project_progress);
184+
grid.add (content_label);
185+
186+
var main_grid = new Gtk.Grid ();
187+
main_grid.attach (header_label, 0, 0, 1, 1);
188+
main_grid.attach (new Gtk.Separator (Gtk.Orientation.VERTICAL), 1, 0, 1, 1);
189+
main_grid.attach (grid, 2, 0, 1, 1);
190+
191+
add (main_grid);
192+
}
193+
}
194+
// public string title { get; construct; }
195+
// public int64 id { get; construct; }
196+
// public int64 project_id { get; construct; }
197+
// public string icon { get; construct; }
198+
// public string element { get; construct; }
199+
200+
// public SearchItem (string title, string icon, string element, int64 id, int64 project_id=0) {
201+
// Object (
202+
// title: title,
203+
// icon: icon,
204+
// element: element,
205+
// id: id,
206+
// project_id: project_id
207+
// );
208+
// }
209+
210+
// construct {
211+
// margin_start = margin_end = 6;
212+
// get_style_context ().add_class ("pane-row");
213+
214+
// var image = new Gtk.Image ();
215+
// image.gicon = new ThemedIcon (icon);
216+
// image.pixel_size = 16;
217+
218+
// var title_label = new Gtk.Label (title);
219+
// //title_label.get_style_context ().add_class ("h3");
220+
// title_label.ellipsize = Pango.EllipsizeMode.END;
221+
// //title_label.use_markup = true;
222+
223+
// var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
224+
// box.hexpand = true;
225+
// box.margin = 6;
226+
// box.pack_start (image, false, false, 0);
227+
// box.pack_start (title_label, false, false, 0);
228+
229+
// add (box);
230+
// }
231+
}

src/MainWindow.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ public class MainWindow : Gtk.Window {
496496
Granite.Services.Application.set_badge_visible.end (res);
497497
update_badge_count ();
498498
} catch (GLib.Error e) {
499-
//critical (e.message);
499+
critical (e.message);
500500
}
501501
});
502502

@@ -534,12 +534,12 @@ public class MainWindow : Gtk.Window {
534534
try {
535535
Granite.Services.Application.set_badge_visible.end (res);
536536
} catch (GLib.Error e) {
537-
//critical (e.message);
537+
critical (e.message);
538538
}
539539
});
540540
}
541541
} catch (GLib.Error e) {
542-
//critical (e.message);
542+
critical (e.message);
543543
}
544544
});
545545
}

src/Services/Todoist.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ public class Services.Todoist : GLib.Object {
373373
Planner.utils.download_profile_image (
374374
user_object.get_string_member ("image_id"), user_object.get_string_member ("avatar_s640")
375375
);
376+
377+
// Run Reminder server
378+
Planner.notifications.init_server ();
379+
380+
// Run Todoisr Sync server
376381
run_server ();
377382

378383
// To do: Create a tutorial project

src/Widgets/Pane.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ public class Widgets.Pane : Gtk.EventBox {
373373

374374
search_button.clicked.connect (() => {
375375
show_quick_find ();
376+
// var dialog = new Dialogs.QuickFind ();
377+
// dialog.destroy.connect (Gtk.main_quit);
378+
// dialog.show_all ();
376379
});
377380

378381
settings_button.clicked.connect (() => {

0 commit comments

Comments
 (0)