Skip to content

Commit

Permalink
fix #414
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed May 29, 2024
1 parent 200754e commit d79a585
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 107 deletions.
1 change: 1 addition & 0 deletions core/Objects/Project.vala
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public class Objects.Project : Objects.BaseObject {
public signal void loading_changed (bool value);
public signal void project_count_updated ();
public signal void show_multi_select_change ();
public signal void expand_all_items (bool value);

construct {
deleted.connect (() => {
Expand Down
3 changes: 3 additions & 0 deletions data/io.github.alainm23.planify.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<file alias="arrow-turn-down-right-symbolic.svg">resources/icons/arrow-turn-down-right-symbolic.svg</file>
<file alias="shoe-box-symbolic.svg">resources/icons/shoe-box-symbolic.svg</file>
<file alias="eye-open-negative-filled-symbolic.svg">resources/icons/eye-open-negative-filled-symbolic.svg</file>
<file alias="size-vertically-symbolic.svg">resources/icons/size-vertically-symbolic.svg</file>
</gresource>

<gresource prefix="/io/github/alainm23/planify/Devel/icons/scalable/actions">
Expand Down Expand Up @@ -152,6 +153,7 @@
<file alias="arrow-turn-down-right-symbolic.svg">resources/icons/arrow-turn-down-right-symbolic.svg</file>
<file alias="shoe-box-symbolic.svg">resources/icons/shoe-box-symbolic.svg</file>
<file alias="eye-open-negative-filled-symbolic.svg">resources/icons/eye-open-negative-filled-symbolic.svg</file>
<file alias="size-vertically-symbolic.svg">resources/icons/size-vertically-symbolic.svg</file>
</gresource>

<gresource prefix="/io/github/alainm23/planify/quick-add/icons/scalable/actions">
Expand Down Expand Up @@ -215,5 +217,6 @@
<file alias="arrow-turn-down-right-symbolic.svg">resources/icons/arrow-turn-down-right-symbolic.svg</file>
<file alias="shoe-box-symbolic.svg">resources/icons/shoe-box-symbolic.svg</file>
<file alias="eye-open-negative-filled-symbolic.svg">resources/icons/eye-open-negative-filled-symbolic.svg</file>
<file alias="size-vertically-symbolic.svg">resources/icons/size-vertically-symbolic.svg</file>
</gresource>
</gresources>
8 changes: 8 additions & 0 deletions data/resources/icons/size-vertically-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions src/Dialogs/DatePicker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ public class Dialogs.DatePicker : Adw.Dialog {
hide_destroy ();
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/Label.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ public class Dialogs.Label : Adw.Dialog {
}
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/ManageProjects.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ public class Dialogs.ManageProjects : Adw.Dialog {
}
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/ManageSectionOrder.vala
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ public class Dialogs.ManageSectionOrder : Adw.Dialog {
}
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/Project.vala
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,6 @@ public class Dialogs.Project : Adw.Dialog {
}
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/QuickFind/QuickFind.vala
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ public class Dialogs.QuickFind.QuickFind : Adw.Dialog {
hide_destroy ();
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/RepeatConfig.vala
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,6 @@ public class Dialogs.RepeatConfig : Adw.Dialog {
update_repeat_label ();
});

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/Section.vala
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ public class Dialogs.Section : Adw.Dialog {
name_entry.entry_activated.connect (add_update_section);
submit_button.clicked.connect (add_update_section);

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
8 changes: 0 additions & 8 deletions src/Dialogs/WhatsNew.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ public class Dialogs.WhatsNew : Adw.Dialog {
child = navigation_view;
Services.EventBus.get_default ().disconnect_typing_accel ();

var destroy_controller = new Gtk.EventControllerKey ();
add_controller (destroy_controller);
destroy_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == 65307) {
hide_destroy ();
}
});

closed.connect (() => {
Services.EventBus.get_default ().connect_typing_accel ();
});
Expand Down
12 changes: 2 additions & 10 deletions src/Layouts/ItemRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,6 @@ public class Layouts.ItemRow : Layouts.ItemBase {

markdown_edit_view.buffer = current_buffer;

var description_scrolled_window = new Gtk.ScrolledWindow () {
hscrollbar_policy = Gtk.PolicyType.NEVER,
vscrollbar_policy = Gtk.PolicyType.NEVER,
hexpand = true,
vexpand = true,
child = markdown_edit_view
};

item_labels = new Widgets.ItemLabels (item) {
margin_start = 24,
sensitive = !item.completed
Expand Down Expand Up @@ -511,7 +503,7 @@ public class Layouts.ItemRow : Layouts.ItemBase {
});

var details_grid = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
details_grid.append (description_scrolled_window);
details_grid.append (markdown_edit_view);
details_grid.append (item_labels);
details_grid.append (action_box);

Expand Down Expand Up @@ -628,7 +620,7 @@ public class Layouts.ItemRow : Layouts.ItemBase {

var description_gesture_click = new Gtk.GestureClick ();
markdown_edit_view.add_controller (description_gesture_click);
description_gesture_click.pressed.connect ((n_press, x, y) => {
description_gesture_click.released.connect ((n_press, x, y) => {
description_gesture_click.set_state (Gtk.EventSequenceState.CLAIMED);
markdown_edit_view.view_focus ();
});
Expand Down
6 changes: 6 additions & 0 deletions src/Layouts/SectionRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ public class Layouts.SectionRow : Gtk.ListBoxRow {
section.loading_change.connect (() => {
is_loading = section.loading;
});

section.project.expand_all_items.connect ((value) => {
foreach (Layouts.ItemRow row in items.values) {
row.edit = value;
}
});
}

private void show_completed_changed () {
Expand Down
7 changes: 0 additions & 7 deletions src/Services/ActionManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class Services.ActionManager : Object {
public const string ACTION_VIEW_PINBOARD = "action_view_pinboard";
public const string ACTION_VIEW_LABELS = "action_view_labels";
public const string ACTION_VIEW_HOME = "action_view_home";
// public const string ACTION_ESC = "action_esc";
public const string ACTION_SHOW_HIDE_SIDEBAR = "action_show_hide_sidebar";

public static Gee.MultiMap<string, string> action_accelerators = new Gee.HashMultiMap<string, string> ();
Expand All @@ -67,7 +66,6 @@ public class Services.ActionManager : Object {
{ ACTION_VIEW_PINBOARD, action_view_pinboard },
{ ACTION_VIEW_LABELS, action_view_labels },
{ ACTION_VIEW_HOME, action_view_home },
// { ACTION_ESC, action_esc },
{ ACTION_SHOW_HIDE_SIDEBAR, action_show_hide_sidebar }
};

Expand All @@ -91,7 +89,6 @@ public class Services.ActionManager : Object {
action_accelerators.set (ACTION_VIEW_SCHEDULED, "<Control>u");
action_accelerators.set (ACTION_VIEW_LABELS, "<Control>l");
action_accelerators.set (ACTION_VIEW_PINBOARD, "<Control>p");
// action_accelerators.set (ACTION_ESC, "Escape");

typing_accelerators.set (ACTION_ADD_TASK, "a");
typing_accelerators.set (ACTION_ADD_TASK_PASTE, "<Control>v");
Expand Down Expand Up @@ -184,10 +181,6 @@ public class Services.ActionManager : Object {
Services.EventBus.get_default ().pane_selected (PaneType.FILTER, FilterType.PINBOARD.to_string ());
}

private void action_esc () {
// Services.EventBus.get_default ().request_escape ();
}

private void action_show_hide_sidebar () {
window.show_hide_sidebar ();
}
Expand Down
64 changes: 46 additions & 18 deletions src/Views/Project/Project.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public class Views.Project : Adw.Bin {
transition_type = Gtk.StackTransitionType.SLIDE_RIGHT
};

view_stack.add_named (new Gtk.Spinner () {
hexpand = true,
vexpand = true,
halign = CENTER,
valign = CENTER,
spinning = true
}, "loading");

var content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
hexpand = true,
vexpand = true
Expand Down Expand Up @@ -194,25 +202,31 @@ public class Views.Project : Adw.Bin {
}

private void update_project_view (ProjectViewStyle view_style) {
if (view_style == ProjectViewStyle.LIST) {
Views.List? list_view;
list_view = (Views.List) view_stack.get_child_by_name (view_style.to_string ());
if (list_view == null) {
list_view = new Views.List (project);
view_stack.add_named (list_view, view_style.to_string ());
}
} else if (view_style == ProjectViewStyle.BOARD) {
Views.Board? board_view;
board_view = (Views.Board) view_stack.get_child_by_name (view_style.to_string ());
if (board_view == null) {
board_view = new Views.Board (project);
view_stack.add_named (board_view, view_style.to_string ());
view_stack.visible_child_name = "loading";

Timeout.add (275, () => {
if (view_style == ProjectViewStyle.LIST) {
Views.List? list_view;
list_view = (Views.List) view_stack.get_child_by_name (view_style.to_string ());
if (list_view == null) {
list_view = new Views.List (project);
view_stack.add_named (list_view, view_style.to_string ());
}
} else if (view_style == ProjectViewStyle.BOARD) {
Views.Board? board_view;
board_view = (Views.Board) view_stack.get_child_by_name (view_style.to_string ());
if (board_view == null) {
board_view = new Views.Board (project);
view_stack.add_named (board_view, view_style.to_string ());
}
}
}

view_stack.set_visible_child_name (view_style.to_string ());
project.view_style = view_style;
project.update_local ();

view_stack.set_visible_child_name (view_style.to_string ());
project.view_style = view_style;
project.update_local ();

return GLib.Source.REMOVE;
});
}

public void prepare_new_item (string content = "") {
Expand Down Expand Up @@ -245,6 +259,8 @@ public class Views.Project : Adw.Bin {

var select_item = new Widgets.ContextMenu.MenuItem (_("Select"), "list-large-symbolic");
var paste_item = new Widgets.ContextMenu.MenuItem (_("Paste"), "tabs-stack-symbolic");
var expand_all_item = new Widgets.ContextMenu.MenuItem (_("Expand All"), "size-vertically-symbolic");
var collapse_all_item = new Widgets.ContextMenu.MenuItem (_("Collapse All"), "size-vertically-symbolic");
var archive_item = new Widgets.ContextMenu.MenuItem (_("Archive"), "shoe-box-symbolic");
var delete_item = new Widgets.ContextMenu.MenuItem (_("Delete Project"), "user-trash-symbolic");
delete_item.add_css_class ("menu-item-danger");
Expand All @@ -270,6 +286,8 @@ public class Views.Project : Adw.Bin {

menu_box.append (select_item);
menu_box.append (paste_item);
menu_box.append (expand_all_item);
menu_box.append (collapse_all_item);
menu_box.append (show_completed_item);

if (!project.is_deck && !project.inbox_project) {
Expand Down Expand Up @@ -335,6 +353,16 @@ public class Views.Project : Adw.Bin {
});
});

expand_all_item.clicked.connect (() => {
popover.popdown ();
project.expand_all_items (true);
});

collapse_all_item.clicked.connect (() => {
popover.popdown ();
project.expand_all_items (false);
});

select_item.clicked.connect (() => {
popover.popdown ();
project.show_multi_select = true;
Expand Down

0 comments on commit d79a585

Please sign in to comment.