Rename the "model" property to "dictionary"
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 18 Mar 2009 08:21:00 +0000 (17:21 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 18 Mar 2009 08:21:00 +0000 (17:21 +0900)
22 files changed:
src/ui/gui/compute-dialog.c
src/ui/gui/crosstabs-dialog.c
src/ui/gui/descriptives-dialog.c
src/ui/gui/examine-dialog.c
src/ui/gui/find-dialog.c
src/ui/gui/frequencies-dialog.c
src/ui/gui/oneway-anova-dialog.c
src/ui/gui/psppire-dict.h
src/ui/gui/psppire-dictview.c
src/ui/gui/rank-dialog.c
src/ui/gui/recode-dialog.c
src/ui/gui/regression-dialog.c
src/ui/gui/select-cases-dialog.c
src/ui/gui/sort-cases-dialog.c
src/ui/gui/split-file-dialog.c
src/ui/gui/t-test-independent-samples-dialog.c
src/ui/gui/t-test-one-sample.c
src/ui/gui/t-test-paired-samples.c
src/ui/gui/text-data-import-dialog.c
src/ui/gui/transpose-dialog.c
src/ui/gui/variable-info-dialog.c
src/ui/gui/weight-cases-dialog.c

index e3d1c6a1410c645b6998ec89dfb570d0cefe3a3c..7703640c4d553e81eb6584f28eb46841a0c3fe21 100644 (file)
@@ -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);
 
index 3d5c5718fc6477172023666d761620760ec173ab..2c71ddef4f39bb4b4cf094fd812cffbea8def84e 100644 (file)
@@ -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);
index 77bf95410870fa9deaa00ef98e7cb5c60b53c1b1..7b9a958409a8cc8c06c95e9e32dbe8c808325364 100644 (file)
@@ -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);
index 2902685d395f45ac932a88251f0dc3a30ab5d579..1d8944754c5ec3bc268dda14858da4bfb60a5a04 100644 (file)
@@ -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;
index 60d54e2679cb37d55c67c38f3c3b209fa1d1dedc..70f2085ca9dd76858596db6216d81aa5f498d0cc 100644 (file)
@@ -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);
 
index a368cabb2a8d622efec471220fb279c59e565890..c78fa95f1869bd907946af25c879803c605933c2 100644 (file)
@@ -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);
 
index 3c80f9e3574e226c9509008d0a329bcd39ee9406..2fb88268731a3b1a4126a1450fca3d122c9252c6 100644 (file)
@@ -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);
 
index 6d731f212a98203225028bbb9f6de79a4253682a..3fd73f9a6dc0bd9f21e9016cc7037f495081dcb6 100644 (file)
@@ -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
 {
index 336092f5abfaf97d20b9a07d55ed193a47dfbe03..f2648298dc25459a9e53e4f4c39829bc17fd5346 100644 (file)
@@ -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)
 {
index 606475bac5d12bfdbe5701f878b4c0a1bb5f68f6..2c4d19a0fde9b6f37ace69dcd82292a9bff7f5e0 100644 (file)
@@ -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);
 
index e5de4597cb011b0dc67999d9342eef487850938b..e480f3c70de75d05fef3be419a4a4b5819f17ac9 100644 (file)
@@ -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 )
     {
index a860501805b391af6a5fbd35f684dfa55fc5aa10..7b6ce6cc8631dfc890aca58890d2184be6714bcb 100644 (file)
@@ -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);
index ca1b31bc0b2a4305acf5e30243b95db27162c49b..3c36f4ededbfa10c201e959af1d235b017d43683 100644 (file)
@@ -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);
index 9d4ea50bc95fcd8ff51c9f8acbf940b1918dd230..b5d1bbaafa1d9803007a65ee5f9ae8ce25cb86ad 100644 (file)
@@ -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);
 
index 1641b50c2df701a08dbc9a0bb477e8634ad0eef3..063f186263f77370da93d956f1e6f759fb7d762f 100644 (file)
@@ -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);
 
 
index 53b2c20c430291bf3792d65d30468bbaa89871d1..e5a04a076a22d833a2397a9b899c97ef695860ff 100644 (file)
@@ -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);
 
index 64232d85754429e4117e8eb02228d54f83836407..2c48c5d9c6c3dffa690fb6cfa48a3764bfc82e54 100644 (file)
@@ -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);
index 5ac5d8aaa41f851ae9c8faef022dcb5624448cd6..a239a47193b4eba5eb778355847ea2b1d5bc1490 100644 (file)
@@ -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);
index 2cecd548756879c8c45cbf4963439a893626cd3d..9c288ad5148bd2af7695c2e0173613360e2c91f0 100644 (file)
@@ -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);
 
index 0e8a6259ddb365cfe13c53d35c068aa0fd69ebb6..7ff758b0d279824a67f4c4043feb8b999f648ed1 100644 (file)
@@ -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);
 
index 9cafd9b80e5613b74d4b675881502fbea05cd414..612643b4351b4447f72b3b35449a1e63793dafd6 100644 (file)
@@ -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);
 
index 8cfae24b74bded8b517a85784c3214bab3852d36..6fccdfb8e11904c420b38d52ca6a84d4306c510d 100644 (file)
@@ -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);