+ fprintf(rf, "\n# Main window geometry.\n");
+ fprintf(rf, "# Decimal numbers.\n");
+ fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_X ": %d\n", recent.gui_geometry_main_x);
+ fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_Y ": %d\n", recent.gui_geometry_main_y);
+ fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_WIDTH ": %d\n",
+ recent.gui_geometry_main_width);
+ fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_HEIGHT ": %d\n",
+ recent.gui_geometry_main_height);
+
+ fprintf(rf, "\n# Main window maximized.\n");
+ fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED ": %s\n",
+ recent.gui_geometry_main_maximized == TRUE ? "TRUE" : "FALSE");
+
+ fprintf(rf, "\n# Statusbar left pane size.\n");
+ fprintf(rf, "# Decimal number.\n");
+ if (recent.gui_geometry_status_pane_left != 0) {
+ fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT ": %d\n",
+ recent.gui_geometry_status_pane_left);
+ }
+ fprintf(rf, "\n# Statusbar middle pane size.\n");
+ fprintf(rf, "# Decimal number.\n");
+ if (recent.gui_geometry_status_pane_right != 0) {
+ fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT ": %d\n",
+ recent.gui_geometry_status_pane_right);
+ }
+
+ fprintf(rf, "\n# Warn if running with elevated permissions (e.g. as root).\n");
+ fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_ELEVATED ": %s\n",
+ recent.privs_warn_if_elevated == TRUE ? "TRUE" : "FALSE");
+
+ fprintf(rf, "\n# Warn if npf.sys isn't loaded on Windows >= 6.0.\n");
+ fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_NO_NPF ": %s\n",
+ recent.privs_warn_if_no_npf == TRUE ? "TRUE" : "FALSE");
+
+ window_geom_recent_write_all(rf);
+
+ fclose(rf);
+
+ /* XXX - catch I/O errors (e.g. "ran out of disk space") and return
+ an error indication, or maybe write to a new recent file and
+ rename that file on top of the old one only if there are not I/O
+ errors. */
+ return TRUE;
+}
+
+
+/* Attempt to Write out profile "recent" to the user's recent file.
+ If we got an error report it with a dialog box and return FALSE,
+ otherwise return TRUE. */
+gboolean
+write_profile_recent(void)
+{
+ char *pf_dir_path;
+ char *rf_path;
+ FILE *rf;
+
+ /* To do:
+ * - Split output lines longer than MAX_VAL_LEN
+ * - Create a function for the preference directory check/creation
+ * so that duplication can be avoided with filter.c
+ */
+
+ /* Create the directory that holds personal configuration files, if
+ necessary. */
+ if (create_persconffile_dir(&pf_dir_path) == -1) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Can't create directory\n\"%s\"\nfor recent file: %s.", pf_dir_path,
+ strerror(errno));
+ g_free(pf_dir_path);
+ return FALSE;
+ }
+
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE);
+ if ((rf = eth_fopen(rf_path, "w")) == NULL) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Can't open recent file\n\"%s\": %s.", rf_path,
+ strerror(errno));
+ g_free(rf_path);
+ return FALSE;
+ }
+ g_free(rf_path);
+
+ fputs("# Recent settings file for Wireshark " VERSION ".\n"
+ "#\n"
+ "# This file is regenerated each time Wireshark is quit\n"
+ "# and when changing configuration profile.\n"
+ "# So be careful, if you want to make manual changes here.\n"
+ "\n", rf);