\f
static void data_save_as_dialog (GtkAction *, struct data_editor *de);
static void new_file (GtkAction *, struct editor_window *de);
-static void open_data_dialog (GtkAction *, struct editor_window *de);
+static void open_data_dialog (GtkAction *, struct data_editor *de);
static void data_save (GtkAction *action, struct data_editor *e);
/* Callback for the data_open action.
Prompts for a filename and opens it */
static void
-open_data_dialog (GtkAction *action, struct editor_window *de)
+open_data_dialog (GtkAction *action, struct data_editor *de)
{
+ struct editor_window *e = (struct editor_window *) de;
+
GtkWidget *dialog =
gtk_file_chooser_dialog_new (_("Open"),
- GTK_WINDOW (de->window),
+ GTK_WINDOW (e->window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
case GTK_RESPONSE_ACCEPT:
{
struct getl_interface *sss;
- gchar *file_name =
+ g_free (de->file_name);
+ de->file_name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- sss = create_syntax_string_source ("GET FILE='%s'.", file_name);
+ sss = create_syntax_string_source ("GET FILE='%s'.", de->file_name);
execute_syntax (sss);
- window_set_name_from_filename (de, file_name);
-
- g_free (file_name);
+ window_set_name_from_filename (e, de->file_name);
}
break;
default:
struct editor_window
{
GtkWindow *window; /* The top level window of the editor */
- gchar *name; /* The name of this editor */
+ gchar *name; /* The name of this editor (UTF-8) */
enum window_type type;
} ;
const gchar * window_name (const struct editor_window *);
+/* Set the name of this window based on FILENAME.
+ FILENAME is in "filename encoding" */
void window_set_name_from_filename (struct editor_window *e,
const gchar *filename);