pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui/gui ChangeLog val-labs-dialog.c val...


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui/gui ChangeLog val-labs-dialog.c val...
Date: Sun, 24 Dec 2006 23:50:59 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/12/24 23:50:59

Modified files:
        src/ui/gui     : ChangeLog val-labs-dialog.c val-labs-dialog.h 
                         var-sheet.c 

Log message:
        Fixed bug in value labels dialog box

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/val-labs-dialog.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/val-labs-dialog.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/var-sheet.c?cvsroot=pspp&r1=1.17&r2=1.18

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- ChangeLog   17 Dec 2006 00:01:05 -0000      1.30
+++ ChangeLog   24 Dec 2006 23:50:59 -0000      1.31
@@ -1,3 +1,8 @@
+Mon Dec 25 08:49:57 WST 2006 John Darrington <address@hidden>
+
+       * var-sheet.c val-labs-dialog.c val-labs-dialog.h: Fixed bug in value
+       labels dialog box.
+
 Sun Dec 17 08:26:10 WST 2006 John Darrington <address@hidden>
 
        * syntax-editor-source.c syntax-editor-source.h syntax-editor.h: 

Index: val-labs-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/val-labs-dialog.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- val-labs-dialog.c   24 Dec 2006 22:30:22 -0000      1.9
+++ val-labs-dialog.c   24 Dec 2006 23:50:59 -0000      1.10
@@ -29,6 +29,34 @@
 #include "val-labs-dialog.h"
 #include <data/value-labels.h>
 
+
+struct val_labs_dialog
+{
+  GtkWidget *window;
+
+  /* The variable to be updated */
+  struct variable *pv;
+
+  /* Local copy of labels */
+  struct val_labs *labs;
+
+  /* Actions */
+  GtkWidget *add_button;
+  GtkWidget *remove_button;
+  GtkWidget *change_button;
+
+  /* Entry Boxes */
+  GtkWidget *value_entry;
+  GtkWidget *label_entry;
+
+  /* Signal handler ids */
+  gint change_handler_id;
+  gint value_handler_id;
+
+  GtkWidget *treeview;
+};
+
+
 /* This callback occurs when the text in the label entry box
    is changed */
 static void
@@ -152,23 +180,50 @@
 
   dialog->labs = 0;
 
+  gtk_widget_hide (dialog->window);
+
   return FALSE;
 }
 
 /* Callback for when the Value Labels dialog is closed using
    the Cancel button.*/
+static void
+val_labs_cancel (struct val_labs_dialog *dialog)
+{
+  val_labs_destroy (dialog->labs);
+
+  dialog->labs = 0;
+
+  gtk_widget_hide (dialog->window);
+}
+
+
+/* Callback for when the Value Labels dialog is closed using
+   the Cancel button.*/
 static gint
-val_labs_cancel (GtkWidget *w, gpointer data)
+on_cancel (GtkWidget *w, gpointer data)
 {
   struct val_labs_dialog *dialog = data;
 
-  val_labs_destroy (dialog->labs);
-  dialog->labs = 0;
+  val_labs_cancel (dialog);
 
   return FALSE;
 }
 
 
+/* Callback for when the Value Labels dialog is closed using
+   the window delete button.*/
+static gint
+on_delete (GtkWidget *w, GdkEvent *e, gpointer data)
+{
+  struct val_labs_dialog *dialog = data;
+
+  val_labs_cancel (dialog);
+
+  return TRUE;
+}
+
+
 /* Return the value-label pair currently selected in the dialog box  */
 static struct val_lab *
 get_selected_tuple (struct val_labs_dialog *dialog)
@@ -324,7 +379,6 @@
     (GTK_WINDOW (dialog->window),
      GTK_WINDOW (get_widget_assert (xml, "data_editor")));
 
