changeset 275:dc69ea2dcf76

fixed histogram label
author nadvornik
date Tue, 08 Apr 2008 21:52:04 +0000
parents 2710d14f6a28
children 4f526d436873
files src/image-overlay.c
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/image-overlay.c	Tue Apr 08 21:33:29 2008 +0000
+++ b/src/image-overlay.c	Tue Apr 08 21:52:04 2008 +0000
@@ -195,7 +195,7 @@
 	PangoLayout *layout;
 	const gchar *name;
 	gchar *name_escaped;
-	gchar *text, *text2;
+	gchar *text;
 	gchar *size;
 	gint n, t;
 	CollectionData *cd;
@@ -312,7 +312,6 @@
   	g_free(name_escaped);
 	g_hash_table_destroy(vars);
 
-	text2 = text;
 	{
 	FileData *fd = image_get_fd(imd);
 
@@ -320,12 +319,20 @@
 		{
 		gint active_marks = 0;
 		gint mark;
+		gchar *text2;
 
 		for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++) 
 			{
 			active_marks += fd->marks[mark];
 			}
 
+    		if (with_hist)
+			{
+			text2 = g_strdup_printf("%s\n%s", text, histogram_label(lw->histogram));
+			g_free(text);
+			text = text2;
+			}
+
 		if (active_marks > 0)
 			{
 			GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
@@ -335,19 +342,18 @@
 				g_string_append_printf(buf, fd->marks[mark] ? " <span background='#FF00FF'>%c</span>" : " %c", '1' + mark);
     				}
 
-    			if (with_hist)
-				text2 = g_strdup_printf("%s\n%s\n%s", text, buf->str, histogram_label(lw->histogram));
-			else
-				text2 = g_strdup_printf("%s\n%s", text, buf->str);
+			text2 = g_strdup_printf("%s\n%s", text, buf->str);
 			g_string_free(buf, TRUE);
 			g_free(text);
+			text = text2;
 			}
+
 		}
 	}
         
 	layout = gtk_widget_create_pango_layout(imd->pr, NULL);
-	pango_layout_set_markup(layout, text2, -1);
-	g_free(text2);
+	pango_layout_set_markup(layout, text, -1);
+	g_free(text);
     
 	pango_layout_get_pixel_size(layout, &width, &height);