diff options
Diffstat (limited to 'mixgtk/mixgtk_device.c')
-rw-r--r-- | mixgtk/mixgtk_device.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c index ac0092d..71e83bd 100644 --- a/mixgtk/mixgtk_device.c +++ b/mixgtk/mixgtk_device.c @@ -316,21 +316,36 @@ mixgtk_device_new_ (mix_device_type_t type) return (mix_device_t *)dev; } +static mix_device_t * +mixgtk_device_copy_ (const struct mixgtk_device_t *from) +{ + struct mixgtk_device_t *result = + (struct mixgtk_device_t *)mixgtk_device_new_ (from->device.type); + g_return_val_if_fail (result != NULL, NULL); + if (MODES_[from->device.type] == mix_dev_CHAR) + { + gchar *text = gtk_editable_get_chars (GTK_EDITABLE (from->widget), + 0, -1); + gtk_text_insert (GTK_TEXT (result->widget), NULL, NULL, NULL, text, -1); + g_free (text); + } + else + { + } + return (mix_device_t *)result; +} + /* init default devices */ gboolean mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm) { - static mix_device_type_t def_types[] = { - /* mix_dev_CONSOLE,*/ mix_dev_INVALID - }; - gint k = 0; g_return_val_if_fail (container != NULL, FALSE); g_return_val_if_fail (vm != NULL, FALSE); container_ = container; vm_ = vm; - /** configuration stuff */ + last_pos_ = 0; devdlg_ = NULL; dtoggle_ = NULL; wtoggle_ = NULL; @@ -345,12 +360,16 @@ mixgtk_device_init (GtkNotebook *container, mix_vm_t *vm) if (mixgtk_config_get (DEV_FORMAT_KEY_)) decs_ = atoi (mixgtk_config_get (DEV_FORMAT_KEY_)); - /* connect default devices */ - while (def_types[k] != mix_dev_INVALID) + /* re-create existing devices */ + for (k = 0; k < mix_dev_INVALID; ++k) { - struct mix_device_t *dev = mixgtk_device_new_ (def_types[k]); - if (dev != NULL) mix_vm_connect_device (vm, dev); - ++k; + mix_device_t *dev = mix_vm_get_device (vm, k); + if (dev != NULL) + { + mix_device_t *newdev = + mixgtk_device_copy_ ((struct mixgtk_device_t *)dev); + mix_vm_connect_device (vm, newdev); + } } /* set to first page */ |