gboolean
main_do_quit(void)
{
- gchar *rec_path;
-
-
- /* get the current geometry, before writing it to disk */
- main_save_window_geometry(top_level);
+ /* get the current geometry, before writing it to disk */
+ main_save_window_geometry(top_level);
/* write user's recent file to disk
* It is no problem to write this file, even if we do not quit */
- write_recent(&rec_path);
+ write_recent();
/* XXX - should we check whether the capture file is an
unsaved temporary file for a live capture and, if so,
#include "ui_util.h"
#include "dlg_utils.h"
#include "cfilter_combo_utils.h"
+#include "simple_dialog.h"
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
#define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show"
return default_value;
}
-/* Write out "recent" to the user's recent file, and return 0.
- If we got an error, stuff a pointer to the path of the recent file
- into "*pf_path_return", and return the errno. */
-int
-write_recent(char **rf_path_return)
+/* Attempt to Write out "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_recent(void)
{
+ char *pf_dir_path;
char *rf_path;
FILE *rf;
* 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);
if ((rf = fopen(rf_path, "w")) == NULL) {
- *rf_path_return = rf_path;
- return errno;
+ 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;
}
fputs("# Recent settings file for Ethereal " VERSION ".\n"
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 preferences file and
+ 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 0;
+ return TRUE;
}
/** Write recent settings file.
*
- * @param rf_path_return path to recent file if function failed
- * @return 0 if succeeded, errno if failed
+ * @return TRUE if succeeded, FALSE if failed
*/
-extern int write_recent(char **rf_path_return);
+extern gboolean write_recent(void);
/** Read recent settings file.
*