Skip to content

Commit

Permalink
fix #575 #336
Browse files Browse the repository at this point in the history
  • Loading branch information
Alain M committed Oct 23, 2020
1 parent 2d59bb3 commit 9911786
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 36 deletions.
11 changes: 11 additions & 0 deletions data/com.github.alainm23.planner.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
<binary>com.github.alainm23.planner</binary>
</provides>
​<releases>
<release version="2.5.6" date="2020-10-23">
<description>
<p>Bug fixes and performance improvement</p>
<ul>
<li>Github #575 - Home page was fixed.</li>
<li>Github #336 - The option to change the text size was added.</li>
<li>Updated translations</li>
</ul>
</description>
</release>

<release version="2.5.4" date="2020-10-12">
<description>
<p>Bug fixes and performance improvement</p>
Expand Down
6 changes: 6 additions & 0 deletions data/com.github.alainm23.planner.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,11 @@
<summary>The currently installed version.</summary>
<description>The currently installed version of Planner, updated only after the user launched the app. This is used to know when to trigger the Release Dialog.</description>
</key>

<key name="font-scale" type="d">
<default>1</default>
<summary>font-scale</summary>
<description>font-scale</description>
</key>
</schema>
</schemalist>
2 changes: 1 addition & 1 deletion data/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ paned.horizontal > separator {
}

.title-label {
font-size: 12pt;
font-size: 1.3em;
}

