summaryrefslogtreecommitdiffhomepage
path: root/mixgtk/mixgtk_cmd_dispatcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixgtk/mixgtk_cmd_dispatcher.c')
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.c22
1 files changed, 14 insertions, 8 deletions
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)