Update selector widgets on dialog activation.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 8 Dec 2015 12:41:09 +0000 (13:41 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 8 Dec 2015 12:41:09 +0000 (13:41 +0100)
When a dialog is activated, call update_subjects on
any PsppireSelector widgets that the dialog contains.

This ensures that the subjects (typically lists of
variables) are in a consistent state if the dialog
is reactivated after having changed a list.

src/ui/gui/psppire-dialog.c
src/ui/gui/psppire-selector.c
src/ui/gui/psppire-selector.h

index 43dd9af38d7d74d00d7d2c58e756bf55420e07c5..918cae0ec1a1b305abe41383c6ad858c9b78e453 100644 (file)
@@ -334,6 +334,8 @@ connect_notify_signal (GtkWidget *w, gpointer data)
       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))
index cd122d7bfb5dcb345cc5efb3525613608cc7dbb8..32e6ce126ca6ce621906cb042001b55c03b2bda8 100644 (file)
@@ -213,9 +213,6 @@ static void on_click (GtkButton *b);
 static void on_realize (GtkWidget *selector);
 
 
-static void update_subjects (PsppireSelector *selector);
-
-
 static void
 psppire_selector_set_property (GObject         *object,
                               guint            prop_id,
@@ -232,15 +229,15 @@ psppire_selector_set_property (GObject         *object,
       break;
     case PROP_PRIMARY:
       selector->primary_requested = TRUE;
-      update_subjects (selector);
+      psppire_selector_update_subjects (selector);
       break;
     case PROP_SOURCE_WIDGET:
       selector->source = g_value_dup_object (value);
-      update_subjects (selector);
+      psppire_selector_update_subjects (selector);
       break;
     case PROP_DEST_WIDGET:
       selector->dest = g_value_dup_object (value);
-      update_subjects (selector);
+      psppire_selector_update_subjects (selector);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1013,8 +1010,8 @@ set_default_filter (PsppireSelector *selector)
 }
 
 
-static void
-update_subjects (PsppireSelector *selector)
+void
+psppire_selector_update_subjects (PsppireSelector *selector)
 {
   if ( NULL == selector->dest )
     return;
index 33f96c21aadba3730dc07e4376abf466f60842ce..c4990c9229eec3e156be160fad6d01de9a1c693d 100644 (file)
@@ -126,6 +126,9 @@ void psppire_selector_set_select_func (PsppireSelector *selector,
                                       SelectItemsFunc *select_func,
                                       gpointer user_data);
 
+/* Force the selector to update its dest and source widgets */
+void psppire_selector_update_subjects (PsppireSelector *selector);
+
 
 void psppire_selector_set_allow (PsppireSelector *, AllowSelectionFunc *);