From: ntakahas Date: Thu, 26 Apr 2007 11:30:57 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: REL-0-9-0~20 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5dfbde64357e9a6bead8ac8514e2cb890c89ff3;p=m17n%2Fm17n-im-config.git *** empty log message *** --- diff --git a/src/command.c b/src/command.c index 535722c..4eec76b 100644 --- a/src/command.c +++ b/src/command.c @@ -29,6 +29,16 @@ minput_config_command (current_lang, current_name, current_command, \ (plist)) +static void +mtext__cat_str (MText *mt, char *str) +{ + while (*str) + { + mtext_cat_char (mt, (int) *str); + str++; + } +} + static unsigned modifier_state = 0; static MPlist *entry_keyseq; static MSymbol current_lang, current_name, current_command; @@ -336,32 +346,19 @@ keyseq_render_function (GtkTreeViewColumn *column, { MPlist *keyseq, *pl; gint n; - gchar buf[1024]; + MText *mt = mtext (); gtk_tree_model_get (model, iter, 0, &keyseq, -1); - for (pl = keyseq, n = 0; + for (pl = keyseq; pl && mplist_key (pl) == Msymbol; pl = mplist_next (pl)) - n += strlen (msymbol_name ((MSymbol) mplist_value (pl))) + 1; - if (n < sizeof (buf)) { - buf[0] = '\0'; - for (pl = keyseq; - pl && mplist_key (pl) == Msymbol; - pl = mplist_next (pl)) - { - strcat (buf, msymbol_name ((MSymbol) mplist_value (pl))); - strcat (buf, " "); - } - g_object_set (renderer, "foreground-set", FALSE, NULL); - } - else - { - g_snprintf (buf, sizeof (buf), _("Too long to display")); - g_object_set (renderer, "foreground", "Red", "foreground-set", TRUE, - NULL); + mtext__cat_str (mt, msymbol_name ((MSymbol) mplist_value (pl))); + mtext_cat_char (mt, ' '); } - g_object_set (renderer, "text", buf, NULL); + g_object_set (renderer, "text", mtext_data (mt, NULL, NULL, NULL, NULL), + NULL); + m17n_object_unref (mt); } static void * @@ -416,16 +413,19 @@ static GtkWidget * create_deleting_section (struct BindingWidgets *bw) { GtkListStore *store; - GtkWidget *scrolled, *hbox, *vbox; + GtkWidget *label, *scrolled, *hbox, *vbox; GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkTreeIter iter; GtkTreeSelection *selection; MPlist *pl; + label = gtk_label_new (_("Current key bindings:")); + store = gtk_list_store_new (1, G_TYPE_POINTER); bw->view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (G_OBJECT (store)); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (bw->view), FALSE); update_binding_store (bw->view); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(bw->view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); @@ -439,7 +439,6 @@ create_deleting_section (struct BindingWidgets *bw) bw->view); column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Current Key Bindings")); gtk_tree_view_append_column (GTK_TREE_VIEW (bw->view), column); renderer = gtk_cell_renderer_text_new (); @@ -463,6 +462,10 @@ create_deleting_section (struct BindingWidgets *bw) vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + hbox = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); + gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_container_add (GTK_CONTAINER (vbox), scrolled); hbox = gtk_hbutton_box_new (); @@ -498,7 +501,7 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, { GtkTreeModel *model; GtkTreeIter iter; - GtkWidget *dialog, *vbox; + GtkWidget *dialog, *vbox, *hbox; struct BindingWidgets bw; gchar *command; @@ -511,19 +514,22 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, dialog = (gtk_dialog_new_with_buttons (command, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL)); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), - create_adding_section (&bw)); + create_deleting_section (&bw)); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), - create_deleting_section (&bw)); + create_adding_section (&bw)); + vbox = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + hbox = gtk_hbox_new (FALSE, 6); bw.status = gtk_label_new (NULL); - vbox = gtk_vbox_new (FALSE, 12); - gtk_container_add (GTK_CONTAINER (vbox), bw.status); + gtk_box_pack_start (GTK_BOX (hbox), bw.status, FALSE, FALSE, 6); + gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); update_widgets (&bw); diff --git a/src/variable.c b/src/variable.c index ad189a5..579c25d 100644 --- a/src/variable.c +++ b/src/variable.c @@ -51,45 +51,25 @@ struct ControllerInfo /* revert button */ GtkWidget *revert; - /* apply button */ - GtkWidget *apply; - /* status label */ GtkWidget *status; + + /* ok button */ + GtkWidget *ok; + + /* dialog itself */ + GtkWidget *dialog; }; static MSymbol current_lang, current_name, current_variable; static void -update_controller (struct ControllerInfo *ci) +update_status (struct ControllerInfo *ci) { MPlist *plist; MSymbol key, status; void *value; - status = CURRENT_STATUS; - if (status == Mconfigured) - { - gtk_widget_set_sensitive (ci->default_, TRUE); - gtk_widget_set_sensitive (ci->revert, TRUE); - gtk_widget_set_sensitive (ci->apply, FALSE); - gtk_label_set_text (GTK_LABEL (ci->status), _("Status : modified")); - } - else if (status == Mcustomized) - { - gtk_widget_set_sensitive (ci->default_, TRUE); - gtk_widget_set_sensitive (ci->revert, FALSE); - gtk_widget_set_sensitive (ci->apply, FALSE); - gtk_label_set_text (GTK_LABEL (ci->status), _("Status : customized")); - } - else - { - gtk_widget_set_sensitive (ci->default_, FALSE); - gtk_widget_set_sensitive (ci->revert, FALSE); - gtk_widget_set_sensitive (ci->apply, FALSE); - gtk_label_set_text (GTK_LABEL (ci->status), _("Status : default")); - } - plist = CURRENT_VALUE; /* plist == (value [valid-value ...]) */ key = mplist_key (plist); @@ -105,7 +85,7 @@ update_controller (struct ControllerInfo *ci) gtk_entry_set_text (GTK_ENTRY (ci->widget), mtext_data ((MText *) value, NULL, NULL, NULL, NULL)); - else + else /* key == Minteger */ { gchar buf[32]; g_snprintf (buf, sizeof (buf), "%d", (gint) value); @@ -123,17 +103,37 @@ update_controller (struct ControllerInfo *ci) break; gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), i); } - else + else /* ci->wtype == SPIN_BUTTON_WIDGET */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (ci->widget), (gdouble) (int) value); + + status = CURRENT_STATUS; + if (status == Mconfigured) + { + gtk_widget_set_sensitive (ci->default_, TRUE); + gtk_widget_set_sensitive (ci->revert, TRUE); + gtk_label_set_text (GTK_LABEL (ci->status), _("Status : modified")); + } + else if (status == Mcustomized) + { + gtk_widget_set_sensitive (ci->default_, TRUE); + gtk_widget_set_sensitive (ci->revert, FALSE); + gtk_label_set_text (GTK_LABEL (ci->status), _("Status : customized")); + } + else + { + gtk_widget_set_sensitive (ci->default_, FALSE); + gtk_widget_set_sensitive (ci->revert, FALSE); + gtk_label_set_text (GTK_LABEL (ci->status), _("Status : default")); + } } -static void -entry_cb (GtkEntry *entry, gpointer data) +static gboolean +config_with_entry (struct ControllerInfo *ci) { - const gchar *text = gtk_entry_get_text (entry); + const gchar *text = gtk_entry_get_text (GTK_ENTRY (ci->widget)); MPlist *plist = mplist (); - struct ControllerInfo *ci = data; + gboolean ret = TRUE; if (ci->vtype == Msymbol) { @@ -149,7 +149,7 @@ entry_cb (GtkEntry *entry, gpointer data) CONFIG_VARIABLE (plist); m17n_object_unref (mt); } - else if (ci->vtype == Minteger) + else /* ci->vtype == Minteger */ { int i; gchar buf[32]; @@ -171,25 +171,20 @@ entry_cb (GtkEntry *entry, gpointer data) _("The value must be an integer.")); gtk_dialog_run (GTK_DIALOG (msg)); gtk_widget_destroy (msg); - /* revert current value */ - mplist_add (plist, Minteger, mplist_value (CURRENT_VALUE)); + update_status (ci); + ret = FALSE; } - /* redraw the value to get rid of non-digits */ - g_snprintf (buf, sizeof (buf), "%d", (gint) mplist_value (plist)); - gtk_entry_set_text (GTK_ENTRY (entry), buf); - gtk_editable_set_position (GTK_EDITABLE (entry), -1); } + m17n_object_unref (plist); - update_controller (ci); + return ret; } static void -combo_cb (GtkComboBox *combo, gpointer data) +config_with_combo (struct ControllerInfo *ci) { - gchar *text = gtk_combo_box_get_active_text (combo); + gchar *text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (ci->widget)); MPlist *plist = mplist (); - struct ControllerInfo *ci = data; - if (ci->vtype == Msymbol) { @@ -205,7 +200,7 @@ combo_cb (GtkComboBox *combo, gpointer data) CONFIG_VARIABLE (plist); m17n_object_unref (mt); } - else if (ci->vtype == Minteger) + else /* ci->vtype == Minteger */ { int i; @@ -214,20 +209,118 @@ combo_cb (GtkComboBox *combo, gpointer data) CONFIG_VARIABLE (plist); } m17n_object_unref (plist); - update_controller (ci); + update_status (ci); } -static void -spin_cb (GtkSpinButton *spin, gpointer data) +static gboolean +config_with_spin (struct ControllerInfo *ci) +{ + gint i; + gdouble min, max; + + i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ci->widget)); + gtk_spin_button_get_range (GTK_SPIN_BUTTON (ci->widget), &min, &max); + if ((gint) min < i && i < (gint) max) + { + MPlist *plist = mplist (); + + mplist_add (plist, Minteger, (void *) i); + CONFIG_VARIABLE (plist); + m17n_object_unref (plist); + return TRUE; + } + else + { + GtkWidget *msg; + + msg = gtk_message_dialog_new (GTK_WINDOW + (gtk_widget_get_toplevel (ci->widget)), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("The value is out of range (%d - %d)."), + (gint) min, (gint) max); + gtk_dialog_run (GTK_DIALOG (msg)); + gtk_widget_destroy (msg); + update_status (ci); + return FALSE; + } +} + +static void * +ok_cb (GtkButton *button, gpointer data) { - MPlist *plist = mplist (); struct ControllerInfo *ci = data; - mplist_add (plist, Minteger, - (void *) gtk_spin_button_get_value_as_int (spin)); - CONFIG_VARIABLE (plist); - m17n_object_unref (plist); - update_controller (ci); + if (! strcmp (gtk_label_get_text (GTK_LABEL (ci->status)), + "Status : modified")) + { + if (ci->wtype == ENTRY_WIDGET) + { + if (config_with_entry (ci)) + gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); + else + update_status (ci); + } + + else if (ci->wtype == COMBO_BOX_WIDGET) + { + config_with_combo (ci); + gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); + } + + else /* ci->wtype == SPIN_BUTTON */ + { + if (config_with_spin (ci)) + gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); + else + update_status (ci); + } + } + else /* default or customized */ + gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); +} + +static void * +default_cb (GtkButton *button, gpointer data) +{ + MPlist *empty = mplist (); + struct ControllerInfo *ci = data; + + CONFIG_VARIABLE (empty); + m17n_object_unref (empty); + update_status (ci); +} + +static void * +revert_cb (GtkButton *button, gpointer data) +{ + struct ControllerInfo *ci = data; + + CONFIG_VARIABLE (NULL); + update_status (ci); +} + +static gboolean +key_pressed_cb (GtkEntry *entry, GdkEventKey *event, gpointer data) +{ + struct ControllerInfo *ci = data; + + gtk_widget_set_sensitive (ci->default_, TRUE); + gtk_widget_set_sensitive (ci->revert, TRUE); + gtk_label_set_text (GTK_LABEL (ci->status), _("Status : modified")); + return FALSE; +} + +static gboolean +value_changed_cb (GtkWidget *widget, gpointer data) +{ + struct ControllerInfo *ci = data; + + gtk_widget_set_sensitive (ci->default_, TRUE); + gtk_widget_set_sensitive (ci->revert, TRUE); + gtk_label_set_text (GTK_LABEL (ci->status), _("Status : modified")); + return FALSE; } enum @@ -273,17 +366,6 @@ set_value_status (GtkListStore *store, GtkTreeIter *iter) -1); } -static gboolean -key_pressed_cb (GtkEntry *entry, GdkEventKey *event, gpointer data) -{ - struct ControllerInfo *ci = data; - - gtk_widget_set_sensitive (ci->default_, TRUE); - gtk_widget_set_sensitive (ci->revert, TRUE); - gtk_widget_set_sensitive (ci->apply, TRUE); - return FALSE; -} - static GtkWidget * create_widget (struct ControllerInfo *ci) { @@ -300,9 +382,11 @@ create_widget (struct ControllerInfo *ci) { if (plist && mplist_key (plist) == Msymbol) { - gint i, nth = -1; + gint i, nth; ci->widget = gtk_combo_box_new_text (); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (value_changed_cb), ci); ci->wtype = COMBO_BOX_WIDGET; for (i = 0; plist && mplist_key (plist) == Msymbol; plist = mplist_next (plist), i++) @@ -313,30 +397,27 @@ create_widget (struct ControllerInfo *ci) (GTK_COMBO_BOX (ci->widget), msymbol_name ((MSymbol) mplist_value (plist))); } - if (nth != -1) - gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); - g_signal_connect (G_OBJECT (ci->widget), "changed", - G_CALLBACK (combo_cb), ci); + gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); } else { ci->widget = gtk_entry_new (); + g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", + G_CALLBACK (key_pressed_cb), ci); ci->wtype = ENTRY_WIDGET; gtk_entry_set_text (GTK_ENTRY (ci->widget), msymbol_name (value)); gtk_editable_set_editable (GTK_EDITABLE (ci->widget), TRUE); - g_signal_connect (G_OBJECT (ci->widget), "activate", - G_CALLBACK (entry_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); } } else if (ci->vtype == Mtext) { if (plist && mplist_key (plist) == Mtext) { - gint i, nth = -1; + gint i, nth; ci->widget = gtk_combo_box_new_text (); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (value_changed_cb), ci); ci->wtype = COMBO_BOX_WIDGET; for (i = 0; plist && mplist_key (plist) == Mtext; plist = mplist_next (plist), i++) @@ -350,32 +431,29 @@ create_widget (struct ControllerInfo *ci) mtext_data ((MText *) mplist_value (plist), NULL, NULL, NULL, NULL)); } - if (nth != -1) - gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); - g_signal_connect (G_OBJECT (ci->widget), "changed", - G_CALLBACK (combo_cb), ci); + gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); } else { ci->widget = gtk_entry_new (); + g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", + G_CALLBACK (key_pressed_cb), ci); ci->wtype = ENTRY_WIDGET; /* Fixme : Assuming the return value is in UTF-8 */ gtk_entry_set_text (GTK_ENTRY (ci->widget), mtext_data (value, NULL, NULL, NULL, NULL)); gtk_editable_set_editable (GTK_EDITABLE (ci->widget), TRUE); - g_signal_connect (G_OBJECT (ci->widget), "activate", - G_CALLBACK (entry_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); } } - else if (ci->vtype == Minteger) + else /* ci->vtype == Minteger */ { if (plist && mplist_key (plist) == Minteger) { - gint i, nth = -1; + gint i, nth; ci->widget = gtk_combo_box_new_text (); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (value_changed_cb), ci); ci->wtype = COMBO_BOX_WIDGET; for (i = 0; plist && mplist_key (plist) == Minteger; plist = mplist_next (plist), i++) @@ -388,10 +466,7 @@ create_widget (struct ControllerInfo *ci) (gint) mplist_value (plist)); gtk_combo_box_append_text (GTK_COMBO_BOX (ci->widget), buf); } - if (nth != -1) - gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); - g_signal_connect (G_OBJECT (ci->widget), "changed", - G_CALLBACK (combo_cb), ci); + gtk_combo_box_set_active (GTK_COMBO_BOX (ci->widget), nth); } else if (plist && mplist_key (plist) == Mplist) { @@ -404,74 +479,30 @@ create_widget (struct ControllerInfo *ci) adj = gtk_adjustment_new ((gdouble) (int) value, lower, upper, 1.0, 10.0, 0); ci->widget = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0); + g_signal_connect (GTK_OBJECT (ci->widget), "value-changed", + G_CALLBACK (value_changed_cb), ci); + g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", + G_CALLBACK (key_pressed_cb), ci); ci->wtype = SPIN_BUTTON_WIDGET; gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (ci->widget), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (ci->widget), GTK_UPDATE_IF_VALID); - g_signal_connect (G_OBJECT (ci->widget), "activate", - G_CALLBACK (entry_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "value_changed", - G_CALLBACK (spin_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); } else { gchar buf[32]; ci->widget = gtk_entry_new (); + g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", + G_CALLBACK (key_pressed_cb), ci); ci->wtype = ENTRY_WIDGET; g_snprintf (buf, sizeof (buf), "%d", (gint) value); gtk_entry_set_text (GTK_ENTRY (ci->widget), buf); gtk_editable_set_editable (GTK_EDITABLE (ci->widget), TRUE); - g_signal_connect (G_OBJECT (ci->widget), "activate", - G_CALLBACK (entry_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); } } - else /* should never come here */ - { - ci->widget = gtk_entry_new (); - ci->wtype = ENTRY_WIDGET; - gtk_entry_set_text (GTK_ENTRY (ci->widget), "???"); - gtk_editable_set_editable (GTK_EDITABLE (ci->widget), TRUE); - g_signal_connect (G_OBJECT (ci->widget), "activate", - G_CALLBACK (entry_cb), ci); - g_signal_connect (G_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); - } - return ci->widget; -} - -static void * -default_cb (GtkButton *button, gpointer data) -{ - MPlist *empty = mplist (); - struct ControllerInfo *ci = data; - CONFIG_VARIABLE (empty); - m17n_object_unref (empty); - update_controller (ci); -} - -static void * -revert_cb (GtkButton *button, gpointer data) -{ - struct ControllerInfo *ci = data; - - CONFIG_VARIABLE (NULL); - update_controller (ci); -} - -static void * -apply_cb (GtkButton *button, gpointer data) -{ - struct ControllerInfo *ci = data; - - if (ci->wtype == ENTRY_WIDGET) - entry_cb (GTK_ENTRY (ci->widget), ci); - update_controller (ci); + return ci->widget; } static void @@ -480,7 +511,7 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, { GtkTreeModel *model; GtkTreeIter iter; - GtkWidget *dialog, *hbox, *vbox; + GtkWidget *hbox, *vbox; struct ControllerInfo ci; gchar *variable; @@ -490,13 +521,12 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, gtk_tree_model_get (model, &iter, VCOL_VARIABLE, &variable, -1); current_variable = msymbol (variable); - dialog = (gtk_dialog_new_with_buttons - (variable, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL)); - + ci.dialog = (gtk_dialog_new_with_buttons + (variable, + GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))), + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + NULL)); + ci.default_ = gtk_button_new_from_stock (_("_Default")); g_signal_connect (G_OBJECT (ci.default_), "clicked", G_CALLBACK (default_cb), &ci); @@ -505,15 +535,15 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, g_signal_connect (G_OBJECT (ci.revert), "clicked", G_CALLBACK (revert_cb), &ci); - ci.apply = gtk_button_new_from_stock (GTK_STOCK_APPLY); - g_signal_connect (G_OBJECT (ci.apply), "clicked", - G_CALLBACK (apply_cb), &ci); - ci.status = gtk_label_new (NULL); - vbox = gtk_vbox_new (FALSE, 6); + ci.ok = gtk_button_new_from_stock (GTK_STOCK_OK); + g_signal_connect (G_OBJECT (ci.ok), "clicked", + G_CALLBACK (ok_cb), &ci); + + vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (ci.dialog)->vbox), vbox); gtk_container_add (GTK_CONTAINER (vbox), create_widget (&ci)); @@ -522,17 +552,24 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, gtk_box_set_spacing (GTK_BOX (hbox), 6); gtk_container_add (GTK_CONTAINER (hbox), ci.default_); gtk_container_add (GTK_CONTAINER (hbox), ci.revert); - gtk_container_add (GTK_CONTAINER (hbox), ci.apply); gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (vbox), ci.status); + hbox = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (hbox), ci.status, FALSE, FALSE, 6); + gtk_container_add (GTK_CONTAINER (vbox), hbox); + + hbox = gtk_hbutton_box_new (); + gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing (GTK_BOX (hbox), 6); + gtk_container_add (GTK_CONTAINER (hbox), ci.ok); + gtk_container_add (GTK_CONTAINER (vbox), hbox); - update_controller (&ci); - gtk_widget_show_all (dialog); - gtk_dialog_run (GTK_DIALOG (dialog)); + update_status (&ci); + gtk_widget_show_all (ci.dialog); + gtk_dialog_run (GTK_DIALOG (ci.dialog)); gtk_tree_model_get_iter (model, &iter, path); set_value_status (GTK_LIST_STORE (model), &iter); - gtk_widget_destroy (dialog); + gtk_widget_destroy (ci.dialog); } GtkWidget *