summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rwxr-xr-xbin/net_applet29
2 files changed, 21 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 8484f4f..476f251 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
- fix "unescaped left brace" warnings in perl-5.22+.
- log dbus errors
+- stop using Gtk3::Notify::Queue as it's broken
2.22
- draknfs, draksambashare:
diff --git a/bin/net_applet b/bin/net_applet
index 1762309..2f0e0ba 100755
--- a/bin/net_applet
+++ b/bin/net_applet
@@ -39,7 +39,7 @@ use mygtk3 qw(gtknew gtkset);
use common;
our ($current_state, $current_interface);
-our ($icon, $notification_queue);
+our $icon;
our $dbus;
our ($interactive_cb, $ifw, $ifw_alert);
@@ -251,8 +251,6 @@ if ($dbus) {
dbus_object::set_gtk3_watch_helper($dbus);
}
-$notification_queue = Gtk3::Notify::Queue->new($icon);
-
$icon->signal_connect(activate => sub {
my ($_icon, $button, $time) = @_;
if ($ifw_alert) {
@@ -438,14 +436,27 @@ sub go2State {
$current_interface = $interface;
$need_update = 1;
}
+ my $show;
if ($current_state ne $state_type) {
- my $show = defined $current_state && $state_type ne 'connecting'; # don't show notification at applet startup and when establishing a connection
+ $show = defined $current_state && $state_type ne 'connecting'; # don't show notification at applet startup and when establishing a connection
$current_state = $state_type;
- $notification_queue->add({
- title => $old_description || $current_description || N("Network connection"),
- pixbuf => network::net_applet::get_state_pixbuf(1) || network::net_applet::get_state_pixbuf(),
- message => get_state_message($old_interface || $current_interface),
- }) if $show;
+ }
+ if ($show) {
+ my $msg;
+ my $ic = $icon; # fix stringification (WTF????)
+ my $bubble = Gtk3::Notify::Notification->new(
+ $old_description || $current_description || N("Network connection"),
+ get_state_message($old_interface || $current_interface),
+ $ic);
+ my $pixbuf = network::net_applet::get_state_pixbuf(1) || network::net_applet::get_state_pixbuf();
+ $bubble->set_icon_from_pixbuf($pixbuf) if $pixbuf;
+
+ my $timeout = 5000;
+ $bubble->set_timeout($timeout);
+ # both need to be in a eval block in case notification daemon isn't running:
+ Glib::Timeout->add($timeout, sub { eval { $bubble->close }; 0 });
+ eval { $bubble->show };
+ warn ">> ERR:$@" if $@;
$need_update = 1;
}