This function is only ever called without any filters.
Generic Open File dialog, if a file is selected and return value is 1, else 0
file name is copied to char* filename,which should be allocated before using the function
*/
-int openfiledlg(int filtercnt, char **filters, agxbuf * xbuf)
-{
+int openfiledlg(agxbuf *xbuf) {
GtkWidget *dialog;
- GtkFileFilter *filter;
- int id, rv;
- filter = gtk_file_filter_new();
- if (filtercnt >= 1) {
- for (id = 0; id < filtercnt; id++) {
- gtk_file_filter_add_pattern(filter, filters[id]);
- }
- }
+ int rv;
dialog = gtk_file_chooser_dialog_new("Open File",
NULL,
GTK_STOCK_OPEN,
GTK_RESPONSE_ACCEPT, NULL);
- if (filtercnt >= 1)
- gtk_file_chooser_set_filter((GtkFileChooser *) dialog, filter);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
agxbput(xbuf,
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)));
/*generic warning pop up*/
void show_gui_warning(char *str);
/*generic open file dialog*/
- int openfiledlg(int filtercnt, char **filters, agxbuf * xbuf);
+ int openfiledlg(agxbuf * xbuf);
/*generic save file dialog*/
int savefiledlg(int filtercnt, char **filters, agxbuf * xbuf);
void append_textview(GtkTextView * textv, const char *s, size_t bytes);
agxbinit(&xbuf, SMALLBUF, xbuffer);
/*file name should be returned in xbuf */
- if (openfiledlg(0, NULL, &xbuf)) {
+ if (openfiledlg(&xbuf)) {
input_file = fopen(agxbuse(&xbuf), "r");
if (input_file) {
while (fgets(buf, BUFSIZ, input_file))