changeset 2424:83d9886b9bcb

Preferences: Open recent list maximum size Implement this function, and change the name to "Recent folder list maximum size"
author Colin Clark <cclark@mcb.net>
date Thu, 05 Jan 2017 13:53:31 +0000
parents ba806fc7a4c1
children 0af6b94854c2
files doc/docbook/GuideOptionsBehavior.xml src/history_list.c src/preferences.c
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideOptionsBehavior.xml	Wed Jan 04 20:01:47 2017 +0000
+++ b/doc/docbook/GuideOptionsBehavior.xml	Thu Jan 05 13:53:31 2017 +0000
@@ -118,10 +118,10 @@
       </varlistentry>
       <varlistentry>
         <term>
-          <guilabel>Open recent list maximum size</guilabel>
+          <guilabel>Recent folder list maximum size</guilabel>
         </term>
         <listitem>
-          <para>This is the number of entries saved in the recent open file list.</para>
+          <para>This is the number of entries to be saved from the recent open folder list drop-down box. The number of entries displayed in the current session is unlimited.</para>
         </listitem>
       </varlistentry>
       <varlistentry>
--- a/src/history_list.c	Wed Jan 04 20:01:47 2017 +0000
+++ b/src/history_list.c	Thu Jan 05 13:53:31 2017 +0000
@@ -130,6 +130,7 @@
 	SecureSaveInfo *ssi;
 	GList *list;
 	gchar *pathl;
+	gint list_count;
 
 	pathl = path_from_utf8(path);
 	ssi = secure_open(pathl);
@@ -157,10 +158,15 @@
 		 * so that when reading they are added correctly
 		 */
 		work = g_list_last(hd->list);
+		list_count = g_list_position(hd->list, g_list_last(hd->list)) + 1;
 		while (work && secsave_errno == SS_ERR_NONE)
 			{
-			secure_fprintf(ssi, "\"%s\"\n", (gchar *)work->data);
+			if (!(strcmp(hd->key, "path_list") == 0 && list_count > options->open_recent_list_maxsize))
+				{
+				secure_fprintf(ssi, "\"%s\"\n", (gchar *)work->data);
+				}
 			work = work->prev;
+			list_count--;
 			}
 		secure_fputc(ssi, '\n');
 		}
--- a/src/preferences.c	Wed Jan 04 20:01:47 2017 +0000
+++ b/src/preferences.c	Thu Jan 05 13:53:31 2017 +0000
@@ -2154,7 +2154,7 @@
 	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);
 
-	pref_spin_new_int(group, _("Open recent list maximum size"), NULL,
+	pref_spin_new_int(group, _("Recent folder list maximum size"), NULL,
 			  1, 50, 1, options->open_recent_list_maxsize, &c_options->open_recent_list_maxsize);
 
 	pref_spin_new_int(group, _("Drag'n drop icon size"), NULL,