From: John Darrington Date: Wed, 18 Mar 2009 08:21:00 +0000 (+0900) Subject: Rename the "model" property to "dictionary" X-Git-Tag: v0.7.3~214 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df83cf8a655317445e3237457658bd827282f970;p=pspp-builds.git Rename the "model" property to "dictionary" --- diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c index e3d1c6a1..7703640c 100644 --- a/src/ui/gui/compute-dialog.c +++ b/src/ui/gui/compute-dialog.c @@ -397,7 +397,7 @@ compute_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); g_object_set (dict_view, - "model", vs->dict, + "dictionary", vs->dict, "selection-mode", GTK_SELECTION_SINGLE, NULL); diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index 3d5c5718..2c71ddef 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -422,7 +422,7 @@ crosstabs_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (dest_rows), vs->dict); set_dest_model (GTK_TREE_VIEW (dest_cols), vs->dict); diff --git a/src/ui/gui/descriptives-dialog.c b/src/ui/gui/descriptives-dialog.c index 77bf9541..7b9a9584 100644 --- a/src/ui/gui/descriptives-dialog.c +++ b/src/ui/gui/descriptives-dialog.c @@ -223,7 +223,7 @@ descriptives_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, + g_object_set (source, "dictionary", vs->dict, "predicate", var_is_numeric, NULL); set_dest_model (GTK_TREE_VIEW (dest), vs->dict); diff --git a/src/ui/gui/examine-dialog.c b/src/ui/gui/examine-dialog.c index 2902685d..1d894475 100644 --- a/src/ui/gui/examine-dialog.c +++ b/src/ui/gui/examine-dialog.c @@ -279,7 +279,7 @@ examine_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (ex_d.stats_dialog), GTK_WINDOW (de)); gtk_window_set_transient_for (GTK_WINDOW (ex_d.opts_dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (ex_d.dep_list), vs->dict); ex_d.dict = vs->dict; diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 60d54e26..70f2085c 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -241,7 +241,7 @@ find_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", fd.dict, + g_object_set (source, "dictionary", fd.dict, "selection-mode", GTK_SELECTION_SINGLE, NULL); diff --git a/src/ui/gui/frequencies-dialog.c b/src/ui/gui/frequencies-dialog.c index a368cabb..c78fa95f 100644 --- a/src/ui/gui/frequencies-dialog.c +++ b/src/ui/gui/frequencies-dialog.c @@ -333,7 +333,7 @@ frequencies_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (dest), vs->dict); diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c index 3c80f9e3..2fb88268 100644 --- a/src/ui/gui/oneway-anova-dialog.c +++ b/src/ui/gui/oneway-anova-dialog.c @@ -171,7 +171,7 @@ oneway_anova_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (ow.dialog, GTK_WINDOW (de)); - g_object_set (dict_view, "model", vs->dict, NULL); + g_object_set (dict_view, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (ow.vars_treeview), vs->dict); diff --git a/src/ui/gui/psppire-dict.h b/src/ui/gui/psppire-dict.h index 6d731f21..3fd73f9a 100644 --- a/src/ui/gui/psppire-dict.h +++ b/src/ui/gui/psppire-dict.h @@ -42,7 +42,7 @@ G_BEGIN_DECLS typedef struct _PsppireDict PsppireDict; typedef struct _PsppireDictClass PsppireDictClass; -enum {DICT_TVM_COL_NAME=0, DICT_TVM_COL_VAR, n_DICT_COLS} ; +enum {DICT_TVM_COL_NAME=0, DICT_TVM_COL_VAR, DICT_TVM_COL_LABEL, n_DICT_COLS} ; struct _PsppireDict { diff --git a/src/ui/gui/psppire-dictview.c b/src/ui/gui/psppire-dictview.c index 336092f5..f2648298 100644 --- a/src/ui/gui/psppire-dictview.c +++ b/src/ui/gui/psppire-dictview.c @@ -75,6 +75,7 @@ enum { PROP_0, PROP_MODEL, + PROP_DICTIONARY, PROP_PREDICATE, PROP_SELECTION_MODE }; @@ -132,9 +133,14 @@ psppire_dict_view_set_property (GObject *object, switch (prop_id) { - case PROP_MODEL: + case PROP_DICTIONARY: dict_view->dict = g_value_get_object (value); break; + case PROP_MODEL: + g_critical ("Don't set the \"model\" property on %s. " + "Use the \"dictionary\" property instead.", + G_OBJECT_TYPE_NAME (dict_view)); + break; case PROP_PREDICATE: dict_view->predicate = g_value_get_pointer (value); break; @@ -168,7 +174,7 @@ psppire_dict_view_get_property (GObject *object, switch (prop_id) { - case PROP_MODEL: + case PROP_DICTIONARY: g_value_set_object (value, dict_view->dict); break; case PROP_PREDICATE: @@ -194,9 +200,9 @@ psppire_dict_view_class_init (PsppireDictViewClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - GParamSpec *model_spec = - g_param_spec_object ("model", - "Model", + GParamSpec *dictionary_spec = + g_param_spec_object ("dictionary", + "Dictionary", _("The dictionary to be displayed by this widget"), PSPPIRE_TYPE_DICT, G_PARAM_READABLE | G_PARAM_WRITABLE); @@ -217,12 +223,22 @@ psppire_dict_view_class_init (PsppireDictViewClass *class) G_PARAM_CONSTRUCT | G_PARAM_READABLE | G_PARAM_WRITABLE); + GParamSpec *dummy_spec = + g_param_spec_pointer ("model", + "Model", + "Don't set the property", + G_PARAM_WRITABLE); + object_class->set_property = psppire_dict_view_set_property; object_class->get_property = psppire_dict_view_get_property; g_object_class_install_property (object_class, PROP_MODEL, - model_spec); + dummy_spec); + + g_object_class_install_property (object_class, + PROP_DICTIONARY, + dictionary_spec); g_object_class_install_property (object_class, PROP_PREDICATE, @@ -259,19 +275,32 @@ dv_get_base_model (GtkTreeModel *top_model, GtkTreeIter *top_iter, { *model = top_model; *iter = *top_iter; - while (GTK_IS_TREE_MODEL_FILTER (*model)) + + while ( ! PSPPIRE_IS_DICT (*model)) { GtkTreeIter parent_iter = *iter; - GtkTreeModelFilter *parent_model = GTK_TREE_MODEL_FILTER (*model); - *model = gtk_tree_model_filter_get_model (parent_model); + if ( GTK_IS_TREE_MODEL_FILTER (*model)) + { + GtkTreeModelFilter *parent_model = GTK_TREE_MODEL_FILTER (*model); - gtk_tree_model_filter_convert_iter_to_child_iter (parent_model, - iter, - &parent_iter); - } + *model = gtk_tree_model_filter_get_model (parent_model); + + gtk_tree_model_filter_convert_iter_to_child_iter (parent_model, + iter, + &parent_iter); + } + else if (GTK_IS_TREE_MODEL_SORT (*model)) + { + GtkTreeModelSort *parent_model = GTK_TREE_MODEL_SORT (*model); - g_assert (PSPPIRE_IS_DICT (*model)); + *model = gtk_tree_model_sort_get_model (parent_model); + + gtk_tree_model_sort_convert_iter_to_child_iter (parent_model, + iter, + &parent_iter); + } + } } @@ -440,6 +469,8 @@ toggle_label_preference (GtkCheckMenuItem *checkbox, gpointer data) gtk_widget_queue_draw (GTK_WIDGET (dv)); } + + static void psppire_dict_view_init (PsppireDictView *dict_view) { diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c index 606475ba..2c4d19a0 100644 --- a/src/ui/gui/rank-dialog.c +++ b/src/ui/gui/rank-dialog.c @@ -306,7 +306,7 @@ rank_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de)); - g_object_set (vars, "model", vs->dict, NULL); + g_object_set (vars, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (rd.rank_vars), vs->dict); diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index e5de4597..e480f3c7 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -885,7 +885,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de)); - g_object_set (rd.dict_treeview, "model", vs->dict, NULL); + g_object_set (rd.dict_treeview, "dictionary", vs->dict, NULL); if ( ! rd.different ) { diff --git a/src/ui/gui/regression-dialog.c b/src/ui/gui/regression-dialog.c index a8605018..7b6ce6cc 100644 --- a/src/ui/gui/regression-dialog.c +++ b/src/ui/gui/regression-dialog.c @@ -252,7 +252,7 @@ regression_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (dest_dep), vs->dict); set_dest_model (GTK_TREE_VIEW (dest_indep), vs->dict); diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c index ca1b31bc..3c36f4ed 100644 --- a/src/ui/gui/select-cases-dialog.c +++ b/src/ui/gui/select-cases-dialog.c @@ -325,7 +325,7 @@ select_cases_dialog (GObject *o, gpointer data) { GtkWidget *source = get_widget_assert (scd.xml, "select-cases-treeview"); - g_object_set (source, "model", + g_object_set (source, "dictionary", scd.data_store->dict, "selection-mode", GTK_SELECTION_SINGLE, NULL); diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c index 9d4ea50b..b5d1bbaa 100644 --- a/src/ui/gui/sort-cases-dialog.c +++ b/src/ui/gui/sort-cases-dialog.c @@ -111,7 +111,7 @@ sort_cases_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (dest), vs->dict); diff --git a/src/ui/gui/split-file-dialog.c b/src/ui/gui/split-file-dialog.c index 1641b50c..063f1862 100644 --- a/src/ui/gui/split-file-dialog.c +++ b/src/ui/gui/split-file-dialog.c @@ -191,7 +191,7 @@ split_file_dialog (GObject *o, gpointer data) sfd.selector = PSPPIRE_SELECTOR ( get_widget_assert (sfd.xml, "split-file-selector")); - g_object_set (source, "model", + g_object_set (source, "dictionary", vs->dict, NULL); diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index 53b2c20c..e5a04a07 100644 --- a/src/ui/gui/t-test-independent-samples-dialog.c +++ b/src/ui/gui/t-test-independent-samples-dialog.c @@ -426,7 +426,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), GTK_WINDOW (de)); - g_object_set (dict_view, "model", + g_object_set (dict_view, "dictionary", vs->dict, NULL); diff --git a/src/ui/gui/t-test-one-sample.c b/src/ui/gui/t-test-one-sample.c index 64232d85..2c48c5d9 100644 --- a/src/ui/gui/t-test-one-sample.c +++ b/src/ui/gui/t-test-one-sample.c @@ -147,7 +147,7 @@ t_test_one_sample_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (dict_view, "model", + g_object_set (dict_view, "dictionary", vs->dict, "predicate", var_is_numeric, NULL); diff --git a/src/ui/gui/t-test-paired-samples.c b/src/ui/gui/t-test-paired-samples.c index 5ac5d8aa..a239a471 100644 --- a/src/ui/gui/t-test-paired-samples.c +++ b/src/ui/gui/t-test-paired-samples.c @@ -205,7 +205,7 @@ t_test_paired_samples_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); - g_object_set (dict_view, "model", + g_object_set (dict_view, "dictionary", vs->dict, "predicate", var_is_numeric, NULL); diff --git a/src/ui/gui/text-data-import-dialog.c b/src/ui/gui/text-data-import-dialog.c index 2cecd548..9c288ad5 100644 --- a/src/ui/gui/text-data-import-dialog.c +++ b/src/ui/gui/text-data-import-dialog.c @@ -1628,7 +1628,7 @@ prepare_formats_page (struct import_assistant *ia) (void *) NULL); var_sheet = PSPPIRE_VAR_SHEET (psppire_var_sheet_new ()); g_object_set (var_sheet, - "model", var_store, + "dictionary", var_store, "may-create-vars", FALSE, (void *) NULL); diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c index 0e8a6259..7ff758b0 100644 --- a/src/ui/gui/transpose-dialog.c +++ b/src/ui/gui/transpose-dialog.c @@ -94,7 +94,7 @@ transpose_dialog (GObject *o, gpointer data) g_object_get (de->data_editor, "var-store", &vs, NULL); - g_object_set (source, "model", vs->dict, NULL); + g_object_set (source, "dictionary", vs->dict, NULL); set_dest_model (GTK_TREE_VIEW (dest), vs->dict); diff --git a/src/ui/gui/variable-info-dialog.c b/src/ui/gui/variable-info-dialog.c index 9cafd9b8..612643b4 100644 --- a/src/ui/gui/variable-info-dialog.c +++ b/src/ui/gui/variable-info-dialog.c @@ -153,7 +153,7 @@ variable_info_dialog (GObject *o, gpointer data) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); g_object_set (treeview, - "model", vs->dict, + "dictionary", vs->dict, "selection-mode", GTK_SELECTION_SINGLE, NULL); diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c index 8cfae24b..6fccdfb8 100644 --- a/src/ui/gui/weight-cases-dialog.c +++ b/src/ui/gui/weight-cases-dialog.c @@ -130,7 +130,7 @@ weight_cases_dialog (GObject *o, gpointer data) g_signal_connect (selector, "de-selected", G_CALLBACK (on_deselect), radiobutton1); - g_object_set (source, "model", vs->dict, + g_object_set (source, "dictionary", vs->dict, "selection-mode", GTK_SELECTION_SINGLE, "predicate", var_is_numeric, NULL);