Mercurial > hg > forks > geeqie
changeset 2619:77596dda797e
Fix #207: Symlink doesn't show in Sort Manager
https://github.com/BestImageViewer/geeqie/issues/207
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Sat, 30 Sep 2017 10:25:33 +0100 |
parents | 9e29be68f634 |
children | 7a7e180298b1 |
files | src/bar_sort.c src/bar_sort.h src/layout_util.c src/rcfile.c src/typedefs.h |
diffstat | 5 files changed, 45 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar_sort.c Wed Sep 27 17:43:52 2017 +0100 +++ b/src/bar_sort.c Sat Sep 30 10:25:33 2017 +0100 @@ -763,6 +763,44 @@ return bar; } +/** + * @brief Sets the bar_sort_enabled flag + * @param lw + * @param attribute_names + * @param attribute_values + * + * Called from rcfile when processing geeqierc.xml on start-up. + * It is neccesary to set the bar_sort_enabled flag because + * the sort manager and desktop files are set up in the idle loop, and + * setup is not yet completed during initialisation. + * The flag is checked in layout_editors_reload_idle_cb. + * action, mode, selection and filter_key are ignored. + */ +void bar_sort_cold_start(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values) +{ + gboolean enabled = TRUE; + gint action = 0; + gint mode = 0; + gint selection = 0; + gchar *filter_key = NULL; + + while (attribute_names && *attribute_names) + { + const gchar *option = *attribute_names++; + const gchar *value = *attribute_values++; + + if (READ_BOOL_FULL("enabled", enabled)) continue; + if (READ_INT_CLAMP_FULL("action", action, 0, BAR_SORT_ACTION_COUNT - 1)) continue; + if (READ_INT_CLAMP_FULL("mode", mode, 0, BAR_SORT_MODE_COUNT - 1)) continue; + if (READ_INT_CLAMP_FULL("selection", selection, 0, BAR_SORT_SELECTION_COUNT - 1)) continue; + if (READ_CHAR_FULL("filter_key", filter_key)) continue; + + log_printf("unknown attribute %s = %s\n", option, value); + } + + lw->bar_sort_enabled = enabled; +} + GtkWidget *bar_sort_new_default(LayoutWindow *lw) { return bar_sort_new_from_config(lw, NULL, NULL);
--- a/src/bar_sort.h Wed Sep 27 17:43:52 2017 +0100 +++ b/src/bar_sort.h Sat Sep 30 10:25:33 2017 +0100 @@ -28,6 +28,6 @@ void bar_sort_close(GtkWidget *bar); void bar_sort_write_config(GtkWidget *bar, GString *outstr, gint indent); - +void bar_sort_cold_start(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values); #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/layout_util.c Wed Sep 27 17:43:52 2017 +0100 +++ b/src/layout_util.c Sat Sep 30 10:25:33 2017 +0100 @@ -2528,6 +2528,10 @@ LayoutWindow *lw = work->data; work = work->next; layout_actions_setup_editors(lw); + if (lw->bar_sort_enabled) + { + layout_bar_sort_toggle(lw); + } } DEBUG_1("%s layout_editors_reload_idle_cb: setup_editors done", get_exec_time());
--- a/src/rcfile.c Wed Sep 27 17:43:52 2017 +0100 +++ b/src/rcfile.c Sat Sep 30 10:25:33 2017 +0100 @@ -1099,17 +1099,11 @@ options_parse_func_push(parser_data, options_parse_bar, NULL, lw->bar); } -#if 0 -/* FIXME: The sort manager and desktop files are set up in the idle loop. - * Setup is not yet completed when the layout is first displayed. - */ else if (g_ascii_strcasecmp(element_name, "bar_sort") == 0) { - GtkWidget *bar = bar_sort_new_from_config(lw, attribute_names, attribute_values); - layout_bar_sort_set(lw, bar); + bar_sort_cold_start(lw, attribute_names, attribute_values); options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); } -#endif else if (g_ascii_strcasecmp(element_name, "toolbar") == 0) { options_parse_func_push(parser_data, options_parse_toolbar_and_statusbar, NULL, NULL);
--- a/src/typedefs.h Wed Sep 27 17:43:52 2017 +0100 +++ b/src/typedefs.h Sat Sep 30 10:25:33 2017 +0100 @@ -775,7 +775,7 @@ GtkWidget *bar_sort; GtkWidget *bar; -// gint bar_sort_enabled; + gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */ // gint bar_enabled; // gint bar_width;