summaryrefslogtreecommitdiffstats
path: root/mgaapplet
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2017-05-12 17:25:50 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2017-05-12 17:25:50 +0200
commit891f99fe81b5c4584dbf01f7fa9605aac28e5aaf (patch)
tree7ab2940939c593ff9a2aaa38a28f069c6a1015d0 /mgaapplet
parent0874e4d6f385d61b3b2012a41f5dbc46728579e2 (diff)
downloadmgaonline-891f99fe81b5c4584dbf01f7fa9605aac28e5aaf.tar
mgaonline-891f99fe81b5c4584dbf01f7fa9605aac28e5aaf.tar.gz
mgaonline-891f99fe81b5c4584dbf01f7fa9605aac28e5aaf.tar.bz2
mgaonline-891f99fe81b5c4584dbf01f7fa9605aac28e5aaf.tar.xz
mgaonline-891f99fe81b5c4584dbf01f7fa9605aac28e5aaf.zip
Correctly detect right-clicks before the first check for updates (mga#20540)
It uses exactly the same code as net_applet, see 20410
Diffstat (limited to 'mgaapplet')
-rwxr-xr-xmgaapplet15
1 files changed, 15 insertions, 0 deletions
diff --git a/mgaapplet b/mgaapplet
index a0ac9048..2f996598 100755
--- a/mgaapplet
+++ b/mgaapplet
@@ -185,6 +185,11 @@ if ($ENV{DESKTOP_SESSION} =~ /plasma$/i) {
$icon->set_title('mgaapplet');
$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#20540)
+ $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;
@@ -227,6 +232,16 @@ shouldStart() or die "$localfile should be set to TRUE: please use --force or -f
go2State('delayed');
+# NOTE: Must be called after go2State() above to make sure that
+# the menu has already been created, else set_context_menu() will complain.
+# When mgaapplet is launched automatically when opening a new session, there
+# 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#20540).
+Glib::Timeout->add(100, sub { $icon->set_context_menu($menu); 0 }) if $is_plasma;
+
Glib::Timeout->add_seconds($config{FIRST_CHECK_DELAY}/1000, sub {
POSIX::sigprocmask(SIG_UNBLOCK, POSIX::SigSet->new(SIGCHLD));
$SIG{CHLD} = \&harvester;