[gst-debugger] handle error message in a client



commit 337c9fe8e37669cdef2c3c091a9417b6e08dc7e3
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Wed Oct 11 23:00:11 2017 +0100

    handle error message in a client

 src/gst-debugger/addins/addins-notifier.h  |    5 +++--
 src/gst-debugger/controller/controller.cpp |    2 ++
 src/gst-debugger/modules/main_module.cpp   |   11 +++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gst-debugger/addins/addins-notifier.h b/src/gst-debugger/addins/addins-notifier.h
index 28fbd12..62e552f 100644
--- a/src/gst-debugger/addins/addins-notifier.h
+++ b/src/gst-debugger/addins/addins-notifier.h
@@ -22,8 +22,9 @@ public:
        sigc::signal<void, const GstDebugger::QueryInfo&> on_query_received;
        sigc::signal<void, const GstDebugger::BufferInfo&> on_buffer_received;
        sigc::signal<void, const GstDebugger::EventInfo&> on_event_received;
-       sigc::signal<void, const GstDebugger::MessageInfo&> on_message_received;
-       sigc::signal<void, const GstDebugger::LogInfo&> on_log_received;
+    sigc::signal<void, const GstDebugger::MessageInfo&> on_message_received;
+    sigc::signal<void, const GstDebugger::LogInfo&> on_log_received;
+    sigc::signal<void, const GstDebugger::ServerError&> on_error_received;
 };
 
 }
diff --git a/src/gst-debugger/controller/controller.cpp b/src/gst-debugger/controller/controller.cpp
index 64ef48d..61b3ce2 100644
--- a/src/gst-debugger/controller/controller.cpp
+++ b/src/gst-debugger/controller/controller.cpp
@@ -107,6 +107,8 @@ void Controller::process_frame(const GstDebugger::GStreamerData &data)
        case GstDebugger::GStreamerData::kLogInfo:
                on_log_received(data.log_info());
                break;
+    case GstDebugger::GStreamerData::kServerError:
+        on_error_received(data.server_error());
     case GstDebugger::GStreamerData::INFO_TYPE_NOT_SET:
         // TODO: error
         break;
diff --git a/src/gst-debugger/modules/main_module.cpp b/src/gst-debugger/modules/main_module.cpp
index 8d59005..d152339 100644
--- a/src/gst-debugger/modules/main_module.cpp
+++ b/src/gst-debugger/modules/main_module.cpp
@@ -17,6 +17,8 @@
 #include "controller/controller.h"
 #include "controller/element_path_processor.h"
 
+#include <glibmm/i18n.h>
+
 MainModule::MainModule(const Glib::RefPtr<Gtk::Builder> &builder)
 {
        builder->get_widget("mainListTreeView", list_tree_view);
@@ -77,6 +79,15 @@ void MainModule::set_controller(const std::shared_ptr<Controller> &controller)
                m.second.display_module->set_controller(controller);
                m.second.control_module->set_controller(controller);
        }
+
+    controller->on_frame_received.connect([] (const GstDebugger::GStreamerData& data) {
+        if (data.info_type_case() == GstDebugger::GStreamerData::kServerError)
+        {
+            Gtk::MessageDialog dialog(_("Error"));
+            dialog.set_secondary_text(data.server_error().error_message());
+            dialog.run();
+        }
+    });
 }
 
 void MainModule::update_module(const MainModuleInfo &module_info)


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