changeset 48:6948407f52a5

Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net> * bar_exif.c: Set a default size for the EXIF data column in the advanced view, and allow resizing of that column to allow more data to be visible when needed. * format_canon.c: Fix data type for Canon MakerNote Serial Number. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Fri, 03 Jun 2005 22:48:37 +0000
parents aa4c0e1b54b0
children ae627d150a6b
files ChangeLog src/bar_exif.c src/format_canon.c
diffstat 3 files changed, 34 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 03 06:07:02 2005 +0000
+++ b/ChangeLog	Fri Jun 03 22:48:37 2005 +0000
@@ -1,3 +1,10 @@
+Fri Jun  3 18:43:46 2005  John Ellis  <johne@verizon.net>
+
+	* bar_exif.c: Set a default size for the EXIF data column in the
+	advanced view, and allow resizing of that column to allow more data to
+	be visible when needed.
+	* format_canon.c: Fix data type for Canon MakerNote Serial Number.
+
 Fri Jun  3 01:49:20 2005  John Ellis  <johne@verizon.net>
 
 	* exif.[ch]: Export several parsing functions for use by the exif
--- a/src/bar_exif.c	Fri Jun 03 06:07:02 2005 +0000
+++ b/src/bar_exif.c	Fri Jun 03 22:48:37 2005 +0000
@@ -24,6 +24,8 @@
 
 #define EXIF_BAR_CUSTOM_COUNT 20
 
+#define BAR_EXIF_DATA_COLUMN_WIDTH 250
+
 static const gchar *bar_exif_key_list[] = {
 	"fCamera",
 	"fDateTime",
@@ -379,14 +381,24 @@
 			 G_CALLBACK(bar_exif_row_toggled_cb), listview);
 }
 
-static void bar_exif_add_column(GtkWidget *listview, const gchar *title, gint n)
+static void bar_exif_add_column(GtkWidget *listview, const gchar *title, gint n, gint sizable)
 {
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
 
 	column = gtk_tree_view_column_new();
 	gtk_tree_view_column_set_title(column, title);
-	gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+
+	if (sizable)
+		{
+		gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
+		gtk_tree_view_column_set_fixed_width(column, BAR_EXIF_DATA_COLUMN_WIDTH);
+		gtk_tree_view_column_set_resizable(column, TRUE);
+		}
+	else
+		{
+		gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+		}
 
 	renderer = gtk_cell_renderer_text_new();
 	gtk_tree_view_column_pack_start(column, renderer, TRUE);
@@ -420,12 +432,12 @@
 
 	bar_exif_add_column_check(eb->listview, "", EXIF_ADVCOL_ENABLED);
 
-	bar_exif_add_column(eb->listview, _("Tag"), EXIF_ADVCOL_TAG);
-	bar_exif_add_column(eb->listview, _("Name"), EXIF_ADVCOL_NAME);
-	bar_exif_add_column(eb->listview, _("Value"), EXIF_ADVCOL_VALUE);
-	bar_exif_add_column(eb->listview, _("Format"), EXIF_ADVCOL_FORMAT);
-	bar_exif_add_column(eb->listview, _("Elements"), EXIF_ADVCOL_ELEMENTS);
-	bar_exif_add_column(eb->listview, _("Description"), EXIF_ADVCOL_DESCRIPTION);
+	bar_exif_add_column(eb->listview, _("Tag"), EXIF_ADVCOL_TAG, FALSE);
+	bar_exif_add_column(eb->listview, _("Name"), EXIF_ADVCOL_NAME, FALSE);
+	bar_exif_add_column(eb->listview, _("Value"), EXIF_ADVCOL_VALUE, TRUE);
+	bar_exif_add_column(eb->listview, _("Format"), EXIF_ADVCOL_FORMAT, FALSE);
+	bar_exif_add_column(eb->listview, _("Elements"), EXIF_ADVCOL_ELEMENTS, FALSE);
+	bar_exif_add_column(eb->listview, _("Description"), EXIF_ADVCOL_DESCRIPTION, FALSE);
 
 	eb->advanced_scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(eb->advanced_scrolled), GTK_SHADOW_IN);
--- a/src/format_canon.c	Fri Jun 03 06:07:02 2005 +0000
+++ b/src/format_canon.c	Fri Jun 03 22:48:37 2005 +0000
@@ -754,7 +754,7 @@
 	{ 7,	EXIF_FORMAT_STRING, -1,		"MkN.Canon.FirmwareVersion",	"Firmware version", NULL },
 	{ 8,	EXIF_FORMAT_LONG_UNSIGNED, 1,	"MkN.Canon.ImageNumber",	"Image number", NULL },
 	{ 9,	EXIF_FORMAT_STRING, -1,		"MkN.Canon.OwnerName",		"Owner name", NULL },
-	{ 12,	EXIF_FORMAT_BYTE_UNSIGNED, -1,	"MkN.Canon.SerialNumber",	"Camera serial number", NULL },
+	{ 12,	EXIF_FORMAT_LONG_UNSIGNED, -1,	"MkN.Canon.SerialNumber",	"Camera serial number", NULL },
 	{ 15,	EXIF_FORMAT_SHORT_UNSIGNED, -1,	"MkN.Canon.CustomFunctions",	NULL, NULL },
 	EXIF_MARKER_LIST_END
 };
@@ -785,6 +785,7 @@
 static void canon_mknote_parse_convert(ExifData *exif)
 {
 	gint value;
+	ExifItem *result;
 
 	/* seems we need more than only this value for distance */
 	if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value))
@@ -802,16 +803,18 @@
 		exif->items = g_list_prepend(exif->items, item);
 		}
 
-	/* Serial Number untested */
-	if (exif_get_integer(exif, "MkN.Canon.SerialNumber", &value))
+	result = exif_get_item(exif, "MkN.Canon.SerialNumber");
+	if (result && result->format == EXIF_FORMAT_LONG_UNSIGNED && result->data_len == 4)
 		{
 		static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1,
 					    "SerialNumber", "Camera serial number", NULL };
 		ExifItem *item;
 		gchar *text;
 		gint l;
+		guint32 n;
 
-		text = g_strdup_printf("%04X%05d", value & 0xff00 >> 8, value & 0x00ff);
+		n = (guint32)result->data;
+		text = g_strdup_printf("%04X%05d", n & 0xffff0000 >> 8, n & 0x0000ffff);
 		l = strlen(text);
 		item = exif_item_new(marker.format, marker.tag, l, &marker);
 		memcpy(item->data, text, l);