Skip to content

Commit

Permalink
Subclass widget directly
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Sep 18, 2024
1 parent 784d964 commit 1b417f0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Widgets/IndicatorEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
* Boston, MA 02110-1301 USA.
*/

public class Wingpanel.Widgets.IndicatorEntry : Gtk.Box {
public class Wingpanel.Widgets.IndicatorEntry : Gtk.Widget {
class construct {
set_layout_manager_type (typeof (Gtk.BinLayout));
}

public Indicator base_indicator { get; construct; }
public Services.PopoverManager popover_manager { get; construct; }

Expand Down Expand Up @@ -62,7 +66,7 @@ public class Wingpanel.Widgets.IndicatorEntry : Gtk.Box {
};
revealer.get_style_context ().add_class ("composited-indicator");

append (revealer);
revealer.set_parent (this);

if (base_indicator.visible) {
popover_manager.register_indicator (this);
Expand Down Expand Up @@ -114,6 +118,10 @@ public class Wingpanel.Widgets.IndicatorEntry : Gtk.Box {
set_reveal (base_indicator.visible);
}

~IndicatorEntry () {
revealer.unparent ();
}

private void indicator_unmapped () {
base_indicator.get_display_widget ().unmap.disconnect (indicator_unmapped);
indicator_bar.remove (this);
Expand Down

0 comments on commit 1b417f0

Please sign in to comment.