# HG changeset patch # User nadvornik # Date 1235427189 0 # Node ID 8cca18bce9501b53dd7320be6d5a32fba28276df # Parent 1ffa5222dc6100127c7f7fc814ee6131e7aacac7 simplified config writing diff -r 1ffa5222dc61 -r 8cca18bce950 src/bar.c --- a/src/bar.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/bar.c Mon Feb 23 22:13:09 2009 +0000 @@ -156,8 +156,7 @@ bd = g_object_get_data(G_OBJECT(bar), "bar_data"); if (!bd) return; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); work = list; @@ -177,8 +176,7 @@ } g_list_free(list); - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); } diff -r 1ffa5222dc61 -r 8cca18bce950 src/bar_comment.c --- a/src/bar_comment.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/bar_comment.c Mon Feb 23 22:13:09 2009 +0000 @@ -151,16 +151,14 @@ pcd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pcd) return; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("/>\n"); } static void bar_pane_comment_notify_cb(FileData *fd, NotifyType type, gpointer data) diff -r 1ffa5222dc61 -r 8cca18bce950 src/bar_exif.c --- a/src/bar_exif.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/bar_exif.c Mon Feb 23 22:13:09 2009 +0000 @@ -289,14 +289,12 @@ ped = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!ped) return; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("/>\n"); } diff -r 1ffa5222dc61 -r 8cca18bce950 src/bar_histogram.c --- a/src/bar_histogram.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/bar_histogram.c Mon Feb 23 22:13:09 2009 +0000 @@ -84,14 +84,12 @@ phd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!phd) return; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("/>\n"); } diff -r 1ffa5222dc61 -r 8cca18bce950 src/bar_keywords.c --- a/src/bar_keywords.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/bar_keywords.c Mon Feb 23 22:13:09 2009 +0000 @@ -482,15 +482,13 @@ pkd = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!pkd) return; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("/>\n"); } gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event) diff -r 1ffa5222dc61 -r 8cca18bce950 src/filefilter.c --- a/src/filefilter.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/filefilter.c Mon Feb 23 22:13:09 2009 +0000 @@ -425,8 +425,7 @@ { GList *work; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); indent++; work = filter_list; @@ -435,8 +434,7 @@ FilterEntry *fe = work->data; work = work->next; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("/>\n"); } indent--; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); } void filter_load_file_type(const gchar **attribute_names, const gchar **attribute_values) diff -r 1ffa5222dc61 -r 8cca18bce950 src/layout.c --- a/src/layout.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/layout.c Mon Feb 23 22:13:09 2009 +0000 @@ -2174,16 +2174,13 @@ void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent) { layout_sync_options_with_current_state(lw); - write_indent(outstr, indent); - g_string_append_printf(outstr, "options, outstr, indent + 1); - write_indent(outstr, indent); - g_string_append_printf(outstr, ">\n"); + WRITE_STRING(">\n"); bar_write_config(lw->bar, outstr, indent + 1); - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); } void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values) diff -r 1ffa5222dc61 -r 8cca18bce950 src/rcfile.c --- a/src/rcfile.c Mon Feb 23 21:21:15 2009 +0000 +++ b/src/rcfile.c Mon Feb 23 22:13:09 2009 +0000 @@ -447,8 +447,7 @@ " color profile options will have no effect.\n-->\n", GQ_APPNAME); #endif - write_indent(outstr, indent); - g_string_append_printf(outstr, "color_profile, screen_type); WRITE_CHAR(options->color_profile, screen_file); @@ -456,24 +455,20 @@ WRITE_BOOL(options->color_profile, use_image); WRITE_INT(options->color_profile, input_type); indent--; - write_indent(outstr, indent); - g_string_append_printf(outstr, ">\n"); + WRITE_STRING(">\n"); indent++; for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { - write_indent(outstr, indent); - g_string_append_printf(outstr, "color_profile.input_file[i]); write_char_option(outstr, indent, "input_name", options->color_profile.input_name[i]); indent--; - write_indent(outstr, indent); - g_string_append_printf(outstr, "/>\n"); + WRITE_STRING("/>\n"); } indent--; - write_indent(outstr, indent); - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); } @@ -507,16 +502,16 @@ g_string_append_printf(outstr, "######################################################################\n"); WRITE_SEPARATOR(); - g_string_append_printf(outstr, "# Note: This file is autogenerated. Options can be changed here,\n"); - g_string_append_printf(outstr, "# but user comments and formatting will be lost.\n"); + WRITE_STRING("# Note: This file is autogenerated. Options can be changed here,\n"); + WRITE_STRING("# but user comments and formatting will be lost.\n"); WRITE_SEPARATOR(); - g_string_append_printf(outstr, "-->\n"); + WRITE_STRING("-->\n"); WRITE_SEPARATOR(); - g_string_append_printf(outstr, "\n"); + indent++; - write_global_attributes(outstr, indent); - write_indent(outstr, indent); - g_string_append_printf(outstr, ">\n"); write_color_profile(outstr, indent); @@ -525,14 +520,12 @@ WRITE_SEPARATOR(); WRITE_SUBTITLE("Layout Options - defaults"); - write_indent(outstr, indent); - g_string_append_printf(outstr, "layout, outstr, indent + 1); - write_indent(outstr, indent); - g_string_append_printf(outstr, "/>\n"); + WRITE_STRING("/>\n"); indent--; - g_string_append_printf(outstr, "\n"); + WRITE_STRING("\n"); WRITE_SEPARATOR(); WRITE_SUBTITLE("Layout Options"); diff -r 1ffa5222dc61 -r 8cca18bce950 src/rcfile.h --- a/src/rcfile.h Mon Feb 23 21:21:15 2009 +0000 +++ b/src/rcfile.h Mon Feb 23 22:13:09 2009 +0000 @@ -40,7 +40,7 @@ #define WRITE_SEPARATOR() g_string_append(outstr, "\n") #define WRITE_SUBTITLE(_title_) g_string_append_printf(outstr, "\n\n\n\n") - +#define WRITE_STRING(_str_) {write_indent(outstr, indent);g_string_append_printf(outstr, _str_);} #define READ_BOOL(target, _name_) if (read_bool_option(option, #_name_, value, &(target)._name_)) continue; #define READ_INT(target, _name_) if (read_int_option(option, #_name_, value, &(target)._name_)) continue;