[caribou: 20/22] Added error dialog to caribou-daemon startup.



commit 72f755f6e1ea89bee617fb6faafa1868b07c0268
Author: Eitan Isaacson <eitan monotonous org>
Date:   Fri Apr 29 23:43:16 2011 -0700

    Added error dialog to caribou-daemon startup.

 caribou/daemon/main.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/caribou/daemon/main.py b/caribou/daemon/main.py
index 4e69740..4f3def9 100644
--- a/caribou/daemon/main.py
+++ b/caribou/daemon/main.py
@@ -16,15 +16,23 @@ class CaribouDaemon:
         try:
             dbus_obj = bus.get_object("org.gnome.Caribou.%s" % keyboard_name,
                                       "/org/gnome/Caribou/%s" % keyboard_name)
-        except dbus.DBusException:
-            raise
-            print "%s is not running, and is not provided by any .service file" % \
-                keyboard_name
-            return
+        except dbus.DBusException, e:
+            self._show_error_dialog(e.message)
         self.keyboard_proxy = dbus.Interface(dbus_obj, "org.gnome.Caribou.Keyboard")
         self._current_acc = None
         self._register_event_listeners()
 
+    def _show_error_dialog(self, message):
+        from gi.repository import Gtk
+        msgdialog = Gtk.MessageDialog(None,
+                                      Gtk.DialogFlags.MODAL,
+                                      Gtk.MessageType.ERROR,
+                                      Gtk.ButtonsType.CLOSE,
+                                      _("Error starting %s") % APP_NAME)
+        msgdialog.format_secondary_text(message)
+        msgdialog.run()
+        quit()
+
     def _show_no_a11y_dialogs(self):
         from gi.repository import Gtk
         msgdialog = Gtk.MessageDialog(None,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]