X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-selector.c;h=7b30106013b21297cd9085a9008856b02de04511;hb=1aa87f10e686eb09df296411d8ebfa28fa151860;hp=83fe2d82792a04fb34425b3f0f5a221dde2238fb;hpb=3bbb4370239deb29ebbf813d258aef6249e2a431;p=pspp-builds.git diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index 83fe2d82..7b301060 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -1,5 +1,5 @@ /* 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 @@ -63,17 +63,10 @@ #include "psppire-dict.h" #include "psppire-select-dest.h" -#include -#include -#include +#include #include "psppire-selector.h" -#include -#include -#include -#include - static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer); static void psppire_selector_base_init (PsppireSelectorClass *class); static void psppire_selector_class_init (PsppireSelectorClass *class); @@ -158,7 +151,7 @@ enum }; -static void on_activate (PsppireSelector *selector, gpointer data); +static void on_click (GtkButton *b); static void update_subjects (PsppireSelector *selector); @@ -225,6 +218,7 @@ static void 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", @@ -257,6 +251,8 @@ psppire_selector_class_init (PsppireSelectorClass *class) G_PARAM_READWRITE); + button_class->clicked = on_click; + object_class->set_property = psppire_selector_set_property; object_class->get_property = psppire_selector_get_property; @@ -330,9 +326,7 @@ on_row_activate (GtkTreeView *tree_view, GtkTreeViewColumn *column, gpointer data) { - PsppireSelector *selector = data; - - gtk_action_activate (selector->action); + on_click (GTK_BUTTON (data)); } /* Callback for when the source selection changes */ @@ -345,12 +339,12 @@ on_source_select (GtkTreeSelection *treeselection, gpointer data) 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 ); } @@ -399,16 +393,11 @@ psppire_selector_init (PsppireSelector *selector) 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; @@ -634,8 +623,10 @@ select_selection (PsppireSelector *selector) 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: @@ -648,6 +639,10 @@ on_activate (PsppireSelector *selector, gpointer data) g_assert_not_reached (); break; } + + if (GTK_BUTTON_CLASS (parent_class)->clicked) + GTK_BUTTON_CLASS (parent_class)->clicked (b); + } static gboolean @@ -981,8 +976,6 @@ psppire_selector_set_filter_func (PsppireSelector *selector, FilterItemsFunc *filter_func) { selector->filter = filter_func ; - - set_default_filter (selector); }