From c8f16e229dede3bf3ec30c329cccc6924778553a Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 8 Dec 2015 13:41:09 +0100 Subject: [PATCH] Update selector widgets on dialog activation. 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 | 2 ++ src/ui/gui/psppire-selector.c | 13 +++++-------- src/ui/gui/psppire-selector.h | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c index 43dd9af38d..918cae0ec1 100644 --- a/src/ui/gui/psppire-dialog.c +++ b/src/ui/gui/psppire-dialog.c @@ -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)) diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index cd122d7bfb..32e6ce126c 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -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; diff --git a/src/ui/gui/psppire-selector.h b/src/ui/gui/psppire-selector.h index 33f96c21aa..c4990c9229 100644 --- a/src/ui/gui/psppire-selector.h +++ b/src/ui/gui/psppire-selector.h @@ -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 *); -- 2.30.2