Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix revealer using unmap event #187

Merged
merged 4 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Widgets/IndicatorEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ public class Wingpanel.Widgets.IndicatorEntry : Gtk.MenuItem {
} else {
set_reveal (base_indicator.visible);
popover_manager.unregister_indicator (this);
Timeout.add (revealer.get_transition_duration (), () => {
menu_bar.apply_new_order ();
return false;
});
// reorder indicators when indicator is invisible
display_widget.unmap.connect (indicator_unmapped);
}
} else {
set_reveal (base_indicator.visible);
Expand Down Expand Up @@ -122,6 +120,11 @@ public class Wingpanel.Widgets.IndicatorEntry : Gtk.MenuItem {
set_reveal (base_indicator.visible);
}

private void indicator_unmapped () {
base_indicator.get_display_widget ().unmap.disconnect (indicator_unmapped);
menu_bar.apply_new_order ();
}

public void set_transition_type (Gtk.RevealerTransitionType transition_type) {
revealer.set_transition_type (transition_type);
}
Expand Down
13 changes: 11 additions & 2 deletions src/Widgets/IndicatorMenuBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
public class Wingpanel.Widgets.IndicatorMenuBar : MenuBar {
private Gee.List<IndicatorEntry> sorted_items;
private Services.IndicatorSorter sorter = new Services.IndicatorSorter ();
private uint apply_new_order_idle_id = 0;

public IndicatorMenuBar () {
sorted_items = new Gee.ArrayList<IndicatorEntry> ();
Expand Down Expand Up @@ -51,8 +52,16 @@ public class Wingpanel.Widgets.IndicatorMenuBar : MenuBar {
}

public void apply_new_order () {
clear ();
append_all_items ();
if (apply_new_order_idle_id > 0) {
GLib.Source.remove (apply_new_order_idle_id);
apply_new_order_idle_id = 0;
}
apply_new_order_idle_id = GLib.Idle.add_full (GLib.Priority.LOW, () => {
clear ();
append_all_items ();
apply_new_order_idle_id = 0;
return false;
});
}

private void clear () {
Expand Down