diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-05-07 16:14:18 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-05-07 16:24:51 +0100 |
commit | c56642819eed87431dff3446fe111f7f3eefaa7d (patch) | |
tree | 397126ca4baac425f9c1c44f3d5c56c681e2c4fe /gtk/scaffolding.c | |
parent | c1e2da80dfa62793ea107cf12408c814e268a54b (diff) | |
download | netsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.gz netsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.bz2 |
add file operations table and make all frontends use it.
This rationalises the path construction and basename file
operations. The default implementation is POSIX which works for all
frontends except windows, riscos and amiga which have differeing path
separators and rules.
These implementations are significantly more robust than the previous
nine implementations and also do not use unsafe strncpy or buffers
with arbitrary length limits.
These implementations also carry full documentation comments.
Diffstat (limited to 'gtk/scaffolding.c')
-rw-r--r-- | gtk/scaffolding.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 436830bd3..fde195657 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -30,6 +30,7 @@ #include "utils/url.h" #include "utils/log.h" #include "utils/nsoption.h" +#include "utils/file.h" #include "desktop/browser_history.h" #include "desktop/browser_private.h" #include "desktop/hotlist.h" @@ -72,7 +73,6 @@ #include "gtk/tabs.h" #include "gtk/schedule.h" - /** Macro to define a handler for menu, button and activate events. */ #define MULTIHANDLER(q)\ static gboolean nsgtk_on_##q##_activate(struct gtk_scaffolding *g);\ @@ -867,7 +867,7 @@ MULTIHANDLER(print) GtkPrintSettings *print_settings; GtkPrintOperationResult res = GTK_PRINT_OPERATION_RESULT_ERROR; struct print_settings *nssettings; - char *settings_fname; + char *settings_fname = NULL; print_op = gtk_print_operation_new(); if (print_op == NULL) { @@ -876,7 +876,7 @@ MULTIHANDLER(print) } /* use previously saved settings if any */ - settings_fname = filepath_append(nsgtk_config_home, "Print"); + netsurf_mkpath(&settings_fname, NULL, 2, nsgtk_config_home, "Print"); if (settings_fname != NULL) { print_settings = gtk_print_settings_new_from_file(settings_fname, NULL); if (print_settings != NULL) { @@ -1260,7 +1260,7 @@ MULTIHANDLER(downloads) MULTIHANDLER(savewindowsize) { int x,y,w,h; - char *choices; + char *choices = NULL; gtk_window_get_position(g->window, &x, &y); gtk_window_get_size(g->window, &w, &h); @@ -1270,7 +1270,7 @@ MULTIHANDLER(savewindowsize) nsoption_set_int(window_x, x); nsoption_set_int(window_y, y); - choices = filepath_append(nsgtk_config_home, "Choices"); + netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices"); if (choices != NULL) { nsoption_write(choices, NULL, NULL); free(choices); |