diff --git a/src/Widgets/PinnedItemsFlowBox.vala b/src/Widgets/PinnedItemsFlowBox.vala index 5a870ad28..cba11f43f 100644 --- a/src/Widgets/PinnedItemsFlowBox.vala +++ b/src/Widgets/PinnedItemsFlowBox.vala @@ -66,15 +66,11 @@ public class Widgets.PinnedItemsFlowBox : Adw.Bin { }); project.item_deleted.connect ((item) => { - if (!items_map.has_key (item.id)) { - return; - } + update_pinboard (item); + }); - items_map[item.id].hide_widget (); - box_layout.remove (items_map[item.id]); - items_map.unset (item.id); - - check_reveal_child (); + Services.EventBus.get_default ().item_moved.connect ((item) => { + update_pinboard (item); }); Services.Store.instance ().item_pin_change.connect ((item) => { @@ -137,7 +133,19 @@ public class Widgets.PinnedItemsFlowBox : Adw.Bin { } } + private void update_pinboard (Objects.Item item) { + if (!items_map.has_key (item.id)) { + return; + } + + items_map[item.id].hide_widget (); + box_layout.remove (items_map[item.id]); + items_map.unset (item.id); + + check_reveal_child (); + } + private void check_reveal_child () { main_revealer.reveal_child = items_map.size > 0; } -} \ No newline at end of file +}