# HG changeset patch # User zas_ # Date 1219512957 0 # Node ID bc73dc055cd02d7867a739be8e2dd927f5ae70a6 # Parent 5049449ad84119f5d9dadff3acbf0b07d8d7fdb6 Only display status if there is at least one file in the file list. diff -r 5049449ad841 -r bc73dc055cd0 src/layout.c --- a/src/layout.c Sat Aug 23 17:00:59 2008 +0000 +++ b/src/layout.c Sat Aug 23 17:35:57 2008 +0000 @@ -520,96 +520,117 @@ { guint n; gint64 n_bytes = 0; - guint s; - gint64 s_bytes = 0; - const gchar *ss; + + n = layout_list_count(lw, &n_bytes); + + if (n) + { + guint s; + gint64 s_bytes = 0; + const gchar *ss; - if (layout_image_slideshow_active(lw)) - { - if (!layout_image_slideshow_paused(lw)) + if (layout_image_slideshow_active(lw)) { - ss = _(" Slideshow"); + if (!layout_image_slideshow_paused(lw)) + { + ss = _(" Slideshow"); + } + else + { + ss = _(" Paused"); + } } else { - ss = _(" Paused"); + ss = ""; + } + + s = layout_selection_count(lw, &s_bytes); + + layout_bars_new_selection(lw, s); + + if (s > 0) + { + gchar *b = text_from_size_abrev(n_bytes); + gchar *sb = text_from_size_abrev(s_bytes); + buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); + g_free(b); + g_free(sb); } + else if (n > 0) + { + gchar *b = text_from_size_abrev(n_bytes); + buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss); + g_free(b); + } + else + { + buf = g_strdup_printf(_("%d files%s"), n, ss); + } + + text = buf; + + image_osd_update(lw->image); } else { - ss = ""; - } - - n = layout_list_count(lw, &n_bytes); - s = layout_selection_count(lw, &s_bytes); - - layout_bars_new_selection(lw, s); - - if (s > 0) - { - gchar *b = text_from_size_abrev(n_bytes); - gchar *sb = text_from_size_abrev(s_bytes); - buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); - g_free(b); - g_free(sb); + text = ""; } - else if (n > 0) - { - gchar *b = text_from_size_abrev(n_bytes); - buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss); - g_free(b); - } - else - { - buf = g_strdup_printf(_("%d files%s"), n, ss); - } - - text = buf; - - image_osd_update(lw->image); - } - + } + if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text); g_free(buf); } void layout_status_update_image(LayoutWindow *lw) { - gchar *text; - gchar *b; + guint64 n; if (!layout_valid(&lw) || !lw->image) return; - text = image_zoom_get_as_text(lw->image); - gtk_label_set_text(GTK_LABEL(lw->info_zoom), text); - g_free(text); - - b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0"); + n = layout_list_count(lw, NULL); + + if (!n) + { + gtk_label_set_text(GTK_LABEL(lw->info_zoom), ""); + gtk_label_set_text(GTK_LABEL(lw->info_details), ""); + } + else + { + gchar *text; + gchar *b; - if (lw->image->unknown) - { - if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK)) + text = image_zoom_get_as_text(lw->image); + gtk_label_set_text(GTK_LABEL(lw->info_zoom), text); + g_free(text); + + b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0"); + + if (lw->image->unknown) { - text = g_strdup_printf(_("(no read permission) %s bytes"), b); + if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK)) + { + text = g_strdup_printf(_("(no read permission) %s bytes"), b); + } + else + { + text = g_strdup_printf(_("( ? x ? ) %s bytes"), b); + } } else { - text = g_strdup_printf(_("( ? x ? ) %s bytes"), b); + gint width, height; + + image_get_image_size(lw->image, &width, &height); + text = g_strdup_printf(_("( %d x %d ) %s bytes"), + width, height, b); } - } - else - { - gint width, height; - image_get_image_size(lw->image, &width, &height); - text = g_strdup_printf(_("( %d x %d ) %s bytes"), - width, height, b); + g_free(b); + + gtk_label_set_text(GTK_LABEL(lw->info_details), text); + g_free(text); } - - gtk_label_set_text(GTK_LABEL(lw->info_details), text); - - g_free(b); - g_free(text); } void layout_status_update_all(LayoutWindow *lw)