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, \ |
54 | 54 | TERMINAL_MATCH_EXPRS, TERMINAL_MATCH_TAGS, \ |
55 | 55 | ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER |
56 | 56 | |
57 | | pynotify.init('Guake!') |
| 57 | popup_works = True |
| 58 | if not pynotify.init('Guake!') or pynotify.get_server_info() == None : |
| 59 | popup_works = False |
| 60 | print "WARNING: could not use popup notification" |
58 | 61 | |
59 | 62 | GNOME_FONT_PATH = '/desktop/gnome/interface/monospace_font_name' |
60 | 63 | |
… |
… |
class Guake(SimpleGladeApp): |
648 | 651 | 'Please use Guake Preferences dialog to choose another ' |
649 | 652 | 'key (The trayicon was enabled)') % label, filename) |
650 | 653 | 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 | |
652 | 661 | |
653 | 662 | elif self.client.get_bool(KEY('/general/use_popup')): |
654 | 663 | # Pop-up that shows that guake is working properly (if not |
… |
… |
class Guake(SimpleGladeApp): |
657 | 666 | _('Guake!'), |
658 | 667 | _('Guake is now running,\n' |
659 | 668 | '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 | |
661 | 675 | |
662 | 676 | def execute_command(self, command, tab=None): |
663 | 677 | """Execute the `command' in the `tab'. If tab is None, the |