Revision: 5028 http://geany.svn.sourceforge.net/geany/?rev=5028&view=rev Author: ntrel Date: 2010-06-17 12:03:00 +0000 (Thu, 17 Jun 2010)
Log Message: ----------- Replace /home/user with ~ in the documents list (patch by Jon Strait, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/src/sidebar.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-06-16 15:26:04 UTC (rev 5027) +++ trunk/ChangeLog 2010-06-17 12:03:00 UTC (rev 5028) @@ -1,3 +1,10 @@ +2010-06-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/sidebar.c: + Replace /home/user with ~ in the documents list (patch by Jon + Strait, thanks). + + 2010-06-16 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/notebook.c:
Modified: trunk/src/sidebar.c =================================================================== --- trunk/src/sidebar.c 2010-06-16 15:26:04 UTC (rev 5027) +++ trunk/src/sidebar.c 2010-06-17 12:03:00 UTC (rev 5028) @@ -345,8 +345,10 @@ gchar *tmp_dirname; gchar *project_base_path; gchar *dirname = NULL; + const gchar *home_dir = g_get_home_dir(); static GtkTreeIter parent; GtkTreeModel *model = GTK_TREE_MODEL(store_openfiles); + const gchar *rest;
if (!documents_show_paths) return NULL; @@ -357,7 +359,6 @@ if (project_base_path != NULL) { gsize len = strlen(project_base_path); - const gchar *rest;
if (project_base_path[len-1] == G_DIR_SEPARATOR) project_base_path[len-1] = '\0'; @@ -367,12 +368,27 @@ { rest = tmp_dirname + len; if (*rest == G_DIR_SEPARATOR || *rest == '\0') + { dirname = g_strdup_printf("%s%s", app->project->name, rest); + } } g_free(project_base_path); } if (dirname == NULL) + { dirname = tmp_dirname; + + /* If matches home dir, replace with tilde */ + if (home_dir && *home_dir != 0 && g_str_has_prefix(dirname, home_dir)) + { + rest = dirname + strlen(home_dir); + if (*rest == G_DIR_SEPARATOR || *rest == '\0') + { + dirname = g_strdup_printf("~%s", rest); + g_free(tmp_dirname); + } + } + } else g_free(tmp_dirname);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.