Re enable the connect_help function
[pspp-builds.git] / src / ui / gui / val-labs-dialog.c
index 05068d0f964523a91df558a58230c8c928ebcb56..3b56efadc6fcce563435d9497893a62cc1b17b9a 100644 (file)
@@ -25,6 +25,7 @@
 #include "helper.h"
 #include "val-labs-dialog.h"
 #include <data/value-labels.h>
+#include <data/format.h>
 
 
 struct val_labs_dialog
@@ -269,6 +270,7 @@ on_change (GtkWidget *w, gpointer data)
   gtk_widget_set_sensitive (dialog->change_button, FALSE);
 
   repopulate_dialog (dialog);
+  gtk_widget_grab_focus (dialog->value_entry);
 
   return FALSE;
 }
@@ -295,6 +297,7 @@ on_add (GtkWidget *w, gpointer data)
   gtk_widget_set_sensitive (dialog->add_button, FALSE);
 
   repopulate_dialog (dialog);
+  gtk_widget_grab_focus (dialog->value_entry);
 
   return FALSE;
 }
@@ -310,6 +313,7 @@ on_remove (GtkWidget *w, gpointer data)
   val_labs_remove (dialog->labs, vl->value);
 
   repopulate_dialog (dialog);
+  gtk_widget_grab_focus (dialog->value_entry);
 
   gtk_widget_set_sensitive (dialog->remove_button, FALSE);
 
@@ -360,7 +364,7 @@ on_select_row                  (GtkTreeView *treeview,
 /* Create a new dialog box
    (there should  normally be only one)*/
 struct val_labs_dialog *
-val_labs_dialog_create (GladeXML *xml)
+val_labs_dialog_create (GtkBuilder *xml)
 {
   GtkTreeViewColumn *column;
 
@@ -368,8 +372,6 @@ val_labs_dialog_create (GladeXML *xml)
 
   struct val_labs_dialog *dialog = g_malloc (sizeof (*dialog));
 
-  connect_help (xml);
-
   dialog->window = get_widget_assert (xml,"val_labs_dialog");
   dialog->value_entry = get_widget_assert (xml,"value_entry");
   dialog->label_entry = get_widget_assert (xml,"label_entry");
@@ -396,39 +398,39 @@ val_labs_dialog_create (GladeXML *xml)
 
   gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->treeview), column);
 
-  g_signal_connect (GTK_OBJECT (get_widget_assert (xml, "val_labs_cancel")),
+  g_signal_connect (get_widget_assert (xml, "val_labs_cancel"),
                   "clicked",
                   GTK_SIGNAL_FUNC (on_cancel), dialog);
 
-  g_signal_connect (GTK_OBJECT (dialog->window), "delete-event",
+  g_signal_connect (dialog->window, "delete-event",
                    GTK_SIGNAL_FUNC (on_delete), dialog);
 
-  g_signal_connect (GTK_OBJECT (get_widget_assert (xml, "val_labs_ok")),
+  g_signal_connect (get_widget_assert (xml, "val_labs_ok"),
                   "clicked",
                   GTK_SIGNAL_FUNC (val_labs_ok), dialog);
 
   dialog->change_handler_id =
-    g_signal_connect (GTK_OBJECT (dialog->label_entry),
+    g_signal_connect (dialog->label_entry,
                     "changed",
                     GTK_SIGNAL_FUNC (on_label_entry_change), dialog);
 
   dialog->value_handler_id  =
-    g_signal_connect (GTK_OBJECT (dialog->value_entry),
+    g_signal_connect (dialog->value_entry,
                     "changed",
                     GTK_SIGNAL_FUNC (on_value_entry_change), dialog);
 
-  g_signal_connect (GTK_OBJECT (dialog->change_button),
+  g_signal_connect (dialog->change_button,
                   "clicked",
                   GTK_SIGNAL_FUNC (on_change), dialog);
 
 
-  g_signal_connect (GTK_OBJECT (dialog->treeview), "cursor-changed",
+  g_signal_connect (dialog->treeview, "cursor-changed",
                   GTK_SIGNAL_FUNC (on_select_row), dialog);
 
-  g_signal_connect (GTK_OBJECT (dialog->remove_button), "clicked",
+  g_signal_connect (dialog->remove_button, "clicked",
                   GTK_SIGNAL_FUNC (on_remove), dialog);
 
-  g_signal_connect (GTK_OBJECT (dialog->add_button), "clicked",
+  g_signal_connect (dialog->add_button, "clicked",
                   GTK_SIGNAL_FUNC (on_add), dialog);
 
   dialog->labs = 0;
@@ -519,7 +521,7 @@ val_labs_dialog_show (struct val_labs_dialog *dialog)
   value_labels = var_get_value_labels (dialog->pv);
 
   if (value_labels)
-    dialog->labs = val_labs_copy ( value_labels );
+    dialog->labs = val_labs_clone ( value_labels );
   else
     dialog->labs = val_labs_create ( var_get_width (dialog->pv));
 
@@ -527,6 +529,8 @@ val_labs_dialog_show (struct val_labs_dialog *dialog)
   gtk_widget_set_sensitive (dialog->change_button, FALSE);
   gtk_widget_set_sensitive (dialog->add_button, FALSE);
 
+  gtk_widget_grab_focus (dialog->value_entry);
+
   repopulate_dialog (dialog);
   gtk_widget_show (dialog->window);
 }