Skip to content

Commit 1275ea2

Browse files
committed
Fix sizing issues
1 parent 172e4ff commit 1275ea2

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

sample/SampleIndicator.vala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class Sample.Indicator : Wingpanel.Indicator {
2626
private Gtk.Overlay display_widget;
2727

2828
/* The main widget that is displayed in the popover */
29-
private Gtk.Grid main_widget;
29+
private Gtk.Box main_widget;
3030

3131
public Indicator () {
3232
/* Some information about the indicator */
@@ -62,10 +62,10 @@ public class Sample.Indicator : Wingpanel.Indicator {
6262

6363
var compositing_switch = new Granite.SwitchModelButton (_("Composited Icon"));
6464

65-
main_widget = new Gtk.Grid ();
66-
main_widget.attach (hide_button, 0, 0);
67-
main_widget.attach (separator, 0, 1);
68-
main_widget.attach (compositing_switch, 0, 2);
65+
main_widget = new Gtk.Box (VERTICAL, 0);
66+
main_widget.append (hide_button);
67+
main_widget.append (separator);
68+
main_widget.append (compositing_switch);
6969

7070
/* Indicator should be visible at startup */
7171
this.visible = true;

src/Widgets/IndicatorPopover.vala

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,26 @@
1818
*/
1919

2020
public class Wingpanel.Widgets.IndicatorPopover : Gtk.Popover {
21-
private unowned Gtk.Widget? widget = null;
22-
23-
private Gtk.Box container;
21+
private Granite.Bin container;
2422

2523
construct {
2624
width_request = 256;
2725
name = name + "/popover";
2826
position = Gtk.PositionType.BOTTOM;
2927

30-
container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
28+
container = new Granite.Bin () {
3129
margin_top = 3,
32-
margin_bottom = 3
30+
margin_bottom = 3,
3331
};
3432

3533
child = container;
3634
}
3735

3836
public void set_content (Gtk.Widget? content) {
39-
if (content == widget) {
37+
if (container.child == content) {
4038
return;
4139
}
4240

43-
if (widget != null) {
44-
container.remove (widget);
45-
widget = null;
46-
}
47-
48-
if (content != null) {
49-
container.append (content);
50-
widget = content;
51-
}
41+
container.child = content;
5242
}
5343
}

0 commit comments

Comments
 (0)