changeset 781:2d2cca2bceb0

Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
author zas_
date Tue, 03 Jun 2008 13:54:22 +0000
parents 44128da39e13
children 3f7a0420c293
files src/bar_sort.c src/collect-dlg.c src/filefilter.c src/image-overlay.c src/img-view.c src/main.c src/main.h src/remote.c
diffstat 8 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_sort.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/bar_sort.c	Tue Jun 03 13:54:22 2008 +0000
@@ -110,7 +110,7 @@
 		fd = work->data;
 		work = work->next;
 
-		if (file_extension_match(fd->path, ".gqv"))
+		if (file_extension_match(fd->path, GQ_COLLECTION_EXT))
 			{
 			name = remove_extension_from_path(fd->name);
 			}
@@ -425,9 +425,9 @@
 	
 		if (strlen(name) == 0) return;
 
-		if (!file_extension_match(name, ".gqv"))
+		if (!file_extension_match(name, GQ_COLLECTION_EXT))
 			{
-			gchar *tmp = g_strconcat(name, ".gqv", NULL);
+			gchar *tmp = g_strconcat(name, GQ_COLLECTION_EXT, NULL);
 			g_free((gpointer) name);
 			name = tmp;
 			}
--- a/src/collect-dlg.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/collect-dlg.c	Tue Jun 03 13:54:22 2008 +0000
@@ -104,10 +104,10 @@
 	path = fd->dest_path;
 
 	/* FIXME: utf8 */
-	if (!(strlen(path) > 7 && strncasecmp(path + (strlen(path) - 4), ".gqv", 4) == 0))
+	if (!file_extension_match(path, GQ_COLLECTION_EXT))
 		{
 		gchar *buf;
-		buf = g_strconcat(path, ".gqv", NULL);
+		buf = g_strconcat(path, GQ_COLLECTION_EXT, NULL);
 		gtk_entry_set_text(GTK_ENTRY(fd->entry), buf);
 		g_free(buf);
 		}
@@ -202,7 +202,7 @@
 
 	base = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL);
 	file_dialog_add_path_widgets(fd, base, path,
-				     "collection_load_save", ".gqv", _("Collection Files"));
+				     "collection_load_save", GQ_COLLECTION_EXT, _("Collection Files"));
 	g_free(base);
 
 	fd->type = type;
--- a/src/filefilter.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/filefilter.c	Tue Jun 03 13:54:22 2008 +0000
@@ -228,7 +228,7 @@
 
 	/* non-image files that might be desirable to show */
 	filter_add_if_missing("xmp", "XMP sidecar", ".xmp", FORMAT_CLASS_META, TRUE);
-	filter_add_if_missing("gqv", GQ_APPNAME " image collection", ".gqv", FORMAT_CLASS_META, TRUE);
+	filter_add_if_missing("gqv", GQ_APPNAME " image collection", GQ_COLLECTION_EXT, FORMAT_CLASS_META, TRUE);
 
 	/* These are the raw camera formats with embedded jpeg/exif.
 	 * (see format_raw.c and/or exiv2.cc)
--- a/src/image-overlay.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/image-overlay.c	Tue Jun 03 13:54:22 2008 +0000
@@ -438,7 +438,7 @@
 		n = g_list_index(cd->list, info) + 1;
 		if (cd->name)
 			{
-			if (file_extension_match(cd->name, ".gqv"))
+			if (file_extension_match(cd->name, GQ_COLLECTION_EXT))
 				collection_name = remove_extension_from_path(cd->name);
 			else
 				collection_name = g_strdup(cd->name);
--- a/src/img-view.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/img-view.c	Tue Jun 03 13:54:22 2008 +0000
@@ -939,7 +939,7 @@
 {
 	GList *list;
 
-	if (file_extension_match(fd->path, ".gqv"))
+	if (file_extension_match(fd->path, GQ_COLLECTION_EXT))
 		{
 		ViewWindow *vw;
 		CollectionData *cd;
--- a/src/main.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/main.c	Tue Jun 03 13:54:22 2008 +0000
@@ -180,7 +180,7 @@
 	path_parsed = g_strdup(file_path);
 	parse_out_relatives(path_parsed);
 
-	if (file_extension_match(path_parsed, ".gqv"))
+	if (file_extension_match(path_parsed, GQ_COLLECTION_EXT))
 		{
 		*collection_list = g_list_append(*collection_list, path_parsed);
 		}
--- a/src/main.h	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/main.h	Tue Jun 03 13:54:22 2008 +0000
@@ -80,6 +80,8 @@
 
 #define RC_FILE_NAME GQ_APPNAME_LC "rc"
 
+#define GQ_COLLECTION_EXT ".gqv"
+
 #define ZOOM_RESET_ORIGINAL 0
 #define ZOOM_RESET_FIT_WINDOW 1
 #define ZOOM_RESET_NONE 2
--- a/src/remote.c	Tue Jun 03 11:24:16 2008 +0000
+++ b/src/remote.c	Tue Jun 03 13:54:22 2008 +0000
@@ -477,7 +477,7 @@
 
 	if (isfile(filename))
 		{
-		if (file_extension_match(filename, ".gqv"))
+		if (file_extension_match(filename, GQ_COLLECTION_EXT))
 			{
 			collection_window_new(filename);
 			}