SF.net SVN: geany:[3013] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Sep 27 14:06:23 UTC 2008


Revision: 3013
          http://geany.svn.sourceforge.net/geany/?rev=3013&view=rev
Author:   eht16
Date:     2008-09-27 14:06:22 +0000 (Sat, 27 Sep 2008)

Log Message:
-----------
Make the debug messages window a little bigger.
Enable wrapping of messages to avoid horizontal scrolling.
Automatically scroll to the end of the messages when showing the dialog or updating its contents.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/log.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-09-26 18:30:03 UTC (rev 3012)
+++ trunk/ChangeLog	2008-09-27 14:06:22 UTC (rev 3013)
@@ -1,3 +1,12 @@
+2008-09-27  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/log.c:
+   Make the debug messages window a little bigger.
+   Enable wrapping of messages to avoid horizontal scrolling.
+   Automatically scroll to the end of the messages when showing the
+   dialog or updating its contents.
+
+
 2008-09-26  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * geany.glade, src/interface.c, src/notebook.c:

Modified: trunk/src/log.c
===================================================================
--- trunk/src/log.c	2008-09-26 18:30:03 UTC (rev 3012)
+++ trunk/src/log.c	2008-09-27 14:06:22 UTC (rev 3013)
@@ -50,7 +50,13 @@
 {
 	if (dialog_textbuffer != NULL)
 	{
+		GtkTextMark *mark;
+		GtkTextView *textview = g_object_get_data(G_OBJECT(dialog_textbuffer), "textview");
+
 		gtk_text_buffer_set_text(dialog_textbuffer, log_buffer->str, log_buffer->len);
+		/* scroll to the end of the messages as this might be most interesting */
+		mark = gtk_text_buffer_get_insert(dialog_textbuffer);
+		gtk_text_view_scroll_to_mark(textview, mark, 0.0, FALSE, 0.0, 0.0);
 	}
 }
 
@@ -144,7 +150,7 @@
 }
 
 
-static void on_dialog_response(GtkWidget *dialog, gint response, gpointer user_data)
+static void on_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
 {
 	if (response == DIALOG_RESPONSE_CLEAR)
 	{
@@ -158,7 +164,7 @@
 	}
 	else
 	{
-		gtk_widget_destroy(dialog);
+		gtk_widget_destroy(GTK_WIDGET(dialog));
 		dialog_textbuffer = NULL;
 	}
 }
@@ -176,24 +182,27 @@
 	gtk_box_set_spacing(GTK_BOX(vbox), 6);
 	gtk_widget_set_name(dialog, "GeanyDialog");
 
-	gtk_window_set_default_size(GTK_WINDOW(dialog), 450, 250);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 550, 300);
 	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));
+	g_object_set_data(G_OBJECT(dialog_textbuffer), "textview", 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(dialog_textbuffer, log_buffer->str, log_buffer->len);
+	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD_CHAR);
 
 	swin = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
 		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), textview);
+	gtk_container_add(GTK_CONTAINER(swin), textview);
 
 	gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
 
 	g_signal_connect(dialog, "response", G_CALLBACK(on_dialog_response), textview);
 	gtk_widget_show_all(dialog);
+
+	update_dialog(); /* set text after showing the window, to not scroll an unrealized textview */
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list