Fix #903, #904: Slideshow settings
[geeqie.git] / src / layout.c
index 165a259..37fe728 100644 (file)
@@ -206,7 +206,7 @@ static void layout_box_folders_changed_cb(GtkWidget *widget, gpointer data)
        LayoutWindow *lw;
        GList *work;
 
-/* FIXME: this is probably not the correct way to implement this */
+/** @FIXME this is probably not the correct way to implement this */
        work = layout_window_list;
        while (work)
                {
@@ -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)
                {
@@ -2443,7 +2468,7 @@ void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
        gboolean refresh_lists;
 
        if (!layout_valid(&lw)) return;
-/* FIXME: add other options too */
+/** @FIXME add other options too */
 
        refresh_style = (lop->style != lw->options.style || strcmp(lop->order, lw->options.order) != 0);
        refresh_lists = (lop->show_directory_date != lw->options.show_directory_date);
@@ -2681,7 +2706,7 @@ LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
 
                pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
 
-               /* FIXME: the zoom value set here is the value, which is then copied again and again
+               /** @FIXME the zoom value set here is the value, which is then copied again and again
                   in "Leave Zoom at previous setting" mode. This is not ideal.  */
                image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE);
                g_object_unref(pixbuf);
@@ -2780,6 +2805,12 @@ void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent
        WRITE_NL(); WRITE_INT(*layout, log_window.w);
        WRITE_NL(); WRITE_INT(*layout, log_window.h);
 
+       WRITE_NL(); WRITE_INT(*layout, preferences_window.x);
+       WRITE_NL(); WRITE_INT(*layout, preferences_window.y);
+       WRITE_NL(); WRITE_INT(*layout, preferences_window.w);
+       WRITE_NL(); WRITE_INT(*layout, preferences_window.h);
+       WRITE_NL(); WRITE_INT(*layout, preferences_window.page_number);
+
        WRITE_NL(); WRITE_INT(*layout, search_window.x);
        WRITE_NL(); WRITE_INT(*layout, search_window.y);
        WRITE_NL(); WRITE_INT(*layout, search_window.w);
@@ -2883,6 +2914,12 @@ void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names
                if (READ_INT(*layout, log_window.w)) continue;
                if (READ_INT(*layout, log_window.h)) continue;
 
+               if (READ_INT(*layout, preferences_window.x)) continue;
+               if (READ_INT(*layout, preferences_window.y)) continue;
+               if (READ_INT(*layout, preferences_window.w)) continue;
+               if (READ_INT(*layout, preferences_window.h)) continue;
+               if (READ_INT(*layout, preferences_window.page_number)) continue;
+
                if (READ_INT(*layout, search_window.x)) continue;
                if (READ_INT(*layout, search_window.y)) continue;
                if (READ_INT(*layout, search_window.w)) continue;