From 4aa26f7373ccaadfd0a47198975afe6bbef5cd1d Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Mon, 24 Aug 2009 17:35:50 +0200 Subject: LOGGER: return valid uri of the log file on succes --- lib/Plugins/Logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index fc96dcac..72e00880 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -135,7 +135,7 @@ std::string CLogger::Report(const map_crash_report_t& pCrashReport, const std::s { throw CABRTException(EXCEP_PLUGIN, "CLogger::Report(): Cannot open file: " + m_sLogPath); } - return "Report was stored into: " + m_sLogPath; + return "file://" + m_sLogPath; } PLUGIN_INFO(REPORTER, -- cgit From d4a40899c270d825ff5d602fcdd5941b3fd7bd77 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Mon, 24 Aug 2009 17:37:03 +0200 Subject: GUI: few improvements, to be more userfriendly --- src/Gui/CCDump.py | 7 ++ src/Gui/CCMainWindow.py | 12 ++- src/Gui/CC_gui_functions.py | 9 +- src/Gui/ccgui.glade | 212 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 235 insertions(+), 5 deletions(-) diff --git a/src/Gui/CCDump.py b/src/Gui/CCDump.py index feb294a4..6993598e 100644 --- a/src/Gui/CCDump.py +++ b/src/Gui/CCDump.py @@ -15,6 +15,7 @@ class Dump(): self.Package = None self.Time = None self.Description = None + self.Message = None self.Reported = None def getUUID(self): @@ -34,6 +35,12 @@ class Dump(): def isReported(self): return self.Reported[CONTENT] == "1" + + def getMessage(self): + if not self.Message: + return [] + #return self.Message[CONTENT].split('\n') + return self.Message[CONTENT] def getTime(self,format): #print format diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index 7ae31775..e96db2bf 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -42,7 +42,7 @@ class MainWindow(): self.wTree = gtk.glade.XML(self.gladefile) #Get the Main Window, and connect the "destroy" event - self.window = self.wTree.get_widget("main_window2") + self.window = self.wTree.get_widget("main_window3") self.window.set_default_size(700, 480) if (self.window): self.window.connect("delete_event", self.delete_event_cb) @@ -203,6 +203,16 @@ class MainWindow(): # this should work until we keep the row object in the last position dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]), dumpsListStore.get_n_columns()-1) #move this to Dump class + if dump.isReported(): + report_label = "This crash has been reported, you can find the report(s) at:\n" + for message in dump.getMessage().split('\n'): + if message: + if "http" in message or "file:///" in message: + message = "%s" % (message, message) + report_label += "%s\n" % message + self.wTree.get_widget("lReported").set_markup(report_label) + else: + self.wTree.get_widget("lReported").set_markup("Not reported!") lPackage = self.wTree.get_widget("lPackage") self.wTree.get_widget("lDescription").set_label(dump.getDescription()) diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index 6e44160f..5a1d3541 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -2,7 +2,8 @@ import gtk import subprocess import sys -# url markup is supported from gtk 2.18 so we need to use libsexy +# url markup is supported from gtk 2.17 so we need to use libsexy +# FIXME: make a new branch for rawhide with gtk 2.17 and remove this if gtk.gtk_version[1] < 17: from sexy import UrlLabel as Label on_url_clicked_signal = "url-activated" @@ -51,9 +52,11 @@ def gui_report_dialog ( report_status_dict, parent_dialog, if report_status_dict[plugin][0] == '0': status_label.set_markup("%s" % report_status_dict[plugin][1]) elif report_status_dict[plugin][0] == '1': - if "http" in report_status_dict[plugin][1] or report_status_dict[plugin][1][0] == '/': + if "http" in report_status_dict[plugin][1] or "file://" in report_status_dict[plugin][1]: status_label.set_markup("%s" % (report_status_dict[plugin][1], report_status_dict[plugin][1])) - status_label.connect(on_url_clicked_signal, on_url_clicked) + # FIXME: make a new branch for rawhide with gtk 2.17 and remove this + if gtk.gtk_version[1] < 17: + status_label.connect(on_url_clicked_signal, on_url_clicked) else: status_label.set_text("%s" % report_status_dict[plugin][1]) status_vbox.pack_start(status_hbox, expand=False) diff --git a/src/Gui/ccgui.glade b/src/Gui/ccgui.glade index e063ec4d..80655ff5 100644 --- a/src/Gui/ccgui.glade +++ b/src/Gui/ccgui.glade @@ -1,6 +1,6 @@ - + Automatic Bug Reporting Tool @@ -292,4 +292,214 @@ Zdenek Prikryl <zprikryl@redhat.com> + + Automatic Bug Reporting Tool + center + + + True + vertical + + + True + + + True + _File + True + + + True + + + gtk-quit + True + True + True + + + + + + + + + True + _Edit + True + + + True + + + gtk-preferences + True + True + True + + + + + + + + + True + _Help + True + + + True + + + gtk-about + True + True + True + + + + + + + + + False + 0 + + + + + True + + + True + False + Delete + gtk-delete + + + False + True + + + + + True + False + Report + gtk-save + + + False + True + + + + + True + + + False + True + + + + + False + 1 + + + + + True + True + automatic + automatic + + + True + True + + + + + 2 + + + + + True + + + True + 0.05000000074505806 + <span color="white">Description</span> + True + + + + + False + 3 + + + + + True + vertical + + + True + True + automatic + automatic + + + True + queue + + + True + 0.10000000149011612 + 0.20000000298023224 + True + + + + + + + 0 + + + + + True + <b>Not reported!</b> + True + fill + + + 1 + + + + + 4 + + + + + True + 2 + + + False + 5 + + + + + -- cgit From ffb9d48d975cab3683bbbf9f94e0eacefcf4ce5b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 24 Aug 2009 18:08:21 +0200 Subject: separate DBus::Glib::BusDispatcher creating from CommLayerServerDBus creation it's technically wrong to do it that way. It was not biting us because we were creating just one object, but it was also ugly. Signed-off-by: Denys Vlasenko --- src/Daemon/CommLayerServerDBus.cpp | 13 +++++++++---- src/Daemon/CommLayerServerDBus.h | 6 +++++- src/Daemon/Daemon.cpp | 11 +++++++---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index 7fa4fb65..f0a9149b 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -1,12 +1,18 @@ +#include "abrtlib.h" #include "CommLayerServerDBus.h" #include #include "ABRTException.h" +void attach_dbus_dispatcher_to_glib_main_context() +{ + DBus::Glib::BusDispatcher* dispatcher; + dispatcher = new DBus::Glib::BusDispatcher(); + dispatcher->attach(NULL); + DBus::default_dispatcher = dispatcher; +} + DBus::Connection *CCommLayerServerDBus::init_dbus(CCommLayerServerDBus *self) { - self->m_pDispatcher = new DBus::Glib::BusDispatcher(); - self->m_pDispatcher->attach(NULL); - DBus::default_dispatcher = self->m_pDispatcher; self->m_pConn = new DBus::Connection(DBus::Connection::SystemBus()); return self->m_pConn; } @@ -31,7 +37,6 @@ CCommLayerServerDBus::CCommLayerServerDBus() CCommLayerServerDBus::~CCommLayerServerDBus() { - delete m_pDispatcher; } vector_crash_infos_t CCommLayerServerDBus::GetCrashInfos(const std::string &pSender) diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h index fe95d5ca..ad245061 100644 --- a/src/Daemon/CommLayerServerDBus.h +++ b/src/Daemon/CommLayerServerDBus.h @@ -13,7 +13,6 @@ class CCommLayerServerDBus { private: DBus::Connection *m_pConn; - DBus::Glib::BusDispatcher *m_pDispatcher; static DBus::Connection *init_dbus(CCommLayerServerDBus *self); public: CCommLayerServerDBus(); @@ -44,3 +43,8 @@ class CCommLayerServerDBus virtual void Warning(const std::string& pDest, const std::string& pMessage); }; +/* + * This must be done before instances of CCommLayerServerDBus are created + * (otherwise "new DBus::Connection(DBus::Connection::SystemBus())" fails) + */ +void attach_dbus_dispatcher_to_glib_main_context(); diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 47a963cf..81484d16 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -522,7 +522,6 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe int main(int argc, char** argv) { - GIOChannel* pGio; int daemonize = 0; signal(SIGTERM, handle_fatal_signal); @@ -565,6 +564,7 @@ int main(int argc, char** argv) xdup(0); } + GIOChannel* pGio = NULL; CCrashWatcher watcher; /* Initialization */ @@ -592,6 +592,7 @@ int main(int argc, char** argv) FindNewDumps(DEBUG_DUMPS_DIR); /* (comment here) */ #ifdef ENABLE_DBUS + attach_dbus_dispatcher_to_glib_main_context(); g_pCommLayer = new CCommLayerServerDBus(); #elif ENABLE_SOCKET g_pCommLayer = new CCommLayerServerSocket(); @@ -616,9 +617,11 @@ int main(int argc, char** argv) catch (...) { /* Initialization error. Clean up, in reverse order */ + error_msg("error while initializing daemon"); unlink(VAR_RUN_PIDFILE); unlink(VAR_RUN_LOCK_FILE); - g_io_channel_unref(pGio); + if (pGio) + g_io_channel_unref(pGio); delete g_pCommLayer; /* This restores /proc/sys/kernel/core_pattern, among other things: */ g_pPluginManager->UnLoadPlugins(); @@ -631,8 +634,8 @@ int main(int argc, char** argv) } /* Inform parent that initialization failed */ if (daemonize) - kill(getppid(), SIGINT); - error_msg_and_die("error while initializing daemon, exiting"); + kill(getppid(), SIGINT); + error_msg_and_die("exiting"); } /* Inform parent that we initialized ok */ -- cgit