# HG changeset patch
# User zas_
# Date 1207555779 0
# Node ID c7fefb0a4b7884c98804ed25eb16fb38f5ea479a
# Parent 343dd4ae2b2bf933d4f88111a3dce0b3839a1469
Display marks in overlay info only if at least one is set.
Fix a missing g_string_free().
diff -r 343dd4ae2b2b -r c7fefb0a4b78 src/image-overlay.c
--- a/src/image-overlay.c Sun Apr 06 10:17:41 2008 +0000
+++ b/src/image-overlay.c Mon Apr 07 08:09:39 2008 +0000
@@ -156,8 +156,7 @@
CollectionData *cd;
CollectInfo *info;
gchar *ct;
- int i;
- gint w, h;
+ gint w, h;
GHashTable *vars;
vars = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
@@ -260,21 +259,37 @@
g_hash_table_destroy(vars);
{
- GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
FileData *fd = image_get_fd(imd);
-
- for (i=0; i < FILEDATA_MARKS_SIZE; i++)
+ gint active_marks = 0;
+ gint mark;
+
+ for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
+ {
+ active_marks += fd->marks[mark];
+ }
+
+ if (active_marks > 0)
{
-
- g_string_append_printf(buf, fd->marks[i] ? " %c" : " %c", '1' + i);
- }
- text2 = g_strdup_printf("%s\n%s", text, buf->str);
+ GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
+
+ for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
+ {
+ g_string_append_printf(buf, fd->marks[mark] ? " %c" : " %c", '1' + mark);
+ }
+
+ text2 = g_strdup_printf("%s\n%s", text, buf->str);
+ g_string_free(buf, TRUE);
+ g_free(text);
+ }
+ else
+ {
+ text2 = text;
+ }
}
layout = gtk_widget_create_pango_layout(imd->pr, NULL);
pango_layout_set_markup(layout, text2, -1);
g_free(text2);
- g_free(text);
pango_layout_get_pixel_size(layout, &width, &height);