2 * interface.c -- gtk-interface
4 * Copyright 2009, 2010 Free Software Foundation, Inc.
6 * GNU XBoard is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or (at
9 * your option) any later version.
11 * GNU XBoard 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.
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/. *
19 *------------------------------------------------------------------------
20 ** See the file ChangeLog for a revision history. */
28 #include <sys/types.h>
33 #include <gdk-pixbuf/gdk-pixbuf.h>
41 #include "xgamelist.h"
43 #include "xedittags.h"
48 # define _(s) gettext (s)
49 # define N_(s) gettext_noop (s)
55 extern GtkWidget *GUI_Window;
58 GdkPixbuf *load_pixbuf(char *filename,int size)
63 image = gdk_pixbuf_new_from_file_at_size(filename,size,size,NULL);
65 image = gdk_pixbuf_new_from_file(filename,NULL);
69 fprintf(stderr,_("Error: couldn't load file: %s\n"),filename);
76 FileNamePopUp(label, def, proc, openMode)
83 * implement look for certain file types
84 * use save/load button depending on what function is calling
89 dialog = gtk_file_chooser_dialog_new (label,
90 GTK_WINDOW(GUI_Window),
91 GTK_FILE_CHOOSER_ACTION_OPEN,
92 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
93 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
95 if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
100 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
103 f = fopen(filename, openMode);
106 DisplayError(_("Failed to open file"), errno);
111 (*proc)(f, 0, filename);
116 gtk_widget_destroy (dialog);