From 84aa93fe0728814893c48cffe2f63eb0e417f097 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 9 Oct 2022 21:28:53 -0700 Subject: [PATCH] smyrna openfiledlg: remove filter parameters This function is only ever called without any filters. --- cmd/smyrna/gui/gui.c | 14 ++------------ cmd/smyrna/gui/gui.h | 2 +- cmd/smyrna/gui/menucallbacks.c | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cmd/smyrna/gui/gui.c b/cmd/smyrna/gui/gui.c index d4a3968da..3e7cd8d83 100644 --- a/cmd/smyrna/gui/gui.c +++ b/cmd/smyrna/gui/gui.c @@ -120,17 +120,9 @@ void show_gui_warning(char *str) 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, @@ -140,8 +132,6 @@ int openfiledlg(int filtercnt, char **filters, agxbuf * xbuf) 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))); diff --git a/cmd/smyrna/gui/gui.h b/cmd/smyrna/gui/gui.h index 139144ad5..112b5aa06 100644 --- a/cmd/smyrna/gui/gui.h +++ b/cmd/smyrna/gui/gui.h @@ -36,7 +36,7 @@ /*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); diff --git a/cmd/smyrna/gui/menucallbacks.c b/cmd/smyrna/gui/menucallbacks.c index 96d4b36aa..d55649151 100644 --- a/cmd/smyrna/gui/menucallbacks.c +++ b/cmd/smyrna/gui/menucallbacks.c @@ -361,7 +361,7 @@ void on_gvprbuttonload_clicked(GtkWidget * widget, gpointer user_data) 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)) -- 2.40.0