]> git.zerfleddert.de Git - snom-frontend/commitdiff
Hide on minimize
authormorty <morty@cs.fau.de>
Wed, 17 Nov 2010 10:46:15 +0000 (11:46 +0100)
committermorty <morty@cs.fau.de>
Wed, 17 Nov 2010 10:46:15 +0000 (11:46 +0100)
snom.pl [changed mode: 0755->0644]

diff --git a/snom.pl b/snom.pl
old mode 100755 (executable)
new mode 100644 (file)
index 608e62f..bc0cdac
--- a/snom.pl
+++ b/snom.pl
@@ -113,6 +113,8 @@ my $window = Gtk2::Window->new('toplevel');
 $window->set_title("snom");
 $window->signal_connect(delete_event => \&CloseAppWindow);   
 $window->signal_connect(destroy => sub { Gtk2->main_quit; });
 $window->set_title("snom");
 $window->signal_connect(delete_event => \&CloseAppWindow);   
 $window->signal_connect(destroy => sub { Gtk2->main_quit; });
+
+
 my $kphandler = $window->signal_connect(key_press_event => \&KBDInput);
 $window->set_border_width(15);
 $window->set_resizable(FALSE);
 my $kphandler = $window->signal_connect(key_press_event => \&KBDInput);
 $window->set_border_width(15);
 $window->set_resizable(FALSE);
@@ -234,6 +236,15 @@ sub activate_icon_cb {
        }
 }
 
        }
 }
 
+sub minimize_to_try{
+       my ($w, $event) = @_;
+       if ($event->changed_mask & [ 'iconified', ]){
+               $window->hide();
+               # Needs to be deiconified after hiding, otherwise show will not behave as expected.
+               $window->deiconify();
+       }
+}
+
 my $status_icon = Gtk2::StatusIcon->new_from_file($Bin.'/snom.ico');
 my $menu = Gtk2::Menu->new();
 
 my $status_icon = Gtk2::StatusIcon->new_from_file($Bin.'/snom.ico');
 my $menu = Gtk2::Menu->new();
 
@@ -245,6 +256,9 @@ $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);
 $status_icon->signal_connect('activate', \&activate_icon_cb);
 $status_icon->signal_connect('popup-menu', \&popup_menu_cb, $menu);
 $status_icon->set_visible(1);
+
+$window->signal_connect('window-state-event',\&minimize_to_try);
 ########################################################################333
 
 $window->add($mainbox);
 ########################################################################333
 
 $window->add($mainbox);
Impressum, Datenschutz