File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -3498,7 +3498,46 @@ static void _lib_tagging_tag_show(dt_action_t *action)
34983498 }
34993499}
35003500
3501- static int _get_recent_tags_list_length (); // forward decl kept consistent
3501+ static int _get_recent_tags_list_length ()
3502+ {
3503+ const int length = dt_conf_get_int ("plugins/lighttable/tagging/nb_recent_tags" );
3504+ if (length == -1 ) return length ;
3505+ else if (length >= 10 /2 ) return length * 2 ;
3506+ else return 10 ;
3507+ }
3508+
3509+ static void _size_recent_tags_list ()
3510+ {
3511+ const char * list = dt_conf_get_string_const ("plugins/lighttable/tagging/recent_tags" );
3512+ if (!list [0 ])
3513+ return ;
3514+ const int length = _get_recent_tags_list_length ();
3515+ if (length == -1 )
3516+ {
3517+ dt_conf_set_string ("plugins/lighttable/tagging/recent_tags" , "" );
3518+ return ;
3519+ }
3520+
3521+ char * p = (char * )list ;
3522+ int nb = 1 ;
3523+ for (; * p != '\0' ; p ++ )
3524+ {
3525+ if (* p == ',' ) nb ++ ;
3526+ }
3527+
3528+ if (nb > length )
3529+ {
3530+ nb -= length ;
3531+ char * list2 = g_strdup (list );
3532+ for (; nb > 0 ; nb -- )
3533+ {
3534+ p = g_strrstr (list2 , "','" );
3535+ if (p ) * p = '\0' ;
3536+ }
3537+ dt_conf_set_string ("plugins/lighttable/tagging/recent_tags" , list2 );
3538+ g_free (list2 );
3539+ }
3540+ }
35023541
35033542void _menuitem_preferences (GtkMenuItem * menuitem , dt_lib_module_t * self )
35043543{
You can’t perform that action at this time.
0 commit comments