[latexila/wip/latexila-next] latexila_build_msg_print() for debugging purposes



commit be601119b915199e753b94ef3b095ca17dc96660
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Sep 17 19:57:58 2014 +0200

    latexila_build_msg_print() for debugging purposes

 docs/reference/latexila-sections.txt  |    1 +
 src/liblatexila/latexila-build-view.c |   27 +++++++++++++++++++++++++++
 src/liblatexila/latexila-build-view.h |    2 ++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/latexila-sections.txt b/docs/reference/latexila-sections.txt
index 2b176f1..d273b9b 100644
--- a/docs/reference/latexila-sections.txt
+++ b/docs/reference/latexila-sections.txt
@@ -114,6 +114,7 @@ LatexilaBuildState
 latexila_build_msg_new
 latexila_build_msg_free
 latexila_build_msg_reinit
+latexila_build_msg_print
 latexila_build_view_new
 latexila_build_view_clear
 latexila_build_view_add_main_title
diff --git a/src/liblatexila/latexila-build-view.c b/src/liblatexila/latexila-build-view.c
index af6680e..e196b47 100644
--- a/src/liblatexila/latexila-build-view.c
+++ b/src/liblatexila/latexila-build-view.c
@@ -136,6 +136,33 @@ latexila_build_msg_free (LatexilaBuildMsg *build_msg)
     }
 }
 
+/**
+ * latexila_build_msg_print:
+ * @build_msg: a #LatexilaBuildMsg.
+ *
+ * Prints @build_msg on stdout, for debugging purposes.
+ */
+void
+latexila_build_msg_print (LatexilaBuildMsg *build_msg)
+{
+  GEnumClass *enum_class;
+  GEnumValue *enum_value;
+
+  enum_class = g_type_class_ref (LATEXILA_TYPE_BUILD_MSG_TYPE);
+  enum_value = g_enum_get_value (enum_class, build_msg->type);
+
+  g_print ("Build message:\n");
+  g_print ("\ttype: %s\n", enum_value->value_nick);
+  g_print ("\ttext: %s\n", build_msg->text);
+  g_print ("\tfilename: %s\n", build_msg->filename);
+  g_print ("\tstart line: %d\n", build_msg->start_line);
+  g_print ("\tend line: %d\n", build_msg->end_line);
+  g_print ("\texpand: %d\n", build_msg->expand);
+  g_print ("\n");
+
+  g_type_class_unref (enum_class);
+}
+
 static const gchar *
 get_icon_name_from_state (LatexilaBuildState state)
 {
diff --git a/src/liblatexila/latexila-build-view.h b/src/liblatexila/latexila-build-view.h
index b99a962..10594b2 100644
--- a/src/liblatexila/latexila-build-view.h
+++ b/src/liblatexila/latexila-build-view.h
@@ -117,6 +117,8 @@ void                  latexila_build_msg_reinit                     (LatexilaBui
 
 void                  latexila_build_msg_free                       (LatexilaBuildMsg *build_msg);
 
+void                  latexila_build_msg_print                      (LatexilaBuildMsg *build_msg);
+
 GType                 latexila_build_view_get_type                  (void) G_GNUC_CONST;
 
 LatexilaBuildView *   latexila_build_view_new                       (void);


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