summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--NEWS6
-rwxr-xr-xmgaapplet15
2 files changed, 19 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 930f902c..7326332d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
-- correctly display the application logo in the 'About' dialog box
-- fix broken paths to drakconnect and drakrpm-editmedia
+- mgaapplet:
+ o correctly detect right-clicks before the first check for updates (mga#20540)
+ o correctly display the application logo in the 'About' dialog box
+ o fix broken paths to drakconnect and drakrpm-editmedia
Version 3.20 - 13 March 2017, Rémi Verschelde
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;