Branch data Line data Source code
1 : : /********************************************************************\
2 : : * dialog-file-access.c -- dialog for opening a file or making a *
3 : : * connection to a libdbi database *
4 : : * *
5 : : * Copyright (C) 2009 Phil Longstaff (plongstaff@rogers.com) *
6 : : * *
7 : : * This program is free software; you can redistribute it and/or *
8 : : * modify it under the terms of the GNU General Public License as *
9 : : * published by the Free Software Foundation; either version 2 of *
10 : : * the License, or (at your option) any later version. *
11 : : * *
12 : : * This program is distributed in the hope that it will be useful, *
13 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 : : * GNU General Public License for more details. *
16 : : * *
17 : : * You should have received a copy of the GNU General Public License*
18 : : * along with this program; if not, contact: *
19 : : * *
20 : : * Free Software Foundation Voice: +1-617-542-5942 *
21 : : * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
22 : : * Boston, MA 02110-1301, USA gnu@gnu.org *
23 : : \********************************************************************/
24 : :
25 : : #include <stdbool.h>
26 : : #include <config.h>
27 : :
28 : : #include <gtk/gtk.h>
29 : : #include <glib/gi18n.h>
30 : :
31 : : #include "gnc-ui.h"
32 : : #include "gnc-ui-util.h"
33 : : #include "gnc-uri-utils.h"
34 : : #include "dialog-utils.h"
35 : : #include "dialog-file-access.h"
36 : : #include "gnc-file.h"
37 : : #include "gnc-filepath-utils.h"
38 : : #include "gnc-plugin-file-history.h"
39 : : #include "gnc-session.h"
40 : :
41 : : static QofLogModule log_module = GNC_MOD_GUI;
42 : :
43 : : /* MariaDB/MySQL/Postgres optimize localhost to a unix socket but
44 : : * flatpak won't connect to unix sockets without gymnastics default to
45 : : * the localhost IP to force a network connection.
46 : : */
47 : : #define DEFAULT_HOST "127.0.0.1"
48 : : #define DEFAULT_DATABASE PROJECT_NAME
49 : : #define FILE_ACCESS_OPEN 0
50 : : #define FILE_ACCESS_SAVE_AS 1
51 : : #define FILE_ACCESS_EXPORT 2
52 : :
53 : : typedef struct FileAccessWindow
54 : : {
55 : : /* Parts of the dialog */
56 : : int type;
57 : :
58 : : GtkWidget *dialog;
59 : : GtkWidget *frame_file;
60 : : GtkWidget *frame_database;
61 : : GtkWidget *readonly_checkbutton;
62 : : GtkFileChooser *fileChooser;
63 : : gchar *starting_dir;
64 : : GtkComboBoxText *cb_uri_type;
65 : : GtkEntry *tf_host;
66 : : GtkEntry *tf_database;
67 : : GtkEntry *tf_username;
68 : : GtkEntry *tf_password;
69 : : } FileAccessWindow;
70 : :
71 : : void gnc_ui_file_access_file_activated_cb( GtkFileChooser *chooser,
72 : : FileAccessWindow *faw );
73 : : void gnc_ui_file_access_response_cb( GtkDialog *, gint, GtkDialog * );
74 : : static void cb_uri_type_changed_cb( GtkComboBoxText* cb );
75 : :
76 : : static gchar*
77 : 0 : geturl( FileAccessWindow* faw )
78 : : {
79 : 0 : gchar* url = NULL;
80 : 0 : const gchar* host = NULL;
81 : 0 : const gchar* username = NULL;
82 : 0 : const gchar* password = NULL;
83 : : /* Not const as return value of gtk_combo_box_text_get_active_text must be freed */
84 : 0 : gchar* type = NULL;
85 : : /* Not const as return value of gtk_file_chooser_get_filename must be freed */
86 : 0 : gchar* path = NULL;
87 : :
88 : 0 : type = gtk_combo_box_text_get_active_text (faw->cb_uri_type);
89 : 0 : if (gnc_uri_is_file_scheme (type))
90 : : {
91 : 0 : path = gtk_file_chooser_get_filename (faw->fileChooser);
92 : 0 : if ( !path ) /* file protocol was chosen but no filename was set */
93 : : {
94 : 0 : g_free (type);
95 : 0 : return NULL;
96 : : }
97 : : }
98 : : else /* db protocol was chosen */
99 : : {
100 : 0 : host = gtk_entry_get_text( faw->tf_host );
101 : 0 : path = g_strdup(gtk_entry_get_text(faw->tf_database));
102 : 0 : username = gtk_entry_get_text( faw->tf_username );
103 : 0 : password = gtk_entry_get_text( faw->tf_password );
104 : : }
105 : :
106 : 0 : url = gnc_uri_create_uri (type, host, 0, username, password, path);
107 : :
108 : 0 : g_free (type);
109 : 0 : g_free (path);
110 : :
111 : 0 : return url;
112 : : }
113 : :
114 : : void
115 : 0 : gnc_ui_file_access_file_activated_cb( GtkFileChooser *chooser, FileAccessWindow *faw )
116 : : {
117 : 0 : g_return_if_fail( chooser != NULL );
118 : :
119 : 0 : gnc_ui_file_access_response_cb( GTK_DIALOG(faw->dialog), GTK_RESPONSE_OK, NULL );
120 : : }
121 : :
122 : : void
123 : 0 : gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
124 : : {
125 : : FileAccessWindow* faw;
126 : : gchar* url;
127 : :
128 : 0 : g_return_if_fail( dialog != NULL );
129 : :
130 : 0 : faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" );
131 : 0 : g_return_if_fail( faw != NULL );
132 : :
133 : 0 : switch ( response )
134 : : {
135 : 0 : case GTK_RESPONSE_HELP:
136 : 0 : gnc_gnome_help (GTK_WINDOW(dialog), DF_MANUAL, DL_GLOBPREFS );
137 : 0 : break;
138 : :
139 : 0 : case GTK_RESPONSE_OK:
140 : 0 : url = geturl( faw );
141 : 0 : if ( url == NULL )
142 : : {
143 : 0 : return;
144 : : }
145 : 0 : if (g_str_has_prefix (url, "file://"))
146 : : {
147 : 0 : if ( g_file_test (gnc_uri_get_path (url), G_FILE_TEST_IS_DIR))
148 : : {
149 : 0 : gtk_file_chooser_set_current_folder_uri( faw->fileChooser, url );
150 : 0 : return;
151 : : }
152 : : }
153 : 0 : if ( faw->type == FILE_ACCESS_OPEN )
154 : : {
155 : 0 : gboolean open_readonly = faw->readonly_checkbutton
156 : 0 : ? gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(faw->readonly_checkbutton))
157 : 0 : : FALSE;
158 : 0 : gnc_file_open_file (GTK_WINDOW(dialog), url, open_readonly);
159 : : }
160 : 0 : else if ( faw->type == FILE_ACCESS_SAVE_AS )
161 : : {
162 : 0 : gnc_file_do_save_as (GTK_WINDOW(dialog), url);
163 : : }
164 : 0 : else if ( faw->type == FILE_ACCESS_EXPORT )
165 : : {
166 : 0 : gnc_file_do_export (GTK_WINDOW(dialog), url);
167 : : }
168 : 0 : break;
169 : :
170 : 0 : case GTK_RESPONSE_CANCEL:
171 : : case GTK_RESPONSE_DELETE_EVENT:
172 : 0 : break;
173 : :
174 : 0 : default:
175 : 0 : PERR( "Invalid response" );
176 : 0 : break;
177 : : }
178 : :
179 : 0 : if ( response != GTK_RESPONSE_HELP )
180 : : {
181 : 0 : gtk_widget_destroy( GTK_WIDGET(dialog) );
182 : : }
183 : : }
184 : :
185 : : /* Activate the file chooser and deactivate the db selection fields */
186 : : static void
187 : 0 : set_widget_sensitivity( FileAccessWindow* faw, gboolean is_file_based_uri )
188 : : {
189 : 0 : if (is_file_based_uri)
190 : : {
191 : 0 : gtk_widget_show(faw->frame_file);
192 : 0 : gtk_widget_hide(faw->frame_database);
193 : 0 : gtk_file_chooser_set_current_folder(faw->fileChooser, faw->starting_dir);
194 : : }
195 : : else
196 : : {
197 : 0 : gtk_widget_show(faw->frame_database);
198 : 0 : gtk_widget_hide(faw->frame_file);
199 : : }
200 : : // gtk_widget_set_sensitive( faw->frame_file, is_file_based_uri );
201 : : // gtk_widget_set_sensitive( faw->frame_database, !is_file_based_uri );
202 : 0 : }
203 : :
204 : : static void
205 : 0 : set_widget_sensitivity_for_uri_type( FileAccessWindow* faw, const gchar* uri_type )
206 : : {
207 : 0 : if ( strcmp( uri_type, "file" ) == 0 || strcmp( uri_type, "xml" ) == 0
208 : 0 : || strcmp( uri_type, "sqlite3" ) == 0 )
209 : : {
210 : 0 : set_widget_sensitivity( faw, /* is_file_based_uri */ TRUE );
211 : : }
212 : 0 : else if ( strcmp( uri_type, "mysql" ) == 0 || strcmp( uri_type, "postgres" ) == 0 )
213 : : {
214 : 0 : set_widget_sensitivity( faw, /* is_file_based_uri */ FALSE );
215 : : }
216 : : else
217 : : {
218 : 0 : g_assert( FALSE );
219 : : }
220 : 0 : }
221 : :
222 : : static void
223 : 0 : cb_uri_type_changed_cb( GtkComboBoxText* cb )
224 : : {
225 : : GtkWidget* dialog;
226 : : FileAccessWindow* faw;
227 : : const gchar* type;
228 : :
229 : 0 : g_return_if_fail( cb != NULL );
230 : :
231 : 0 : dialog = gtk_widget_get_toplevel( GTK_WIDGET(cb) );
232 : 0 : g_return_if_fail( dialog != NULL );
233 : 0 : faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" );
234 : 0 : g_return_if_fail( faw != NULL );
235 : :
236 : 0 : type = gtk_combo_box_text_get_active_text( cb );
237 : 0 : set_widget_sensitivity_for_uri_type( faw, type );
238 : : }
239 : :
240 : : static const char*
241 : 0 : get_default_database( void )
242 : : {
243 : : const gchar* default_db;
244 : :
245 : 0 : default_db = g_getenv( "GNC_DEFAULT_DATABASE" );
246 : 0 : if ( default_db == NULL )
247 : : {
248 : 0 : default_db = DEFAULT_DATABASE;
249 : : }
250 : :
251 : 0 : return default_db;
252 : : }
253 : :
254 : : typedef bool (*CharToBool)(const char*);
255 : :
256 : 0 : static bool datafile_filter (const GtkFileFilterInfo* filter_info,
257 : : CharToBool filename_checker)
258 : : {
259 : 0 : return filter_info && filter_info->filename &&
260 : 0 : filename_checker (filter_info->filename);
261 : : }
262 : :
263 : 0 : static void free_file_access_window (FileAccessWindow *faw)
264 : : {
265 : 0 : g_free (faw->starting_dir);
266 : 0 : g_free (faw);
267 : 0 : }
268 : :
269 : : static void
270 : 0 : gnc_ui_file_access (GtkWindow *parent, int type)
271 : : {
272 : : FileAccessWindow *faw;
273 : : GtkBuilder* builder;
274 : : GtkButton* op;
275 : : GtkWidget* file_chooser;
276 : : GtkFileChooserWidget* fileChooser;
277 : 0 : GtkFileChooserAction fileChooserAction = GTK_FILE_CHOOSER_ACTION_OPEN;
278 : : GList* list;
279 : : GList* node;
280 : : GtkWidget* uri_type_container;
281 : 0 : gboolean need_access_method_file = FALSE;
282 : 0 : gboolean need_access_method_mysql = FALSE;
283 : 0 : gboolean need_access_method_postgres = FALSE;
284 : 0 : gboolean need_access_method_sqlite3 = FALSE;
285 : 0 : gboolean need_access_method_xml = FALSE;
286 : 0 : gint access_method_index = -1;
287 : 0 : gint active_access_method_index = -1;
288 : : const gchar* default_db;
289 : 0 : const gchar *button_label = NULL;
290 : 0 : const gchar *settings_section = NULL;
291 : : gchar *last;
292 : :
293 : 0 : g_return_if_fail( type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS || type == FILE_ACCESS_EXPORT );
294 : :
295 : 0 : faw = g_new0(FileAccessWindow, 1);
296 : 0 : g_return_if_fail( faw != NULL );
297 : :
298 : 0 : faw->type = type;
299 : 0 : faw->starting_dir = NULL;
300 : :
301 : : /* Open the dialog */
302 : 0 : builder = gtk_builder_new();
303 : 0 : gnc_builder_add_from_file (builder, "dialog-file-access.glade", "file_access_dialog" );
304 : 0 : faw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "file_access_dialog" ));
305 : 0 : gtk_window_set_transient_for (GTK_WINDOW (faw->dialog), parent);
306 : 0 : g_object_set_data_full (G_OBJECT(faw->dialog), "FileAccessWindow", faw,
307 : : (GDestroyNotify)free_file_access_window);
308 : :
309 : : // Set the name for this dialog so it can be easily manipulated with css
310 : 0 : gtk_widget_set_name (GTK_WIDGET(faw->dialog), "gnc-id-file-access");
311 : :
312 : 0 : faw->frame_file = GTK_WIDGET(gtk_builder_get_object (builder, "frame_file" ));
313 : 0 : faw->frame_database = GTK_WIDGET(gtk_builder_get_object (builder, "frame_database" ));
314 : 0 : faw->readonly_checkbutton = GTK_WIDGET(gtk_builder_get_object (builder, "readonly_checkbutton"));
315 : 0 : faw->tf_host = GTK_ENTRY(gtk_builder_get_object (builder, "tf_host" ));
316 : 0 : gtk_entry_set_text( faw->tf_host, DEFAULT_HOST );
317 : 0 : faw->tf_database = GTK_ENTRY(gtk_builder_get_object (builder, "tf_database" ));
318 : 0 : default_db = get_default_database();
319 : 0 : gtk_entry_set_text( faw->tf_database, default_db );
320 : 0 : faw->tf_username = GTK_ENTRY(gtk_builder_get_object (builder, "tf_username" ));
321 : 0 : faw->tf_password = GTK_ENTRY(gtk_builder_get_object (builder, "tf_password" ));
322 : :
323 : 0 : switch ( type )
324 : : {
325 : 0 : case FILE_ACCESS_OPEN:
326 : 0 : gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Open…"));
327 : 0 : button_label = _("_Open");
328 : 0 : fileChooserAction = GTK_FILE_CHOOSER_ACTION_OPEN;
329 : 0 : settings_section = GNC_PREFS_GROUP_OPEN_SAVE;
330 : 0 : break;
331 : :
332 : 0 : case FILE_ACCESS_SAVE_AS:
333 : 0 : gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Save As…"));
334 : 0 : button_label = _("_Save As");
335 : 0 : fileChooserAction = GTK_FILE_CHOOSER_ACTION_SAVE;
336 : 0 : settings_section = GNC_PREFS_GROUP_OPEN_SAVE;
337 : 0 : gtk_widget_destroy(faw->readonly_checkbutton);
338 : 0 : faw->readonly_checkbutton = NULL;
339 : 0 : break;
340 : :
341 : 0 : case FILE_ACCESS_EXPORT:
342 : 0 : gtk_window_set_title(GTK_WINDOW(faw->dialog), _("Export"));
343 : 0 : button_label = _("_Save As");
344 : 0 : fileChooserAction = GTK_FILE_CHOOSER_ACTION_SAVE;
345 : 0 : settings_section = GNC_PREFS_GROUP_EXPORT;
346 : 0 : gtk_widget_destroy(faw->readonly_checkbutton);
347 : 0 : faw->readonly_checkbutton = NULL;
348 : 0 : break;
349 : : }
350 : :
351 : 0 : op = GTK_BUTTON(gtk_builder_get_object (builder, "pb_op" ));
352 : 0 : if ( op != NULL )
353 : 0 : gtk_button_set_label( op, button_label );
354 : :
355 : 0 : file_chooser = GTK_WIDGET(gtk_builder_get_object (builder, "file_chooser" ));
356 : 0 : fileChooser = GTK_FILE_CHOOSER_WIDGET(gtk_file_chooser_widget_new( fileChooserAction ));
357 : 0 : faw->fileChooser = GTK_FILE_CHOOSER(fileChooser);
358 : 0 : gtk_box_pack_start( GTK_BOX(file_chooser), GTK_WIDGET(fileChooser), TRUE, TRUE, 6 );
359 : :
360 : : /* set up .gnucash filters for Datafile operations */
361 : 0 : GtkFileFilter *filter = gtk_file_filter_new ();
362 : 0 : gtk_file_filter_set_name (filter, _("All files"));
363 : 0 : gtk_file_filter_add_pattern (filter, "*");
364 : 0 : gtk_file_chooser_add_filter (faw->fileChooser, filter);
365 : :
366 : 0 : filter = gtk_file_filter_new ();
367 : : /* Translators: *.gnucash and *.xac are file patterns and must not
368 : : be translated*/
369 : 0 : gtk_file_filter_set_name (filter, _("Datafiles only (*.gnucash, *.xac)"));
370 : 0 : gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
371 : : (GtkFileFilterFunc)datafile_filter,
372 : : gnc_filename_is_datafile, NULL);
373 : 0 : gtk_file_chooser_add_filter (faw->fileChooser, filter);
374 : 0 : gtk_file_chooser_set_filter (faw->fileChooser, filter);
375 : :
376 : 0 : filter = gtk_file_filter_new ();
377 : : /* Translators: *.gnucash.*.gnucash, *.xac.*.xac are file
378 : : patterns and must not be translated*/
379 : 0 : gtk_file_filter_set_name (filter, _("Backups only (*.gnucash.*.gnucash, *.xac.*.xac)"));
380 : 0 : gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
381 : : (GtkFileFilterFunc)datafile_filter,
382 : : gnc_filename_is_backup, NULL);
383 : 0 : gtk_file_chooser_add_filter (faw->fileChooser, filter);
384 : :
385 : : /* Set the default directory */
386 : 0 : if (type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS)
387 : : {
388 : 0 : last = gnc_history_get_last();
389 : 0 : if ( last && *last && gnc_uri_targets_local_fs (last))
390 : : {
391 : 0 : gchar *filepath = gnc_uri_get_path ( last );
392 : 0 : faw->starting_dir = g_path_get_dirname( filepath );
393 : 0 : g_free ( filepath );
394 : : }
395 : 0 : g_free (last);
396 : : }
397 : 0 : if (!faw->starting_dir)
398 : 0 : faw->starting_dir = gnc_get_default_directory(settings_section);
399 : 0 : gtk_file_chooser_set_current_folder(faw->fileChooser, faw->starting_dir);
400 : :
401 : 0 : g_object_connect( G_OBJECT(faw->fileChooser), "signal::file-activated",
402 : : gnc_ui_file_access_file_activated_cb, faw, NULL );
403 : :
404 : 0 : uri_type_container = GTK_WIDGET(gtk_builder_get_object (builder, "vb_uri_type_container" ));
405 : 0 : faw->cb_uri_type = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new());
406 : 0 : gtk_container_add( GTK_CONTAINER(uri_type_container), GTK_WIDGET(faw->cb_uri_type) );
407 : 0 : gtk_box_set_child_packing( GTK_BOX(uri_type_container), GTK_WIDGET(faw->cb_uri_type),
408 : : /*expand*/TRUE, /*fill*/FALSE, /*padding*/0, GTK_PACK_START );
409 : 0 : g_object_connect( G_OBJECT(faw->cb_uri_type),
410 : : "signal::changed", cb_uri_type_changed_cb, NULL,
411 : : NULL );
412 : :
413 : : /* Autoconnect signals */
414 : 0 : gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, faw);
415 : :
416 : : /* See what qof backends are available and add appropriate ones to the combo box */
417 : 0 : list = qof_backend_get_registered_access_method_list();
418 : 0 : for ( node = list; node != NULL; node = node->next )
419 : : {
420 : 0 : const gchar* access_method = node->data;
421 : :
422 : : /* For the different access methods, "mysql" and "postgres" are added if available. Access
423 : : methods "xml" and "sqlite3" are compressed to "file" if opening a file, but when saving a file,
424 : : both access methods are added. */
425 : 0 : if ( strcmp( access_method, "mysql" ) == 0 )
426 : : {
427 : 0 : need_access_method_mysql = TRUE;
428 : : }
429 : 0 : else if ( strcmp( access_method, "postgres" ) == 0 )
430 : : {
431 : 0 : need_access_method_postgres = TRUE;
432 : : }
433 : 0 : else if ( strcmp( access_method, "xml" ) == 0 )
434 : : {
435 : 0 : if ( type == FILE_ACCESS_OPEN )
436 : : {
437 : 0 : need_access_method_file = TRUE;
438 : : }
439 : : else
440 : : {
441 : 0 : need_access_method_xml = TRUE;
442 : : }
443 : : }
444 : 0 : else if ( strcmp( access_method, "sqlite3" ) == 0 )
445 : : {
446 : 0 : if ( type == FILE_ACCESS_OPEN )
447 : : {
448 : 0 : need_access_method_file = TRUE;
449 : : }
450 : : else
451 : : {
452 : 0 : need_access_method_sqlite3 = TRUE;
453 : : }
454 : : }
455 : : }
456 : 0 : g_list_free(list);
457 : :
458 : : /* Now that the set of access methods has been ascertained, add them to the list, and set the
459 : : default. */
460 : 0 : access_method_index = -1;
461 : 0 : if ( need_access_method_file )
462 : : {
463 : 0 : gtk_combo_box_text_append_text( faw->cb_uri_type, "file" );
464 : 0 : active_access_method_index = ++access_method_index;
465 : : }
466 : 0 : if ( need_access_method_mysql )
467 : : {
468 : 0 : gtk_combo_box_text_append_text( faw->cb_uri_type, "mysql" );
469 : 0 : ++access_method_index;
470 : : }
471 : 0 : if ( need_access_method_postgres )
472 : : {
473 : 0 : gtk_combo_box_text_append_text( faw->cb_uri_type, "postgres" );
474 : 0 : ++access_method_index;
475 : : }
476 : 0 : if ( need_access_method_sqlite3 )
477 : : {
478 : 0 : gtk_combo_box_text_append_text( faw->cb_uri_type, "sqlite3" );
479 : 0 : active_access_method_index = ++access_method_index;
480 : : }
481 : 0 : if ( need_access_method_xml )
482 : : {
483 : 0 : gtk_combo_box_text_append_text( faw->cb_uri_type, "xml" );
484 : 0 : ++access_method_index;
485 : :
486 : : // Set XML as default if it is offered (which mean we are in
487 : : // the "Save As" dialog)
488 : 0 : active_access_method_index = access_method_index;
489 : : }
490 : 0 : g_assert( active_access_method_index >= 0 );
491 : :
492 : 0 : g_object_unref(G_OBJECT(builder));
493 : :
494 : : /* Run the dialog */
495 : 0 : gtk_widget_show_all( faw->dialog );
496 : :
497 : : /* Hide the frame that's not required for the active access method so either only
498 : : * the File or only the Database frame are presented. */
499 : 0 : gtk_combo_box_set_active(GTK_COMBO_BOX(faw->cb_uri_type), active_access_method_index );
500 : 0 : set_widget_sensitivity_for_uri_type( faw, gtk_combo_box_text_get_active_text( faw->cb_uri_type ));
501 : : }
502 : :
503 : : void
504 : 0 : gnc_ui_file_access_for_open (GtkWindow *parent)
505 : : {
506 : 0 : gnc_ui_file_access (parent, FILE_ACCESS_OPEN);
507 : 0 : }
508 : :
509 : :
510 : : void
511 : 0 : gnc_ui_file_access_for_save_as (GtkWindow *parent)
512 : : {
513 : 0 : gnc_ui_file_access (parent, FILE_ACCESS_SAVE_AS);
514 : 0 : }
515 : :
516 : :
517 : : void
518 : 0 : gnc_ui_file_access_for_export (GtkWindow *parent)
519 : : {
520 : 0 : gnc_ui_file_access (parent, FILE_ACCESS_EXPORT);
521 : 0 : }
|