From a27ae12b98f6ce945517164940a6eaf7a8301e66 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 30 Jun 2001 19:35:44 +0000 Subject: split improved --- mixgtk/mixgtk_cmd_dispatcher.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'mixgtk/mixgtk_cmd_dispatcher.c') diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index f034cd3..c03db47 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -54,6 +54,7 @@ typedef struct mixgtk_dispatch_ GtkWidget *status; /* the status bar widget */ guint context; /* context of the status bar messages */ GCompletion *completions; /* mixvm command completions */ + gchar *last_file; } mixgtk_dispatch_data_t; static struct mixgtk_dispatch_ dis_data_ = {NULL}; @@ -65,6 +66,7 @@ static GtkWidget *asm_entry_ = NULL; static const gchar *ED_NAME_ = "editor_entry"; static const gchar *ASM_NAME_ = "mixasm_entry"; +static const gchar *TITLE_FORMAT_ = "gmixvm - %s"; static void log_command_ (mixgtk_dispatch_data_t *dis, const gchar *cmd) @@ -123,26 +125,26 @@ load_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, gpointer data) { static glong id = -1; - static GtkWindow *mainw = NULL; if (mix_vm_cmd_dispatcher_get_last_result (dis)) { - gchar *file = g_strdup_printf ("gmixvm - %s", arg); + GtkWindow *mainw = + GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)); + + if (dis_data_.last_file) g_free (dis_data_.last_file); + dis_data_.last_file = g_strdup_printf (TITLE_FORMAT_, arg); + gtk_window_set_title (mainw, dis_data_.last_file); + mixgtk_mixal_load_file (); mixgtk_mixal_update (); mixgtk_mixal_update_bp_all (); - if (!mainw) - mainw = GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)); - if (id != -1) gtk_statusbar_remove (GTK_STATUSBAR (dis_data_.status), dis_data_.context, (guint)id); id = gtk_statusbar_push (GTK_STATUSBAR (dis_data_.status), dis_data_.context, - file); - gtk_window_set_title (mainw, file); - g_free (file); + dis_data_.last_file); } } @@ -342,6 +344,10 @@ mixgtk_cmd_dispatcher_init (mixgtk_dialog_id_t top) "cmd_dis_context"); if (!dis_data_.completions) init_completions_ (); if (!restart) read_config_ (); + if (dis_data_.last_file) + gtk_window_set_title + (GTK_WINDOW (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)), + dis_data_.last_file); #ifdef HAVE_LIBHISTORY if (!restart) -- cgit v1.2.3