Skip to content

Commit 1e03c3b

Browse files
vjrJeremy Wootten
andauthored
Suppress tooltips when popover is open (#393)
* Suppress tooltip when popover is open * Use unowned keyword for display widget vars * Suppress tooltips using "has-tooltip" (#1) * Simplify by using "has-tooltip" property * Remove unused code. * Use the visible property of the popover widget. * null-check the display_widget and DRY. * Fix warning about unowned being default in this context. * Update PopoverManager.vala Rename `suppress_tooltip ()` function to `update_has_tooltip ()` Co-authored-by: Jeremy Wootten <[email protected]>
1 parent 6437f0d commit 1e03c3b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Services/PopoverManager.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,23 @@ public class Wingpanel.Services.PopoverManager : Object {
4545
_current_indicator.base_indicator.closed ();
4646
_current_indicator = null;
4747
} else { // Switch
48+
update_has_tooltip (_current_indicator.display_widget);
4849
_current_indicator.base_indicator.closed ();
4950
_current_indicator = value;
5051
}
5152

5253
if (_current_indicator != null) {
5354
popover.set_content (_current_indicator.indicator_widget);
5455
popover.relative_to = _current_indicator;
56+
update_has_tooltip (_current_indicator.display_widget, false);
5557
owner.set_expanded (true);
5658
make_modal (popover, true);
5759
owner.present ();
5860
popover.popup ();
5961
popover.show_all ();
6062
_current_indicator.base_indicator.opened ();
6163
} else {
64+
update_has_tooltip (((Wingpanel.Widgets.IndicatorEntry)popover.get_relative_to ()).display_widget);
6265
popover.popdown ();
6366
}
6467
}
@@ -165,6 +168,12 @@ public class Wingpanel.Services.PopoverManager : Object {
165168
return current_indicator != null && current_indicator.base_indicator.code_name == entry.base_indicator.code_name;
166169
}
167170

171+
private void update_has_tooltip (Gtk.Widget display_widget, bool enable = true) {
172+
if (display_widget != null) {
173+
display_widget.has_tooltip = enable;
174+
}
175+
}
176+
168177
private void make_modal (Gtk.Popover? pop, bool modal = true) {
169178
if (pop == null || pop.get_window () == null || mousing) {
170179
return;

0 commit comments

Comments
 (0)