diff --git a/scim-wnn/src/scim_wnn_imengine_setup.cpp b/scim-wnn/src/scim_wnn_imengine_setup.cpp index 62bdd61..ec40a4a 100644 --- a/scim-wnn/src/scim_wnn_imengine_setup.cpp +++ b/scim-wnn/src/scim_wnn_imengine_setup.cpp @@ -136,6 +136,13 @@ KeyboardConfigData *data; }; +struct ListData +{ + GtkWidget *widget; + String name; + gchar *label; +}; + // Internal data declaration. //static bool __config_use_kana = false; static String __config_server = SCIM_DEFAULT_WNN_SERVER; @@ -156,6 +163,30 @@ static GtkWidget * __widget_numkeyselect = 0; static GtkTooltips * __widget_tooltips = 0; +static ListData __list_data [] = +{ + { + NULL, + String("Wnn4"), + N_("Wnn4 or FreeWnn"), + }, + { + NULL, + String("Wnn6"), + N_("Wnn6"), + }, + { + NULL, + String("Wnn7"), + N_("Wnn7"), + }, + { + NULL, + String(), + NULL, + }, +}; + static KeyboardConfigData __config_keyboards_common [] = { { @@ -429,6 +460,9 @@ gpointer user_data); static void on_default_file_selection_button (GtkButton *button, gpointer user_data); +static void on_default_list_changed (GtkList *list, + GtkWidget *widget, + gpointer user_data); static void setup_widget_value (void); @@ -436,10 +470,17 @@ create_options_page () { GtkWidget *vbox, *table, *label, *button; + unsigned int i; + GList *list = NULL; vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox); + for(i = 0;__list_data[i].label;i ++) { + __list_data[i].widget = gtk_list_item_new_with_label(__list_data[i].label); + gtk_widget_show (__list_data[i].widget); + } + //__widget_use_kana = gtk_check_button_new_with_mnemonic (_("Use _Kana Table")); //gtk_widget_show (__widget_use_kana); //gtk_box_pack_start (GTK_BOX (vbox), __widget_use_kana, FALSE, FALSE, 4); @@ -509,12 +550,16 @@ (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 4, 4); - __widget_servertype = gtk_entry_new (); + list = g_list_append(list,__list_data[0].widget); + list = g_list_append(list,__list_data[1].widget); + list = g_list_append(list,__list_data[2].widget); + __widget_servertype = gtk_list_new (); + gtk_list_append_items(GTK_LIST(__widget_servertype),list); gtk_widget_show (__widget_servertype); gtk_table_attach (GTK_TABLE (table), __widget_servertype, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_servertype); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __list_data[0].widget); gtk_tooltips_set_tip (__widget_tooltips, __widget_servertype, _("select the server type from Wnn4 / Wnn6 / Wnn7."), NULL); @@ -587,8 +632,8 @@ g_signal_connect ((gpointer) button, "clicked", G_CALLBACK (on_default_file_selection_button), __widget_wnn_rc); - g_signal_connect ((gpointer) __widget_servertype, "changed", - G_CALLBACK (on_default_editable_changed), + g_signal_connect ((gpointer) __widget_servertype, "select-child", + G_CALLBACK (on_default_list_changed), &__config_servertype); g_signal_connect ((gpointer) __widget_alp, "changed", G_CALLBACK (on_default_number_changed), @@ -716,9 +761,12 @@ } if (__widget_servertype) { - gtk_entry_set_text ( - GTK_ENTRY (__widget_servertype), - __config_servertype.c_str ()); + for(unsigned int i = 0;__list_data[i].widget;i ++) { + if (__list_data[i].name == __config_servertype) { + gtk_list_select_child(GTK_LIST(__widget_servertype),__list_data[i].widget); + break; + } + } } if (__widget_alp) { @@ -864,6 +912,22 @@ } static void +on_default_list_changed (GtkList *list, + GtkWidget *widget, + gpointer user_data) +{ + String *str = static_cast (user_data); + + if (str) { + for(unsigned int i = 0;__list_data[i].widget;i ++) { + if (__list_data[i].widget == widget) + *str = __list_data[i].name; + } + __have_changed = true; + } +} + +static void on_default_key_selection_clicked (GtkButton *button, gpointer user_data) {