From: Colin Clark Date: Sat, 30 Sep 2017 09:25:33 +0000 (+0100) Subject: Fix #207: Symlink doesn't show in Sort Manager X-Git-Tag: v1.4~71 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=81dc6bbc7195b04542df8719c35a9a9bf45afdb2 Fix #207: Symlink doesn't show in Sort Manager https://github.com/BestImageViewer/geeqie/issues/207 --- diff --git a/src/bar_sort.c b/src/bar_sort.c index 2b915509..705988e7 100644 --- a/src/bar_sort.c +++ b/src/bar_sort.c @@ -763,6 +763,44 @@ GtkWidget *bar_sort_new_from_config(LayoutWindow *lw, const gchar **attribute_na 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); diff --git a/src/bar_sort.h b/src/bar_sort.h index cb3c843b..d26d2571 100644 --- a/src/bar_sort.h +++ b/src/bar_sort.h @@ -28,6 +28,6 @@ GtkWidget *bar_sort_new_from_config(LayoutWindow *lw, const gchar **attribute_na 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: */ diff --git a/src/layout_util.c b/src/layout_util.c index 72e1d6cb..4fdd4c12 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -2528,6 +2528,10 @@ static gboolean layout_editors_reload_idle_cb(gpointer data) 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()); diff --git a/src/rcfile.c b/src/rcfile.c index 460a46cb..2ac5922b 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1099,17 +1099,11 @@ static void options_parse_layout(GQParserData *parser_data, GMarkupParseContext 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); diff --git a/src/typedefs.h b/src/typedefs.h index 9327e358..9d78ddd0 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -775,7 +775,7 @@ struct _LayoutWindow 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;