From a56262448a11bb90d558c3f69e955cf595896398 Mon Sep 17 00:00:00 2001 From: morty Date: Thu, 8 Jul 2010 08:47:08 +0200 Subject: [PATCH 1/1] Added tray and icon --- snom.ico | Bin 0 -> 5430 bytes snom.pl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 snom.ico diff --git a/snom.ico b/snom.ico new file mode 100644 index 0000000000000000000000000000000000000000..7639919065f98c90843ac53bc5698855490061b0 GIT binary patch literal 5430 zcmcgtL2eU45bR}?N99?XIR-U8e*~M!TSEjJ~EFU`QJKw&+i{AyUg)x3}fNbe4eEk z+^2^Y#!O)&=F3}q#yooFs^=L!aB-g2T~lK&U$rYg*5sytjQlbEWBlI!UA?pC)J@O& z_^lqeJcoxaJ=Z?vun~(q;H0@cQ~Vr8ju*Mgtr%GAJmm7Ha#JkLAI~%U9n5wYX4f0D z&3Uw&Xgjlud&3%b9`~=~`EF+RXKog{<2$pAFU#v_c#p>Za@wZ$(0A|KF@;le20rvj z?;GoMmTE9PvEO@Sf4iC4N zpE`i)sXy%_^K;%)zvh)RjJ;=yfi-)obLQ1OrNM)NeC1_NJ-Ms{zY*rCM_r7`d7S6C zi2>Xa2K&bxdf?_bbq_T%e#)aqnwMLrSf&1zYF9m|rPPOX4oaGVryQkqsUGx1@3O?7 z>Mil-{?AYELFe$){Lojr1D%0VY;FCu{Etz82~+DY#Xh9|5@rp5?fj$vHT;;xbUxE> z%yen)^}IAwTEFMb(0Jv^t!saOz$o<#{m|cRj+cATn)Xk>(Hnh#kmu113}C0Z7o}alHIv z_paPrm+rEbzlNI{;L!`@rZv{^Ka^W_pdaAGy#o)rc%EwGU1MK$GXB(F`LTw+|G~>T z&=VLq(I@UZeF(c4`6-0E=4UuGL)bUN`nDOm?QB?V7sEXMI~%(Fy&c+NeYF0czl-0| mI#}F~wp~P1t;`7k literal 0 HcmV?d00001 diff --git a/snom.pl b/snom.pl index 6f580ab..3ee79da 100755 --- a/snom.pl +++ b/snom.pl @@ -201,7 +201,55 @@ $mainbox->show(); +######################################################### +# +# Tray Icon +# +######################################################### +sub quit_cb { + my ($widget, $status_icon) = @_; + + $status_icon->set_visible(0) if $status_icon; + Gtk2->main_quit(); +} + +sub popup_menu_cb { + my ($widget, $button, $time, $menu) = @_; + + if ($button == 3) { + my ($x, $y, $push_in) + = Gtk2::StatusIcon::position_menu($menu, $widget); + + $menu->show_all(); + $menu->popup( undef, undef, + sub{return ($x,$y,0)} , + undef, 0, $time ); + } +} + +sub activate_icon_cb { + if ($window->visible){ + $window->hide(); + } else { + $window->show(); + } +} + +my $status_icon = Gtk2::StatusIcon->new_from_file('snom.ico'); +my $menu = Gtk2::Menu->new(); + +my $menuItem = Gtk2::ImageMenuItem->new_from_stock('gtk-quit'); +$menuItem->signal_connect('activate', \&quit_cb, $status_icon); +$menu->append($menuItem); + +$status_icon->set_tooltip(" Snom Tray "); +$status_icon->signal_connect('activate', \&activate_icon_cb); +$status_icon->signal_connect('popup-menu', \&popup_menu_cb, $menu); +$status_icon->set_visible(1); +########################################################################333 + $window->add($mainbox); +$window->set_icon_from_file('snom.ico'); $window->show(); $g_key{OK}->grab_focus(); -- 2.39.5