/* Layout Options */
if (!lw)
{
- work = layout_window_list;
- while (work)
+ /* If not save_window_positions, do not include a <layout> section */
+ if (options->save_window_positions)
{
- LayoutWindow *lw = work->data;
- layout_write_config(lw, outstr, indent);
- work = work->next;
+ work = layout_window_list;
+ while (work)
+ {
+ LayoutWindow *lw = work->data;
+ layout_write_config(lw, outstr, indent);
+ work = work->next;
+ }
}
}
else
return TRUE;
}
+gboolean save_default_layout_options_to_file(const gchar *utf8_path, ConfOptions *options, LayoutWindow *lw)
+{
+ SecureSaveInfo *ssi;
+ gchar *rc_pathl;
+ GString *outstr;
+ gint indent = 0;
+
+ rc_pathl = path_from_utf8(utf8_path);
+ ssi = secure_open(rc_pathl);
+ g_free(rc_pathl);
+ if (!ssi)
+ {
+ log_printf(_("error saving default layout file: %s\n"), utf8_path);
+ return FALSE;
+ }
+
+ outstr = g_string_new("");
+ g_string_append_printf(outstr, "<!--\n");
+ g_string_append_printf(outstr, "######################################################################\n");
+ g_string_append_printf(outstr, "# %8s default layout file version %-10s #\n", GQ_APPNAME, VERSION);
+ g_string_append_printf(outstr, "######################################################################\n");
+ WRITE_SEPARATOR();
+
+ 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();
+ WRITE_STRING("-->\n");
+ WRITE_SEPARATOR();
+
+ WRITE_STRING("<gq>\n");
+ indent++;
+
+ layout_write_config(lw, outstr, indent);
+
+ indent--;
+ WRITE_NL(); WRITE_STRING("</gq>\n");
+ WRITE_SEPARATOR();
+
+ secure_fputs(ssi, outstr->str);
+ g_string_free(outstr, TRUE);
+
+ if (secure_close(ssi))
+ {
+ log_printf(_("error saving config file: %s\nerror: %s\n"), utf8_path,
+ secsave_strerror(secsave_errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/*
*-----------------------------------------------------------------------------
* loading attributes for elements (private)