[gnome-builder/wip/chergert/debugger: 95/106] debugger: add IdeDebugger::log



commit 8b1b80fa1577531226d2a0c945d99efdf3db7db6
Author: Christian Hergert <chergert redhat com>
Date:   Sun Mar 26 17:46:55 2017 -0700

    debugger: add IdeDebugger::log
    
    This signal can be used by debuggers to pass on informative information
    from the debugger to the user.

 libide/debugger/ide-debugger.c |   27 +++++++++++++++++++++++++++
 libide/debugger/ide-debugger.h |    4 ++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libide/debugger/ide-debugger.c b/libide/debugger/ide-debugger.c
index 81cc880..249d9df 100644
--- a/libide/debugger/ide-debugger.c
+++ b/libide/debugger/ide-debugger.c
@@ -28,6 +28,7 @@
 G_DEFINE_INTERFACE (IdeDebugger, ide_debugger, IDE_TYPE_OBJECT)
 
 enum {
+  LOG,
   STOPPED,
   N_SIGNALS
 };
@@ -76,6 +77,22 @@ ide_debugger_default_init (IdeDebuggerInterface *iface)
                                                              (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
 
   /**
+   * IdeDebugger:log:
+   * @self: A #IdeDebugger
+   * @message: the log message
+   *
+   * The "log" signal is emitted when the debugger has informative information
+   * to display to the user.
+   */
+  signals [LOG] =
+    g_signal_new ("log",
+                  G_TYPE_FROM_INTERFACE (iface),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (IdeDebuggerInterface, log),
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+  /**
    * IdeDebugger::stopped:
    * @self: An #IdeDebugger
    * @reason: An #IdeDebuggerStopReason for why the stop occurred
@@ -183,3 +200,13 @@ ide_debugger_run (IdeDebugger        *self,
   if (IDE_DEBUGGER_GET_IFACE (self)->run)
     IDE_DEBUGGER_GET_IFACE (self)->run (self, run_type);
 }
+
+void
+ide_debugger_emit_log (IdeDebugger *self,
+                       const gchar *message)
+{
+  g_return_if_fail (IDE_IS_DEBUGGER (self));
+
+  if (message != NULL)
+    g_signal_emit (self, signals [LOG], 0, message);
+}
diff --git a/libide/debugger/ide-debugger.h b/libide/debugger/ide-debugger.h
index ac103ba..843920a 100644
--- a/libide/debugger/ide-debugger.h
+++ b/libide/debugger/ide-debugger.h
@@ -59,6 +59,8 @@ struct _IdeDebuggerInterface
                                 IdeRunner              *runner);
   void      (*run)             (IdeDebugger            *self,
                                 IdeDebuggerRunType      run_type);
+  void      (*log)             (IdeDebugger            *self,
+                                const gchar            *message);
 };
 
 gchar    *ide_debugger_get_name        (IdeDebugger           *self);
@@ -69,6 +71,8 @@ void      ide_debugger_prepare         (IdeDebugger           *self,
                                         IdeRunner             *runner);
 void      ide_debugger_run             (IdeDebugger           *self,
                                         IdeDebuggerRunType     run_type);
+void      ide_debugger_emit_log        (IdeDebugger           *self,
+                                        const gchar           *message);
 void      ide_debugger_emit_stopped    (IdeDebugger           *self,
                                         IdeDebuggerStopReason  reason,
                                         IdeSourceLocation     *location);


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