1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2007, 2009 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"
66 #include <gtk/gtksignal.h>
67 #include <gtk/gtkbutton.h>
68 #include <gtk/gtkentry.h>
70 #include "psppire-selector.h"
72 #include <gtk/gtktreeview.h>
73 #include <gtk/gtktreeselection.h>
74 #include <gtk/gtktextview.h>
75 #include <gtk/gtkwidget.h>
77 static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer);
78 static void psppire_selector_base_init (PsppireSelectorClass *class);
79 static void psppire_selector_class_init (PsppireSelectorClass *class);
80 static void psppire_selector_init (PsppireSelector *selector);
83 static void set_direction (PsppireSelector *, enum psppire_selector_dir);
86 enum {SELECTED, /* Emitted when an item is inserted into dest */
87 DE_SELECTED, /* Emitted when an item is removed from dest */
90 static guint signals [n_SIGNALS];
94 psppire_selector_get_type (void)
96 static GType psppire_selector_type = 0;
98 if (!psppire_selector_type)
100 static const GTypeInfo psppire_selector_info =
102 sizeof (PsppireSelectorClass),
103 (GBaseInitFunc) psppire_selector_base_init,
104 (GBaseFinalizeFunc) psppire_selector_base_finalize,
105 (GClassInitFunc)psppire_selector_class_init,
106 (GClassFinalizeFunc) NULL,
108 sizeof (PsppireSelector),
110 (GInstanceInitFunc) psppire_selector_init,
113 psppire_selector_type =
114 g_type_register_static (GTK_TYPE_BUTTON, "PsppireSelector",
115 &psppire_selector_info, 0);
118 return psppire_selector_type;
121 static GObjectClass * parent_class = NULL;
124 psppire_selector_finalize (GObject *obj)
126 /* Chain up to the parent class */
127 G_OBJECT_CLASS (parent_class)->finalize (obj);
132 psppire_selector_dispose (GObject *obj)
134 PsppireSelector *sel = PSPPIRE_SELECTOR (obj);
136 if (sel->dispose_has_run)
139 /* Make sure dispose does not run twice. */
140 sel->dispose_has_run = TRUE;
142 g_object_unref (sel->dest);
143 g_object_unref (sel->source);
145 /* Chain up to the parent class */
146 G_OBJECT_CLASS (parent_class)->dispose (obj);
161 static void on_activate (PsppireSelector *selector, gpointer data);
163 static void update_subjects (PsppireSelector *selector);
167 psppire_selector_set_property (GObject *object,
172 PsppireSelector *selector = PSPPIRE_SELECTOR (object);
176 case PROP_ORIENTATION:
177 selector->orientation = g_value_get_enum (value);
178 set_direction (selector, selector->direction);
181 selector->primary_requested = TRUE;
182 update_subjects (selector);
184 case PROP_SOURCE_WIDGET:
185 selector->source = g_value_dup_object (value);
186 update_subjects (selector);
188 case PROP_DEST_WIDGET:
189 selector->dest = g_value_dup_object (value);
190 update_subjects (selector);
193 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
200 psppire_selector_get_property (GObject *object,
205 PsppireSelector *selector = PSPPIRE_SELECTOR (object);
209 case PROP_ORIENTATION:
210 g_value_set_enum (value, selector->orientation);
212 case PROP_SOURCE_WIDGET:
213 g_value_take_object (value, selector->source);
215 case PROP_DEST_WIDGET:
216 g_value_take_object (value, selector->dest);
219 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
225 psppire_selector_class_init (PsppireSelectorClass *class)
227 GObjectClass *object_class = G_OBJECT_CLASS (class);
228 GParamSpec *orientation_spec =
229 g_param_spec_enum ("orientation",
231 "Where the selector is relative to its subjects",
232 PSPPIRE_TYPE_SELECTOR_ORIENTATION,
233 PSPPIRE_SELECT_SOURCE_BEFORE_DEST /* default value */,
234 G_PARAM_CONSTRUCT_ONLY |G_PARAM_READWRITE);
237 /* Meaningfull only if more than one selector shares this selectors source */
238 GParamSpec *primary_spec =
239 g_param_spec_boolean ("primary",
241 "Whether this selector should be the primary selector for the source",
245 GParamSpec *source_widget_spec =
246 g_param_spec_object ("source-widget",
248 "The widget to be used as the source for this selector",
252 GParamSpec *dest_widget_spec =
253 g_param_spec_object ("dest-widget",
254 "Destination Widget",
255 "The widget to be used as the destination for this selector",
260 object_class->set_property = psppire_selector_set_property;
261 object_class->get_property = psppire_selector_get_property;
263 g_object_class_install_property (object_class,
267 g_object_class_install_property (object_class,
271 g_object_class_install_property (object_class,
275 g_object_class_install_property (object_class,
279 parent_class = g_type_class_peek_parent (class);
282 g_signal_new ("selected",
283 G_TYPE_FROM_CLASS (class),
287 g_cclosure_marshal_VOID__VOID,
291 signals [DE_SELECTED] =
292 g_signal_new ("de-selected",
293 G_TYPE_FROM_CLASS (class),
297 g_cclosure_marshal_VOID__VOID,
301 class->default_selection_funcs = g_hash_table_new (g_direct_hash, g_direct_equal);
306 psppire_selector_base_init (PsppireSelectorClass *class)
308 GObjectClass *object_class = G_OBJECT_CLASS (class);
310 object_class->finalize = psppire_selector_finalize;
311 object_class->dispose = psppire_selector_dispose;
313 class->source_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
319 psppire_selector_base_finalize(PsppireSelectorClass *class,
322 g_hash_table_destroy (class->source_hash);
323 g_hash_table_destroy (class->default_selection_funcs);
326 /* Callback for when the source treeview is activated (double clicked) */
328 on_row_activate (GtkTreeView *tree_view,
330 GtkTreeViewColumn *column,
333 PsppireSelector *selector = data;
335 gtk_action_activate (selector->action);
338 /* Callback for when the source selection changes */
340 on_source_select (GtkTreeSelection *treeselection, gpointer data)
342 PsppireSelector *selector = data;
344 set_direction (selector, PSPPIRE_SELECTOR_SOURCE_TO_DEST);
346 if ( selector->allow_selection )
348 gtk_action_set_sensitive (selector->action,
349 selector->allow_selection (selector->source, selector->dest));
351 else if ( GTK_IS_ENTRY (selector->dest) )
353 gtk_action_set_sensitive (selector->action,
354 gtk_tree_selection_count_selected_rows
355 (treeselection) <= 1 );
361 on_realize (PsppireSelector *selector)
363 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
364 GtkTreeSelection* selection ;
366 GList *list = g_hash_table_lookup (class->source_hash, selector->source);
371 if ( g_list_first (list)->data == selector)
373 if ( selector->row_activate_id )
374 g_signal_handler_disconnect (selector->source, selector->row_activate_id);
376 selector->row_activate_id =
377 g_signal_connect (selector->source, "row-activated", G_CALLBACK (on_row_activate), selector);
380 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source));
382 if ( selector->source_select_id )
383 g_signal_handler_disconnect (selection, selector->source_select_id);
385 selector->source_select_id =
386 g_signal_connect (selection, "changed", G_CALLBACK (on_source_select), selector);
391 psppire_selector_init (PsppireSelector *selector)
393 selector->primary_requested = FALSE;
394 selector->select_user_data = NULL;
395 selector->select_items = NULL;
396 selector->allow_selection = NULL;
397 selector->filter = NULL;
399 selector->arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
400 selector->filtered_source = NULL;
402 selector->action = gtk_action_new ("select", NULL, NULL, "pspp-stock-select");
404 gtk_action_connect_proxy (selector->action, GTK_WIDGET (selector));
406 gtk_container_add (GTK_CONTAINER (selector), selector->arrow);
408 gtk_widget_show (selector->arrow);
410 g_signal_connect_swapped (selector->action, "activate", G_CALLBACK (on_activate), selector);
412 selector->selecting = FALSE;
414 selector->source = NULL;
415 selector->dest = NULL;
416 selector->dispose_has_run = FALSE;
419 selector->row_activate_id = 0;
420 selector->source_select_id = 0;
422 g_signal_connect (selector, "realize",
423 G_CALLBACK (on_realize), NULL);
429 psppire_selector_new (void)
431 return GTK_WIDGET (g_object_new (psppire_selector_get_type (), NULL));
436 set_direction (PsppireSelector *selector, enum psppire_selector_dir d)
438 selector->direction = d;
440 /* FIXME: Need to reverse the arrow direction if an RTL locale is in
442 if ( d == PSPPIRE_SELECTOR_SOURCE_TO_DEST )
444 switch (selector->orientation)
446 case PSPPIRE_SELECT_SOURCE_BEFORE_DEST:
447 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_RIGHT, NULL);
449 case PSPPIRE_SELECT_SOURCE_AFTER_DEST:
450 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_LEFT, NULL);
452 case PSPPIRE_SELECT_SOURCE_ABOVE_DEST:
453 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_DOWN, NULL);
455 case PSPPIRE_SELECT_SOURCE_BELOW_DEST:
456 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_UP, NULL);
459 g_assert_not_reached ();
465 switch (selector->orientation)
467 case PSPPIRE_SELECT_SOURCE_BEFORE_DEST:
468 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_LEFT, NULL);
470 case PSPPIRE_SELECT_SOURCE_AFTER_DEST:
471 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_RIGHT, NULL);
473 case PSPPIRE_SELECT_SOURCE_ABOVE_DEST:
474 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_UP, NULL);
476 case PSPPIRE_SELECT_SOURCE_BELOW_DEST:
477 g_object_set (selector->arrow, "arrow-type", GTK_ARROW_DOWN, NULL);
480 g_assert_not_reached ();
487 /* Callback for when the destination treeview selection changes */
489 on_dest_treeview_select (GtkTreeSelection *treeselection, gpointer data)
491 PsppireSelector *selector = data;
493 gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source)));
495 set_direction (selector, PSPPIRE_SELECTOR_DEST_TO_SOURCE);
498 /* Callback for source deselection, when the dest is GtkEntry */
500 de_select_selection_entry (PsppireSelector *selector)
502 gtk_entry_set_text (GTK_ENTRY (selector->dest), "");
505 /* Callback for source deselection, when the dest is GtkTreeView */
507 de_select_selection_tree_view (PsppireSelector *selector)
511 GtkTreeSelection* selection =
512 gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->dest));
514 GtkTreeModel *model =
515 gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
517 GList *selected_rows =
518 gtk_tree_selection_get_selected_rows (selection, NULL);
520 g_return_if_fail (selector->select_items);
522 /* Convert paths to RowRefs */
523 for (item = g_list_first (selected_rows);
525 item = g_list_next (item))
527 GtkTreeRowReference* rowref;
528 GtkTreePath *path = item->data;
530 rowref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
532 item->data = rowref ;
533 gtk_tree_path_free (path);
536 /* Remove each selected row from the dest widget */
537 for (item = g_list_first (selected_rows);
539 item = g_list_next (item))
542 GtkTreeRowReference *rr = item->data;
544 GtkTreePath *path = gtk_tree_row_reference_get_path (rr);
546 gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
548 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
550 gtk_tree_path_free (path);
553 /* Delete list of RowRefs and its contents */
554 g_list_foreach (selected_rows, (GFunc) gtk_tree_row_reference_free, NULL);
555 g_list_free (selected_rows);
559 /* Removes something from the DEST widget */
561 de_select_selection (PsppireSelector *selector)
563 selector->selecting = TRUE;
565 if ( GTK_IS_TREE_VIEW (selector->dest ) )
566 de_select_selection_tree_view (selector);
568 else if ( GTK_IS_ENTRY (selector->dest))
569 de_select_selection_entry (selector);
572 g_assert_not_reached ();
574 selector->selecting = FALSE;
576 gtk_tree_model_filter_refilter (selector->filtered_source);
578 g_signal_emit (selector, signals [DE_SELECTED], 0);
582 /* Puts something into the DEST widget */
584 select_selection (PsppireSelector *selector)
587 GtkTreeSelection* selection =
588 gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->source));
590 GList *selected_rows =
591 gtk_tree_selection_get_selected_rows (selection, NULL);
593 GtkTreeModel *childmodel = gtk_tree_model_filter_get_model
594 (selector->filtered_source);
596 g_return_if_fail (selector->select_items);
598 selector->selecting = TRUE;
600 for (item = g_list_first (selected_rows);
602 item = g_list_next (item))
604 GtkTreeIter child_iter;
606 GtkTreePath *path = item->data;
608 gtk_tree_model_get_iter (GTK_TREE_MODEL (selector->filtered_source),
611 gtk_tree_model_filter_convert_iter_to_child_iter
612 (selector->filtered_source,
616 selector->select_items (child_iter,
619 selector->select_user_data
623 g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
624 g_list_free (selected_rows);
626 gtk_tree_model_filter_refilter (selector->filtered_source);
628 g_signal_emit (selector, signals [SELECTED], 0);
630 selector->selecting = FALSE;
633 /* Callback for when the selector button is clicked,
634 or other event which causes the selector's action to occur.
637 on_activate (PsppireSelector *selector, gpointer data)
639 switch (selector->direction)
641 case PSPPIRE_SELECTOR_SOURCE_TO_DEST:
642 select_selection (selector);
644 case PSPPIRE_SELECTOR_DEST_TO_SOURCE:
645 de_select_selection (selector);
648 g_assert_not_reached ();
654 is_item_in_dest (GtkTreeModel *model, GtkTreeIter *iter, PsppireSelector *selector)
656 gboolean result = FALSE;
657 GtkTreeIter source_iter;
658 GtkTreeModel *source_model;
661 if (GTK_IS_TREE_MODEL_FILTER (model))
663 source_model = gtk_tree_model_filter_get_model
664 (GTK_TREE_MODEL_FILTER (model));
666 gtk_tree_model_filter_convert_iter_to_child_iter
667 (GTK_TREE_MODEL_FILTER (model), &source_iter, iter);
671 source_model = model;
675 gtk_tree_model_get_value (source_model, &source_iter, DICT_TVM_COL_VAR, &value);
677 result = psppire_select_dest_widget_contains_var (PSPPIRE_SELECT_DEST_WIDGET (selector->dest),
680 g_value_unset (&value);
687 /* Visibility function for items in the SOURCE widget.
688 Returns TRUE iff *all* the selectors for which SOURCE is associated
691 is_source_item_visible (GtkTreeModel *childmodel,
692 GtkTreeIter *iter, gpointer data)
694 PsppireSelector *selector = data;
695 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
699 list = g_hash_table_lookup (class->source_hash, selector->source);
703 PsppireSelector *selector = list->data;
705 if ( selector->filter && selector->filter (childmodel, iter, selector))
715 /* set the source widget to SOURCE */
717 set_tree_view_source (PsppireSelector *selector,
722 PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
724 GtkTreeModel *model = gtk_tree_view_get_model (source);
726 if ( ! (list = g_hash_table_lookup (class->source_hash, source)))
728 selector->filtered_source =
729 GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (model, NULL));
731 gtk_tree_view_set_model (source,
732 GTK_TREE_MODEL (selector->filtered_source));
734 list = g_list_append (list, selector);
735 g_hash_table_insert (class->source_hash, source, list);
738 gtk_tree_model_filter_set_visible_func (selector->filtered_source,
739 is_source_item_visible,
744 { /* Append this selector to the list and push the <source,list>
745 pair onto the hash table */
747 selector->filtered_source = GTK_TREE_MODEL_FILTER (model);
749 if ( NULL == g_list_find (list, selector) )
751 if ( selector->primary_requested )
752 list = g_list_prepend (list, selector);
754 list = g_list_append (list, selector);
755 g_hash_table_replace (class->source_hash, source, list);
762 Callback for when the destination treeview's data changes
765 on_dest_data_change (GtkTreeModel *tree_model,
770 PsppireSelector *selector = user_data;
772 if ( selector->selecting) return;
774 gtk_tree_model_filter_refilter (selector->filtered_source);
779 on_dest_data_delete (GtkTreeModel *tree_model,
783 PsppireSelector *selector = user_data;
785 if ( selector->selecting ) return;
787 gtk_tree_model_filter_refilter (selector->filtered_source);
792 on_dest_model_changed (PsppireSelector *selector)
794 GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
796 g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change),
799 g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete),
803 /* Set the destination widget to DEST */
805 set_tree_view_dest (PsppireSelector *selector,
808 GtkTreeSelection* selection = gtk_tree_view_get_selection (dest);
811 gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
813 g_signal_connect (selection, "changed", G_CALLBACK (on_dest_treeview_select),
816 on_dest_model_changed (selector);
817 g_signal_connect_swapped (dest, "notify::model",
818 G_CALLBACK (on_dest_model_changed), selector);
822 /* Callback which causes the filter to be refiltered.
823 Called when the DEST GtkEntry is activated (Enter is pressed), or when it
827 refilter (PsppireSelector *selector)
829 gtk_tree_model_filter_refilter (selector->filtered_source);
834 /* Callback for when the DEST GtkEntry is selected (clicked) */
836 on_entry_dest_select (GtkWidget *widget, GdkEventFocus *event, gpointer data)
838 PsppireSelector * selector = data;
840 gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source)));
841 set_direction (selector, PSPPIRE_SELECTOR_DEST_TO_SOURCE);
847 /* Callback for when an item disappears from the source list.
848 By implication, this means that the item has been inserted into the
852 on_row_deleted (PsppireSelector *selector)
854 g_signal_emit (selector, signals [SELECTED], 0);
857 /* Callback for when a new item appears in the source list.
858 By implication, this means that an item has been deleted from the
862 on_row_inserted (PsppireSelector *selector)
864 g_signal_emit (selector, signals [DE_SELECTED], 0);
869 /* Set DEST to be the destination GtkEntry widget */
871 set_entry_dest (PsppireSelector *selector,
874 g_signal_connect_swapped (dest, "activate", G_CALLBACK (refilter),
877 g_signal_connect_swapped (dest, "changed", G_CALLBACK (refilter),
880 g_signal_connect (dest, "focus-in-event", G_CALLBACK (on_entry_dest_select),
883 g_signal_connect_swapped (dest, "focus-out-event", G_CALLBACK (refilter),
887 g_signal_connect_swapped (selector->filtered_source, "row-deleted",
888 G_CALLBACK (on_row_deleted), selector);
890 g_signal_connect_swapped (selector->filtered_source, "row-inserted",
891 G_CALLBACK (on_row_inserted), selector);
895 set_default_filter (PsppireSelector *selector)
897 if ( selector->filter == NULL)
899 if (GTK_IS_TREE_VIEW (selector->dest))
900 selector->filter = is_item_in_dest;
905 update_subjects (PsppireSelector *selector)
907 GtkTreeModel *model = NULL;
909 if ( NULL == selector->dest )
912 set_default_filter (selector);
914 if ( NULL == selector->source )
917 g_signal_connect_swapped (selector->source, "notify::model",
918 G_CALLBACK (update_subjects), selector);
920 model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source));
926 if ( GTK_IS_TREE_VIEW (selector->source))
927 set_tree_view_source (selector, GTK_TREE_VIEW (selector->source) );
929 g_error ("Unsupported source widget: %s", G_OBJECT_TYPE_NAME (selector->source));
931 if ( NULL == selector->dest)
933 else if ( GTK_IS_TREE_VIEW (selector->dest))
935 set_tree_view_dest (selector, GTK_TREE_VIEW (selector->dest));
938 else if ( GTK_IS_ENTRY (selector->dest))
939 set_entry_dest (selector, GTK_ENTRY (selector->dest));
941 else if (GTK_IS_TEXT_VIEW (selector->dest))
943 /* Nothing to be done */
946 g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (selector->dest));
949 /* FIXME: Remove this dependency */
950 if ( PSPPIRE_IS_DICT_VIEW (selector->source) )
952 GObjectClass *class = G_OBJECT_GET_CLASS (selector);
953 GType type = G_OBJECT_TYPE (selector->dest);
955 SelectItemsFunc *func =
956 g_hash_table_lookup (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type);
959 psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
966 psppire_selector_set_default_selection_func (GType type, SelectItemsFunc *func)
968 GObjectClass *class = g_type_class_ref (PSPPIRE_SELECTOR_TYPE);
970 g_hash_table_insert (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type, func);
972 g_type_class_unref (class);
978 /* Set FILTER_FUNC for this selector */
980 psppire_selector_set_filter_func (PsppireSelector *selector,
981 FilterItemsFunc *filter_func)
983 selector->filter = filter_func ;
987 /* Set SELECT_FUNC for this selector */
989 psppire_selector_set_select_func (PsppireSelector *selector,
990 SelectItemsFunc *select_func,
993 selector->select_user_data = user_data;
994 selector->select_items = select_func;
1000 psppire_selector_set_allow (PsppireSelector *selector, AllowSelectionFunc *allow)
1002 selector->allow_selection = allow;
1007 psppire_selector_orientation_get_type (void)
1009 static GType etype = 0;
1011 static const GEnumValue values[] = {
1012 { PSPPIRE_SELECT_SOURCE_BEFORE_DEST, "PSPPIRE_SELECT_SOURCE_BEFORE_DEST", "source before destination" },
1013 { PSPPIRE_SELECT_SOURCE_AFTER_DEST, "PSPPIRE_SELECT_SOURCE_AFTER_DEST", "source after destination" },
1014 { PSPPIRE_SELECT_SOURCE_ABOVE_DEST, "PSPPIRE_SELECT_SOURCE_ABOVE_DEST", "source above destination" },
1015 { PSPPIRE_SELECT_SOURCE_BELOW_DEST, "PSPPIRE_SELECT_SOURCE_BELOW_DEST", "source below destination" },
1018 etype = g_enum_register_static (g_intern_static_string ("PsppireSelectorOrientation"), values);