Skip to content

Commit

Permalink
Display marks in overlay info only if at least one is set.
Browse files Browse the repository at this point in the history
Fix a missing g_string_free().
  • Loading branch information
Laurent Monin committed Apr 7, 2008
1 parent 7391c9d commit e0831fd
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/image-overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ static GdkPixbuf *image_osd_info_render(ImageWindow *imd)
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);
Expand Down Expand Up @@ -260,21 +259,37 @@ static GdkPixbuf *image_osd_info_render(ImageWindow *imd)
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] ? " <span background='#FF00FF'>%c</span>" : " %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] ? " <span background='#FF00FF'>%c</span>" : " %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);

Expand Down

0 comments on commit e0831fd

Please sign in to comment.