0001-Fix-notification.patch 2.2 KB

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