Skip to content

Commit

Permalink
fix #1253
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Apr 16, 2024
1 parent f29aa4e commit 311942b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
9 changes: 4 additions & 5 deletions src/Layouts/SectionBoard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,11 @@ public class Layouts.SectionBoard : Gtk.FlowBoxChild {
content_box.add_controller (drop_target);
drop_target.drop.connect ((value, x, y) => {
var picked_widget = (Layouts.ItemBoard) value;
var old_section_id = "";

picked_widget.drag_end ();

old_section_id = picked_widget.item.section_id;
string old_section_id = picked_widget.item.section_id;
string old_parent_id = picked_widget.item.parent_id;

picked_widget.item.project_id = section.project_id;
picked_widget.item.section_id = section.id;
Expand All @@ -589,9 +589,8 @@ public class Layouts.SectionBoard : Gtk.FlowBoxChild {
source_list.remove (picked_widget);

listbox.append (picked_widget);
Services.EventBus.get_default ().update_inserted_item_map (picked_widget, old_section_id, "");
// update_items_item_order (listbox);

Services.EventBus.get_default ().update_inserted_item_map (picked_widget, old_section_id, old_parent_id);

return true;
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/Layouts/SectionRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,11 @@ public class Layouts.SectionRow : Gtk.ListBoxRow {
drop_widget.add_controller (drop_inbox_target);
drop_inbox_target.drop.connect ((target, value, x, y) => {
var picked_widget = (Layouts.ItemRow) value;
var old_section_id = "";

picked_widget.drag_end ();

old_section_id = picked_widget.item.section_id;
string old_section_id = picked_widget.item.section_id;
string old_parent_id = picked_widget.item.parent_id;

picked_widget.item.project_id = section.project_id;
picked_widget.item.section_id = section.id;
Expand Down Expand Up @@ -734,7 +734,7 @@ public class Layouts.SectionRow : Gtk.ListBoxRow {
source_list.remove (picked_widget);

listbox.insert (picked_widget, 0);
Services.EventBus.get_default ().update_inserted_item_map (picked_widget, old_section_id, "");
Services.EventBus.get_default ().update_inserted_item_map (picked_widget, old_section_id, old_parent_id);
update_items_item_order (listbox);

return true;
Expand Down
6 changes: 0 additions & 6 deletions src/Layouts/Sidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,10 @@ public class Layouts.Sidebar : Adw.Bin {
Services.Database.get_default ().project_updated.connect (update_projects_sort);

Services.EventBus.get_default ().project_parent_changed.connect ((project, old_parent_id) => {
print ("project: %s\n".printf (project.name));
print ("project parent id: %s\n".printf (project.parent.name));
print ("old_parent_id: %s\n".printf (old_parent_id));

if (old_parent_id == "") {
if (local_hashmap.has_key (project.id)) {
local_hashmap [project.id].hide_destroy ();
local_hashmap.unset (project.id);

print ("Elimina sub project\n");
}

if (todoist_hashmap.has_key (project.id)) {
Expand Down

0 comments on commit 311942b

Please sign in to comment.