Revision: 2931 http://geany.svn.sourceforge.net/geany/?rev=2931&view=rev Author: eht16 Date: 2008-09-10 11:24:47 +0000 (Wed, 10 Sep 2008)
Log Message: ----------- Update the debug messages automatically in the debug messages window if it is open.
Modified Paths: -------------- trunk/ChangeLog trunk/src/log.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-09-08 14:28:59 UTC (rev 2930) +++ trunk/ChangeLog 2008-09-10 11:24:47 UTC (rev 2931) @@ -6,6 +6,9 @@ * src/plugindata.h, src/plugins.c, src/ui_utils.c, src/ui_utils.h: Add ui_get_toolbar_insert_position() for plugins to get a position to insert new toolbar items. + * src/log.c: + Update the debug messages automatically in the debug messages window + if it is open.
2008-09-07 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/src/log.c =================================================================== --- trunk/src/log.c 2008-09-08 14:28:59 UTC (rev 2930) +++ trunk/src/log.c 2008-09-10 11:24:47 UTC (rev 2931) @@ -38,6 +38,7 @@
static GString *log_buffer = NULL; +static GtkTextBuffer *dialog_textbuffer = NULL;
enum { @@ -45,6 +46,15 @@ };
+static void update_dialog(void) +{ + if (dialog_textbuffer != NULL) + { + gtk_text_buffer_set_text(dialog_textbuffer, log_buffer->str, log_buffer->len); + } +} + + /* Geany's main debug/log function, declared in geany.h */ void geany_debug(gchar const *format, ...) { @@ -59,6 +69,8 @@ { printf("%s\n", msg); g_string_append_printf(log_buffer, "%s\n", msg); + + update_dialog(); }
@@ -66,6 +78,8 @@ { fprintf(stderr, "%s\n", msg); g_string_append_printf(log_buffer, "%s\n", msg); + + update_dialog(); }
@@ -115,6 +129,8 @@ g_string_append_printf(log_buffer, "%s: %s: %s\n", time_str, get_log_prefix(level), msg);
g_free(time_str); + + update_dialog(); }
@@ -133,16 +149,18 @@ if (response == DIALOG_RESPONSE_CLEAR) { GtkTextIter start_iter, end_iter; - GtkTextBuffer *tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(user_data));
- gtk_text_buffer_get_start_iter(tb, &start_iter); - gtk_text_buffer_get_end_iter(tb, &end_iter); - gtk_text_buffer_delete(tb, &start_iter, &end_iter); + gtk_text_buffer_get_start_iter(dialog_textbuffer, &start_iter); + gtk_text_buffer_get_end_iter(dialog_textbuffer, &end_iter); + gtk_text_buffer_delete(dialog_textbuffer, &start_iter, &end_iter);
g_string_erase(log_buffer, 0, -1); } else + { gtk_widget_destroy(dialog); + dialog_textbuffer = NULL; + } }
@@ -162,10 +180,10 @@ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
textview = gtk_text_view_new(); + dialog_textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), FALSE); - gtk_text_buffer_set_text(gtk_text_view_get_buffer( - GTK_TEXT_VIEW(textview)), log_buffer->str, log_buffer->len); + gtk_text_buffer_set_text(dialog_textbuffer, log_buffer->str, log_buffer->len);
swin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.