comparison src/rcfile.c @ 1404:de06d83e1adc

save and restore the keyword tree
author nadvornik
date Sun, 08 Mar 2009 23:09:27 +0000
parents 6f31fa931d3f
children d7a6fb7a90dd
comparison
equal deleted inserted replaced
1403:9274b3b4eaad 1404:de06d83e1adc
30 #include "slideshow.h" 30 #include "slideshow.h"
31 #include "ui_fileops.h" 31 #include "ui_fileops.h"
32 #include "layout.h" 32 #include "layout.h"
33 #include "layout_util.h" 33 #include "layout_util.h"
34 #include "bar.h" 34 #include "bar.h"
35 #include "metadata.h"
35 36
36 37
37 /* 38 /*
38 *----------------------------------------------------------------------------- 39 *-----------------------------------------------------------------------------
39 * line write/parse routines (public) 40 * line write/parse routines (public)
535 WRITE_SEPARATOR(); 536 WRITE_SEPARATOR();
536 WRITE_SUBTITLE("Layout Options - defaults"); 537 WRITE_SUBTITLE("Layout Options - defaults");
537 WRITE_STRING("<layout\n"); 538 WRITE_STRING("<layout\n");
538 layout_write_attributes(&options->layout, outstr, indent + 1); 539 layout_write_attributes(&options->layout, outstr, indent + 1);
539 WRITE_STRING("/>\n"); 540 WRITE_STRING("/>\n");
540 541 keyword_tree_write_config(outstr, indent);
541 indent--; 542 indent--;
542 WRITE_STRING("</global>\n"); 543 WRITE_STRING("</global>\n");
543 544
544 WRITE_SEPARATOR(); 545 WRITE_SEPARATOR();
545 WRITE_SUBTITLE("Layout Options"); 546 WRITE_SUBTITLE("Layout Options");
819 { 820 {
820 if (!parser_data->startup) filter_rebuild(); 821 if (!parser_data->startup) filter_rebuild();
821 /* else this is called in init_after_global_options */ 822 /* else this is called in init_after_global_options */
822 } 823 }
823 824
825 static void options_parse_keyword_end(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, gpointer data, GError **error)
826 {
827 GtkTreeIter *iter_ptr = data;
828 gtk_tree_iter_free(iter_ptr);
829 }
830
831
832 static void options_parse_keyword(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
833 {
834 GtkTreeIter *iter_ptr = data;
835 if (g_ascii_strcasecmp(element_name, "keyword") == 0)
836 {
837 GtkTreeIter *child = keyword_add_from_config(keyword_tree, iter_ptr, attribute_names, attribute_values);
838 options_parse_func_push(parser_data, options_parse_keyword, options_parse_keyword_end, child);
839 }
840 else
841 {
842 DEBUG_1("unexpected in <keyword>: <%s>", element_name);
843 options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
844 }
845 }
846
847
848
849 static void options_parse_keyword_tree(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
850 {
851 if (g_ascii_strcasecmp(element_name, "keyword") == 0)
852 {
853 GtkTreeIter *iter_ptr = keyword_add_from_config(keyword_tree, NULL, attribute_names, attribute_values);
854 options_parse_func_push(parser_data, options_parse_keyword, options_parse_keyword_end, iter_ptr);
855 }
856 else
857 {
858 DEBUG_1("unexpected in <keyword_tree>: <%s>", element_name);
859 options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
860 }
861 }
862
863
824 static void options_parse_global(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) 864 static void options_parse_global(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
825 { 865 {
826 if (g_ascii_strcasecmp(element_name, "color_profiles") == 0) 866 if (g_ascii_strcasecmp(element_name, "color_profiles") == 0)
827 { 867 {
828 options_load_color_profiles(parser_data, context, element_name, attribute_names, attribute_values, data, error); 868 options_load_color_profiles(parser_data, context, element_name, attribute_names, attribute_values, data, error);
829 options_parse_func_push(parser_data, options_parse_color_profiles, NULL, GINT_TO_POINTER(0)); 869 options_parse_func_push(parser_data, options_parse_color_profiles, NULL, GINT_TO_POINTER(0));
830 } 870 }
831 else if (g_ascii_strcasecmp(element_name, "filter") == 0) 871 else if (g_ascii_strcasecmp(element_name, "filter") == 0)
832 { 872 {
833 options_parse_func_push(parser_data, options_parse_filter, options_parse_filter_end, NULL); 873 options_parse_func_push(parser_data, options_parse_filter, options_parse_filter_end, NULL);
874 }
875 else if (g_ascii_strcasecmp(element_name, "keyword_tree") == 0)
876 {
877 if (!keyword_tree) keyword_tree_new();
878 options_parse_func_push(parser_data, options_parse_keyword_tree, NULL, NULL);
834 } 879 }
835 else if (g_ascii_strcasecmp(element_name, "layout") == 0) 880 else if (g_ascii_strcasecmp(element_name, "layout") == 0)
836 { 881 {
837 layout_load_attributes(&options->layout, attribute_names, attribute_values); 882 layout_load_attributes(&options->layout, attribute_names, attribute_values);
838 options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); 883 options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);