return -1;
}
+static gpointer info_tab_new_funcs[] = {
+ info_tab_general_new,
+ info_tab_meta_new,
+ info_tab_exif_new,
+};
+
+gchar *info_tab_default_order(void)
+{
+ gint i;
+ static gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1];
+
+ for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++)
+ str[i] = i + '1';
+ str[i] = '\0';
+
+ return str;
+}
+
+static void info_tab_get_order_string(gchar **dest)
+{
+ GList *work;
+ gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1];
+
+ g_assert(dest);
+
+ if (!info_tabs_pos_list)
+ return;
+
+ memset(str, 0, G_N_ELEMENTS(info_tab_new_funcs) + 1);
+
+ work = info_tabs_pos_list;
+ while (work)
+ {
+ gint i;
+ InfoTabsPos *t = work->data;
+ work = work->next;
+
+ for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++)
+ {
+ if (t->func == info_tab_new_funcs[i])
+ {
+ g_assert(t->pos >= 0 && t->pos < G_N_ELEMENTS(info_tab_new_funcs));
+ str[t->pos] = i + '1';
+ }
+ }
+ }
+
+ if (strlen(str) != G_N_ELEMENTS(info_tab_new_funcs)) return;
+
+ g_free(*dest);
+ *dest = g_strdup(str);
+}
+
static void info_tabs_init(InfoData *id)
{
GList *work;
if (!info_tabs_pos_list)
{
- /* First run, default tabs order is defined here. */
- info_tabs_pos_list_append(info_tab_general_new);
- info_tabs_pos_list_append(info_tab_meta_new);
- info_tabs_pos_list_append(info_tab_exif_new);
+ gint count = 0;
+ gint i;
+ gchar *order = options->properties.tabs_order;
+
+ for (i = 0; i < strlen(order); i++)
+ {
+ gint n = order[i] - '1';
+
+ if (n < 0 || n >= G_N_ELEMENTS(info_tab_new_funcs)) break;
+ count++;
+ }
+
+ if (count != G_N_ELEMENTS(info_tab_new_funcs))
+ order = info_tab_default_order();
+
+ for (i = 0; i < strlen(order); i++)
+ {
+ gint n = order[i] - '1';
+
+ if (n < 0 || n >= G_N_ELEMENTS(info_tab_new_funcs)) continue;
+ if (g_list_find(info_tabs_pos_list, info_tab_new_funcs[n])) continue;
+ info_tabs_pos_list_append(info_tab_new_funcs[n]);
+ }
}
else
info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos);
+ info_tab_get_order_string(&options->properties.tabs_order);
+
work = info_tabs_pos_list;
while (work)
{
}
}
}
+
+ info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos);
+ info_tab_get_order_string(&options->properties.tabs_order);
}
/*
#include "fullscreen.h"
#include "image-overlay.h"
#include "img-view.h"
+#include "info.h"
#include "layout.h"
#include "layout_image.h"
#include "menu.h"
set_default_image_overlay_template_string(options);
sidecar_ext_add_defaults();
options->layout.order = g_strdup("123");
+ options->properties.tabs_order = g_strdup(info_tab_default_order());
}
static void exit_program_final(void)
WRITE_INT(panels.sort.mode_state);
WRITE_INT(panels.sort.selection_state);
+ WRITE_SUBTITLE("Properties dialog Options");
+ WRITE_CHAR(properties.tabs_order);
+
WRITE_SUBTITLE("Image Options");
secure_fprintf(ssi, "# image.zoom_mode possible values are:\n"
READ_INT(panels.sort.mode_state);
READ_INT(panels.sort.selection_state);
+ /* properties dialog options */
+ READ_CHAR(properties.tabs_order);
+
/* image options */
if (g_ascii_strcasecmp(option, "image.zoom_mode") == 0)
{