Ticket #2932: systray.diff

File systray.diff, 2.5 kB (added by radious, 20 months ago)
  • src/systray.py

     
    285285                gajim.interface.roster.on_quit_menuitem_activate(widget) 
    286286 
    287287        def on_left_click(self): 
     288                on_left_click_recive = gajim.config.get('use_left_click_to_recive_messages') 
    288289                win = gajim.interface.roster.window 
    289                 # toggle visible/hidden for roster window 
    290                 if win.get_property('visible'): # visible in ANY virtual desktop? 
    291  
    292                         # we could be in another VD right now. eg vd2 
    293                         # and we want to show it in vd2 
    294                         if not gtkgui_helpers.possibly_move_window_in_current_desktop(win): 
    295                                 win.hide() # else we hide it from VD that was visible in 
     290                if len(gajim.events.get_systray_events()) == 0: 
     291                        #We check if there is present at least one inconming message 
     292                        #There's no need to check settings if there is not. 
     293                        #And we always change the visibility of roster 
     294                        if win.get_property('visible'): # visible in ANY virtual desktop? 
     295                                # we could be in another VD right now. eg vd2 
     296                                # and we want to show it in vd2 
     297                                if not gtkgui_helpers.possibly_move_window_in_current_desktop(win): 
     298                                        win.hide() # else we hide it from VD that was visible in 
     299                        else: 
     300                                # in Windows (perhaps other Window Managers too) minimize state 
     301                                # is remembered, so make sure it's not minimized (iconified) 
     302                                # because user wants to see roster 
     303                                win.deiconify() 
     304                                win.present() 
    296305                else: 
    297                         # in Windows (perhaps other Window Managers too) minimize state 
    298                         # is remembered, so make sure it's not minimized (iconified) 
    299                         # because user wants to see roster 
    300                         win.deiconify() 
    301                         win.present() 
     306                        if on_left_click_recive == False:                        
     307                                # use middle click to recive, so toggle visible/hidden for roster window 
     308                                if win.get_property('visible'): # visible in ANY virtual desktop? 
     309         
     310                                        # we could be in another VD right now. eg vd2 
     311                                        # and we want to show it in vd2 
     312                                        if not gtkgui_helpers.possibly_move_window_in_current_desktop(win): 
     313                                                win.hide() # else we hide it from VD that was visible in 
     314                                else: 
     315                                        # in Windows (perhaps other Window Managers too) minimize state 
     316                                        # is remembered, so make sure it's not minimized (iconified) 
     317                                        # because user wants to see roster 
     318                                        win.deiconify() 
     319                                        win.present() 
     320                        else: 
     321                                #if user prefers to recive by left click, do it 
     322                                self.handle_first_event() 
     323                                 
    302324 
    303325        def handle_first_event(self): 
    304326                account, jid, event = gajim.events.get_first_systray_event()