[geany/geany] d3417b: api: add non-variadic variants of msgwin_*_add to the API

Thomas Martitz git-noreply at xxxxx
Thu Apr 5 19:44:43 UTC 2018


Branch:      refs/heads/master
Author:      Thomas Martitz <kugel at rockbox.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Thu, 05 Apr 2018 19:44:43 UTC
Commit:      d3417b7b37d289fc2a7d985f54c5b8a5385f295e
             https://github.com/geany/geany/commit/d3417b7b37d289fc2a7d985f54c5b8a5385f295e

Log Message:
-----------
api: add non-variadic variants of msgwin_*_add to the API

The variadic variants cannot be gobject-introspected, i.e. are not available
in  Peasy.

In fact, msgwin_compiler_add_string() and msgwin_msg_add_string() already
existed and have just been exported. msgwin_status_add_string() is new but
msgwin_status_add() becaume a wrapper around it in the same fashion as the
other two pairs.


Modified Paths:
--------------
    src/msgwindow.c
    src/msgwindow.h

Modified: src/msgwindow.c
59 lines changed, 47 insertions(+), 12 deletions(-)
===================================================================
@@ -334,7 +334,15 @@ void msgwin_compiler_add(gint msg_color, const gchar *format, ...)
 	g_free(string);
 }
 
-
+/**
+ *  Adds a new message in the compiler tab treeview in the messages window.
+ *
+ *  @param msg_color A color to be used for the text. It must be an element of #MsgColors.
+ *  @param msg Compiler message to be added.
+ *
+ *  @since @todo
+ **/
+GEANY_API_SYMBOL
 void msgwin_compiler_add_string(gint msg_color, const gchar *msg)
 {
 	GtkTreeIter iter;
@@ -410,7 +418,19 @@ void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *
 }
 
 
-/* adds string to the msg treeview */
+/**
+ *  Adds a new message in the messages tab treeview in the messages window.
+ *  If @a line and @a doc are set, clicking on this line jumps into the
+ *  file which is specified by @a doc into the line specified with @a line.
+ *
+ *  @param msg_color A color to be used for the text. It must be an element of #MsgColors.
+ *  @param line The document's line where the message belongs to. Set to @c -1 to ignore.
+ *  @param doc The document. Set to @c NULL to ignore.
+ *  @param string Message to be added.
+ *
+ *  @since @todo
+ **/
+GEANY_API_SYMBOL
 void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const gchar *string)
 {
 	GtkTreeIter iter;
@@ -451,26 +471,20 @@ void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const
  *  Logs a status message *without* setting the status bar.
  *  (Use ui_set_statusbar() to display text on the statusbar)
  *
- *  @param format @c printf()-style format string.
- *  @param ... Arguments for the @c format string.
+ *  @param string Status message to be logged.
+ *
+ *  @since @todo
  **/
 GEANY_API_SYMBOL
-void msgwin_status_add(const gchar *format, ...)
+void msgwin_status_add_string(const gchar *string)
 {
 	GtkTreeIter iter;
-	gchar *string;
 	gchar *statusmsg, *time_str;
-	va_list args;
-
-	va_start(args, format);
-	string = g_strdup_vprintf(format, args);
-	va_end(args);
 
 	/* add a timestamp to status messages */
 	time_str = utils_get_current_time_string();
 	statusmsg = g_strconcat(time_str, ": ", string, NULL);
 	g_free(time_str);
-	g_free(string);
 
 	/* add message to Status window */
 	gtk_list_store_append(msgwindow.store_status, &iter);
@@ -488,6 +502,27 @@ void msgwin_status_add(const gchar *format, ...)
 	}
 }
 
+/**
+ *  Logs a status message *without* setting the status bar.
+ *  (Use ui_set_statusbar() to display text on the statusbar)
+ *
+ *  @param format @c printf()-style format string.
+ *  @param ... Arguments for the @c format string.
+ **/
+GEANY_API_SYMBOL
+void msgwin_status_add(const gchar *format, ...)
+{
+	gchar *string;
+	va_list args;
+
+	va_start(args, format);
+	string = g_strdup_vprintf(format, args);
+	va_end(args);
+
+	msgwin_status_add_string(string);
+	g_free(string);
+}
+
 
 static void
 on_message_treeview_clear_activate(GtkMenuItem *menuitem, gpointer user_data)


Modified: src/msgwindow.h
7 lines changed, 3 insertions(+), 4 deletions(-)
===================================================================
@@ -53,11 +53,14 @@ typedef enum
 
 
 void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
+void msgwin_status_add_string(const gchar *msg);
 
 void msgwin_compiler_add(gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
+void msgwin_compiler_add_string(gint msg_color, const gchar *msg);
 
 void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *format, ...)
 			G_GNUC_PRINTF (4, 5);
+void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const char *msg);
 
 void msgwin_clear_tab(gint tabnum);
 
@@ -93,10 +96,6 @@ void msgwin_finalize(void);
 
 void msgwin_show_hide(gboolean show);
 
-void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const gchar *string);
-
-void msgwin_compiler_add_string(gint msg_color, const gchar *msg);
-
 void msgwin_show_hide_tabs(void);
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list