@@ -85,8 +85,9 @@ def __init__(self):
8585 self ._preferences_dialog = None
8686 self ._help_dialog = None
8787
88- self .ind = Gtk .Button .new ()
89- self .ind .set_label ("Init..." )
88+ self .ind = Gtk .EventBox ()
89+ self .label = Gtk .Label ("Init..." )
90+ self .ind .add (self .label )
9091
9192 self ._create_menu ()
9293
@@ -97,34 +98,35 @@ def __init__(self):
9798 self .load_settings ()
9899
99100 def _create_menu (self ):
100- """Creates the main menu and shows it."""
101- # create menu {{{
102- menu = Gtk .Menu ()
103- # add System Monitor menu item
104- full_sysmon = Gtk .MenuItem (_ ('System Monitor' ))
105- full_sysmon .connect ('activate' , self .on_full_sysmon_activated )
106- menu .add (full_sysmon )
107- menu .add (Gtk .SeparatorMenuItem ())
108-
109- # add preferences menu item
110- pref_menu = Gtk .MenuItem (_ ('Preferences' ))
111- pref_menu .connect ('activate' , self .on_preferences_activated )
112- menu .add (pref_menu )
113-
114- # add help menu item
115- help_menu = Gtk .MenuItem (_ ('Help' ))
116- help_menu .connect ('activate' , self ._on_help )
117- menu .add (help_menu )
118-
119- menu .show_all ()
120-
121- self .popup = menu
122- self .ind .connect ('clicked' , self .popup_menu )
123- logging .info ("Menu shown" )
124- # }}} menu done!
101+ """Creates the main popover and its content."""
102+ self .popover = Budgie .Popover .new (self .ind )
103+
104+ vbox = Gtk .Box (orientation = Gtk .Orientation .VERTICAL , spacing = 2 )
105+ vbox .set_border_width (8 )
106+
107+ full_sysmon = Gtk .ModelButton (label = _ ('System Monitor' ))
108+ full_sysmon .connect ('clicked' , self .on_full_sysmon_activated )
109+ vbox .pack_start (full_sysmon , False , False , 0 )
110+
111+ sep = Gtk .Separator (orientation = Gtk .Orientation .HORIZONTAL )
112+ vbox .pack_start (sep , False , False , 0 )
113+
114+ pref_btn = Gtk .ModelButton (label = _ ('Preferences' ))
115+ pref_btn .connect ('clicked' , self .on_preferences_activated )
116+ vbox .pack_start (pref_btn , False , False , 0 )
117+
118+ help_btn = Gtk .ModelButton (label = _ ('Help' ))
119+ help_btn .connect ('clicked' , self ._on_help )
120+ vbox .pack_start (help_btn , False , False , 0 )
121+
122+ vbox .show_all ()
123+ self .popover .add (vbox )
124+
125+ self .ind .connect ('button-press-event' , self .popup_menu )
126+ logging .info ("Popover created" )
125127
126128 def popup_menu (self , * args ):
127- self .popup . popup ( None , None , None , None , 0 , Gtk . get_current_event_time () )
129+ self .manager . show_popover ( self . ind )
128130
129131 def update_indicator_guide (self ):
130132
@@ -161,9 +163,9 @@ def update(self, data):
161163
162164
163165 def update_label (label ):
164- self .ind . set_label (label )
166+ self .label . set_text (label )
165167 return False
166- if label and self .ind :
168+ if label and self .label :
167169 GLib .idle_add (update_label , label .strip ())
168170
169171 def load_settings (self ):
@@ -287,6 +289,9 @@ def __init__(self, uuid):
287289
288290 self .app = IndicatorSysmonitor ()
289291 self .button = self .app .ind
290- self .button .set_relief (Gtk .ReliefStyle .NONE )
292+ # self.button.set_relief(Gtk.ReliefStyle.NONE)
291293 self .add (self .button )
292294 self .show_all ()
295+ def do_update_popovers (self , manager ):
296+ self .app .manager = manager
297+ manager .register_popover (self .app .ind , self .app .popover )
0 commit comments