Ticket #37: guake.py.patch

File guake.py.patch, 3.8 KB (added by pingou, 4 years ago)
  • .py

    old new  
    221221        ac = self.client.get_bool(GCONF_PATH + 'general/use_scrollbar') 
    222222        self.get_widget('show-scrollbar-checkbutton').set_active(ac) 
    223223 
     224        # tray 
     225        ac = self.client.get_bool(GCONF_PATH + 'general/use_tray') 
     226        self.get_widget('show-tray-checkbutton').set_active(ac) 
     227  
     228 
    224229        # hide on lost focus 
    225230        ac = self.client.get_bool(GCONF_PATH + 'general/hide_on_lost_focus') 
    226231        self.get_widget('hide-onlostfocus-checkbutton').set_active(ac) 
     
    343348        fbool = chk.get_active() 
    344349        self.client.set_bool(GCONF_PATH + 'general/use_scrollbar', fbool) 
    345350        self.guake.toggle_scrollbars() 
    346          
     351 
     352    def on_show_tray_checkbutton_toggled(self, chk): 
     353        fbool = chk.get_active() 
     354        self.client.set_bool(GCONF_PATH + 'general/use_tray', fbool) 
     355        self.guake.toggle_tray() 
     356 
    347357    def on_chk_lostfocus_toggled(self, chk): 
    348358        fbool = chk.get_active() 
    349359        self.client.set_bool(GCONF_PATH + 'general/hide_on_lost_focus', fbool) 
     
    574584        # setting global hotkey and showing a pretty notification =) 
    575585        globalhotkeys.init() 
    576586        key = self.client.get_string(GHOTKEYS[0][0]) 
    577         filename = common.pixmapfile('guake-notification.png') 
    578         if not globalhotkeys.bind(key, self.show_hide): 
    579             n = pynotify.Notification(_('Guake!'), 
    580                 _('A problem happened when binding <b>%s</b> key.\n' 
    581                   'Please use guake properties form to choose another ' 
    582                   'key') % key, filename) 
    583         else: 
    584             n = pynotify.Notification(_('Guake!'), 
    585                 _('Guake is already running,\n' 
    586                   'press <b>%s</b> to use it.') % key, filename) 
    587         n.show() 
    588587 
    589588        # trayicon! 
    590         tray_icon = GuakeStatusIcon() 
    591         tray_icon.connect('popup-menu', self.show_menu) 
    592         tray_icon.connect('activate', self.show_hide) 
    593         tray_icon.show_all() 
     589        ac = self.client.get_bool(GCONF_PATH + 'general/use_tray') 
     590             if ac==True: 
     591           tray_icon = GuakeStatusIcon() 
     592           tray_icon = tray_icon.set_tray() 
     593           tray_icon.connect('popup-menu', self.show_menu) 
     594           tray_icon.connect('activate', self.show_hide) 
     595           tray_icon.show_all() 
    594596 
    595597        # adding images from a different path. 
    596598        ipath = common.pixmapfile('guake.png') 
     
    641643        self.add_tab() 
    642644        self.toggle_ontop() 
    643645 
     646        # pop up that guake is working (or not) 
     647        filename = common.pixmapfile('guake-notification.png') 
     648        if not globalhotkeys.bind(key, self.show_hide): 
     649            n = pynotify.Notification(_('Guake!'), 
     650                _('A problem happened when binding <b>%s</b> key.\n' 
     651                  'Please use guake properties form to choose another ' 
     652                  'key') % key, filename) 
     653        else: 
     654            n = pynotify.Notification(_('Guake!'), 
     655                _('Guake is already running,\n' 
     656                  'press <b>%s</b> to use it.') % key, filename) 
     657 
     658        n.show() 
     659 
    644660    def on_window_lostfocus(self,window, event): 
    645661        getb = lambda x:self.client.get_bool(x) 
    646662        value = getb(GCONF_PATH+'general/hide_on_lost_focus') 
     
    849865        b = self.client.get_bool(GCONF_PATH+'general/window_ontop') 
    850866        self.window.set_keep_above(b) 
    851867 
     868    def toggle_tray(self): 
     869        b = self.client.get_bool(GCONF_PATH+'general/use_tray') 
     870        if b==False: 
     871                 try: 
     872                   tray_icon = GuakeStatusIcon() 
     873                # To be fixed does not work yet, should remove all the tray 
     874               tray_icon.hide_all() 
     875              except: 
     876                     pass 
     877 
    852878    # -- format functions -- 
    853879 
    854880    def set_bgcolor(self):