Circular selection lists option
authorColin Clark <colin.clark@cclark.uk>
Wed, 28 Apr 2021 10:17:05 +0000 (11:17 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 28 Apr 2021 10:17:05 +0000 (11:17 +0100)
An option in Preferences/Behavior to permit image selections to be
traversed in a circular or non-circular manner.

The default is "on" (circular) which is the method used until now.

doc/docbook/GuideOptionsBehavior.xml
src/layout_image.c
src/options.c
src/options.h
src/preferences.c
src/rcfile.c

index 67e1850..1d3ae3b 100644 (file)
           <para>If selected, a single click will enter a directory, rather than the GTK+ default of a double click.</para>\r
         </listitem>\r
       </varlistentry>\r
+      <varlistentry>\r
+        <term>\r
+          <guilabel>Circular selection lists</guilabel>\r
+        </term>\r
+        <listitem>\r
+          <para>If selected, when traversing a list of selected images using Next or Previous Image, when the last or first image is encountered the focus moves to the beginning or end of the list. When deselected, focus will go no further than the start or end of the list.</para>\r
+        </listitem>\r
+      </varlistentry>\r
       <varlistentry>\r
         <term>\r
           <guilabel>Save marks on exit</guilabel>\r
index 4f1e769..b26f956 100644 (file)
@@ -1618,7 +1618,12 @@ void layout_image_next(LayoutWindow *lw)
                        if (y->next)
                                layout_image_set_index(lw, GPOINTER_TO_INT(y->next->data));
                        else
-                               layout_image_set_index(lw, GPOINTER_TO_INT(x->data));
+                               {
+                               if (options->circular_selection_lists)
+                                       {
+                                       layout_image_set_index(lw, GPOINTER_TO_INT(x->data));
+                                       }
+                               }
                        }
                while (x)
                        x = g_list_remove(x, x->data);
@@ -1691,7 +1696,12 @@ void layout_image_prev(LayoutWindow *lw)
                        if (y->prev)
                                layout_image_set_index(lw, GPOINTER_TO_INT(y->prev->data));
                        else
-                               layout_image_set_index(lw, GPOINTER_TO_INT(last->data));
+                               {
+                               if (options->circular_selection_lists)
+                                       {
+                                       layout_image_set_index(lw, GPOINTER_TO_INT(last->data));
+                                       }
+                               }
                        }
                while (x)
                        x = g_list_remove(x, x->data);
index 371ab1d..0cf6092 100644 (file)
@@ -187,6 +187,7 @@ ConfOptions *init_options(ConfOptions *options)
 
        options->tree_descend_subdirs = FALSE;
        options->view_dir_list_single_click_enter = TRUE;
+       options->circular_selection_lists = TRUE;
        options->update_on_time_change = TRUE;
        options->clipboard_selection = CLIPBOARD_BOTH;
 
index c59161c..c303f45 100644 (file)
@@ -45,6 +45,8 @@ struct _ConfOptions
        gboolean tree_descend_subdirs;
        gboolean view_dir_list_single_click_enter;
 
+       gboolean circular_selection_lists;
+
        gboolean lazy_image_sync;
        gboolean update_on_time_change;
 
index dbee9b5..fa17431 100644 (file)
@@ -378,6 +378,7 @@ static void config_window_apply(void)
        options->tree_descend_subdirs = c_options->tree_descend_subdirs;
 
        options->view_dir_list_single_click_enter = c_options->view_dir_list_single_click_enter;
+       options->circular_selection_lists = c_options->circular_selection_lists;
 
        options->open_recent_list_maxsize = c_options->open_recent_list_maxsize;
        options->dnd_icon_size = c_options->dnd_icon_size;
@@ -3287,6 +3288,7 @@ static void config_tab_behavior(GtkWidget *notebook)
        GtkWidget *collections_on_top;
        GtkWidget *hide_window_in_fullscreen;
        GtkWidget *checkbox;
+       GtkWidget *tmp;
 
        vbox = scrolled_notebook_page(notebook, _("Behavior"));
 
@@ -3350,6 +3352,10 @@ static void config_tab_behavior(GtkWidget *notebook)
        pref_checkbox_new_int(group, _("List directory view uses single click to enter"),
                              options->view_dir_list_single_click_enter, &c_options->view_dir_list_single_click_enter);
 
+       tmp = pref_checkbox_new_int(group, _("Circular selection lists"),
+                             options->circular_selection_lists, &c_options->circular_selection_lists);
+       gtk_widget_set_tooltip_text(tmp, _("Traverse selection lists in a circular manner"));
+
        marks = pref_checkbox_new_int(group, _("Save marks on exit"),
                                options->marks_save, &c_options->marks_save);
        gtk_widget_set_tooltip_text(marks,"Note that marks linked to a keyword will be saved irrespective of this setting");
index accc7b3..cac00af 100644 (file)
@@ -313,6 +313,7 @@ static void write_global_attributes(GString *outstr, gint indent)
 
        WRITE_NL(); WRITE_BOOL(*options, tree_descend_subdirs);
        WRITE_NL(); WRITE_BOOL(*options, view_dir_list_single_click_enter);
+       WRITE_NL(); WRITE_BOOL(*options, circular_selection_lists);
        WRITE_NL(); WRITE_BOOL(*options, lazy_image_sync);
        WRITE_NL(); WRITE_BOOL(*options, update_on_time_change);
        WRITE_SEPARATOR();
@@ -746,6 +747,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
 
                if (READ_BOOL(*options, tree_descend_subdirs)) continue;
                if (READ_BOOL(*options, view_dir_list_single_click_enter)) continue;
+               if (READ_BOOL(*options, circular_selection_lists)) continue;
                if (READ_BOOL(*options, lazy_image_sync)) continue;
                if (READ_BOOL(*options, update_on_time_change)) continue;