1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2007, 2009, 2010, 2012 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 This module provides a widget, PsppireSelector derived from
22 It contains a GtkArrow, and is used for selecting objects from a
23 GtkTreeView and putting them into a destination widget (often
24 another GtkTreeView). Typically this is used in psppire for
25 selecting variables, thus:
28 +----------------------------------------------------------+
30 | Source Widget Dest Widget |
31 | +----------------+ +----------------+ |
32 | | Variable0 | | Variable2 | |
47 | +----------------+ +----------------+ |
49 +----------------------------------------------------------+
51 The Source Widget is always a GtkTreeView. The Dest Widget may be a
52 GtkTreeView or a GtkEntry (other destination widgets may be
53 supported in the future).
55 Widgets may be source to more than one PsppireSelector.
61 #include "psppire-dictview.h"
62 #include "psppire-var-view.h"
63 #include "psppire-dict.h"
64 #include "psppire-select-dest.h"
68 #include "psppire-selector.h"
70 static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer);
71 static void psppire_selector_base_init (PsppireSelectorClass *class);
72 static void psppire_selector_class_init (PsppireSelectorClass *class);
73 static void psppire_selector_init (PsppireSelector *selector);
76 static void set_direction (PsppireSelector *, enum psppire_selector_dir);
79 enum {SELECTED, /* Emitted when an item is inserted into dest */
80 DE_SELECTED, /* Emitted when an item is removed from dest */
83 static guint signals [n_SIGNALS];
85 /* Callback for when an item disappears from the source list.
86 By implication, this means that the item has been inserted into the
90 on_row_deleted (PsppireSelector *selector)
92 g_signal_emit (selector, signals [SELECTED], 0);
95 /* Callback for when a new item appears in the source list.
96 By implication, this means that an item has been deleted from the
100 on_row_inserted (PsppireSelector *selector)
102 g_signal_emit (selector, signals [DE_SELECTED], 0);
107 psppire_selector_get_type (void)
109 static GType psppire_selector_type = 0;
111 if (!psppire_selector_type)
113 static const GTypeInfo psppire_selector_info =
115 sizeof (PsppireSelectorClass),
116 (GBaseInitFunc) psppire_selector_base_init,
117 (GBaseFinalizeFunc) psppire_selector_base_finalize,
118 (GClassInitFunc)psppire_selector_class_init,
119 (GClassFinalizeFunc) NULL,
121 sizeof (PsppireSelector),
123 (GInstanceInitFunc) psppire_selector_init,
126 psppire_selector_type =
127 g_type_register_static (GTK_TYPE_BUTTON, "PsppireSelector",
128 &psppire_selector_info, 0);
131 return psppire_selector_type;
134 static GObjectClass * parent_class = NULL;
137 psppire_selector_finalize (GObject *obj)
139 /* Chain up to the parent class */
140 G_OBJECT_CLASS (parent_class)->finalize (obj);
145 psppire_selector_dispose (GObject *obj)
147 PsppireSelector *sel = PSPPIRE_SELECTOR (obj);
149 if (sel->dispose_has_run)
152 /* Make sure dispose does not run twice. */
153 sel->dispose_has_run = TRUE;
155 g_object_unref (sel->dest);
156 g_object_unref (sel->source);
158 /* Chain up to the parent class */
159 G_OBJECT_CLASS (parent_class)->dispose (obj);
174 static void on_click (GtkButton *b);
175 static void on_realize (GtkWidget *selector);
178 static void update_subjects (PsppireSelector *selector);
182 psppire_selector_set_property (GObject *object,
187 PsppireSelector *selector = PSPPIRE_SELECTOR (object);
191 case PROP_ORIENTATION:
192 selector->orientation = g_value_get_enum (value);
193 set_direction (selector, selector->direction);
196 selector->primary_requested = TRUE;
197 update_subjects (selector);
199 case PROP_SOURCE_WIDGET:
200 selector->source = g_value_dup_object (value);
201 update_subjects (selector);
203 case PROP_DEST_WIDGET:
204 selector->dest = g_value_dup_object (value);
205 update_subjects (selector);
208 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
215 psppire_selector_get_property (GObject *object,
220 PsppireSelector *selector = PSPPIRE_SELECTOR (object);
224 case PROP_ORIENTATION:
225 g_value_set_enum (value, selector->orientation);
227 case PROP_SOURCE_WIDGET:
228 g_value_take_object (value, selector->source);
230 case PROP_DEST_WIDGET:
231 g_value_take_object (value, selector->dest);
234 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
240 psppire_selector_class_init (PsppireSelectorClass *class)
242 GObjectClass *object_class = G_OBJECT_CLASS (class);
243 GtkButtonClass *button_class = GTK_BUTTON_CLASS (class);
244 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
245 GParamSpec *orientation_spec =
246 g_param_spec_enum ("orientation",
248 "Where the selector is relative to its subjects",
249 PSPPIRE_TYPE_SELECTOR_ORIENTATION,
250 PSPPIRE_SELECT_SOURCE_BEFORE_DEST /* default value */,
251 G_PARAM_CONSTRUCT_ONLY |G_PARAM_READWRITE);
254 /* Meaningfull only if more than one selector shares this selectors source */
255 GParamSpec *primary_spec =
256 g_param_spec_boolean ("primary",
258 "Whether this selector should be the primary selector for the source",
262 GParamSpec *source_widget_spec =
263 g_param_spec_object ("source-widget",
265 "The widget to be used as the source for this selector",
269 GParamSpec *dest_widget_spec =
270 g_param_spec_object ("dest-widget",
271 "Destination Widget",
272 "The widget to be used as the destination for this selector",
277 button_class->clicked = on_click;
278 widget_class->realize = on_realize;
281 object_class->set_property = psppire_selector_set_property;
282 object_class->get_property = psppire_selector_get_property;
284 g_object_class_install_property (object_class,
288 g_object_class_install_property (object_class,
292 g_object_class_install_property (object_class,
296 g_object_class_install_property (object_class,
300 parent_class = g_type_class_peek_parent (class);
303 g_signal_new ("selected",
304 G_TYPE_FROM_CLASS (class),
308 g_cclosure_marshal_VOID__VOID,
312 signals [DE_SELECTED] =
313 g_signal_new ("de-selected",
314 G_TYPE_FROM_CLASS (class),
318 g_cclosure_marshal_VOID__VOID,
322 class->default_selection_funcs = g_hash_table_new (g_direct_hash, g_direct_equal);
327 psppire_selector_base_init (PsppireSelectorClass *class)
329 GObjectClass *object_class = G_OBJECT_CLASS (class);
331 object_class->finalize = psppire_selector_finalize;
332 object_class->dispose = psppire_selector_dispose;
334 class->source_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
340 psppire_selector_base_finalize(PsppireSelectorClass *class,
343 g_hash_table_destroy (class->source_hash);
344 g_hash_table_destroy (class->default_selection_funcs);
347 /* Callback for when the source treeview is activated (double clicked) */
349 on_row_activate (GtkTreeView *tree_view,
351 GtkTreeViewColumn *column,
354 on_click (GTK_BUTTON (data));
357 /* Callback for when the source selection changes */
359 on_source_select (GtkTreeSelection *treeselection, gpointer data)
361 PsppireSelector *selector = data;
363 set_direction (selector, PSPPIRE_SELECTOR_SOURCE_TO_DEST);
365 if ( selector->allow_selection )
367 gtk_widget_set_sensitive (GTK_WIDGET (selector),
368 selector->allow_selection (selector->source, selector->dest));
370 else if ( GTK_IS_ENTRY (selector->dest) )
372 gtk_widget_set_sensitive (GTK_WIDGET (selector),
373 gtk_tree_selection_count_selected_rows
374 (treeselection) <= 1 );
380 on_realize (GtkWidget *w)
382 PsppireSelector *selector = PSPPIRE_SELECTOR (w);
383 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
384 GtkTreeSelection* selection ;
386 GList *list = g_hash_table_lookup (class->source_hash, selector->source);
388 if (GTK_WIDGET_CLASS (parent_class)->realize)
389 GTK_WIDGET_CLASS (parent_class)->realize (w);
394 if ( g_list_first (list)->data == selector)
396 if ( selector->row_activate_id )
397 g_signal_handler_disconnect (selector->source, selector->row_activate_id);
399 selector->row_activate_id =
400 g_signal_connect (selector->source, "row-activated", G_CALLBACK (on_row_activate), selector);
403 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source));
405 if ( selector->source_select_id )
406 g_signal_handler_disconnect (selection, selector->source_select_id);
408 selector->source_select_id =
409 g_signal_connect (selection, "changed", G_CALLBACK (on_source_select), selector);
414 psppire_selector_init (PsppireSelector *selector)
416 selector->primary_requested = FALSE;
417 selector->select_user_data = NULL;
418 selector->select_items = NULL;
419 selector->allow_selection = NULL;
420 selector->filter = NULL;
422 selector->arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
425 gtk_container_add (GTK_CONTAINER (selector), selector->arrow);
427 gtk_widget_show (selector->arrow);
429 selector->selecting = FALSE;
431 selector->source = NULL;
432 selector->dest = NULL;
433 selector->dispose_has_run = FALSE;
436 selector->row_activate_id = 0;
437 selector->source_select_id = 0;
442 psppire_selector_new (void)
444 return GTK_WIDGET (g_object_new (psppire_selector_get_type (), NULL));
449 set_direction (PsppireSelector *selector, enum psppire_selector_dir d)
451 selector->direction = d;
453 /* FIXME: Need to reverse the arrow direction if an RTL locale is in
455 if ( d == PSPPIRE_SELECTOR_SOURCE_TO_DEST )
457 switch (selector->orientation)
459 case PSPPIRE_SELECT_SOURCE_BEFORE_DEST:
460 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_RIGHT, NULL);
462 case PSPPIRE_SELECT_SOURCE_AFTER_DEST:
463 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_LEFT, NULL);
465 case PSPPIRE_SELECT_SOURCE_ABOVE_DEST:
466 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_DOWN, NULL);
468 case PSPPIRE_SELECT_SOURCE_BELOW_DEST:
469 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_UP, NULL);
472 g_assert_not_reached ();
478 switch (selector->orientation)
480 case PSPPIRE_SELECT_SOURCE_BEFORE_DEST:
481 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_LEFT, NULL);
483 case PSPPIRE_SELECT_SOURCE_AFTER_DEST:
484 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_RIGHT, NULL);
486 case PSPPIRE_SELECT_SOURCE_ABOVE_DEST:
487 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_UP, NULL);
489 case PSPPIRE_SELECT_SOURCE_BELOW_DEST:
490 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_DOWN, NULL);
493 g_assert_not_reached ();
500 /* Callback for when the destination treeview selection changes */
502 on_dest_treeview_select (GtkTreeSelection *treeselection, gpointer data)
504 PsppireSelector *selector = data;
506 gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source)));
508 set_direction (selector, PSPPIRE_SELECTOR_DEST_TO_SOURCE);
511 /* Callback for source deselection, when the dest is GtkEntry */
513 de_select_selection_entry (PsppireSelector *selector)
515 gtk_entry_set_text (GTK_ENTRY (selector->dest), "");
518 /* Callback for source deselection, when the dest is GtkTreeView */
520 de_select_selection_tree_view (PsppireSelector *selector)
524 GtkTreeSelection* selection =
525 gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->dest));
527 GtkTreeModel *model =
528 gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
530 GList *selected_rows =
531 gtk_tree_selection_get_selected_rows (selection, NULL);
533 g_return_if_fail (selector->select_items);
535 /* Convert paths to RowRefs */
536 for (item = g_list_first (selected_rows);
538 item = g_list_next (item))
540 GtkTreeRowReference* rowref;
541 GtkTreePath *path = item->data;
543 rowref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
545 item->data = rowref ;
546 gtk_tree_path_free (path);
549 /* Remove each selected row from the dest widget */
550 for (item = g_list_first (selected_rows);
552 item = g_list_next (item))
555 GtkTreeRowReference *rr = item->data;
557 GtkTreePath *path = gtk_tree_row_reference_get_path (rr);
559 gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
561 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
563 gtk_tree_path_free (path);
566 /* Delete list of RowRefs and its contents */
567 g_list_foreach (selected_rows, (GFunc) gtk_tree_row_reference_free, NULL);
568 g_list_free (selected_rows);
572 /* Callback which causes the filter to be refiltered.
573 Called when the DEST GtkEntry is activated (Enter is pressed), or when it
577 refilter (PsppireSelector *selector)
579 GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source));
580 gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
584 /* Removes something from the DEST widget */
586 de_select_selection (PsppireSelector *selector)
588 selector->selecting = TRUE;
590 if ( GTK_IS_TREE_VIEW (selector->dest ) )
591 de_select_selection_tree_view (selector);
593 else if ( GTK_IS_ENTRY (selector->dest))
594 de_select_selection_entry (selector);
597 g_assert_not_reached ();
599 selector->selecting = FALSE;
603 g_signal_emit (selector, signals [DE_SELECTED], 0);
607 /* Puts something into the DEST widget */
609 select_selection (PsppireSelector *selector)
612 GtkTreeSelection* selection =
613 gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->source));
615 GList *selected_rows =
616 gtk_tree_selection_get_selected_rows (selection, NULL);
618 GtkTreeModel *childmodel =
619 gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source))));
621 g_return_if_fail (selector->select_items);
623 if (selector->allow_selection &&
624 ! selector->allow_selection (selector->source, selector->dest))
627 selector->selecting = TRUE;
629 for (item = g_list_first (selected_rows);
631 item = g_list_next (item))
633 GtkTreeIter child_iter;
635 GtkTreePath *path = item->data;
637 gtk_tree_model_get_iter (GTK_TREE_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source))),
640 gtk_tree_model_filter_convert_iter_to_child_iter
641 (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source))),
645 selector->select_items (child_iter,
648 selector->select_user_data
652 g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
653 g_list_free (selected_rows);
657 g_signal_emit (selector, signals [SELECTED], 0);
659 selector->selecting = FALSE;
662 /* Callback for when the selector button is clicked,
663 or other event which causes the selector's action to occur.
666 on_click (GtkButton *b)
668 PsppireSelector *selector = PSPPIRE_SELECTOR (b);
670 switch (selector->direction)
672 case PSPPIRE_SELECTOR_SOURCE_TO_DEST:
673 select_selection (selector);
675 case PSPPIRE_SELECTOR_DEST_TO_SOURCE:
676 de_select_selection (selector);
679 g_assert_not_reached ();
683 if (GTK_BUTTON_CLASS (parent_class)->clicked)
684 GTK_BUTTON_CLASS (parent_class)->clicked (b);
688 is_item_in_dest (GtkTreeModel *model, GtkTreeIter *iter, PsppireSelector *selector)
690 gboolean result = FALSE;
691 GtkTreeIter source_iter;
692 GtkTreeModel *source_model;
695 if (GTK_IS_TREE_MODEL_FILTER (model))
697 source_model = gtk_tree_model_filter_get_model
698 (GTK_TREE_MODEL_FILTER (model));
700 gtk_tree_model_filter_convert_iter_to_child_iter
701 (GTK_TREE_MODEL_FILTER (model), &source_iter, iter);
705 source_model = model;
709 gtk_tree_model_get_value (source_model, &source_iter, DICT_TVM_COL_VAR, &value);
711 result = psppire_select_dest_widget_contains_var (PSPPIRE_SELECT_DEST_WIDGET (selector->dest),
714 g_value_unset (&value);
721 /* Visibility function for items in the SOURCE widget.
722 Returns TRUE iff *all* the selectors for which SOURCE is associated
725 is_source_item_visible (GtkTreeModel *childmodel,
726 GtkTreeIter *iter, gpointer data)
728 PsppireSelector *selector = data;
729 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
733 list = g_hash_table_lookup (class->source_hash, selector->source);
737 PsppireSelector *selector = list->data;
739 if ( selector->filter && selector->filter (childmodel, iter, selector))
749 /* set the source widget to SOURCE */
751 set_tree_view_source (PsppireSelector *selector)
755 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
757 if ( ! (list = g_hash_table_lookup (class->source_hash, selector->source)))
759 list = g_list_append (list, selector);
760 g_hash_table_insert (class->source_hash, selector->source, list);
763 { /* Append this selector to the list and push the <source,list>
764 pair onto the hash table */
766 if ( NULL == g_list_find (list, selector) )
768 if ( selector->primary_requested )
769 list = g_list_prepend (list, selector);
771 list = g_list_append (list, selector);
772 g_hash_table_replace (class->source_hash, selector->source, list);
779 /* This function is a callback which occurs when the
780 SOURCE's model has changed */
785 PsppireSelector *selector
788 GtkTreeModel *model = gtk_tree_view_get_model (source);
790 g_assert (source == GTK_TREE_VIEW (selector->source));
792 if (model && (model == g_object_get_data (G_OBJECT (source), "model-copy")))
797 GtkTreeModel *new_model = gtk_tree_model_filter_new (model, NULL);
799 g_object_set_data (G_OBJECT (source), "model-copy", new_model);
801 gtk_tree_view_set_model (source, new_model);
803 gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (new_model),
804 is_source_item_visible,
808 g_signal_connect_swapped (new_model,
810 G_CALLBACK (on_row_deleted), selector);
812 g_signal_connect_swapped (new_model,
814 G_CALLBACK (on_row_inserted), selector);
816 g_object_unref (new_model);
823 Callback for when the destination treeview's data changes
826 on_dest_data_change (GtkTreeModel *tree_model,
831 PsppireSelector *selector = user_data;
833 if ( selector->selecting) return;
840 on_dest_data_delete (GtkTreeModel *tree_model,
844 PsppireSelector *selector = user_data;
846 if ( selector->selecting ) return;
853 on_dest_model_changed (PsppireSelector *selector)
855 GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
859 g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change),
862 g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete),
867 /* Set the destination widget to DEST */
869 set_tree_view_dest (PsppireSelector *selector,
872 GtkTreeSelection* selection = gtk_tree_view_get_selection (dest);
875 gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
877 g_signal_connect (selection, "changed", G_CALLBACK (on_dest_treeview_select),
880 on_dest_model_changed (selector);
881 g_signal_connect_swapped (dest, "notify::model",
882 G_CALLBACK (on_dest_model_changed), selector);
888 /* Callback for when the DEST GtkEntry is selected (clicked) */
890 on_entry_dest_select (GtkWidget *widget, GdkEventFocus *event, gpointer data)
892 PsppireSelector * selector = data;
894 gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source)));
895 set_direction (selector, PSPPIRE_SELECTOR_DEST_TO_SOURCE);
902 /* Set DEST to be the destination GtkEntry widget */
904 set_entry_dest (PsppireSelector *selector,
907 g_signal_connect_swapped (dest, "activate", G_CALLBACK (refilter),
910 g_signal_connect_swapped (dest, "changed", G_CALLBACK (refilter),
913 g_signal_connect (dest, "focus-in-event", G_CALLBACK (on_entry_dest_select),
916 g_signal_connect_swapped (dest, "focus-out-event", G_CALLBACK (refilter),
923 set_default_filter (PsppireSelector *selector)
925 if ( selector->filter == NULL)
927 if (GTK_IS_TREE_VIEW (selector->dest))
928 selector->filter = is_item_in_dest;
934 update_subjects (PsppireSelector *selector)
936 if ( NULL == selector->dest )
939 set_default_filter (selector);
941 if ( NULL == selector->source )
944 if ( GTK_IS_TREE_VIEW (selector->source))
946 set_tree_view_source (selector);
948 g_signal_connect (selector->source, "notify::model",
949 G_CALLBACK (update_model), selector);
951 update_model (GTK_TREE_VIEW (selector->source), 0, selector);
954 g_error ("Unsupported source widget: %s", G_OBJECT_TYPE_NAME (selector->source));
956 if ( NULL == selector->dest)
958 else if ( GTK_IS_TREE_VIEW (selector->dest))
960 set_tree_view_dest (selector, GTK_TREE_VIEW (selector->dest));
963 else if ( GTK_IS_ENTRY (selector->dest))
964 set_entry_dest (selector, GTK_ENTRY (selector->dest));
966 else if (GTK_IS_TEXT_VIEW (selector->dest))
968 /* Nothing to be done */
971 g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (selector->dest));
974 /* FIXME: Remove this dependency */
975 if ( PSPPIRE_IS_DICT_VIEW (selector->source) )
977 GObjectClass *class = G_OBJECT_GET_CLASS (selector);
978 GType type = G_OBJECT_TYPE (selector->dest);
980 SelectItemsFunc *func =
981 g_hash_table_lookup (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type);
984 psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
991 psppire_selector_set_default_selection_func (GType type, SelectItemsFunc *func)
993 GObjectClass *class = g_type_class_ref (PSPPIRE_SELECTOR_TYPE);
995 g_hash_table_insert (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type, func);
997 g_type_class_unref (class);
1003 /* Set FILTER_FUNC for this selector */
1005 psppire_selector_set_filter_func (PsppireSelector *selector,
1006 FilterItemsFunc *filter_func)
1008 selector->filter = filter_func ;
1012 /* Set SELECT_FUNC for this selector */
1014 psppire_selector_set_select_func (PsppireSelector *selector,
1015 SelectItemsFunc *select_func,
1018 selector->select_user_data = user_data;
1019 selector->select_items = select_func;
1025 psppire_selector_set_allow (PsppireSelector *selector, AllowSelectionFunc *allow)
1027 selector->allow_selection = allow;
1032 psppire_selector_orientation_get_type (void)
1034 static GType etype = 0;
1036 static const GEnumValue values[] = {
1037 { PSPPIRE_SELECT_SOURCE_BEFORE_DEST, "PSPPIRE_SELECT_SOURCE_BEFORE_DEST", "source before destination" },
1038 { PSPPIRE_SELECT_SOURCE_AFTER_DEST, "PSPPIRE_SELECT_SOURCE_AFTER_DEST", "source after destination" },
1039 { PSPPIRE_SELECT_SOURCE_ABOVE_DEST, "PSPPIRE_SELECT_SOURCE_ABOVE_DEST", "source above destination" },
1040 { PSPPIRE_SELECT_SOURCE_BELOW_DEST, "PSPPIRE_SELECT_SOURCE_BELOW_DEST", "source below destination" },
1043 etype = g_enum_register_static (g_intern_static_string ("PsppireSelectorOrientation"), values);