SF.net SVN: geany: [2780] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Jul 15 14:50:24 UTC 2008


Revision: 2780
          http://geany.svn.sourceforge.net/geany/?rev=2780&view=rev
Author:   ntrel
Date:     2008-07-15 07:50:06 -0700 (Tue, 15 Jul 2008)

Log Message:
-----------
Show '..' item when the current folder is empty (fixes #2015121).
Replace is_top_level_directory() code by checking g_path_skip_root().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/filebrowser.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-07-15 14:29:41 UTC (rev 2779)
+++ trunk/ChangeLog	2008-07-15 14:50:06 UTC (rev 2780)
@@ -27,6 +27,9 @@
    gradually or as required).
    Move utils_get_current_function() to symbols.c.
    Move utils_replace_filename() to document.c.
+ * plugins/filebrowser.c:
+   Show '..' item when the current folder is empty (fixes #2015121).
+   Replace is_top_level_directory() code by checking g_path_skip_root().
 
 
 2008-07-14  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/plugins/filebrowser.c
===================================================================
--- trunk/plugins/filebrowser.c	2008-07-15 14:29:41 UTC (rev 2779)
+++ trunk/plugins/filebrowser.c	2008-07-15 14:50:06 UTC (rev 2780)
@@ -63,13 +63,6 @@
 PLUGIN_KEY_GROUP(file_browser, KB_COUNT)
 
 
-/* number of characters to skip the root of an absolute path("c:" or "d:" on Windows) */
-#ifdef G_OS_WIN32
-# define ROOT_OFFSET 2
-#else
-# define ROOT_OFFSET 0
-#endif
-
 enum
 {
 	FILEVIEW_COLUMN_ICON = 0,
@@ -188,21 +181,13 @@
 }
 
 
-static gboolean is_top_level_directory(const gchar *dir)
-{
-	g_return_val_if_fail(dir && strlen(dir) > ROOT_OFFSET, FALSE);
-
-	return (p_utils->str_equal(dir + ROOT_OFFSET, G_DIR_SEPARATOR_S));
-}
-
-
 /* adds ".." to the start of the file list */
 static void add_top_level_entry(void)
 {
 	GtkTreeIter iter;
 
-	if (is_top_level_directory(current_dir))
-		return;
+	if (! NZV(g_path_skip_root(current_dir)))
+		return;	/* ignore 'C:\' or '/' */
 
 	gtk_list_store_prepend(file_store, &iter);
 	last_dir_iter = gtk_tree_iter_copy(&iter);
@@ -239,10 +224,11 @@
 	gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir);
 	g_free(utf8_dir);
 
+	add_top_level_entry();	/* ".." item */
+
 	list = p_utils->get_file_list(current_dir, NULL, NULL);
 	if (list != NULL)
 	{
-		add_top_level_entry();
 		g_slist_foreach(list, (GFunc) add_item, NULL);
 		g_slist_foreach(list, (GFunc) g_free, NULL);
 		g_slist_free(list);


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