.duedate-upcoming {
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project ('com.github.alainm23.planner', 'vala', 'c', version: '2.5.5')
project ('com.github.alainm23.planner', 'vala', 'c', version: '2.5.6')

gnome = import('gnome')
i18n = import('i18n')
Expand Down
10 changes: 6 additions & 4 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class Planner : Gtk.Application {
// task_store = new Services.Tasks.Store ();

add_main_option_entries (PLANNER_OPTIONS);

// Set lang
// GLib.Environment.set_variable ("LANGUAGE", "es", true);
}

public static Planner _instance = null;
Expand Down Expand Up @@ -195,6 +198,7 @@ public class Planner : Gtk.Application {
default_theme.add_resource_path ("/com/github/alainm23/planner");

utils.apply_theme_changed ();
utils.update_font_scale ();

// Set Theme and Icon
Gtk.Settings.get_default ().set_property ("gtk-icon-theme-name", "elementary");
Expand Down Expand Up @@ -233,10 +237,8 @@ public class Planner : Gtk.Application {
var dialog = new Widgets.WhatsNew ("com.github.alainm23.planner", _("Planner %s is here, with many design improvements, new features, and more.".printf (Constants.VERSION)));

List<string> list = new List<string> ();
list.append (_("New Quick Find button position."));
list.append (_("Github #565 - Fixing error when displaying the project name."));
list.append (_("Github #563 - Fixing error when moving a task to the end of the list."));
list.append (_("Github #559 #415 - Enabled click to see full details of a completed task."));
list.append (_("Github #575 - Homepage was fixed."));
list.append (_("Github #336 - The option to change the text size was added."));
list.append (_("Updated translations."));

dialog.append_notes (_("Bug fixes and performance improvement"), list, 30);
Expand Down
53 changes: 45 additions & 8 deletions src/Dialogs/Preferences/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
}

construct {
get_style_context ().add_class ("app");

Planner.event_bus.unselect_all ();
width_request = 525;
height_request = 600;
Expand Down Expand Up @@ -107,7 +109,7 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {

var start_page_item = new Dialogs.Preferences.Item ("go-home", _("Homepage"));
var badge_item = new Dialogs.Preferences.Item ("planner-badge-count", _("Badge Count"));
var theme_item = new Dialogs.Preferences.Item ("night-light", _("Theme"));
var theme_item = new Dialogs.Preferences.Item ("preferences-color", _("Appearance"));
var quick_add_item = new Dialogs.Preferences.Item ("planner-quick-add", _("Quick Add"));
var backups_item = new Dialogs.Preferences.Item ("drive-harddisk", _("Backups"));
var general_item = new Dialogs.Preferences.Item ("preferences-system", _("General"), true);
Expand Down Expand Up @@ -262,9 +264,9 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {

if (!Planner.settings.get_boolean ("homepage-project")) {
int type = Planner.settings.get_int ("homepage-item");
if (type == 0) {
if (type == 1) {
inbox_radio.active = true;
} else if (type == 1) {
} else if (type == 2) {
today_radio.active = true;
} else {
upcoming_radio.active = true;
Expand Down Expand Up @@ -323,17 +325,17 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {

inbox_radio.toggled.connect (() => {
Planner.settings.set_boolean ("homepage-project", false);
Planner.settings.set_int ("homepage-item", 0);
Planner.settings.set_int ("homepage-item", 1);
});

today_radio.toggled.connect (() => {
Planner.settings.set_boolean ("homepage-project", false);
Planner.settings.set_int ("homepage-item", 1);
Planner.settings.set_int ("homepage-item", 2);
});

upcoming_radio.toggled.connect (() => {
Planner.settings.set_boolean ("homepage-project", false);
Planner.settings.set_int ("homepage-item", 2);
Planner.settings.set_int ("homepage-item", 3);
});

return main_box;
Expand Down Expand Up @@ -413,7 +415,7 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
}

private Gtk.Widget get_theme_widget () {
var info_box = new Dialogs.Preferences.TopBox ("night-light", _("Theme"));
var info_box = new Dialogs.Preferences.TopBox ("night-light", _("Appearance"));

var description_label = new Gtk.Label (
_("Personalize the look and feel of your Planner by choosing the theme that best suits you.")
Expand All @@ -427,7 +429,6 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
description_label.xalign = 0;

var light_radio = new Gtk.RadioButton.with_label (null, _("Light"));
light_radio.margin_top = 12;
light_radio.get_style_context ().add_class ("preference-item-radio");

var night_radio = new Gtk.RadioButton.with_label_from_widget (light_radio, _("Night"));
Expand All @@ -439,16 +440,48 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
var arc_dark_radio = new Gtk.RadioButton.with_label_from_widget (light_radio, _("Arc Dark"));
arc_dark_radio.get_style_context ().add_class ("preference-item-radio");

var font_size_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0.5, 2, 0.1);
font_size_scale.hexpand = true;
font_size_scale.set_value (Planner.settings.get_double ("font-scale"));
font_size_scale.add_mark (1, Gtk.PositionType.LEFT, null);
font_size_scale.draw_value = false;

var font_size_small = new Gtk.Image ();
font_size_small.gicon = new ThemedIcon ("font-x-generic-symbolic");
font_size_small.pixel_size = 16;

var font_size_large = new Gtk.Image ();
font_size_large.gicon = new ThemedIcon ("font-x-generic-symbolic");
font_size_large.pixel_size = 24;

var font_size_grid = new Gtk.Grid ();
font_size_grid.column_spacing = 12;
font_size_grid.hexpand = true;
font_size_grid.add (font_size_small);
font_size_grid.add (font_size_scale);
font_size_grid.add (font_size_large);
font_size_grid.valign = Gtk.Align.START;
font_size_grid.margin_start = 12;
font_size_grid.margin_end = 12;

var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
main_box.expand = true;

main_box.pack_start (info_box, false, false, 0);
main_box.pack_start (description_label, false, false, 0);
main_box.pack_start (new Granite.HeaderLabel (_("Theme")) {
margin_start = 12
}, false, false, 0);
main_box.pack_start (light_radio, false, false, 0);
main_box.pack_start (night_radio, false, false, 0);
main_box.pack_start (dark_blue_radio, false, false, 0);
main_box.pack_start (arc_dark_radio, false, false, 0);
main_box.pack_start (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), false, true, 0);
main_box.pack_start (new Granite.HeaderLabel (_("Font Size")) {
margin_start = 12,
margin_top = 12
}, false, false, 0);
main_box.pack_start (font_size_grid);

if (Planner.settings.get_enum ("appearance") == 0) {
light_radio.active = true;
Expand Down Expand Up @@ -480,6 +513,10 @@ public class Dialogs.Preferences.Preferences : Gtk.Dialog {
Planner.settings.set_enum ("appearance", 3);
});

font_size_scale.value_changed.connect (() => {
Planner.settings.set_double ("font-scale", font_size_scale.get_value ());
});

return main_box;
}

Expand Down
1 change: 1 addition & 0 deletions src/Dialogs/Project.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class Dialogs.Project : Gtk.Dialog {
Planner.event_bus.hide_new_window_project (project.id);

get_style_context ().add_class ("project-dialog");
get_style_context ().add_class ("app");
int window_x, window_y;
int width, height;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogs/ProjectSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class Dialogs.ProjectSettings : Gtk.Dialog {
height_request = 550;
width_request = 480;
get_style_context ().add_class ("planner-dialog");
get_style_context ().add_class ("app");

name_entry = new Widgets.Entry ();
name_entry.margin_start = 12;
Expand Down
27 changes: 11 additions & 16 deletions src/Dialogs/QuickFind.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class Dialogs.QuickFind : Gtk.Dialog {

construct {
Planner.event_bus.unselect_all ();
get_style_context ().add_class ("app");
get_style_context ().add_class ("quick-find-dialog");
// if (get_os_info ("PRETTY_NAME") == null || get_os_info ("PRETTY_NAME").index_of ("elementary") == -1) {
// get_style_context ().add_class ("dialog-patch");
Expand Down Expand Up @@ -91,12 +92,12 @@ public class Dialogs.QuickFind : Gtk.Dialog {
}
""".printf (_("Completed")));

// views.add ("""
// {
// "name": "%s",
// "id": 5
// }
// """.printf (_("All Tasks")));
views.add ("""
{
"name": "%s",
"id": 5
}
""".printf (_("All Tasks")));

var priorities = new Gee.ArrayList<string> ();
priorities.add ("""
Expand Down Expand Up @@ -136,7 +137,6 @@ public class Dialogs.QuickFind : Gtk.Dialog {

var search_label = new Gtk.Label (_("Search"));
search_label.get_style_context ().add_class ("font-weight-600");
search_label.get_style_context ().add_class ("welcome");
search_label.width_request = 90;
search_label.margin_start = 6;
search_label.xalign = (float) 0.5;
Expand Down Expand Up @@ -398,11 +398,11 @@ public class Dialogs.QuickFind : Gtk.Dialog {
return false;
});

// focus_out_event.connect (() => {
// popdown ();
focus_out_event.connect (() => {
popdown ();

// return false;
// });
return false;
});

key_press_event.connect ((event) => {
var key = Gdk.keyval_name (event.keyval).replace ("KP_", "");
Expand Down Expand Up @@ -513,7 +513,6 @@ public class SearchItem : Gtk.ListBoxRow {

if (result_type == QuickFindResultType.ITEM) {
header_label = new Gtk.Label (_("Tasks"));
header_label.get_style_context ().add_class ("welcome");
header_label.get_style_context ().add_class ("font-weight-600");
header_label.width_request = 73;
header_label.xalign = 1;
Expand Down Expand Up @@ -569,7 +568,6 @@ public class SearchItem : Gtk.ListBoxRow {
add (main_grid);
} else if (result_type == QuickFindResultType.PROJECT) {
header_label = new Gtk.Label (_("Projects"));
header_label.get_style_context ().add_class ("welcome");
header_label.get_style_context ().add_class ("font-weight-600");
header_label.width_request = 73;
header_label.xalign = 1;
Expand Down Expand Up @@ -626,7 +624,6 @@ public class SearchItem : Gtk.ListBoxRow {
add (main_grid);
} else if (result_type == QuickFindResultType.VIEW) {
header_label = new Gtk.Label (_("Views"));
header_label.get_style_context ().add_class ("welcome");
header_label.get_style_context ().add_class ("font-weight-600");
header_label.width_request = 73;
header_label.xalign = 1;
Expand Down Expand Up @@ -682,7 +679,6 @@ public class SearchItem : Gtk.ListBoxRow {
add (main_grid);
} else if (result_type == QuickFindResultType.LABEL) {
header_label = new Gtk.Label (_("Labels"));
header_label.get_style_context ().add_class ("welcome");
header_label.get_style_context ().add_class ("font-weight-600");
header_label.width_request = 73;
header_label.xalign = 1;
Expand Down Expand Up @@ -727,7 +723,6 @@ public class SearchItem : Gtk.ListBoxRow {
add (main_grid);
} else if (result_type == QuickFindResultType.PRIORITY) {
header_label = new Gtk.Label (_("Priorities"));
header_label.get_style_context ().add_class ("welcome");
header_label.get_style_context ().add_class ("font-weight-600");
header_label.width_request = 73;
header_label.xalign = 1;
Expand Down
1 change: 1 addition & 0 deletions src/Dialogs/ShortcutsDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Dialogs.ShortcutsDialog : Gtk.Dialog {
construct {
Planner.event_bus.unselect_all ();
get_style_context ().add_class ("release-dialog");
get_style_context ().add_class ("app");
width_request = 525;
height_request = 600;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogs/TodoistOAuth.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class Dialogs.TodoistOAuth : Gtk.Dialog {
construct {
height_request = 700;
width_request = 600;
get_style_context ().add_class ("app");
get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW);

var info_label = new Gtk.Label (_("Loading…"));
Expand Down
3 changes: 3 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public class MainWindow : Gtk.Window {
// This must come after setting header_paned as the titlebar
header_paned.get_style_context ().remove_class ("titlebar");
get_style_context ().add_class ("rounded");
get_style_context ().add_class ("app");
Planner.settings.bind ("pane-position", header_paned, "position", GLib.SettingsBindFlags.DEFAULT);
Planner.settings.bind ("pane-position", paned, "position", GLib.SettingsBindFlags.DEFAULT);

Expand Down Expand Up @@ -363,6 +364,8 @@ public class MainWindow : Gtk.Window {
);
} else if (key == "button-layout") {
check_button_layout ();
} else if (key == "font-scale") {
Planner.utils.update_font_scale ();
}
});

Expand Down
28 changes: 28 additions & 0 deletions src/Services/Database.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3364,6 +3364,34 @@ public class Services.Database : GLib.Object {
return all;
}

public Gee.ArrayList<Objects.Item?> get_all_items_uncompleted () {
Sqlite.Statement stmt;
string sql;
int res;

sql = """
SELECT id, project_id, section_id, user_id, assigned_by_uid, responsible_uid,
sync_id, parent_id, priority, item_order, checked, is_deleted, content, note,
due_date, due_timezone, due_string, due_lang, due_is_recurring, date_added,
date_completed, date_updated, is_todoist, day_order
FROM Items WHERE checked = 0;
""";

res = db.prepare_v2 (sql, -1, out stmt);
assert (res == Sqlite.OK);

var all = new Gee.ArrayList<Objects.Item?> ();

while ((res = stmt.step ()) == Sqlite.ROW) {
var i = create_item_from_stmt (stmt);

all.add (i);
}

stmt.reset ();
return all;
}

public Gee.ArrayList<Objects.Item?> get_all_items_by_project (int64 id) {
Sqlite.Statement stmt;
string sql;
Expand Down
1 change: 0 additions & 1 deletion src/Services/LabelsController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class Services.LabelsController : GLib.Object {
color: @text_color;
padding: 0px 3px 1px 3px;
border-radius: 4px;
font-size: 6pt;
font-weight: 700;
border: 1px solid shade (%s, 0.95)
}
Expand Down
Loading

0 comments on commit 9911786

Please sign in to comment.