/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007, 2009 Free Software Foundation
+ Copyright (C) 2007, 2009, 2010 Free Software Foundation
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
#include "psppire-dict.h"
#include "psppire-select-dest.h"
-#include <gtk/gtksignal.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
#include "psppire-selector.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);
static void psppire_selector_base_init (PsppireSelectorClass *class);
static void psppire_selector_class_init (PsppireSelectorClass *class);
};
-static void on_activate (PsppireSelector *selector, gpointer data);
+static void on_click (GtkButton *b);
static void update_subjects (PsppireSelector *selector);
psppire_selector_class_init (PsppireSelectorClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GtkButtonClass *button_class = GTK_BUTTON_CLASS (class);
GParamSpec *orientation_spec =
g_param_spec_enum ("orientation",
"Orientation",
G_PARAM_READWRITE);
+ button_class->clicked = on_click;
+
object_class->set_property = psppire_selector_set_property;
object_class->get_property = psppire_selector_get_property;
GtkTreeViewColumn *column,
gpointer data)
{
- PsppireSelector *selector = data;
-
- gtk_action_activate (selector->action);
+ on_click (GTK_BUTTON (data));
}
/* Callback for when the source selection changes */
if ( selector->allow_selection )
{
- gtk_action_set_sensitive (selector->action,
+ gtk_widget_set_sensitive (GTK_WIDGET (selector),
selector->allow_selection (selector->source, selector->dest));
}
else if ( GTK_IS_ENTRY (selector->dest) )
{
- gtk_action_set_sensitive (selector->action,
+ gtk_widget_set_sensitive (GTK_WIDGET (selector),
gtk_tree_selection_count_selected_rows
(treeselection) <= 1 );
}
selector->arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
selector->filtered_source = NULL;
- selector->action = gtk_action_new ("select", NULL, NULL, "pspp-stock-select");
-
- gtk_action_connect_proxy (selector->action, GTK_WIDGET (selector));
gtk_container_add (GTK_CONTAINER (selector), selector->arrow);
gtk_widget_show (selector->arrow);
- g_signal_connect_swapped (selector->action, "activate", G_CALLBACK (on_activate), selector);
-
selector->selecting = FALSE;
selector->source = NULL;
or other event which causes the selector's action to occur.
*/
static void
-on_activate (PsppireSelector *selector, gpointer data)
+on_click (GtkButton *b)
{
+ PsppireSelector *selector = PSPPIRE_SELECTOR (b);
+
switch (selector->direction)
{
case PSPPIRE_SELECTOR_SOURCE_TO_DEST:
g_assert_not_reached ();
break;
}
+
+ if (GTK_BUTTON_CLASS (parent_class)->clicked)
+ GTK_BUTTON_CLASS (parent_class)->clicked (b);
+
}
static gboolean