/* minput_config_variable or minput_config_command. */
int (*config) (MSymbol, MSymbol, MSymbol, MPlist *);
/* If non-NULL, a function to call before finishing a dialog. */
- int (*config_on_ok) (struct ConfigControl *control);
+ gboolean (*config_on_ok) (struct ConfigControl *control);
/* Widget showing the current data (value or key bindings) */
GtkWidget *data;
control->config (control->lang, control->name, control->item, \
(plist))
+static MPlist *entry_keyseq;
+
static void
-update_widgets (struct ConfigControl *control)
+update_status (struct ConfigControl *control)
{
MSymbol status = CURRENT_STATUS;
if (status == Mconfigured)
{
- gtk_widget_set_sensitive (control->default_, TRUE);
- gtk_widget_set_sensitive (control->revert, TRUE);
gtk_label_set_text (GTK_LABEL (control->status),
mim_status_str[MIM_STATUS_MODIFIED]);
+ gtk_widget_set_sensitive (control->default_, TRUE);
+ gtk_widget_set_sensitive (control->revert, TRUE);
}
else if (status == Mcustomized)
{
- gtk_widget_set_sensitive (control->default_, TRUE);
- gtk_widget_set_sensitive (control->revert, FALSE);
gtk_label_set_text (GTK_LABEL (control->status),
mim_status_str[MIM_STATUS_CUSTOMIZED]);
+ gtk_widget_set_sensitive (control->default_, TRUE);
+ gtk_widget_set_sensitive (control->revert, FALSE);
}
else
{
- gtk_widget_set_sensitive (control->default_, FALSE);
- gtk_widget_set_sensitive (control->revert, FALSE);
gtk_label_set_text (GTK_LABEL (control->status),
mim_status_str[MIM_STATUS_DEFAULT]);
+ gtk_widget_set_sensitive (control->default_, FALSE);
+ gtk_widget_set_sensitive (control->revert, FALSE);
}
}
CONFIG_DATA (empty);
m17n_object_unref (empty);
control->update_data (control);
- update_widgets (control);
+ update_status (control);
control->config_on_ok = NULL;
}
CONFIG_DATA (NULL);
control->update_data (control);
- update_widgets (control);
+ update_status (control);
control->config_on_ok = NULL;
}
}
control->config_on_ok = NULL;
}
+ if (control->config == minput_config_command)
+ m17n_object_unref (entry_keyseq);
gtk_dialog_response (GTK_DIALOG
(gtk_widget_get_toplevel (GTK_WIDGET (button))),
GTK_RESPONSE_OK);
gtk_tree_model_get (model, &iter, CONFIG_COL_ITEM, &item, -1);
control->item = msymbol (item);
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), msymbol_name (control->item));
- gtk_window_set_transient_for
- (GTK_WINDOW (dialog),
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))));
- gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+ dialog = (gtk_dialog_new_with_buttons
+ (msymbol_name (control->item),
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent))),
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ NULL));
gtk_button_box_set_layout (GTK_BUTTON_BOX (GTK_DIALOG (dialog)->action_area),
GTK_BUTTONBOX_EDGE);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
hbox = gtk_hbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
label = gtk_label_new (_("Status"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
label = gtk_label_new (": ");
control->setup_dialog (dialog, control);
- update_widgets (control);
+ update_status (control);
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_tree_model_get_iter (model, &iter, path);
set_list_element (GTK_LIST_STORE (model), &iter, control, NULL);
gtk_widget_destroy (dialog);
- /*m17n_object_unref (entry_keyseq);*/
}
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL));
gtk_widget_set_size_request (dialog, 500, 300);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER(vbox), 10);
+ gtk_container_set_border_width (GTK_CONTAINER(vbox), 5);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
notebook = gtk_notebook_new ();
{
MPlist *plist;
void *value;
- GtkWidget *hbox;
+ GtkWidget *hbox, *vbox;
plist = CURRENT_DATA;
VARIABLE_CONTROL (control)->vtype = mplist_key (plist);
gint i, nth;
control->data = gtk_combo_box_new_text ();
- g_signal_connect (GTK_OBJECT (control->data), "changed",
- G_CALLBACK (changed_cb), control);
VARIABLE_CONTROL (control)->wtype = COMBO_BOX_WIDGET;
for (i = 0; mplist_key (plist) == Msymbol;
plist = mplist_next (plist), i++)
msymbol_name ((MSymbol) mplist_value (plist)));
}
gtk_combo_box_set_active (GTK_COMBO_BOX (control->data), nth);
+ g_signal_connect (GTK_OBJECT (control->data), "changed",
+ G_CALLBACK (changed_cb), control);
}
else
{
control->data = gtk_entry_new ();
+ VARIABLE_CONTROL (control)->wtype = ENTRY_WIDGET;
+ gtk_entry_set_text (GTK_ENTRY (control->data), msymbol_name (value));
+ gtk_editable_set_editable (GTK_EDITABLE (control->data), TRUE);
g_signal_connect (GTK_OBJECT (control->data), "changed",
G_CALLBACK (changed_cb), control);
g_signal_connect (GTK_OBJECT (control->data), "activate",
G_CALLBACK (ok_cb), control);
- VARIABLE_CONTROL (control)->wtype = ENTRY_WIDGET;
- gtk_entry_set_text (GTK_ENTRY (control->data), msymbol_name (value));
- gtk_editable_set_editable (GTK_EDITABLE (control->data), TRUE);
}
}
else if (VARIABLE_CONTROL (control)->vtype == Mtext)
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (hbox), control->default_);
gtk_container_add (GTK_CONTAINER (hbox), control->revert);
+ vbox = gtk_vbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+ gtk_box_pack_start (GTK_BOX (vbox), control->data, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- control->data, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- hbox, FALSE, FALSE, 0);
+ vbox, FALSE, FALSE, 0);
}
\f
CONFIG_DATA (new);
m17n_object_unref (new);
control->update_data (control);
- update_widgets (control);
+ update_status (control);
}
static GtkWidget *
g_signal_connect (G_OBJECT (cmd_control->delete), "clicked",
G_CALLBACK (delete_cb), control);
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+ vbox = gtk_vbox_new (FALSE, 5);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
}
static unsigned modifier_state = 0;
-static MPlist *entry_keyseq;
enum KeyMaskBit {
META_MASK_BIT = 1,
CONFIG_DATA (new);
m17n_object_unref (new);
control->update_data (control);
- update_widgets (control);
+ update_status (control);
+ clear_cb (NULL, control);
}
static GtkWidget *
g_signal_connect (G_OBJECT (cmd_control->add), "clicked",
G_CALLBACK (add_cb), cmd_control);
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
hbox = gtk_hbox_new (FALSE, 6);