changeset 1065:6a8402e0eaea

improved custom exif look: - use toggle instead of remove button - display description instead of property key
author nadvornik
date Fri, 17 Oct 2008 22:00:07 +0000
parents 90dcc0060e22
children d0add22edb45
files src/bar_exif.c
diffstat 1 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_exif.c	Tue Oct 14 21:24:34 2008 +0000
+++ b/src/bar_exif.c	Fri Oct 17 22:00:07 2008 +0000
@@ -63,7 +63,7 @@
 static void table_add_line_custom(GtkWidget *table, gint x, gint y,
 				  const gchar *text1, const gchar *text2,
 				  GtkWidget **label1, GtkWidget **label2,
-				  GtkWidget **button)
+				  GtkWidget **remove)
 {
 	GtkWidget *label;
 	gchar *buf;
@@ -75,7 +75,7 @@
 	gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0);
 	pref_label_bold(label, TRUE, FALSE);
 	gtk_table_attach(GTK_TABLE(table), label,
-			 x, x + 1, y, y + 1,
+			 x + 1, x + 2, y, y + 1,
 			 GTK_FILL, GTK_FILL,
 			 2, 2);
 	*label1 = label;
@@ -83,16 +83,18 @@
 	label = gtk_label_new(text2);
 	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
 	gtk_table_attach(GTK_TABLE(table), label,
-			 x + 1, x + 2, y, y + 1,
+			 x + 2, x + 3, y, y + 1,
 			 GTK_FILL, GTK_FILL,
 			 2, 2);
 	*label2 = label;
 
-	if (button)
+	if (remove)
 		{
-		*button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
-		gtk_table_attach(GTK_TABLE(table), *button,
-				 x + 2, x + 3, y, y + 1,
+		*remove = gtk_check_button_new();
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*remove), TRUE);
+
+		gtk_table_attach(GTK_TABLE(table), *remove,
+				 x, x + 1, y, y + 1,
 				 GTK_FILL, GTK_FILL,
 				 2, 2);
 		}
@@ -238,6 +240,7 @@
 			gchar *utf8_text;
 			gchar *name;
 			gchar *buf;
+			gchar *description;
 
 			name = list->data;
 			list = list->prev;
@@ -246,7 +249,11 @@
 			utf8_text = utf8_validate_or_convert(text);
 			g_free(text);
 
-			buf = g_strconcat(name, ":", NULL);
+			description = exif_get_tag_description_by_key(name);
+			if (!description) description = g_strdup(name);
+			buf = g_strconcat(description, ":", NULL);
+			g_free(description);
+			
 			gtk_label_set_text(GTK_LABEL(eb->custom_name[i]), buf);
 			g_free(buf);
 			gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), utf8_text);
@@ -254,8 +261,9 @@
 
 			gtk_widget_show(eb->custom_name[i]);
 			gtk_widget_show(eb->custom_value[i]);
+			g_object_set_data(G_OBJECT(eb->custom_remove[i]), "key", name);
+			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(eb->custom_remove[i]), TRUE);
 			gtk_widget_show(eb->custom_remove[i]);
-			g_object_set_data(G_OBJECT(eb->custom_remove[i]), "key", name);
 
 			i++;
 			}
@@ -407,6 +415,9 @@
 	ExifBar *eb = data;
 	const gchar *key;
 
+	/* continue only if the toggle was deactivated */
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) return;
+
 	key = g_object_get_data(G_OBJECT(widget), "key");
 	if (!key) return;