SF.net SVN: geany: [500] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Jun 28 15:18:30 UTC 2006


Revision: 500
Author:   eht16
Date:     2006-06-28 08:18:23 -0700 (Wed, 28 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=500&view=rev

Log Message:
-----------
Fixed weird behaviour of the recent files list.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keyfile.c
    trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-27 22:15:12 UTC (rev 499)
+++ trunk/ChangeLog	2006-06-28 15:18:23 UTC (rev 500)
@@ -1,3 +1,9 @@
+2006-06-28  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/utils.c, src/keyfile.c: Fixed weird behaviour of the recent
+                               files list.
+
+
 2006-06-27  Enrico Troeger  <enrico.troeger at uvena.de>
 
  * data/filetypes.php, data/filetypes.pascal, src/callbacks.c,

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2006-06-27 22:15:12 UTC (rev 499)
+++ trunk/src/keyfile.c	2006-06-28 15:18:23 UTC (rev 500)
@@ -55,8 +55,7 @@
 
 	if (!config_exists)
 	{
-		gchar *start_comm = g_malloc(100);
-		g_snprintf(start_comm, 100, _("%s configuration file, edit as you need"), PACKAGE);
+		gchar *start_comm = g_strdup_printf(_("%s configuration file, edit as you need"), PACKAGE);
 		g_key_file_set_comment(config, NULL, NULL, start_comm, NULL);
 		g_free(start_comm);
 	}
@@ -140,11 +139,14 @@
 	{
 		if (! g_queue_is_empty(app->recent_queue))
 		{
-			recent_files[i] = g_queue_pop_head(app->recent_queue);
+			// copy the values, this is necessary when this function is called from the
+			// preferences dialog or when quitting is canceled to keep the queue intact
+			recent_files[i] = g_strdup(g_queue_peek_nth(app->recent_queue, i));
 		}
 		else
 		{
 			recent_files[i] = NULL;
+			break;
 		}
 	}
 	// There is a bug in GTK2.6 g_key_file_set_string_list, we must NULL terminate.

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-06-27 22:15:12 UTC (rev 499)
+++ trunk/src/utils.c	2006-06-28 15:18:23 UTC (rev 500)
@@ -131,7 +131,6 @@
 		line = sci_get_line_from_position(doc_list[idx].sci, pos);
 		col = sci_get_col_from_position(doc_list[idx].sci, pos);
 
-		// currently text need in German and C locale about 150 chars
 		text = g_strdup_printf(_("%c  line: % 4d column: % 3d  selection: % 4d   %s      mode: %s%s      cur. function: %s      encoding: %s      filetype: %s"),
 			(doc_list[idx].changed) ? 42 : 32,
 			(line + 1), (col + 1),
@@ -1929,7 +1928,7 @@
 	if (g_list_length(children) > app->mru_length)
 	{
 		children = g_list_nth(children, app->mru_length - 1);
-		while (children)
+		while (children != NULL)
 		{
 			if (GTK_IS_WIDGET(children->data)) gtk_widget_destroy(GTK_WIDGET(children->data));
 			children = g_list_next(children);
@@ -1939,7 +1938,8 @@
 	filename = g_queue_peek_head(app->recent_queue);
 	tmp = gtk_menu_item_new_with_label(filename);
 	gtk_widget_show(tmp);
-	gtk_menu_shell_insert(GTK_MENU_SHELL(recent_menu), tmp, 0);
+	//gtk_menu_shell_insert(GTK_MENU_SHELL(recent_menu), tmp, 0);
+	gtk_container_add(GTK_CONTAINER(recent_menu), tmp);
 	g_signal_connect((gpointer) tmp, "activate",
 				G_CALLBACK(on_recent_file_activate), (gpointer) filename);
 }


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