From: John Darrington Date: Sun, 7 May 2017 10:51:22 +0000 (+0200) Subject: PsppireDataEditor: Automatically set the dictionary as hmodel when the data store... X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7a3ebdcf1f308496cbf94d7e102d89f5648e9d7;p=pspp PsppireDataEditor: Automatically set the dictionary as hmodel when the data store changes --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 13cd902de8..2b654f76bf 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -166,7 +166,6 @@ psppire_data_editor_set_property (GObject *object, de->dict = g_value_get_pointer (value); g_object_ref (de->dict); - g_object_set (de->data_sheet, "hmodel", de->dict, NULL); g_object_set (de->var_sheet, "data-model", de->dict, NULL); break; case PROP_VALUE_LABELS: diff --git a/src/ui/gui/psppire-data-sheet.c b/src/ui/gui/psppire-data-sheet.c index cf73ff454c..f9800a501b 100644 --- a/src/ui/gui/psppire-data-sheet.c +++ b/src/ui/gui/psppire-data-sheet.c @@ -362,6 +362,15 @@ psppire_data_sheet_new (void) return GTK_WIDGET (obj); } +static void +set_dictionary (PsppireDataSheet *sheet) +{ + GtkTreeModel *data_model = NULL; + g_object_get (sheet, "data-model", &data_model, NULL); + + PsppireDataStore *store = PSPPIRE_DATA_STORE (data_model); + g_object_set (sheet, "hmodel", store->dict, NULL); +} static void psppire_data_sheet_init (PsppireDataSheet *sheet) @@ -383,4 +392,7 @@ psppire_data_sheet_init (PsppireDataSheet *sheet) g_signal_connect (sheet, "value-changed", G_CALLBACK (change_data_value), NULL); + + g_signal_connect (sheet, "notify::data-model", + G_CALLBACK (set_dictionary), NULL); }