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);
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);
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);
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;
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);
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);
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);
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
{
{
PROP_0,
PROP_MODEL,
+ PROP_DICTIONARY,
PROP_PREDICATE,
PROP_SELECTION_MODE
};
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;
switch (prop_id)
{
- case PROP_MODEL:
+ case PROP_DICTIONARY:
g_value_set_object (value, dict_view->dict);
break;
case PROP_PREDICATE:
{
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);
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,
{
*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);
+ }
+ }
}
gtk_widget_queue_draw (GTK_WIDGET (dv));
}
+
+
static void
psppire_dict_view_init (PsppireDictView *dict_view)
{
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);
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 )
{
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);
{
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);
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);
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);
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);
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);
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);
(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);
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);
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);
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);