From 7e010a8e8c4bd2f8d27aaa91d2fdd29f47af89dc Mon Sep 17 00:00:00 2001 From: ntakahas Date: Fri, 27 Apr 2007 06:10:25 +0000 Subject: [PATCH] *** empty log message *** --- src/command.c | 14 ++++++------ src/main.c | 3 ++- src/mim-config.c | 17 +++++++------- src/variable.c | 66 +++++++++++++++++------------------------------------- 4 files changed, 38 insertions(+), 62 deletions(-) diff --git a/src/command.c b/src/command.c index 4eec76b..ccf85c9 100644 --- a/src/command.c +++ b/src/command.c @@ -308,8 +308,8 @@ create_adding_section (struct BindingWidgets *bw) g_signal_connect (G_OBJECT (bw->add), "clicked", G_CALLBACK (add_cb), bw); - vbox = gtk_vbox_new (FALSE, 6); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); @@ -459,8 +459,8 @@ create_deleting_section (struct BindingWidgets *bw) g_signal_connect (G_OBJECT (bw->delete), "clicked", G_CALLBACK (delete_cb), bw); - vbox = gtk_vbox_new (FALSE, 6); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); @@ -524,8 +524,8 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), create_adding_section (&bw)); - vbox = gtk_vbox_new (FALSE, 6); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); hbox = gtk_hbox_new (FALSE, 6); bw.status = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (hbox), bw.status, FALSE, FALSE, 6); @@ -542,7 +542,7 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, } GtkWidget * -create_command_list (GtkTooltips *tip, MSymbol lang, MSymbol name) +create_command_list (MSymbol lang, MSymbol name) { GtkListStore *store; GtkWidget *view; diff --git a/src/main.c b/src/main.c index 29990d0..01b1aad 100644 --- a/src/main.c +++ b/src/main.c @@ -167,7 +167,8 @@ main (int argc, char **argv) +---------------------------------------+ */ - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_container_add (GTK_CONTAINER (window), vbox); revert = gtk_button_new_from_stock (GTK_STOCK_REVERT_TO_SAVED); diff --git a/src/mim-config.c b/src/mim-config.c index 775194c..b8a7d20 100644 --- a/src/mim-config.c +++ b/src/mim-config.c @@ -162,16 +162,13 @@ tree_expanded_cb (GtkTreeView *tree, GtkTreeIter *parent, } } -extern GtkWidget *create_variable_list (GtkTooltips *tip, MSymbol lang, - MSymbol name); -extern GtkWidget *create_command_list (GtkTooltips *tip, MSymbol lang, - MSymbol name); +extern GtkWidget *create_variable_list (MSymbol lang, MSymbol name); +extern GtkWidget *create_command_list (MSymbol lang, MSymbol name); static void edit_im (GtkTreeView *tree, MSymbol lang, MSymbol name) { GtkWidget *dialog, *notebook, *scrolled, *vbox, *label; - GtkTooltips *tip = gtk_tooltips_new (); gint response; MPlist *plist; @@ -183,8 +180,12 @@ edit_im (GtkTreeView *tree, MSymbol lang, MSymbol name) NULL)); gtk_widget_set_size_request (dialog, 500, 300); + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER(vbox), 10); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + notebook = gtk_notebook_new (); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), notebook); + gtk_container_add (GTK_CONTAINER (vbox), notebook); /* Variables' page */ scrolled = gtk_scrolled_window_new (NULL, NULL); @@ -196,7 +197,7 @@ edit_im (GtkTreeView *tree, MSymbol lang, MSymbol name) gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), vbox); gtk_box_pack_start (GTK_BOX (vbox), - create_variable_list (tip, lang, name), + create_variable_list (lang, name), FALSE, FALSE, 0); /* Commands' pages */ @@ -209,7 +210,7 @@ edit_im (GtkTreeView *tree, MSymbol lang, MSymbol name) gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), vbox); gtk_box_pack_start (GTK_BOX (vbox), - create_command_list (tip, lang, name), + create_command_list (lang, name), FALSE, FALSE, 0); gtk_widget_show_all (dialog); diff --git a/src/variable.c b/src/variable.c index 579c25d..e1a97f9 100644 --- a/src/variable.c +++ b/src/variable.c @@ -212,39 +212,16 @@ config_with_combo (struct ControllerInfo *ci) update_status (ci); } -static gboolean +static void config_with_spin (struct ControllerInfo *ci) { + MPlist *plist = mplist (); 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; - } + mplist_add (plist, Minteger, (void *) i); + CONFIG_VARIABLE (plist); + m17n_object_unref (plist); } static void * @@ -271,10 +248,8 @@ ok_cb (GtkButton *button, gpointer data) else /* ci->wtype == SPIN_BUTTON */ { - if (config_with_spin (ci)) - gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); - else - update_status (ci); + config_with_spin (ci); + gtk_dialog_response (GTK_DIALOG (ci->dialog), GTK_RESPONSE_OK); } } else /* default or customized */ @@ -301,15 +276,14 @@ revert_cb (GtkButton *button, gpointer data) update_status (ci); } -static gboolean -key_pressed_cb (GtkEntry *entry, GdkEventKey *event, gpointer data) +static void +changed_cb (GtkEntry *entry, 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 @@ -402,8 +376,8 @@ create_widget (struct ControllerInfo *ci) else { ci->widget = gtk_entry_new (); - g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (changed_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); @@ -436,8 +410,8 @@ create_widget (struct ControllerInfo *ci) else { ci->widget = gtk_entry_new (); - g_signal_connect (GTK_OBJECT (ci->widget), "key-press-event", - G_CALLBACK (key_pressed_cb), ci); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (changed_cb), ci); ci->wtype = ENTRY_WIDGET; /* Fixme : Assuming the return value is in UTF-8 */ gtk_entry_set_text (GTK_ENTRY (ci->widget), @@ -481,20 +455,20 @@ create_widget (struct ControllerInfo *ci) 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); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (changed_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); + GTK_UPDATE_ALWAYS); } 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); + g_signal_connect (GTK_OBJECT (ci->widget), "changed", + G_CALLBACK (changed_cb), ci); ci->wtype = ENTRY_WIDGET; g_snprintf (buf, sizeof (buf), "%d", (gint) value); gtk_entry_set_text (GTK_ENTRY (ci->widget), buf); @@ -542,7 +516,7 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, G_CALLBACK (ok_cb), &ci); vbox = gtk_vbox_new (FALSE, 12); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (ci.dialog)->vbox), vbox); gtk_container_add (GTK_CONTAINER (vbox), create_widget (&ci)); @@ -573,7 +547,7 @@ activated_cb (GtkTreeView *parent, GtkTreePath *path, } GtkWidget * -create_variable_list (GtkTooltips *tip, MSymbol lang, MSymbol name) +create_variable_list (MSymbol lang, MSymbol name) { GtkListStore *store; GtkWidget *view; -- 1.7.10.4