diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-07-09 22:49:55 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-07-09 22:49:55 +0000 |
commit | 888a3d7a8c313481de4004a5a1766f85c0dd7f20 (patch) | |
tree | 8bb257e31d058c98bda72805281185af98a47ffc /mixgtk | |
parent | 1265e5419737a2fbd12eff899d19df706855b55e (diff) | |
download | mdk-888a3d7a8c313481de4004a5a1766f85c0dd7f20.tar.gz mdk-888a3d7a8c313481de4004a5a1766f85c0dd7f20.tar.bz2 |
history file
Diffstat (limited to 'mixgtk')
-rw-r--r-- | mixgtk/mixgtk.c | 2 | ||||
-rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.c | 37 | ||||
-rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.h | 5 |
3 files changed, 24 insertions, 20 deletions
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c index 1198fb3..9c18703 100644 --- a/mixgtk/mixgtk.c +++ b/mixgtk/mixgtk.c @@ -136,6 +136,6 @@ void mixgtk_release (void) { if (mixgtk_config_is_autosave ()) mixgtk_config_save (); - + mix_vm_cmd_dispatcher_delete (mixgtk_cmd_dispatcher_get_mix_dispatcher ()); mix_release_lib (); } diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index 2f47c64..8d2d0a7 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -219,10 +219,6 @@ install_hooks_ (void) /* configuration stuff */ static const gchar *EDITOR_KEY_ = "Editor"; static const gchar *MIXASM_KEY_ = "Mixasm"; -static const gchar *HISTORY_FILE_KEY_ = "History.file"; -static const gchar *MAX_HISTORY_KEY_ = "History.size"; -static const gchar *HISTORY_FILE_ = NULL; -static int MAX_HISTORY_ = 50; static void read_config_ (void) @@ -230,13 +226,6 @@ read_config_ (void) const gchar *editor = mixgtk_config_get (EDITOR_KEY_); const gchar *assem = mixgtk_config_get (MIXASM_KEY_); -#ifdef HAVE_LIBHISTORY - const gchar *mh = mixgtk_config_get (MAX_HISTORY_KEY_); - if (mh) MAX_HISTORY_ = atoi (mh); - if (MAX_HISTORY_ <= 0) MAX_HISTORY_ = 50; - HISTORY_FILE_ = mixgtk_config_get (HISTORY_FILE_KEY_); -#endif - if (!editor) { static const gchar *ENV[] = {"MDK_EDITOR", "X_EDITOR", NULL}; @@ -328,6 +317,10 @@ mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top) if (!dis_data_.dispatcher) { + static const gchar *HISTORY_FILE = "gmixvm.history"; + static gint HISTORY_SIZE = 100; + mix_config_t *config = mixgtk_config_get_mix_config (); + int r = pipe (dis_data_.fildes); g_return_val_if_fail (r == 0, FALSE); /* connect stdout/stderr to the pipe's write end @@ -341,10 +334,16 @@ mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top) r |= O_NONBLOCK; r = fcntl(dis_data_.fildes[0], F_SETFL, r); g_return_val_if_fail (r != -1, FALSE); + + if (!mix_config_get_history_file (config)) + mix_config_set_history_file (config, HISTORY_FILE); + if (mix_config_get_history_size (config) == 0) + mix_config_set_history_size (config, HISTORY_SIZE); + dis_data_.dispatcher = mix_vm_cmd_dispatcher_new_with_config (dis_data_.out, dis_data_.out, - mixgtk_config_get_mix_config ()); + config); mix_vm_cmd_dispatcher_print_time (dis_data_.dispatcher, FALSE); install_hooks_ (); @@ -363,13 +362,6 @@ mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top) (GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)), dis_data_.last_file); -#ifdef HAVE_LIBHISTORY - if (!restart) - { - using_history (); - stifle_history (MAX_HISTORY_); - } -#endif restart = TRUE; return TRUE; @@ -414,6 +406,13 @@ mixgtk_cmd_dispatcher_get_src_path (void) return mix_vm_cmd_dispatcher_get_src_file_path (dis_data_.dispatcher); } +/* get the mix cmd dispatcher */ +mix_vm_cmd_dispatcher_t * +mixgtk_cmd_dispatcher_get_mix_dispatcher (void) +{ + return dis_data_.dispatcher; +} + /* process commands */ void complete_command_ (void) diff --git a/mixgtk/mixgtk_cmd_dispatcher.h b/mixgtk/mixgtk_cmd_dispatcher.h index a67ec26..6ea840c 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.h +++ b/mixgtk/mixgtk_cmd_dispatcher.h @@ -26,6 +26,7 @@ #define MIXGTK_CMD_DISPATCHER_H #include <mixlib/mix_vm.h> +#include <mixlib/mix_vm_command.h> #include "mixgtk_widgets.h" /* initialise the command dispatcher */ @@ -48,6 +49,10 @@ mixgtk_cmd_dispatcher_get_vm (void); extern const gchar * mixgtk_cmd_dispatcher_get_src_path (void); +/* get the mix cmd dispatcher */ +extern mix_vm_cmd_dispatcher_t * +mixgtk_cmd_dispatcher_get_mix_dispatcher (void); + #endif /* MIXGTK_CMD_DISPATCHER_H */ |