From 0a901ba3e651a70984e980f61619b005031a71f0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 30 Sep 2009 13:10:22 +0200 Subject: abrt-gui: make "report" toolbar button work even if abrtd is not running Signed-off-by: Denys Vlasenko --- src/Gui/CCDBusBackend.py | 23 ++++++++++++++++------- src/Gui/CCMainWindow.py | 9 +++++---- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index c1134882..32310203 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -125,12 +125,17 @@ class DBusManager(gobject.GObject): # when abrtd is autostarted by dbus-daemon: connect_to_daemon() would install # duplicate signal handlers! def owner_changed_cb(self,name, old_owner, new_owner): - if(name == CC_NAME and new_owner): - #self.proxy = self.connect_to_daemon() - self.emit("daemon-state-changed", "up") - if(name == CC_NAME and not(new_owner)): - #self.proxy = None - self.emit("daemon-state-changed", "down") + if name == CC_NAME: + # No need to connect at once, we can do it when we need it + # (and this "connect on demand" mode of operation is needed + # anyway if abrtd is autostarted by dbus: before we call it, + # there is no abrtd to connect to!) + if new_owner: + #self.proxy = self.connect_to_daemon() + self.emit("daemon-state-changed", "up") + else: + #self.proxy = None + self.emit("daemon-state-changed", "down") def connect_to_daemon(self): @@ -176,7 +181,11 @@ class DBusManager(gobject.GObject): # we don't need the return value, as the job_id is sent via JobStarted signal self.cc.CreateReport(UUID, timeout=60) except dbus.exceptions.DBusException, e: - raise Exception(e) + # One case when it fails is if abrtd exited and needs to be + # autostarted by dbus again. (This is a first stab + # at making it work in this case, I want to find a better way) + self.connect_to_daemon() + self.cc.CreateReport(UUID, timeout=60) def Report(self, report, reporters_settings = None): # map < Plguin_name vec > diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index a9976a37..9bfc9500 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -130,10 +130,11 @@ class MainWindow(): def on_daemon_state_changed_cb(self, widget, state): if state == "up": - self.hydrate() - self.window.set_sensitive(True) - elif state == "down": - self.window.set_sensitive(False) + self.hydrate() # refresh crash list + #self.window.set_sensitive(True) + # abrtd might just die on timeout, it's not fatal + #elif state == "down": + # self.window.set_sensitive(False) def on_popupActivate(self, widget, event): menu = self.wTree.get_widget("popup_menu") -- cgit