From aaf1420aa54c31f2d7f4acb4b38fa018196e2c63 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 25 Jun 2021 09:35:10 +0100 Subject: [PATCH] Fix #903, #904: Slideshow settings https://github.com/BestImageViewer/geeqie/issues/903 https://github.com/BestImageViewer/geeqie/issues/904 Slideshow delay shown in the status bar. Faster/slower default keys moved from keypad to main keyboard. --- .../GuideReferenceKeyboardShortcuts.xml | 4 +-- src/layout.c | 35 ++++++++++++++++--- src/layout_util.c | 4 +-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/doc/docbook/GuideReferenceKeyboardShortcuts.xml b/doc/docbook/GuideReferenceKeyboardShortcuts.xml index 3a1aecf6..34b7ad87 100644 --- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml +++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml @@ -767,7 +767,7 @@ Ctrl + - Keypad + + = @@ -777,7 +777,7 @@ Ctrl + - Keypad - + - diff --git a/src/layout.c b/src/layout.c index 5aa22100..37fe728a 100644 --- a/src/layout.c +++ b/src/layout.c @@ -660,6 +660,10 @@ void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *t void layout_status_update_info(LayoutWindow *lw, const gchar *text) { gchar *buf = NULL; + gint hrs; + gint min; + gdouble sec; + GString *delay; if (!layout_valid(&lw)) return; @@ -674,22 +678,40 @@ void layout_status_update_info(LayoutWindow *lw, const gchar *text) { guint s; gint64 s_bytes = 0; - const gchar *ss; + gchar *ss; if (layout_image_slideshow_active(lw)) { + if (!layout_image_slideshow_paused(lw)) { - ss = _(" Slideshow"); + delay = g_string_new(_(" Slideshow [")); } else { - ss = _(" Paused"); + delay = g_string_new(_(" Paused [")); + } + hrs = options->slideshow.delay / (36000); + min = (options->slideshow.delay -(36000 * hrs))/600; + sec = (gdouble)(options->slideshow.delay -(36000 * hrs)-(min * 600)) / 10; + + if (hrs > 0) + { + g_string_append_printf(delay, "%dh ", hrs); } + if (min > 0) + { + g_string_append_printf(delay, "%dm ", min); + } + g_string_append_printf(delay, "%.1fs]", sec); + + ss = g_strdup(delay->str); + + g_string_free(delay, TRUE); } else { - ss = ""; + ss = g_strdup(""); } s = layout_selection_count(lw, &s_bytes); @@ -703,16 +725,19 @@ void layout_status_update_info(LayoutWindow *lw, const gchar *text) buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); g_free(b); g_free(sb); + g_free(ss); } 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); + g_free(ss); } else { buf = g_strdup_printf(_("%d files%s"), n, ss); + g_free(ss); } text = buf; @@ -879,7 +904,7 @@ static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gboolean small lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format)); DEBUG_NAME(lw->info_status); - gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_status), _("Folder contents (files selected)")); + gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_status), _("Folder contents (files selected)\nSlideshow [time interval]")); if (small_format) { diff --git a/src/layout_util.c b/src/layout_util.c index d4dc6eb1..a9c7da75 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -2557,8 +2557,8 @@ static GtkActionEntry menu_entries[] = { { "HistogramModeCycle",NULL, N_("Cycle through histogram mo_des"), "J", N_("Cycle through histogram modes"), CB(layout_menu_histogram_toggle_mode_cb) }, { "HideTools", PIXBUF_INLINE_ICON_HIDETOOLS, N_("_Hide file list"), "H", N_("Hide file list"), CB(layout_menu_hide_cb) }, { "SlideShowPause", GTK_STOCK_MEDIA_PAUSE, N_("_Pause slideshow"), "P", N_("Pause slideshow"), CB(layout_menu_slideshow_pause_cb) }, - { "SlideShowFaster", GTK_STOCK_FILE, N_("Faster"), "KP_Add", N_("Slideshow Faster"), CB(layout_menu_slideshow_faster_cb) }, - { "SlideShowSlower", GTK_STOCK_FILE, N_("Slower"), "KP_Subtract", N_("Slideshow Slower"), CB(layout_menu_slideshow_slower_cb) }, + { "SlideShowFaster", GTK_STOCK_FILE, N_("Faster"), "equal", N_("Slideshow Faster"), CB(layout_menu_slideshow_faster_cb) }, + { "SlideShowSlower", GTK_STOCK_FILE, N_("Slower"), "minus", N_("Slideshow Slower"), CB(layout_menu_slideshow_slower_cb) }, { "Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "R", N_("Refresh"), CB(layout_menu_refresh_cb) }, { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Contents"), CB(layout_menu_help_cb) }, { "HelpSearch", NULL, N_("On-line help search"), NULL, N_("On-line help search"), CB(layout_menu_help_search_cb) }, -- 2.20.1