[retro-gtk/wip/aplazas/c-port: 9/25] Port g_log() to C



commit 4a9f860c14afe56010201acab7a7f7f8470110a7
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Sep 7 11:37:06 2017 +0200

    Port g_log() to C

 retro-gtk/Makefile.am |    1 +
 retro-gtk/retro-gtk.h |    1 +
 retro-gtk/retro-log.c |   13 +++++++++++++
 retro-gtk/retro-log.h |   24 ++++++++++++++++++++++++
 retro-gtk/retro.vala  |    2 --
 5 files changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index 3c97cbe..6fd90a5 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -39,6 +39,7 @@ retro_gtk_public_h_sources = \
        retro-input-device.h \
        retro-joypad-id.h \
        retro-lightgun-id.h \
+       retro-log.h \
        retro-memory-type.h \
        retro-mouse-id.h \
        retro-pixel-format.h \
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index be5a8e3..0009531 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -17,6 +17,7 @@
 #include "retro-input-device.h"
 #include "retro-joypad-id.h"
 #include "retro-lightgun-id.h"
+#include "retro-log.h"
 #include "retro-memory-type.h"
 #include "retro-mouse-id.h"
 #include "retro-pixel-format.h"
diff --git a/retro-gtk/retro-log.c b/retro-gtk/retro-log.c
index 3b14fef..27340b5 100644
--- a/retro-gtk/retro-log.c
+++ b/retro-gtk/retro-log.c
@@ -2,6 +2,19 @@
 
 #include "retro-gtk-internal.h"
 
+/**
+ * retro_g_log:
+ * @self: a #RetroCore
+ * @log_domain: (nullable): the log domain, usually #G_LOG_DOMAIN, or %NULL
+ * @log_level: the log level, either from #GLogLevelFlags or a user-defined
+ * level
+ * @message: the message to log
+ *
+ * Logs an error or debugging message.
+ *
+ * This is a convenience function to forward the log signal of #RetroCore to
+ * g_log(), see it for more information.
+ */
 void
 retro_g_log (RetroCore      *self,
              const gchar    *log_domain,
diff --git a/retro-gtk/retro-log.h b/retro-gtk/retro-log.h
new file mode 100644
index 0000000..69b2377
--- /dev/null
+++ b/retro-gtk/retro-log.h
@@ -0,0 +1,24 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_LOG_H
+#define RETRO_LOG_H
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+// FIXME Remove as soon as possible.
+typedef struct _RetroCore RetroCore;
+
+void retro_g_log (RetroCore      *self,
+                  const gchar    *log_domain,
+                  GLogLevelFlags  log_level,
+                  const gchar    *message);
+
+G_END_DECLS
+
+#endif /* RETRO_LOG_H */
diff --git a/retro-gtk/retro.vala b/retro-gtk/retro.vala
index 05dbe7b..2d77e8e 100644
--- a/retro-gtk/retro.vala
+++ b/retro-gtk/retro.vala
@@ -19,7 +19,5 @@ private errordomain CbError {
        NO_CALLBACK
 }
 
-public extern void g_log (Core core, string log_domain, LogLevelFlags log_level, string message);
-
 }
 


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