1 /* 2 * TilEm II 3 * 4 * Copyright (c) 2011 Benjamin Moody 5 * 6 * This program is free software: you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 /* Run a file chooser dialog, allowing user to select a single 21 existing file to open. 22 23 TITLE is the title of the dialog (UTF-8.) 24 25 PARENT is the "parent" (transient-for) window, if any. 26 27 SUGGEST_DIR is the directory to start in (GLib filename encoding.) 28 29 Remaining arguments are a series of pairs of strings describing the 30 permitted file types. First string in each pair is the 31 description; second is a pattern set (consisting of one or more 32 glob-style patterns, separated by semicolons.) Patterns must be 33 lowercase; they will be checked case-insensitively. The list is 34 terminated by NULL. 35 36 A pattern may be the empty string (""); if so, that file type is 37 disabled. 38 39 Result is NULL if dialog was cancelled; otherwise, a string in 40 filename encoding, which must be freed with g_free(). 41 */ 42 char * prompt_open_file(const char *title, /* UTF-8 */ 43 GtkWindow *parent, 44 const char *suggest_dir, /* filename encoding */ 45 const char *desc1, /* UTF-8 */ 46 const char *pattern1, /* ASCII */ 47 ...) 48 G_GNUC_NULL_TERMINATED; 49 50 /* Run a file chooser dialog, allowing user to select one or more 51 files to open. Result is either NULL or an array of strings, which 52 must be freed with g_strfreev(). */ 53 char ** prompt_open_files(const char *title, /* UTF-8 */ 54 GtkWindow *parent, 55 const char *suggest_dir, /* filename encoding */ 56 const char *desc1, /* UTF-8 */ 57 const char *pattern1, /* ASCII */ 58 ...) 59 G_GNUC_NULL_TERMINATED; 60 61 /* Run a file chooser dialog, allowing user to enter a new filename to 62 be created. SUGGEST_NAME is a suggested name for the new file; 63 note that this is UTF-8. */ 64 char * prompt_save_file(const char *title, /* UTF-8 */ 65 GtkWindow *parent, 66 const char *suggest_name, /* UTF-8 (!) */ 67 const char *suggest_dir, /* filename encoding */ 68 const char *desc1, /* UTF-8 */ 69 const char *pattern1, /* ASCII */ 70 ...) 71 G_GNUC_NULL_TERMINATED; 72 73 /* Create a file entry or file-chooser button widget, allowing user to 74 select a single existing file to open. */ 75 GtkWidget * file_entry_new(const char *title, /* UTF-8 */ 76 const char *desc1, /* UTF-8 */ 77 const char *pattern1, /* ASCII */ 78 ...) 79 G_GNUC_NULL_TERMINATED; 80 81 /* Set filename in a file entry. */ 82 void file_entry_set_filename(GtkWidget *fe, 83 const char *filename); /* filename encoding */ 84 85 /* Get filename in a file entry. Result is NULL if no file is 86 selected; otherwise, a string in filename encoding, which must be 87 freed with g_free(). */ 88 char * file_entry_get_filename(GtkWidget *fe); 89 90 /* Run a directory chooser dialog, allowing user to select a directory. */ 91 char * prompt_select_dir(const char *title, GtkWindow *parent, const char *suggest_dir); 92