-  dialog->ok = get_widget_assert (xml, "val_labs_ok");
   dialog->add_button = get_widget_assert (xml, "val_labs_add");
   dialog->remove_button = get_widget_assert (xml, "val_labs_remove");
   dialog->change_button = get_widget_assert (xml, "val_labs_change");
@@ -345,7 +399,14 @@
 
   g_signal_connect (GTK_OBJECT (get_widget_assert (xml, "val_labs_cancel")),
                   "clicked",
-                  GTK_SIGNAL_FUNC (val_labs_cancel), dialog);
+                  GTK_SIGNAL_FUNC (on_cancel), dialog);
+
+  g_signal_connect (GTK_OBJECT (dialog->window), "delete-event",
+                   GTK_SIGNAL_FUNC (on_delete), dialog);
+
+  g_signal_connect (GTK_OBJECT (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),
@@ -362,19 +423,12 @@
                   GTK_SIGNAL_FUNC (on_change), dialog);
 
 
-  g_signal_connect (GTK_OBJECT (get_widget_assert (xml, "val_labs_ok")),
-                  "clicked",
-                  GTK_SIGNAL_FUNC (val_labs_ok), dialog);
-
-
   g_signal_connect (GTK_OBJECT (dialog->treeview), "cursor-changed",
                   GTK_SIGNAL_FUNC (on_select_row), dialog);
 
-
   g_signal_connect (GTK_OBJECT (dialog->remove_button), "clicked",
                   GTK_SIGNAL_FUNC (on_remove), dialog);
 
-
   g_signal_connect (GTK_OBJECT (dialog->add_button), "clicked",
                   GTK_SIGNAL_FUNC (on_add), dialog);
 
@@ -384,6 +438,15 @@
 }
 
 
+void
+val_labs_dialog_set_target_variable (struct val_labs_dialog *dialog,
+                                    struct variable *var)
+{
+  dialog->pv = var;
+}
+
+
+
 /* Populate the components of the dialog box, from the 'labs' member
    variable */
 static void

Index: val-labs-dialog.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/val-labs-dialog.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- val-labs-dialog.h   24 Dec 2006 22:49:18 -0000      1.5
+++ val-labs-dialog.h   24 Dec 2006 23:50:59 -0000      1.6
@@ -33,40 +33,12 @@
 
 struct val_labs;
 
-struct val_labs_dialog
-{
-  GtkWidget *window;
 
+struct val_labs_dialog * val_labs_dialog_create (GladeXML *);
 
-  /* The variable to be updated */
-  struct variable *pv;
-
-  /* Local copy of labels */
-  struct val_labs *labs;
-
-  /* Actions */
-  GtkWidget *ok;
-  GtkWidget *add_button;
-  GtkWidget *remove_button;
-  GtkWidget *change_button;
-
-  /* Entry Boxes */
-  GtkWidget *value_entry;
-  GtkWidget *label_entry;
-
-  /* Signal handler ids */
-  gint change_handler_id;
-  gint value_handler_id;
-
-  GtkWidget *treeview;
-};
-
-
-
-
-struct val_labs_dialog * val_labs_dialog_create (GladeXML *xml);
-
-void val_labs_dialog_show (struct val_labs_dialog *dialog);
+void val_labs_dialog_show (struct val_labs_dialog *);
 
+void val_labs_dialog_set_target_variable (struct val_labs_dialog *,
+                                         struct variable *);
 
 #endif

Index: var-sheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/var-sheet.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- var-sheet.c 24 Dec 2006 23:08:25 -0000      1.17
+++ var-sheet.c 24 Dec 2006 23:50:59 -0000      1.18
@@ -287,7 +287,7 @@
        if (!val_labs_dialog )
            val_labs_dialog = val_labs_dialog_create (xml);
 
-       val_labs_dialog->pv = pv;
+       val_labs_dialog_set_target_variable (val_labs_dialog, pv);
 
        g_signal_connect_swapped (GTK_OBJECT (customEntry),
                                 "clicked",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]