+#########################################################
+#
+# 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
+