From 7978f86304a572e67a6cdb56c3f6113724b0cdd2 Mon Sep 17 00:00:00 2001 From: Klaus Ethgen Date: Thu, 19 May 2016 14:35:25 +0100 Subject: [PATCH] Don't store toolbars in config file It makes no sense to save that information in config file. Even more, it makes more troubles than it is worth. Starting from here, just drop that information and use the configured in values all the time. This also fixes the troubles with e9fc136. --- src/layout.c | 3 --- src/layout_util.c | 50 ----------------------------------------------- src/layout_util.h | 2 -- src/rcfile.c | 47 ++++++++------------------------------------ 4 files changed, 8 insertions(+), 94 deletions(-) diff --git a/src/layout.c b/src/layout.c index 45c702cc..c05a3fcf 100644 --- a/src/layout.c +++ b/src/layout.c @@ -2278,9 +2278,6 @@ void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent) bar_sort_write_config(lw->bar_sort, outstr, indent + 1); bar_write_config(lw->bar, outstr, indent + 1); - layout_toolbar_write_config(lw, TOOLBAR_MAIN, outstr, indent + 1); - layout_toolbar_write_config(lw, TOOLBAR_STATUS, outstr, indent + 1); - WRITE_NL(); WRITE_STRING(""); } diff --git a/src/layout_util.c b/src/layout_util.c index 8c30ff5d..f734d6ab 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -2193,56 +2193,6 @@ void layout_toolbar_add_default(LayoutWindow *lw, ToolbarType type) } } -void layout_toolbar_write_config(LayoutWindow *lw, ToolbarType type, GString *outstr, gint indent) -{ - const gchar *name = NULL; - GList *work = lw->toolbar_actions[type]; - - switch (type) - { - case TOOLBAR_MAIN: - name = "toolbar"; - break; - case TOOLBAR_STATUS: - name = "statusbar"; - break; - default: - break; - } - - WRITE_NL(); WRITE_STRING("<%s>", name); - indent++; - WRITE_NL(); WRITE_STRING(""); - while (work) - { - gchar *action = work->data; - work = work->next; - WRITE_NL(); WRITE_STRING(""); - } - indent--; - WRITE_NL(); WRITE_STRING("", name); -} - -void layout_toolbar_add_from_config(LayoutWindow *lw, ToolbarType type, const gchar **attribute_names, const gchar **attribute_values) -{ - gchar *action = NULL; - - while (*attribute_names) - { - const gchar *option = *attribute_names++; - const gchar *value = *attribute_values++; - - if (READ_CHAR_FULL("action", action)) continue; - - log_printf("unknown attribute %s = %s\n", option, value); - } - - layout_toolbar_add(lw, type, action); - g_free(action); -} - /* *----------------------------------------------------------------------------- * misc diff --git a/src/layout_util.h b/src/layout_util.h index 70552fc9..ea6f403f 100644 --- a/src/layout_util.h +++ b/src/layout_util.h @@ -38,14 +38,12 @@ void layout_editors_reload_finish(void); void layout_actions_setup(LayoutWindow *lw); void layout_actions_add_window(LayoutWindow *lw, GtkWidget *window); GtkWidget *layout_actions_menu_bar(LayoutWindow *lw); -void layout_toolbar_add_from_config(LayoutWindow *lw, ToolbarType type, const gchar **attribute_names, const gchar **attribute_values); GtkWidget *layout_actions_toolbar(LayoutWindow *lw, ToolbarType type); void layout_toolbar_clear(LayoutWindow *lw, ToolbarType type); void layout_toolbar_add(LayoutWindow *lw, ToolbarType type, const gchar *action); void layout_toolbar_add_default(LayoutWindow *lw, ToolbarType type); -void layout_toolbar_write_config(LayoutWindow *lw, ToolbarType type, GString *outstr, gint indent); void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window); diff --git a/src/rcfile.c b/src/rcfile.c index f3c986d0..f9460daa 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -976,44 +976,13 @@ static void options_parse_bar(GQParserData *parser_data, GMarkupParseContext *co } } -static void options_parse_toolbar(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) -{ - LayoutWindow *lw = data; - if (g_ascii_strcasecmp(element_name, "toolitem") == 0) - { - layout_toolbar_add_from_config(lw, TOOLBAR_MAIN, attribute_names, attribute_values); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } - else if (g_ascii_strcasecmp(element_name, "clear") == 0) - { - layout_toolbar_clear(lw, TOOLBAR_MAIN); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } - else - { - log_printf("unexpected in : <%s>\n", element_name); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } -} - -static void options_parse_statusbar(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) +/* Just a dummy function to parse out old leftovers + * + * This function can be cleaned somedays. + */ +static void options_parse_toolbar_and_statusbar(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) { - LayoutWindow *lw = data; - if (g_ascii_strcasecmp(element_name, "toolitem") == 0) - { - layout_toolbar_add_from_config(lw, TOOLBAR_STATUS, attribute_names, attribute_values); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } - else if (g_ascii_strcasecmp(element_name, "clear") == 0) - { - layout_toolbar_clear(lw, TOOLBAR_STATUS); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } - else - { - log_printf("unexpected in : <%s>\n", element_name); - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); - } + options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); } static void options_parse_layout(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) @@ -1041,11 +1010,11 @@ static void options_parse_layout(GQParserData *parser_data, GMarkupParseContext } else if (g_ascii_strcasecmp(element_name, "toolbar") == 0) { - options_parse_func_push(parser_data, options_parse_toolbar, NULL, lw); + options_parse_func_push(parser_data, options_parse_toolbar_and_statusbar, NULL, NULL); } else if (g_ascii_strcasecmp(element_name, "statusbar") == 0) { - options_parse_func_push(parser_data, options_parse_statusbar, NULL, lw); + options_parse_func_push(parser_data, options_parse_toolbar_and_statusbar, NULL, NULL); } else { -- 2.20.1