Implemented the INSERT command.
[pspp-builds.git] / src / ui / gui / psppire-selector.c
index f3f684a16fc1e1e004835926c77ce45c5403e780..7f34baebafcbcbad1ff98535aa30f1fdcb293a4e 100644 (file)
@@ -1,10 +1,9 @@
-/*
-   PSPPIRE --- A Graphical User Interface for PSPP
+/* PSPPIRE - a graphical user interface for PSPP.
    Copyright (C) 2007  Free Software Foundation
 
    Copyright (C) 2007  Free Software Foundation
 
-   This program is free software; you can redistribute it and/or modify
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -13,9 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /*
   This module provides a widget, PsppireSelector derived from
 
 /*
   This module provides a widget, PsppireSelector derived from
@@ -68,6 +65,7 @@
 
 #include <gtk/gtktreeview.h>
 #include <gtk/gtktreeselection.h>
 
 #include <gtk/gtktreeview.h>
 #include <gtk/gtktreeselection.h>
+#include <gtk/gtktextview.h>
 #include <gtk/gtkwidget.h>
 
 static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer);
 #include <gtk/gtkwidget.h>
 
 static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer);
@@ -561,8 +559,8 @@ is_source_item_visible (GtkTreeModel *childmodel,
     {
       PsppireSelector *selector = list->data;
 
     {
       PsppireSelector *selector = list->data;
 
-      if ( selector->filter (childmodel, iter, selector))
-         return FALSE;
+      if ( selector->filter && selector->filter (childmodel, iter, selector))
+       return FALSE;
 
       list = list->next;
     }
 
       list = list->next;
     }
@@ -717,6 +715,8 @@ psppire_selector_set_subjects (PsppireSelector *selector,
                               SelectItemsFunc *select_func,
                               FilterItemsFunc *filter_func )
 {
                               SelectItemsFunc *select_func,
                               FilterItemsFunc *filter_func )
 {
+  g_assert(selector);
+
   selector->filter = filter_func ;
 
   selector->source = source;
   selector->filter = filter_func ;
 
   selector->source = source;
@@ -743,6 +743,11 @@ psppire_selector_set_subjects (PsppireSelector *selector,
   else if ( GTK_IS_ENTRY (dest))
     set_entry_dest (selector, GTK_ENTRY (dest));
 
   else if ( GTK_IS_ENTRY (dest))
     set_entry_dest (selector, GTK_ENTRY (dest));
 
+  else if (GTK_IS_TEXT_VIEW (dest))
+    {
+      /* Nothing to be done */
+    }
+
   else
     g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (dest));
 
   else
     g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (dest));