diff --git a/wicd/gui.py b/wicd/gui.py index 7d9bbe7..91a685a 100644 --- a/wicd/gui.py +++ b/wicd/gui.py @@ -84,24 +84,28 @@ def handle_no_dbus(from_tray=False): DBUS_AVAIL = False if from_tray: return False print "Wicd daemon is shutting down!" - error(None, "The wicd daemon has shut down, the UI will not function properly until it is restarted.") + error(None, language['lost_dbus'], block=False) return False - -def error(parent, message): + +def error(parent, message, block=True): """ Shows an error dialog """ dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK) dialog.set_markup(message) - dialog.run() - dialog.destroy() + if not block: + dialog.present() + dialog.connect("response", lambda *args: dialog.destroy()) + else: + dialog.run() + dialog.destroy() def alert(parent, message): - """ Shows an error dialog """ + """ Shows an warning dialog """ dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK) dialog.set_markup(message) - dialog.run() - dialog.destroy() + dialog.present() + dialog.connect("response", lambda *args: dialog.destroy()) def dummy(x=None):pass diff --git a/wicd/misc.py b/wicd/misc.py index a3c01e2..a65fc4e 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -511,6 +511,7 @@ def get_language_list_gui(): language['cannot_start_daemon'] = _("Unable to connect to wicd daemon DBus interface." + \ "This typically means there was a problem starting the daemon." + \ "Check the wicd log for more info") + language['lost_dbus'] = _("The wicd daemon has shut down, the UI will not function properly until it is restarted.") return language @@ -536,6 +537,7 @@ def get_language_list_tray(): "This typically means there was a problem starting the daemon." + \ "Check the wicd log for more info") language['no_daemon_tooltip'] = _("Wicd daemon unreachable") + language['lost_dbus'] = _("The wicd daemon has shut down, the UI will not function properly until it is restarted.") return language def noneToBlankString(text): diff --git a/wicd/wicd-client.py b/wicd/wicd-client.py index 37528ae..40114de 100755 --- a/wicd/wicd-client.py +++ b/wicd/wicd-client.py @@ -673,8 +673,7 @@ def handle_no_dbus(): DBUS_AVAIL = False gui.handle_no_dbus(from_tray=True) print "Wicd daemon is shutting down!" - gui.error(None, "The wicd daemon has shut down, the UI will not function " + - "properly until it is restarted.") + gui.error(None, language['lost_dbus'], block=False) return False def main(argv): diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 4b2e8c5..150d81e 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1571,7 +1571,10 @@ def sigterm_caught(sig=None, frame=None): global child_pid if child_pid: print 'Daemon going down, killing wicd-monitor...' - os.kill(child_pid, signal.SIGTERM) + try: + os.kill(child_pid, signal.SIGTERM) + except OSError: + pass print 'Removing PID file...' if os.path.exists(wpath.pidfile): os.remove(wpath.pidfile)