summaryrefslogtreecommitdiffstats
path: root/mgaapplet
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-01-22 18:40:30 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-01-22 19:27:21 +0100
commit87813dd7cfa302347b06cd9b0675d18577a2be11 (patch)
tree1ccde59cc52a4d8c42a402f49b836864db02200e /mgaapplet
parent4e396b0d14b639eca27a94196cbd9a4e9595016c (diff)
downloadmgaonline-87813dd7cfa302347b06cd9b0675d18577a2be11.tar
mgaonline-87813dd7cfa302347b06cd9b0675d18577a2be11.tar.gz
mgaonline-87813dd7cfa302347b06cd9b0675d18577a2be11.tar.bz2
mgaonline-87813dd7cfa302347b06cd9b0675d18577a2be11.tar.xz
mgaonline-87813dd7cfa302347b06cd9b0675d18577a2be11.zip
better fix for mga#12280 while fixing exit reported by Colin
previous fixes for mga#12280 resulted in Colin reporting mgaapplet exiting (not segfaulting): "When updates a bubble pops up: - If you click on the background of this bubble, mgaaplet exits - If you click on the "Install Updates" button, it pops up the password dialog. Without touching anything, about 1s later the dialog seems to be replaced with another that says "Sorry, that didn't work, please try again". When this dialog appears, mgaapplet exits." So let's clean the pile of fixes and: - have only _one_ gtk+ main loop - creating _one_ hidden notification before entering the main loop - never destroy it, but use >close + >clear_actions() then ->update() prior calling >show() when one need to show a notification again
Diffstat (limited to 'mgaapplet')
-rwxr-xr-xmgaapplet22
1 files changed, 10 insertions, 12 deletions
diff --git a/mgaapplet b/mgaapplet
index 2ad9e441..8d4deaa2 100755
--- a/mgaapplet
+++ b/mgaapplet
@@ -223,7 +223,7 @@ $SIG{HUP} = \&restart_applet;
run_program::raw({ detach => 1 }, 'ionice', '-p', $$, '-n7');
-
+my $bubble = Gtk3::Notify::Notification->new('', '');
Gtk3->main;
ugtk3::exit(0);
@@ -616,6 +616,7 @@ sub go2State {
my ($state) = @_;
$menu->destroy if $menu;
$menu = setState($state);
+ warn ">> GOING FROM $state_global to $state\n";
$state_global = $state;
gtkflush();
}
@@ -667,34 +668,31 @@ sub setState {
gtkflush(); # so that bubbles are displayed on right icon
if ($state{$state}{tt}[0] && $icon->isa('Gtk3::StatusIcon') && !$state{$state}{do_not_use_bubble}) {
- my $bubble = Gtk3::Notify::Notification->new(N("Warning"), formatAlaTeX(translate($state{$state}{tt}[0])) . "\n",
+ $bubble->clear_actions;
+ $bubble->update(N("Warning"), formatAlaTeX(translate($state{$state}{tt}[0])) . "\n",
'/usr/share/icons/mgaonline.png');
if ($state eq 'new_distribution') {
- $bubble->add_action('upgrade', N("More Information"), sub { upgrade(); Gtk3->main_quit });
- $bubble->signal_connect('closed' => \&Gtk3::main_quit);
+ $bubble->add_action('upgrade', N("More Information"), sub { upgrade() });
if ($sub_state eq 'updates') {
push @arr, 'update';
}
} elsif ($state eq 'no_more_supported') {
- $bubble->add_action('no_more', N("More Information"), sub { no_more_supported(); Gtk3->main_quit });
- $bubble->signal_connect('closed' => \&Gtk3::main_quit);
+ $bubble->add_action('no_more', N("More Information"), sub { no_more_supported() });
if ($sub_state eq 'updates') {
push @arr, 'update';
}
} elsif ($state eq 'updates') {
unshift @arr, 'upgrade_distro' if $new_distro;
- $bubble->add_action('updates', N("Install updates"), sub { installUpdates(); Gtk3->main_quit });
- $bubble->signal_connect('closed' => \&Gtk3::main_quit);
+ $bubble->add_action('updates', N("Install updates"), sub { installUpdates() });
} elsif (member($state, qw(no_enabled_medium no_update_medium))) {
- $bubble->add_action('add_med', N("Add media"), sub { add_media(); Gtk3->main_quit });
- $bubble->signal_connect('closed' => \&Gtk3::main_quit);
+ $bubble->add_action('add_med', N("Add media"), sub { add_media() });
}
$bubble->set_urgency($state{$state}{urgency}) if $state{$state}{urgency};
my $timeout = 5000;
$bubble->set_timeout($timeout);
- Glib::Timeout->add($timeout, sub { Gtk3->main_quit; 0 });
- eval { $bubble->show; Gtk3->main };
+ Glib::Timeout->add($timeout, sub { $bubble->close; 0 });
+ eval { $bubble->show };
warn ">> ERR:$@" if $@;
}