From 545890f5206022c643592c8d04251c1b3ed0f7b3 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 28 Jan 2019 20:27:20 +0000 Subject: Change $is_plasma to $is_sni - other DEs support SNI now. --- bin/net_applet | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/net_applet b/bin/net_applet index aff7561..e891b22 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -40,7 +40,7 @@ use mygtk3 qw(gtknew gtkset); use common; our ($current_state, $current_interface); -our ($icon, $is_plasma); +our ($icon, $is_sni); our $dbus; our ($interactive_cb, $ifw, $ifw_alert); @@ -68,12 +68,12 @@ sub get_state_pixbuf { sub update_tray_icon() { if (!$ifw_alert) { if (my $pixbuf = get_state_pixbuf()) { - my @args = $is_plasma ? qw(STATUS_NOTIFIER_ICON) : (); + my @args = $is_sni ? qw(STATUS_NOTIFIER_ICON) : (); push @args, $pixbuf; $icon->set_from_pixbuf(@args); } } - elsif ($is_plasma) { + elsif ($is_sni) { $icon->set_from_icon_name('STATUS_NOTIFIER_ICON', 'dialog-warning'); } else { @@ -233,7 +233,7 @@ my %actions = ( # Plasma supports SNI natively. Other DE do not. In that case, we fall back to # the deprecated GtkStatusIcon. if ($ENV{DESKTOP_SESSION} =~ /plasma$/i) { - $is_plasma = 1; + $is_sni = 1; Glib::Object::Introspection->setup( basename => 'StatusNotifier', @@ -311,7 +311,7 @@ $SIG{USR1} = sub { # 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. -Glib::Timeout->add(100, sub { $icon->set_context_menu($menu); 0 }) if $is_plasma; +Glib::Timeout->add(100, sub { $icon->set_context_menu($menu); 0 }) if $is_sni; # do not create zombies (#20552) Glib::Timeout->add_seconds(1, sub { @@ -505,7 +505,7 @@ sub update_applet() { network::net_applet::update_tray_icon(); my $message = get_state_message(); - $is_plasma ? $icon->set_tooltip("drakx-net-$current_state", 'net_applet', $message) : $icon->set_tooltip_text($message); + $is_sni ? $icon->set_tooltip("drakx-net-$current_state", 'net_applet', $message) : $icon->set_tooltip_text($message); } sub create_menu_choices { @@ -561,7 +561,7 @@ 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; + $icon->set_context_menu() if $is_sni; $menu->destroy if $menu; $menu = Gtk3::Menu->new; @@ -604,7 +604,7 @@ sub generate_menu() { $menu->append(create_action_item('help')); $menu->append(create_action_item('quit')); # As we destroyed the menu before recreating it, we need to attach it again. - $icon->set_context_menu($menu) if $is_plasma; + $icon->set_context_menu($menu) if $is_sni; } sub mainQuit() { Glib::Source->remove($timeout) if $timeout; -- cgit v1.2.1