From 1265e5419737a2fbd12eff899d19df706855b55e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 8 Jul 2001 21:55:13 +0000 Subject: devdir command via menu --- mixgtk/mixgtk_gen_handlers.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'mixgtk/mixgtk_gen_handlers.c') diff --git a/mixgtk/mixgtk_gen_handlers.c b/mixgtk/mixgtk_gen_handlers.c index 63314f1..0d3daa3 100644 --- a/mixgtk/mixgtk_gen_handlers.c +++ b/mixgtk/mixgtk_gen_handlers.c @@ -26,10 +26,9 @@ #include "mixgtk_cmd_dispatcher.h" #include "mixgtk_config.h" -typedef void (*file_callback_t)(const gchar *file); - static file_callback_t callback_ = NULL; + static void on_file_ok_ (GtkWidget *w, gpointer fs) { @@ -66,6 +65,17 @@ static void show_dlg_ (const gchar *title, const gchar *pattern) gtk_grab_add (file); } +/* grab a file with an externally provided callback */ +void +mixgtk_get_file (file_callback_t callback, + const gchar *title, const gchar *pattern) +{ + g_return_if_fail (callback != NULL); + callback_ = callback; + show_dlg_ (title, pattern); +} + + /* exec prompt command */ static void exec_cmd_ (mix_vm_command_t cmd, const gchar *arg) { @@ -90,8 +100,7 @@ static void open_cb_ (const gchar *file) void on_file_open_activate (GtkWidget *w, gpointer data) { - callback_ = open_cb_; - show_dlg_ ("Load MIX program...", "*.mix"); + mixgtk_get_file (open_cb_, "Load MIX program...", "*.mix"); } /* edit mixal source */ @@ -103,9 +112,8 @@ static void edit_cb_ (const gchar *file) void on_file_edit_activate (GtkWidget *w, gpointer data) { - callback_ = edit_cb_; - show_dlg_ ("Edit MIXAL source file...", - mixgtk_cmd_dispatcher_get_src_path ()); + mixgtk_get_file (edit_cb_, "Edit MIXAL source file...", + mixgtk_cmd_dispatcher_get_src_path ()); } /* compile mixal source */ @@ -117,9 +125,8 @@ static void compile_cb_ (const gchar *file) void on_file_compile_activate (GtkWidget *w, gpointer data) { - callback_ = compile_cb_; - show_dlg_ ("Compile MIXAL source file...", - mixgtk_cmd_dispatcher_get_src_path ()); + mixgtk_get_file (compile_cb_, "Compile MIXAL source file...", + mixgtk_cmd_dispatcher_get_src_path ()); } void @@ -141,7 +148,6 @@ on_file_exit_activate (GtkWidget *w, gpointer data) gtk_main_quit (); } - void on_clear_breakpoints_activate (GtkWidget *w, gpointer data) { -- cgit v1.2.3