[8096] | 1 | From 855be1063f201a0fcc8c37efe3c59bde17801a32 Mon Sep 17 00:00:00 2001 |
---|
| 2 | From: Pierre-Yves Chibon <pingou@pingoured.fr> |
---|
| 3 | Date: Fri, 27 Jul 2012 09:40:03 +0200 |
---|
| 4 | Subject: [PATCH] Fix notification |
---|
| 5 | |
---|
| 6 | With this commit we prevent guake from using the pynotify module |
---|
| 7 | if this one does not work or is not properly installed. |
---|
| 8 | --- |
---|
| 9 | src/guake | 20 +++++++++++++++++--- |
---|
| 10 | 1 files changed, 17 insertions(+), 3 deletions(-) |
---|
| 11 | |
---|
| 12 | diff --git a/src/guake b/src/guake |
---|
| 13 | index 6d8f9c5..9da941c 100644 |
---|
| 14 | --- a/src/guake |
---|
| 15 | +++ b/src/guake |
---|
| 16 | @@ -54,7 +54,10 @@ from guake.globals import NAME, VERSION, LOCALE_DIR, KEY, GCONF_PATH, \ |
---|
| 17 | TERMINAL_MATCH_EXPRS, TERMINAL_MATCH_TAGS, \ |
---|
| 18 | ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER |
---|
| 19 | |
---|
| 20 | -pynotify.init('Guake!') |
---|
| 21 | +popup_works = True |
---|
| 22 | +if not pynotify.init('Guake!') or pynotify.get_server_info() == None : |
---|
| 23 | + popup_works = False |
---|
| 24 | + print "WARNING: could not use popup notification" |
---|
| 25 | |
---|
| 26 | GNOME_FONT_PATH = '/desktop/gnome/interface/monospace_font_name' |
---|
| 27 | |
---|
| 28 | @@ -648,7 +651,13 @@ class Guake(SimpleGladeApp): |
---|
| 29 | 'Please use Guake Preferences dialog to choose another ' |
---|
| 30 | 'key (The trayicon was enabled)') % label, filename) |
---|
| 31 | self.client.set_bool(KEY('/general/use_trayicon'), True) |
---|
| 32 | - notification.show() |
---|
| 33 | + if popup_works : |
---|
| 34 | + notification.show() |
---|
| 35 | + else : |
---|
| 36 | + print _('A problem happened when binding <b>%s</b> key.\n' |
---|
| 37 | + 'Please use Guake Preferences dialog to choose another ' |
---|
| 38 | + 'key (The trayicon was enabled)') % label |
---|
| 39 | + |
---|
| 40 | |
---|
| 41 | elif self.client.get_bool(KEY('/general/use_popup')): |
---|
| 42 | # Pop-up that shows that guake is working properly (if not |
---|
| 43 | @@ -657,7 +666,12 @@ class Guake(SimpleGladeApp): |
---|
| 44 | _('Guake!'), |
---|
| 45 | _('Guake is now running,\n' |
---|
| 46 | 'press <b>%s</b> to use it.') % label, filename) |
---|
| 47 | - notification.show() |
---|
| 48 | + if popup_works : |
---|
| 49 | + notification.show() |
---|
| 50 | + else : |
---|
| 51 | + print _('Guake is now running,\n' |
---|
| 52 | + 'press <b>%s</b> to use it.') % label |
---|
| 53 | + |
---|
| 54 | |
---|
| 55 | def execute_command(self, command, tab=None): |
---|
| 56 | """Execute the `command' in the `tab'. If tab is None, the |
---|
| 57 | -- |
---|
| 58 | 1.7.7.6 |
---|
| 59 | |
---|