psppire-data-window.c: Remove ssw api protection
[pspp] / src / ui / gui / psppire-dialog.c
index b006222a6199495a44eb29aecc0eb1409581161c..3a1893d839442cf8a943d24cc69c4b7fd7fbe07a 100644 (file)
@@ -152,8 +152,8 @@ psppire_dialog_class_init (PsppireDialogClass *class)
   GParamSpec *sliding_spec ;
   GParamSpec *help_page_spec ;
 
   GParamSpec *sliding_spec ;
   GParamSpec *help_page_spec ;
 
-  help_page_spec = 
-    g_param_spec_string ("help-page", 
+  help_page_spec =
+    g_param_spec_string ("help-page",
                         "Help Page",
                         "The section of the manual to load when the Help button is clicked",
                         NULL,
                         "Help Page",
                         "The section of the manual to load when the Help button is clicked",
                         NULL,
@@ -287,7 +287,7 @@ psppire_dialog_new (void)
 void
 psppire_dialog_notify_change (PsppireDialog *dialog)
 {
 void
 psppire_dialog_notify_change (PsppireDialog *dialog)
 {
-  if ( dialog->contents_are_valid )
+  if (dialog->contents_are_valid)
     {
       gboolean valid = dialog->contents_are_valid (dialog->validity_data);
 
     {
       gboolean valid = dialog->contents_are_valid (dialog->validity_data);
 
@@ -296,13 +296,6 @@ psppire_dialog_notify_change (PsppireDialog *dialog)
 }
 
 
 }
 
 
-static void
-remove_notify_handlers (PsppireDialog *dialog, GObject *sel)
-{
-  g_signal_handlers_disconnect_by_data (sel, dialog);
-}
-
-
 /* Descend the widget tree, connecting appropriate signals to the
    psppire_dialog_notify_change callback */
 static void
 /* Descend the widget tree, connecting appropriate signals to the
    psppire_dialog_notify_change callback */
 static void
@@ -310,10 +303,10 @@ connect_notify_signal (GtkWidget *w, gpointer data)
 {
   PsppireDialog *dialog = data;
 
 {
   PsppireDialog *dialog = data;
 
-  if ( PSPPIRE_IS_BUTTONBOX (w))
+  if (PSPPIRE_IS_BUTTONBOX (w))
     return;
 
     return;
 
-  if ( GTK_IS_CONTAINER (w))
+  if (GTK_IS_CONTAINER (w))
     {
       gtk_container_foreach (GTK_CONTAINER (w),
                             connect_notify_signal,
     {
       gtk_container_foreach (GTK_CONTAINER (w),
                             connect_notify_signal,
@@ -325,14 +318,14 @@ connect_notify_signal (GtkWidget *w, gpointer data)
      "user-modified-state-changed" signal.  Instead, we have to try and
      predict what widgets and signals are likely to exist in our dialogs. */
 
      "user-modified-state-changed" signal.  Instead, we have to try and
      predict what widgets and signals are likely to exist in our dialogs. */
 
-  if ( GTK_IS_TOGGLE_BUTTON (w))
+  if (GTK_IS_TOGGLE_BUTTON (w))
     {
       g_signal_connect_swapped (w, "toggled",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
     {
       g_signal_connect_swapped (w, "toggled",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
-  if ( PSPPIRE_IS_SELECTOR (w))
+  if (PSPPIRE_IS_SELECTOR (w))
     {
       g_signal_connect_swapped (w, "selected",
                                G_CALLBACK (psppire_dialog_notify_change),
     {
       g_signal_connect_swapped (w, "selected",
                                G_CALLBACK (psppire_dialog_notify_change),
@@ -341,23 +334,25 @@ connect_notify_signal (GtkWidget *w, gpointer data)
       g_signal_connect_swapped (w, "de-selected",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
       g_signal_connect_swapped (w, "de-selected",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
+
+      psppire_selector_update_subjects (PSPPIRE_SELECTOR (w));
     }
 
     }
 
-  if ( GTK_IS_EDITABLE (w))
+  if (GTK_IS_EDITABLE (w))
     {
       g_signal_connect_swapped (w, "changed",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
     {
       g_signal_connect_swapped (w, "changed",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
-  if ( GTK_IS_CELL_EDITABLE (w))
+  if (GTK_IS_CELL_EDITABLE (w))
     {
       g_signal_connect_swapped (w, "editing-done",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
     {
       g_signal_connect_swapped (w, "editing-done",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
     }
 
-  if ( GTK_IS_TEXT_VIEW (w))
+  if (GTK_IS_TEXT_VIEW (w))
     {
       GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
 
     {
       GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
 
@@ -366,7 +361,7 @@ connect_notify_signal (GtkWidget *w, gpointer data)
                                dialog);
     }
 
                                dialog);
     }
 
-  if ( GTK_IS_TREE_VIEW (w))
+  if (GTK_IS_TREE_VIEW (w))
     {
       gint i = 0;
       GtkTreeView *tv = GTK_TREE_VIEW (w);
     {
       gint i = 0;
       GtkTreeView *tv = GTK_TREE_VIEW (w);
@@ -375,7 +370,7 @@ connect_notify_signal (GtkWidget *w, gpointer data)
       GtkTreeViewColumn *col;
       GtkTreeModel *model = gtk_tree_view_get_model (tv);
 
       GtkTreeViewColumn *col;
       GtkTreeModel *model = gtk_tree_view_get_model (tv);
 
-      if ( model)
+      if (model)
        {
          g_signal_connect_swapped (model, "row-changed",
                                    G_CALLBACK (psppire_dialog_notify_change),
        {
          g_signal_connect_swapped (model, "row-changed",
                                    G_CALLBACK (psppire_dialog_notify_change),
@@ -389,10 +384,8 @@ connect_notify_signal (GtkWidget *w, gpointer data)
                                    G_CALLBACK (psppire_dialog_notify_change),
                                    dialog);
 
                                    G_CALLBACK (psppire_dialog_notify_change),
                                    dialog);
 
-         g_signal_connect (dialog, "destroy", G_CALLBACK (remove_notify_handlers),
-                           model);
        }
        }
-      
+
       g_signal_connect_swapped (selection, "changed",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
       g_signal_connect_swapped (selection, "changed",
                                G_CALLBACK (psppire_dialog_notify_change),
                                dialog);
@@ -403,7 +396,7 @@ connect_notify_signal (GtkWidget *w, gpointer data)
          GList *start = renderers;
          while (renderers)
            {
          GList *start = renderers;
          while (renderers)
            {
-             if ( GTK_IS_CELL_RENDERER_TOGGLE (renderers->data))
+             if (GTK_IS_CELL_RENDERER_TOGGLE (renderers->data))
                g_signal_connect_swapped (renderers->data, "toggled",
                                          G_CALLBACK (psppire_dialog_notify_change), dialog);
              renderers = renderers->next;
                g_signal_connect_swapped (renderers->data, "toggled",
                                          G_CALLBACK (psppire_dialog_notify_change), dialog);
              renderers = renderers->next;
@@ -422,8 +415,8 @@ psppire_dialog_run (PsppireDialog *dialog)
 
   if (title == NULL)
     g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
 
   if (title == NULL)
     g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
-  
-  if ( dialog->contents_are_valid != NULL )
+
+  if (dialog->contents_are_valid != NULL)
     gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child(GTK_BIN(dialog))),
                           connect_notify_signal,
                           dialog);
     gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child(GTK_BIN(dialog))),
                           connect_notify_signal,
                           dialog);
@@ -431,20 +424,16 @@ psppire_dialog_run (PsppireDialog *dialog)
   dialog->loop = g_main_loop_new (NULL, FALSE);
 
   gtk_widget_show (GTK_WIDGET (dialog));
   dialog->loop = g_main_loop_new (NULL, FALSE);
 
   gtk_widget_show (GTK_WIDGET (dialog));
+  psppire_dialog_notify_change (dialog);
 
 
-  if ( dialog->contents_are_valid != NULL)
-    g_signal_emit (dialog, signals [VALIDITY_CHANGED], 0, FALSE);
-
-  g_signal_emit (dialog, signals [DIALOG_REFRESH], 0);
-
-  gdk_threads_leave ();
   g_main_loop_run (dialog->loop);
   g_main_loop_run (dialog->loop);
-  gdk_threads_enter ();
 
   g_main_loop_unref (dialog->loop);
 
   g_signal_emit (dialog, signals [RESPONSE], 0, dialog->response);
 
 
   g_main_loop_unref (dialog->loop);
 
   g_signal_emit (dialog, signals [RESPONSE], 0, dialog->response);
 
+  g_free (title);
+
   return dialog->response;
 }
 
   return dialog->response;
 }