source: projects/specs/trunk/g/guake/0001-Fix-notification.patch @ 8096

Revision 8096, 2.2 KB checked in by iwaim, 10 years ago (diff)

guake 0.4.4-2

  • src/guake

    From 855be1063f201a0fcc8c37efe3c59bde17801a32 Mon Sep 17 00:00:00 2001
    From: Pierre-Yves Chibon <pingou@pingoured.fr>
    Date: Fri, 27 Jul 2012 09:40:03 +0200
    Subject: [PATCH] Fix notification
    
    With this commit we prevent guake from using the pynotify module
    if this one does not work or is not properly installed.
    ---
     src/guake |   20 +++++++++++++++++---
     1 files changed, 17 insertions(+), 3 deletions(-)
    
    diff --git a/src/guake b/src/guake
    index 6d8f9c5..9da941c 100644
    a b from guake.globals import NAME, VERSION, LOCALE_DIR, KEY, GCONF_PATH, \ 
    5454    TERMINAL_MATCH_EXPRS, TERMINAL_MATCH_TAGS, \ 
    5555    ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER 
    5656 
    57 pynotify.init('Guake!') 
     57popup_works = True 
     58if not pynotify.init('Guake!') or pynotify.get_server_info() == None : 
     59    popup_works = False 
     60    print "WARNING: could not use popup notification" 
    5861 
    5962GNOME_FONT_PATH = '/desktop/gnome/interface/monospace_font_name' 
    6063 
    class Guake(SimpleGladeApp): 
    648651                  'Please use Guake Preferences dialog to choose another ' 
    649652                  'key (The trayicon was enabled)') % label, filename) 
    650653            self.client.set_bool(KEY('/general/use_trayicon'), True) 
    651             notification.show() 
     654            if popup_works : 
     655                notification.show()  
     656            else : 
     657                print _('A problem happened when binding <b>%s</b> key.\n' 
     658                  'Please use Guake Preferences dialog to choose another ' 
     659                  'key (The trayicon was enabled)') % label 
     660 
    652661 
    653662        elif self.client.get_bool(KEY('/general/use_popup')): 
    654663            # Pop-up that shows that guake is working properly (if not 
    class Guake(SimpleGladeApp): 
    657666                _('Guake!'), 
    658667                _('Guake is now running,\n' 
    659668                  'press <b>%s</b> to use it.') % label, filename) 
    660             notification.show() 
     669            if popup_works : 
     670                notification.show() 
     671            else : 
     672                print _('Guake is now running,\n' 
     673                  'press <b>%s</b> to use it.') % label 
     674 
    661675 
    662676    def execute_command(self, command, tab=None): 
    663677        """Execute the `command' in the `tab'. If tab is None, the 
Note: See TracBrowser for help on using the repository browser.