File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public class Sample.Indicator : Wingpanel.Indicator {
26
26
private Gtk . Overlay display_widget;
27
27
28
28
/* The main widget that is displayed in the popover */
29
- private Gtk . Grid main_widget;
29
+ private Gtk . Box main_widget;
30
30
31
31
public Indicator () {
32
32
/* Some information about the indicator */
@@ -62,10 +62,10 @@ public class Sample.Indicator : Wingpanel.Indicator {
62
62
63
63
var compositing_switch = new Granite .SwitchModelButton (_(" Composited Icon" ));
64
64
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);
69
69
70
70
/* Indicator should be visible at startup */
71
71
this . visible = true ;
Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
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;
24
22
25
23
construct {
26
24
width_request = 256 ;
27
25
name = name + " /popover" ;
28
26
position = Gtk . PositionType . BOTTOM ;
29
27
30
- container = new Gtk . Box ( Gtk . Orientation . HORIZONTAL , 0 ) {
28
+ container = new Granite . Bin ( ) {
31
29
margin_top = 3 ,
32
- margin_bottom = 3
30
+ margin_bottom = 3 ,
33
31
};
34
32
35
33
child = container;
36
34
}
37
35
38
36
public void set_content (Gtk .Widget ? content ) {
39
- if (content == widget ) {
37
+ if (container . child == content ) {
40
38
return ;
41
39
}
42
40
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;
52
42
}
53
43
}
You can’t perform that action at this time.
0 commit comments