Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 05 Apr 2018 19:47:30 UTC Commit: 1611e3f94960a821ced0af9b99052afa6ade2111 https://github.com/geany/geany/commit/1611e3f94960a821ced0af9b99052afa6ade21...
Log Message: ----------- Merge pull request #1748 from kugel-/msgwin-api
Add GI-compatible msgwin_*_add()
Closes #1748.
Modified Paths: -------------- src/msgwindow.c src/msgwindow.h src/plugindata.h
Modified: src/msgwindow.c 132 lines changed, 95 insertions(+), 37 deletions(-) =================================================================== @@ -106,9 +106,11 @@ void msgwin_show_hide_tabs(void) }
-/** Sets the Messages path for opening any parsed filenames without absolute path - * from message lines. - * @param messages_dir The directory. **/ +/** + * Sets the Messages path for opening any parsed filenames without absolute path from message lines. + * + * @param messages_dir The directory. + **/ GEANY_API_SYMBOL void msgwin_set_messages_dir(const gchar *messages_dir) { @@ -315,11 +317,15 @@ static const GdkColor *get_color(gint msg_color)
/** - * Adds a new message in the compiler tab treeview in the messages window. + * Adds a formatted 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 format @c printf()-style format string. + * @param ... Arguments for the @c format string. * - * @param msg_color A color to be used for the text. It must be an element of #MsgColors. - * @param format @c printf()-style format string. - * @param ... Arguments for the @c format string. + * @see msgwin_compiler_add_string() + * + * @since 0.16 **/ GEANY_API_SYMBOL void msgwin_compiler_add(gint msg_color, const gchar *format, ...) @@ -334,7 +340,17 @@ 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. + * + * @see msgwin_compiler_add() + * + * @since 1.34 (API 236) + **/ +GEANY_API_SYMBOL void msgwin_compiler_add_string(gint msg_color, const gchar *msg) { GtkTreeIter iter; @@ -383,17 +399,20 @@ void msgwin_show_hide(gboolean show)
/** - * 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. + * Adds a formatted message in the messages 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 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 format @c printf()-style format string. - * @param ... Arguments for the @c format string. + * 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. * - * @since 0.15 + * @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 @nullable The document. Set to @c NULL to ignore. + * @param format @c printf()-style format string. + * @param ... Arguments for the @c format string. + * + * @see msgwin_msg_add_string() + * + * @since 0.16 **/ GEANY_API_SYMBOL void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *format, ...) @@ -410,7 +429,22 @@ 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 @nullable The document. Set to @c NULL to ignore. + * @param string Message to be added. + * + * @see msgwin_msg_add() + * + * @since 1.34 (API 236) + **/ +GEANY_API_SYMBOL void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const gchar *string) { GtkTreeIter iter; @@ -448,29 +482,26 @@ 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) + * Logs a new status message *without* setting the status bar. + * + * Use @ref ui_set_statusbar() to display text on the statusbar. + * + * @param string Status message to be logged. * - * @param format @c printf()-style format string. - * @param ... Arguments for the @c format string. + * @see msgwin_status_add() + * + * @since 1.34 (API 236) **/ 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 +519,32 @@ void msgwin_status_add(const gchar *format, ...) } }
+/** + * Logs a formatted status message *without* setting the status bar. + * + * Use @ref ui_set_statusbar() to display text on the statusbar. + * + * @param format @c printf()-style format string. + * @param ... Arguments for the @c format string. + * + * @see msgwin_status_add_string() + * + * @since 0.12 + **/ +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) @@ -1237,12 +1294,13 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *
/** - * Switches to the given notebook tab of the messages window and shows the messages window - * if it was previously hidden and @a show is set to @c TRUE. + * Switches to the given notebook tab of the messages window. + * + * The messages window is shown if it was previously hidden and @a show is set to @c TRUE. * - * @param tabnum An index of a tab in the messages window. Valid values are all elements of - * #MessageWindowTabNum. - * @param show Whether to show the messages window at all if it was hidden before. + * @param tabnum An index of a tab in the messages window. Valid values are + * all elements of #MessageWindowTabNum. + * @param show Whether to show the messages window at all if it was hidden before. * * @since 0.15 **/ @@ -1274,9 +1332,9 @@ void msgwin_switch_tab(gint tabnum, gboolean show)
/** - * Removes all messages from a tab specified by @a tabnum in the messages window. + * Removes all messages from a tab specified by @a tabnum in the messages window. * - * @param tabnum An index of a tab in the messages window which should be cleared. + * @param tabnum An index of a tab in the messages window which should be cleared. * Valid values are @c MSG_STATUS, @c MSG_COMPILER and @c MSG_MESSAGE. * * @since 0.15
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);
Modified: src/plugindata.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -59,7 +59,7 @@ G_BEGIN_DECLS * @warning You should not test for values below 200 as previously * @c GEANY_API_VERSION was defined as an enum value, not a macro. */ -#define GEANY_API_VERSION 235 +#define GEANY_API_VERSION 236
/* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins * with GTK3-linked Geany leads to crash */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).