From 64eabe363865cdc3aa3a0779148e1d7f431f773b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Mon, 31 Jul 2017 23:20:08 +0200 Subject: Make sure to unset the context menu before destroying it --- NEWS | 3 +++ bin/net_applet | 10 +++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 86b8367..8411db0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +- net_applet: + o fix the context menu + 2.32 - drakfirewall o adapt to new samba package name (mga#20584) diff --git a/bin/net_applet b/bin/net_applet index 4732e9c..74569ec 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -242,11 +242,6 @@ if ($ENV{DESKTOP_SESSION} =~ /plasma$/i) { $icon->set_title('net_applet'); $icon->set_status('STATUS_NOTIFIER_STATUS_ACTIVE'); $icon->register; - # We keep this only as a fallback if the DBusMenu service does not work. - # This way, we are sure that right-clicks will always work. (mga#20410) - $icon->signal_connect(context_menu => sub { - $menu->popup(undef, undef, undef, undef, 0, Gtk3::get_current_event_time()) if $menu; - }); } else { $icon = Gtk3::StatusIcon->new; @@ -313,8 +308,7 @@ $SIG{USR1} = sub { # seems to be some latency with DBus and/or DBusMenu, and when this method # is called too early, it seems to be blocked. So we add a timer here to call # it again to make sure that right-click events will be correctly handled by -# DBusMenu. If the registration fails again, then the 'context_menu' signal -# will be emitted and caught above (mga#20410). +# DBusMenu. Glib::Timeout->add(100, sub { $icon->set_context_menu($menu); 0 }) if $is_plasma; # do not create zombies (#20552) @@ -564,6 +558,8 @@ sub get_wireless_networks_sorted() { sub generate_menu() { delete $_->{menuitems} foreach values %wireless_networks; + # Unset the context menu before destroying it. + $icon->set_context_menu() if $is_plasma; $menu->destroy if $menu; $menu = Gtk3::Menu->new; -- cgit v1.2.1