Mercurial > geeqie
changeset 1461:e015b6573d36
improved config file formatting
author | nadvornik |
---|---|
date | Thu, 19 Mar 2009 22:12:14 +0000 |
parents | 8178ef34d257 |
children | 75721f22155c |
files | src/bar.c src/bar_comment.c src/bar_exif.c src/bar_histogram.c src/bar_keywords.c src/bar_sort.c src/filefilter.c src/layout.c src/layout_util.c src/metadata.c src/rcfile.c src/rcfile.h |
diffstat | 12 files changed, 184 insertions(+), 190 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar.c Thu Mar 19 22:12:14 2009 +0000 @@ -161,12 +161,10 @@ bd = g_object_get_data(G_OBJECT(bar), "bar_data"); if (!bd) return; - WRITE_STRING("<bar\n"); - indent++; + WRITE_NL(); WRITE_STRING("<bar "); write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar)); write_uint_option(outstr, indent, "width", bd->width); - indent--; - WRITE_STRING(">\n"); + WRITE_STRING(">"); list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); work = list; @@ -186,7 +184,7 @@ } g_list_free(list); - WRITE_STRING("</bar>\n"); + WRITE_NL(); WRITE_STRING("</bar>"); }
--- a/src/bar_comment.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar_comment.c Thu Mar 19 22:12:14 2009 +0000 @@ -150,14 +150,12 @@ pcd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pcd) return; - WRITE_STRING("<pane_comment\n"); - indent++; + WRITE_NL(); WRITE_STRING("<pane_comment "); write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(pcd->pane.title))); WRITE_BOOL(*pcd, pane.expanded); WRITE_CHAR(*pcd, key); WRITE_INT(*pcd, height); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } static void bar_pane_comment_notify_cb(FileData *fd, NotifyType type, gpointer data)
--- a/src/bar_exif.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar_exif.c Thu Mar 19 22:12:14 2009 +0000 @@ -636,14 +636,12 @@ ExifEntry *ee = g_object_get_data(G_OBJECT(entry), "entry_data"); if (!ee) return; - WRITE_STRING("<entry\n"); - indent++; + WRITE_NL(); WRITE_STRING("<entry "); WRITE_CHAR(*ee, key); if (!ee->auto_title) WRITE_CHAR(*ee, title); WRITE_BOOL(*ee, if_set); WRITE_BOOL(*ee, editable); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } static void bar_pane_exif_write_config(GtkWidget *pane, GString *outstr, gint indent) @@ -654,12 +652,10 @@ ped = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!ped) return; - WRITE_STRING("<pane_exif\n"); - indent++; + WRITE_NL(); WRITE_STRING("<pane_exif "); write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(ped->pane.title))); WRITE_BOOL(*ped, pane.expanded); - indent--; - WRITE_STRING(">\n"); + WRITE_STRING(">"); indent++; list = gtk_container_get_children(GTK_CONTAINER(ped->vbox)); @@ -673,7 +669,7 @@ } g_list_free(list); indent--; - WRITE_STRING("</pane_exif>\n"); + WRITE_NL(); WRITE_STRING("</pane_exif>"); }
--- a/src/bar_histogram.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar_histogram.c Thu Mar 19 22:12:14 2009 +0000 @@ -117,14 +117,12 @@ phd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!phd) return; - WRITE_STRING("<pane_histogram\n"); - indent++; + WRITE_NL(); WRITE_STRING("<pane_histogram "); write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(phd->pane.title))); WRITE_BOOL(*phd, pane.expanded); WRITE_INT(*phd->histogram, histogram_channel); WRITE_INT(*phd->histogram, histogram_mode); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } static void bar_pane_histogram_notify_cb(FileData *fd, NotifyType type, gpointer data)
--- a/src/bar_keywords.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar_keywords.c Thu Mar 19 22:12:14 2009 +0000 @@ -247,13 +247,11 @@ pkd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pkd) return; - WRITE_STRING("<pane_keywords\n"); - indent++; + WRITE_NL(); WRITE_STRING("<pane_keywords "); write_char_option(outstr, indent, "pane.title", gtk_label_get_text(GTK_LABEL(pkd->pane.title))); WRITE_BOOL(*pkd, pane.expanded); WRITE_CHAR(*pkd, key); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
--- a/src/bar_sort.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/bar_sort.c Thu Mar 19 22:12:14 2009 +0000 @@ -723,15 +723,13 @@ sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data"); if (!sd) return; - WRITE_STRING("<bar_sort\n"); - indent++; + WRITE_NL(); WRITE_STRING("<bar_sort "); write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar)); WRITE_INT(*sd, mode); WRITE_INT(*sd, action); WRITE_INT(*sd, selection); WRITE_CHAR(*sd, filter_key); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); }
--- a/src/filefilter.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/filefilter.c Thu Mar 19 22:12:14 2009 +0000 @@ -418,7 +418,7 @@ { GList *work; - WRITE_STRING("<filter>\n"); + WRITE_NL(); WRITE_STRING("<filter>"); indent++; work = filter_list; @@ -427,8 +427,7 @@ FilterEntry *fe = work->data; work = work->next; - WRITE_STRING("<file_type\n"); - indent++; + WRITE_NL(); WRITE_STRING("<file_type "); WRITE_CHAR(*fe, key); WRITE_BOOL(*fe, enabled); WRITE_CHAR(*fe, extensions); @@ -436,11 +435,10 @@ WRITE_UINT(*fe, file_class); WRITE_BOOL(*fe, writable); WRITE_BOOL(*fe, allow_sidecar); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } indent--; - WRITE_STRING("</filter>\n"); + WRITE_NL(); WRITE_STRING("</filter>"); } void filter_load_file_type(const gchar **attribute_names, const gchar **attribute_values)
--- a/src/layout.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/layout.c Thu Mar 19 22:12:14 2009 +0000 @@ -2328,62 +2328,62 @@ void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent) { - WRITE_INT(*layout, style); - WRITE_CHAR(*layout, order); - WRITE_UINT(*layout, dir_view_type); - WRITE_UINT(*layout, file_view_type); - WRITE_BOOL(*layout, show_marks); - WRITE_BOOL(*layout, show_thumbnails); - WRITE_BOOL(*layout, show_directory_date); - WRITE_CHAR(*layout, home_path); + WRITE_NL(); WRITE_INT(*layout, style); + WRITE_NL(); WRITE_CHAR(*layout, order); + WRITE_NL(); WRITE_UINT(*layout, dir_view_type); + WRITE_NL(); WRITE_UINT(*layout, file_view_type); + WRITE_NL(); WRITE_BOOL(*layout, show_marks); + WRITE_NL(); WRITE_BOOL(*layout, show_thumbnails); + WRITE_NL(); WRITE_BOOL(*layout, show_directory_date); + WRITE_NL(); WRITE_CHAR(*layout, home_path); WRITE_SEPARATOR(); - WRITE_INT(*layout, main_window.x); - WRITE_INT(*layout, main_window.y); - WRITE_INT(*layout, main_window.w); - WRITE_INT(*layout, main_window.h); - WRITE_BOOL(*layout, main_window.maximized); - WRITE_INT(*layout, main_window.hdivider_pos); - WRITE_INT(*layout, main_window.vdivider_pos); + WRITE_NL(); WRITE_INT(*layout, main_window.x); + WRITE_NL(); WRITE_INT(*layout, main_window.y); + WRITE_NL(); WRITE_INT(*layout, main_window.w); + WRITE_NL(); WRITE_INT(*layout, main_window.h); + WRITE_NL(); WRITE_BOOL(*layout, main_window.maximized); + WRITE_NL(); WRITE_INT(*layout, main_window.hdivider_pos); + WRITE_NL(); WRITE_INT(*layout, main_window.vdivider_pos); WRITE_SEPARATOR(); - WRITE_INT(*layout, float_window.x); - WRITE_INT(*layout, float_window.y); - WRITE_INT(*layout, float_window.w); - WRITE_INT(*layout, float_window.h); - WRITE_INT(*layout, float_window.vdivider_pos); + WRITE_NL(); WRITE_INT(*layout, float_window.x); + WRITE_NL(); WRITE_INT(*layout, float_window.y); + WRITE_NL(); WRITE_INT(*layout, float_window.w); + WRITE_NL(); WRITE_INT(*layout, float_window.h); + WRITE_NL(); WRITE_INT(*layout, float_window.vdivider_pos); WRITE_SEPARATOR(); - WRITE_INT(*layout, properties_window.w); - WRITE_INT(*layout, properties_window.h); + WRITE_NL(); WRITE_INT(*layout, properties_window.w); + WRITE_NL(); WRITE_INT(*layout, properties_window.h); WRITE_SEPARATOR(); - WRITE_BOOL(*layout, tools_float); - WRITE_BOOL(*layout, tools_hidden); + WRITE_NL(); WRITE_BOOL(*layout, tools_float); + WRITE_NL(); WRITE_BOOL(*layout, tools_hidden); WRITE_SEPARATOR(); - WRITE_BOOL(*layout, toolbar_hidden); - WRITE_BOOL(*layout, info_pixel_hidden); - - WRITE_UINT(*layout, image_overlay.state); - WRITE_INT(*layout, image_overlay.histogram_channel); - WRITE_INT(*layout, image_overlay.histogram_mode); + WRITE_NL(); WRITE_BOOL(*layout, toolbar_hidden); + WRITE_NL(); WRITE_BOOL(*layout, info_pixel_hidden); + + WRITE_NL(); WRITE_UINT(*layout, image_overlay.state); + WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_channel); + WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_mode); } void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent) { layout_sync_options_with_current_state(lw); - WRITE_STRING("<layout\n"); + WRITE_NL(); WRITE_STRING("<layout"); layout_write_attributes(&lw->options, outstr, indent + 1); - WRITE_STRING(">\n"); + WRITE_STRING(">"); bar_sort_write_config(lw->bar_sort, outstr, indent + 1); bar_write_config(lw->bar, outstr, indent + 1); layout_toolbar_write_config(lw, outstr, indent + 1); - WRITE_STRING("</layout>\n"); + WRITE_NL(); WRITE_STRING("</layout>"); } void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values)
--- a/src/layout_util.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/layout_util.c Thu Mar 19 22:12:14 2009 +0000 @@ -1819,18 +1819,18 @@ void layout_toolbar_write_config(LayoutWindow *lw, GString *outstr, gint indent) { GList *work = lw->toolbar_actions; - WRITE_STRING("<toolbar>\n"); + WRITE_NL(); WRITE_STRING("<toolbar>"); indent++; while (work) { gchar *action = work->data; work = work->next; - WRITE_STRING("<toolitem\n"); + WRITE_NL(); WRITE_STRING("<toolitem "); write_char_option(outstr, indent + 1, "action", action); - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } indent--; - WRITE_STRING("</toolbar>\n"); + WRITE_NL(); WRITE_STRING("</toolbar>"); } void layout_toolbar_add_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values)
--- a/src/metadata.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/metadata.c Thu Mar 19 22:12:14 2009 +0000 @@ -1239,21 +1239,23 @@ GtkTreeIter children; gchar *name; - WRITE_STRING("<keyword\n"); - indent++; + WRITE_NL(); WRITE_STRING("<keyword "); name = keyword_get_name(keyword_tree, &iter); write_char_option(outstr, indent, "name", name); g_free(name); write_bool_option(outstr, indent, "kw", keyword_get_is_keyword(keyword_tree, &iter)); - indent--; - WRITE_STRING(">\n"); - indent++; if (gtk_tree_model_iter_children(keyword_tree, &children, &iter)) { + WRITE_STRING(">"); + indent++; keyword_tree_node_write_config(keyword_tree, &children, outstr, indent); + indent--; + WRITE_NL(); WRITE_STRING("</keyword>"); } - indent--; - WRITE_STRING("</keyword>\n"); + else + { + WRITE_STRING("/>"); + } if (!gtk_tree_model_iter_next(keyword_tree, &iter)) return; } } @@ -1261,7 +1263,7 @@ void keyword_tree_write_config(GString *outstr, gint indent) { GtkTreeIter iter; - WRITE_STRING("<keyword_tree>\n"); + WRITE_NL(); WRITE_STRING("<keyword_tree>"); indent++; if (keyword_tree && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_tree), &iter)) @@ -1269,7 +1271,7 @@ keyword_tree_node_write_config(GTK_TREE_MODEL(keyword_tree), &iter, outstr, indent); } indent--; - WRITE_STRING("</keyword_tree>\n"); + WRITE_NL(); WRITE_STRING("</keyword_tree>"); } GtkTreeIter *keyword_add_from_config(GtkTreeStore *keyword_tree, GtkTreeIter *parent, const gchar **attribute_names, const gchar **attribute_values)
--- a/src/rcfile.c Tue Mar 17 23:03:07 2009 +0000 +++ b/src/rcfile.c Thu Mar 19 22:12:14 2009 +0000 @@ -43,7 +43,7 @@ void write_indent(GString *str, gint indent) { - g_string_append_printf(str, "%*s", indent * 4, ""); + g_string_append_printf(str, "\n%*s", indent * 4, ""); } void write_char_option(GString *str, gint indent, const gchar *label, const gchar *text) @@ -68,8 +68,7 @@ gchar *escval1 = g_strescape(text ? text : "", (gchar *) no_quote_utf); gchar *escval2 = g_markup_escape_text(escval1, -1); - write_indent(str, indent); - g_string_append_printf(str, "%s = \"%s\"\n", label, escval2); + g_string_append_printf(str, "%s = \"%s\" ", label, escval2); g_free(escval2); g_free(escval1); } @@ -116,8 +115,7 @@ void write_int_option(GString *str, gint indent, const gchar *label, gint n) { - write_indent(str, indent); - g_string_append_printf(str, "%s = \"%d\"\n", label, n); + g_string_append_printf(str, "%s = \"%d\" ", label, n); } gboolean read_int_option(const gchar *option, const gchar *label, const gchar *value, gint *n) @@ -142,8 +140,7 @@ void write_uint_option(GString *str, gint indent, const gchar *label, guint n) { - write_indent(str, indent); - g_string_append_printf(str, "%s = \"%u\"\n", label, n); + g_string_append_printf(str, "%s = \"%u\" ", label, n); } gboolean read_uint_option(const gchar *option, const gchar *label, const gchar *value, guint *n) @@ -202,8 +199,7 @@ r = 0; } - write_indent(str, indent); - g_string_append_printf(str, "%s = \"%d.%d\"\n", label, l, r); + g_string_append_printf(str, "%s = \"%d.%d\" ", label, l, r); } gboolean read_int_unit_option(const gchar *option, const gchar *label, const gchar *value, gint *n, gint subunits) @@ -239,8 +235,7 @@ void write_bool_option(GString *str, gint indent, gchar *label, gint n) { - write_indent(str, indent); - g_string_append_printf(str, "%s = \"%s\"\n", label, n ? "true" : "false"); + g_string_append_printf(str, "%s = \"%s\" ", label, n ? "true" : "false"); } gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *value, gint *n) @@ -266,53 +261,53 @@ { // WRITE_SUBTITLE("General Options"); - WRITE_BOOL(*options, show_icon_names); - WRITE_BOOL(*options, show_copy_path); + WRITE_NL(); WRITE_BOOL(*options, show_icon_names); + WRITE_NL(); WRITE_BOOL(*options, show_copy_path); WRITE_SEPARATOR(); - WRITE_BOOL(*options, tree_descend_subdirs); - WRITE_BOOL(*options, lazy_image_sync); - WRITE_BOOL(*options, update_on_time_change); + WRITE_NL(); WRITE_BOOL(*options, tree_descend_subdirs); + WRITE_NL(); WRITE_BOOL(*options, lazy_image_sync); + WRITE_NL(); WRITE_BOOL(*options, update_on_time_change); WRITE_SEPARATOR(); - WRITE_BOOL(*options, progressive_key_scrolling); + WRITE_NL(); WRITE_BOOL(*options, progressive_key_scrolling); - WRITE_UINT(*options, duplicates_similarity_threshold); + WRITE_NL(); WRITE_UINT(*options, duplicates_similarity_threshold); WRITE_SEPARATOR(); - WRITE_BOOL(*options, mousewheel_scrolls); - WRITE_INT(*options, open_recent_list_maxsize); - WRITE_INT(*options, dnd_icon_size); - WRITE_BOOL(*options, place_dialogs_under_mouse); + WRITE_NL(); WRITE_BOOL(*options, mousewheel_scrolls); + WRITE_NL(); WRITE_INT(*options, open_recent_list_maxsize); + WRITE_NL(); WRITE_INT(*options, dnd_icon_size); + WRITE_NL(); WRITE_BOOL(*options, place_dialogs_under_mouse); - WRITE_BOOL(*options, save_window_positions); - WRITE_BOOL(*options, tools_restore_state); + WRITE_NL(); WRITE_BOOL(*options, save_window_positions); + WRITE_NL(); WRITE_BOOL(*options, tools_restore_state); // WRITE_SUBTITLE("Startup Options"); - WRITE_BOOL(*options, startup.restore_path); - WRITE_BOOL(*options, startup.use_last_path); - WRITE_CHAR(*options, startup.path); + WRITE_NL(); WRITE_BOOL(*options, startup.restore_path); + WRITE_NL(); WRITE_BOOL(*options, startup.use_last_path); + WRITE_NL(); WRITE_CHAR(*options, startup.path); // WRITE_SUBTITLE("File operations Options"); - WRITE_BOOL(*options, file_ops.enable_in_place_rename); - WRITE_BOOL(*options, file_ops.confirm_delete); - WRITE_BOOL(*options, file_ops.enable_delete_key); - WRITE_BOOL(*options, file_ops.safe_delete_enable); - WRITE_CHAR(*options, file_ops.safe_delete_path); - WRITE_INT(*options, file_ops.safe_delete_folder_maxsize); + WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename); + WRITE_NL(); WRITE_BOOL(*options, file_ops.confirm_delete); + WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_delete_key); + WRITE_NL(); WRITE_BOOL(*options, file_ops.safe_delete_enable); + WRITE_NL(); WRITE_CHAR(*options, file_ops.safe_delete_path); + WRITE_NL(); WRITE_INT(*options, file_ops.safe_delete_folder_maxsize); // WRITE_SUBTITLE("Properties dialog Options"); - WRITE_CHAR(*options, properties.tabs_order); + WRITE_NL(); WRITE_CHAR(*options, properties.tabs_order); // WRITE_SUBTITLE("Image Options"); - WRITE_UINT(*options, image.zoom_mode); + WRITE_NL(); WRITE_UINT(*options, image.zoom_mode); // g_string_append_printf(outstr, "# image.zoom_mode possible values are:\n" // "# original\n" @@ -326,96 +321,96 @@ // case ZOOM_RESET_NONE: g_string_append_printf(outstr, "dont_change\n"); break; // } WRITE_SEPARATOR(); - WRITE_BOOL(*options, image.zoom_2pass); - WRITE_BOOL(*options, image.zoom_to_fit_allow_expand); - WRITE_UINT(*options, image.zoom_quality); - WRITE_INT(*options, image.zoom_increment); - WRITE_BOOL(*options, image.fit_window_to_image); - WRITE_BOOL(*options, image.limit_window_size); - WRITE_INT(*options, image.max_window_size); - WRITE_BOOL(*options, image.limit_autofit_size); - WRITE_INT(*options, image.max_autofit_size); - WRITE_UINT(*options, image.scroll_reset_method); - WRITE_INT(*options, image.tile_cache_max); - WRITE_INT(*options, image.image_cache_max); - WRITE_UINT(*options, image.dither_quality); - WRITE_BOOL(*options, image.enable_read_ahead); - WRITE_BOOL(*options, image.exif_rotate_enable); - WRITE_BOOL(*options, image.use_custom_border_color); - WRITE_COLOR(*options, image.border_color); - WRITE_INT(*options, image.read_buffer_size); - WRITE_INT(*options, image.idle_read_loop_count); + WRITE_NL(); WRITE_BOOL(*options, image.zoom_2pass); + WRITE_NL(); WRITE_BOOL(*options, image.zoom_to_fit_allow_expand); + WRITE_NL(); WRITE_UINT(*options, image.zoom_quality); + WRITE_NL(); WRITE_INT(*options, image.zoom_increment); + WRITE_NL(); WRITE_BOOL(*options, image.fit_window_to_image); + WRITE_NL(); WRITE_BOOL(*options, image.limit_window_size); + WRITE_NL(); WRITE_INT(*options, image.max_window_size); + WRITE_NL(); WRITE_BOOL(*options, image.limit_autofit_size); + WRITE_NL(); WRITE_INT(*options, image.max_autofit_size); + WRITE_NL(); WRITE_UINT(*options, image.scroll_reset_method); + WRITE_NL(); WRITE_INT(*options, image.tile_cache_max); + WRITE_NL(); WRITE_INT(*options, image.image_cache_max); + WRITE_NL(); WRITE_UINT(*options, image.dither_quality); + WRITE_NL(); WRITE_BOOL(*options, image.enable_read_ahead); + WRITE_NL(); WRITE_BOOL(*options, image.exif_rotate_enable); + WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color); + WRITE_NL(); WRITE_COLOR(*options, image.border_color); + WRITE_NL(); WRITE_INT(*options, image.read_buffer_size); + WRITE_NL(); WRITE_INT(*options, image.idle_read_loop_count); // WRITE_SUBTITLE("Thumbnails Options"); - WRITE_INT(*options, thumbnails.max_width); - WRITE_INT(*options, thumbnails.max_height); - WRITE_BOOL(*options, thumbnails.enable_caching); - WRITE_BOOL(*options, thumbnails.cache_into_dirs); - WRITE_BOOL(*options, thumbnails.fast); - WRITE_BOOL(*options, thumbnails.use_xvpics); - WRITE_BOOL(*options, thumbnails.spec_standard); - WRITE_UINT(*options, thumbnails.quality); - WRITE_BOOL(*options, thumbnails.use_exif); + WRITE_NL(); WRITE_INT(*options, thumbnails.max_width); + WRITE_NL(); WRITE_INT(*options, thumbnails.max_height); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.enable_caching); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.cache_into_dirs); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.fast); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.use_xvpics); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.spec_standard); + WRITE_NL(); WRITE_UINT(*options, thumbnails.quality); + WRITE_NL(); WRITE_BOOL(*options, thumbnails.use_exif); // WRITE_SUBTITLE("File sorting Options"); - WRITE_INT(*options, file_sort.method); - WRITE_BOOL(*options, file_sort.ascending); - WRITE_BOOL(*options, file_sort.case_sensitive); + WRITE_NL(); WRITE_INT(*options, file_sort.method); + WRITE_NL(); WRITE_BOOL(*options, file_sort.ascending); + WRITE_NL(); WRITE_BOOL(*options, file_sort.case_sensitive); // WRITE_SUBTITLE("Fullscreen Options"); - WRITE_INT(*options, fullscreen.screen); - WRITE_BOOL(*options, fullscreen.clean_flip); - WRITE_BOOL(*options, fullscreen.disable_saver); - WRITE_BOOL(*options, fullscreen.above); + WRITE_NL(); WRITE_INT(*options, fullscreen.screen); + WRITE_NL(); WRITE_BOOL(*options, fullscreen.clean_flip); + WRITE_NL(); WRITE_BOOL(*options, fullscreen.disable_saver); + WRITE_NL(); WRITE_BOOL(*options, fullscreen.above); WRITE_SEPARATOR(); // WRITE_SUBTITLE("Image Overlay Options"); - WRITE_CHAR(*options, image_overlay.template_string); + WRITE_NL(); WRITE_CHAR(*options, image_overlay.template_string); // g_string_append_printf(outstr, "# these are relative positions:\n"); // g_string_append_printf(outstr, "# x >= 0: |x| pixels from left border\n"); // g_string_append_printf(outstr, "# x < 0 : |x| pixels from right border\n"); // g_string_append_printf(outstr, "# y >= 0: |y| pixels from top border\n"); // g_string_append_printf(outstr, "# y < 0 : |y| pixels from bottom border\n"); - WRITE_INT(*options, image_overlay.x); - WRITE_INT(*options, image_overlay.y); + WRITE_NL(); WRITE_INT(*options, image_overlay.x); + WRITE_NL(); WRITE_INT(*options, image_overlay.y); // WRITE_SUBTITLE("Slideshow Options"); - WRITE_INT_UNIT(*options, slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION); - WRITE_BOOL(*options, slideshow.random); - WRITE_BOOL(*options, slideshow.repeat); + WRITE_NL(); WRITE_INT_UNIT(*options, slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION); + WRITE_NL(); WRITE_BOOL(*options, slideshow.random); + WRITE_NL(); WRITE_BOOL(*options, slideshow.repeat); // WRITE_SUBTITLE("Collection Options"); - WRITE_BOOL(*options, collections.rectangular_selection); + WRITE_NL(); WRITE_BOOL(*options, collections.rectangular_selection); // WRITE_SUBTITLE("Filtering Options"); - WRITE_BOOL(*options, file_filter.show_hidden_files); - WRITE_BOOL(*options, file_filter.show_dot_directory); - WRITE_BOOL(*options, file_filter.disable); + WRITE_NL(); WRITE_BOOL(*options, file_filter.show_hidden_files); + WRITE_NL(); WRITE_BOOL(*options, file_filter.show_dot_directory); + WRITE_NL(); WRITE_BOOL(*options, file_filter.disable); WRITE_SEPARATOR(); // WRITE_SUBTITLE("Sidecars Options"); - WRITE_CHAR(*options, sidecar.ext); + WRITE_NL(); WRITE_CHAR(*options, sidecar.ext); // WRITE_SUBTITLE("Shell command"); - WRITE_CHAR(*options, shell.path); - WRITE_CHAR(*options, shell.options); + WRITE_NL(); WRITE_CHAR(*options, shell.path); + WRITE_NL(); WRITE_CHAR(*options, shell.options); // WRITE_SUBTITLE("Helpers"); @@ -426,8 +421,8 @@ // g_string_append_printf(outstr, "# \"\" (empty string) = execute binary with html file path as command line\n"); // g_string_append_printf(outstr, "# \"string\" = execute string and use results for command line\n"); // g_string_append_printf(outstr, "# \"!string\" = use text following ! as command line, replacing optional %%s with html file path\n"); - WRITE_CHAR(*options, helpers.html_browser.command_name); - WRITE_CHAR(*options, helpers.html_browser.command_line); + WRITE_NL(); WRITE_CHAR(*options, helpers.html_browser.command_name); + WRITE_NL(); WRITE_CHAR(*options, helpers.html_browser.command_line); /* FIXME: WRITE_SUBTITLE("Exif Options"); @@ -442,17 +437,17 @@ */ // WRITE_SUBTITLE("Metadata Options"); - WRITE_BOOL(*options, metadata.enable_metadata_dirs); - WRITE_BOOL(*options, metadata.save_in_image_file); - WRITE_BOOL(*options, metadata.save_legacy_IPTC); - WRITE_BOOL(*options, metadata.warn_on_write_problems); - WRITE_BOOL(*options, metadata.save_legacy_format); - WRITE_BOOL(*options, metadata.sync_grouped_files); - WRITE_BOOL(*options, metadata.confirm_write); - WRITE_INT(*options, metadata.confirm_timeout); - WRITE_BOOL(*options, metadata.confirm_after_timeout); - WRITE_BOOL(*options, metadata.confirm_on_image_change); - WRITE_BOOL(*options, metadata.confirm_on_dir_change); + WRITE_NL(); WRITE_BOOL(*options, metadata.enable_metadata_dirs); + WRITE_NL(); WRITE_BOOL(*options, metadata.save_in_image_file); + WRITE_NL(); WRITE_BOOL(*options, metadata.save_legacy_IPTC); + WRITE_NL(); WRITE_BOOL(*options, metadata.warn_on_write_problems); + WRITE_NL(); WRITE_BOOL(*options, metadata.save_legacy_format); + WRITE_NL(); WRITE_BOOL(*options, metadata.sync_grouped_files); + WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_write); + WRITE_NL(); WRITE_INT(*options, metadata.confirm_timeout); + WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_after_timeout); + WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_on_image_change); + WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_on_dir_change); } @@ -464,28 +459,24 @@ " color profile options will have no effect.\n-->\n", GQ_APPNAME); #endif - WRITE_STRING("<color_profiles\n"); - indent++; + WRITE_NL(); WRITE_STRING("<color_profiles "); WRITE_INT(options->color_profile, screen_type); WRITE_CHAR(options->color_profile, screen_file); WRITE_BOOL(options->color_profile, enabled); WRITE_BOOL(options->color_profile, use_image); WRITE_INT(options->color_profile, input_type); - indent--; - WRITE_STRING(">\n"); + WRITE_STRING(">"); indent++; for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { - WRITE_STRING("<profile\n"); - indent++; + WRITE_NL(); WRITE_STRING("<profile "); write_char_option(outstr, indent, "input_file", options->color_profile.input_file[i]); write_char_option(outstr, indent, "input_name", options->color_profile.input_name[i]); - indent--; - WRITE_STRING("/>\n"); + WRITE_STRING("/>"); } indent--; - WRITE_STRING("</color_profiles>\n"); + WRITE_NL(); WRITE_STRING("</color_profiles>"); } @@ -524,8 +515,14 @@ WRITE_SEPARATOR(); WRITE_STRING("-->\n"); WRITE_SEPARATOR(); - WRITE_STRING("<global\n"); + + WRITE_STRING("<gq>\n"); + indent++; + + WRITE_NL(); WRITE_STRING("<global\n"); + indent++; write_global_attributes(outstr, indent + 1); + indent--; WRITE_STRING(">\n"); indent++; @@ -538,7 +535,7 @@ WRITE_SEPARATOR(); keyword_tree_write_config(outstr, indent); indent--; - WRITE_STRING("</global>\n"); + WRITE_NL(); WRITE_STRING("</global>\n"); WRITE_SEPARATOR(); WRITE_SUBTITLE("Layout Options"); @@ -551,6 +548,10 @@ work = work->next; } + indent--; + WRITE_NL(); WRITE_STRING("</gq>\n"); + WRITE_SEPARATOR(); + secure_fputs(ssi, outstr->str); g_string_free(outstr, TRUE); @@ -980,6 +981,12 @@ static void options_parse_toplevel(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) { + if (g_ascii_strcasecmp(element_name, "gq") == 0) + { + /* optional top-level node */ + options_parse_func_push(parser_data, options_parse_toplevel, NULL, NULL); + return; + } if (g_ascii_strcasecmp(element_name, "global") == 0) { load_global_params(attribute_names, attribute_values);
--- a/src/rcfile.h Tue Mar 17 23:03:07 2009 +0000 +++ b/src/rcfile.h Thu Mar 19 22:12:14 2009 +0000 @@ -38,9 +38,10 @@ #define WRITE_CHAR(_source_, _name_) write_char_option(outstr, indent, #_name_, (_source_)._name_) #define WRITE_COLOR(_source_, _name_) write_color_option(outstr, indent, #_name_, &(_source_)._name_) +#define WRITE_NL() write_indent(outstr, indent) #define WRITE_SEPARATOR() g_string_append(outstr, "\n") #define WRITE_SUBTITLE(_title_) g_string_append_printf(outstr, "\n\n<!-- "_title_" -->\n\n") -#define WRITE_STRING(_str_) do { write_indent(outstr, indent); g_string_append_printf(outstr, _str_); } while (0) +#define WRITE_STRING(_str_) g_string_append_printf(outstr, _str_) #define READ_BOOL(_target_, _name_) read_bool_option(option, #_name_, value, &(_target_)._name_) #define READ_INT(_target_, _name_) read_int_option(option, #_name_, value, &(_target_)._name_)