Warnings: added cast for enumaration types
[pspp] / src / ui / gui / psppire-dialog.c
index f3703993b5bbb59e0e64483c69871a732adce7aa..4f3bb243132dbe8c85dd69c471ecc2dfebcab696 100644 (file)
@@ -70,14 +70,15 @@ psppire_dialog_get_type (void)
       static const GTypeInfo dialog_info =
       {
        sizeof (PsppireDialogClass),
       static const GTypeInfo dialog_info =
       {
        sizeof (PsppireDialogClass),
-       (GBaseInitFunc) psppire_dialog_base_init,
+       (GBaseInitFunc) (void (*)(void)) psppire_dialog_base_init,
         NULL, /* base_finalize */
         NULL, /* base_finalize */
-       (GClassInitFunc) psppire_dialog_class_init,
+       (GClassInitFunc) (void (*)(void)) psppire_dialog_class_init,
         NULL, /* class_finalize */
        NULL, /* class_data */
         sizeof (PsppireDialog),
        0,
         NULL, /* class_finalize */
        NULL, /* class_data */
         sizeof (PsppireDialog),
        0,
-       (GInstanceInitFunc) psppire_dialog_init,
+       (GInstanceInitFunc) (void (*)(void)) psppire_dialog_init,
+       NULL /* value_table */
       };
 
       dialog_type = g_type_register_static (PSPPIRE_TYPE_WINDOW_BASE,
       };
 
       dialog_type = g_type_register_static (PSPPIRE_TYPE_WINDOW_BASE,
@@ -152,8 +153,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 +288,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 +297,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 +304,10 @@ connect_notify_signal (GtkWidget *w, gpointer data)
 {
   PsppireDialog *dialog = data;
 
 {
   PsppireDialog *dialog = data;
 
-  if ( PSPPIRE_IS_BUTTONBOX (w))
+  if (PSPPIRE_IS_BUTTON_BOX (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 +319,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 +335,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 +362,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 +371,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 +385,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 +397,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,29 +416,25 @@ 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 )
-    gtk_container_foreach (gtk_bin_get_child(GTK_BIN(dialog)),
+
+  if (dialog->contents_are_valid != NULL)
+    gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child(GTK_BIN(dialog))),
                           connect_notify_signal,
                           dialog);
 
   dialog->loop = g_main_loop_new (NULL, FALSE);
 
   gtk_widget_show (GTK_WIDGET (dialog));
                           connect_notify_signal,
                           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;
 }