changeset 1176:d3e51e1a02f8

Hide .gqv extension from collection name in collection window title and recent menu list.
author zas_
date Sun, 23 Nov 2008 22:05:27 +0000
parents 2518a4a73d89
children 5a20c47e7a14
files src/collect.c src/layout_util.c
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect.c	Sun Nov 23 16:16:09 2008 +0000
+++ b/src/collect.c	Sun Nov 23 22:05:27 2008 +0000
@@ -983,11 +983,24 @@
 
 static void collection_window_update_title(CollectWindow *cw)
 {
+	gboolean free_name = FALSE;
+	gchar *name;
 	gchar *buf;
 
 	if (!cw) return;
 
-	buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
+	if (file_extension_match(cw->cd->name, GQ_COLLECTION_EXT))
+		{
+		name = remove_extension_from_path(cw->cd->name);
+		free_name = TRUE;
+		}
+	else
+		{
+		name = cw->cd->name;
+		}
+
+	buf = g_strdup_printf(_("%s - Collection - %s"), name, GQ_APPNAME);
+	if (free_name) g_free(name);
 	gtk_window_set_title(GTK_WINDOW(cw->window), buf);
 	g_free(buf);
 }
--- a/src/layout_util.c	Sun Nov 23 16:16:09 2008 +0000
+++ b/src/layout_util.c	Sun Nov 23 22:05:27 2008 +0000
@@ -1008,8 +1008,22 @@
 
 	while (list)
 		{
-		item = menu_item_add_simple(menu, filename_from_path((gchar *)list->data),
-					    G_CALLBACK(layout_menu_recent_cb), lw);
+		const gchar *filename = filename_from_path((gchar *)list->data);
+		gchar *name;
+		gboolean free_name = FALSE;
+
+		if (file_extension_match(filename, GQ_COLLECTION_EXT))
+			{
+			name = remove_extension_from_path(filename);
+			free_name = TRUE;
+			}
+		else
+			{
+			name = (gchar *) filename;
+			}
+
+		item = menu_item_add_simple(menu, name, G_CALLBACK(layout_menu_recent_cb), lw);
+		if (free_name) g_free(name);
 		g_object_set_data(G_OBJECT(item), "recent_index", GINT_TO_POINTER(n));
 		list = list->next;
 		n++;