X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-weight.c;h=280d3c3c483ef4d28755f654c40dd7452ad1af5f;hb=0f447caa885d8f0fd8c30d4440556d9b6abb99ea;hp=79f7254c55c8676e2cc798c8cf3a24707a822b19;hpb=258cbd9cdf386687122b0854274923acafc786d4;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-weight.c b/src/ui/gui/psppire-dialog-action-weight.c index 79f7254c55..280d3c3c48 100644 --- a/src/ui/gui/psppire-dialog-action-weight.c +++ b/src/ui/gui/psppire-dialog-action-weight.c @@ -119,49 +119,43 @@ on_toggle (GtkToggleButton *off, gpointer data) } -static void -psppire_dialog_action_weight_activate (PsppireDialogAction *pda) +static GtkBuilder * +psppire_dialog_action_weight_activate (PsppireDialogAction *pda, GVariant *param) { PsppireDialogActionWeight *act = PSPPIRE_DIALOG_ACTION_WEIGHT (pda); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, pda); - if (!xml) - { - xml = builder_new ("weight.ui"); - g_hash_table_insert (thing, pda, xml); - - pda->dialog = get_widget_assert (xml, "weight-cases-dialog"); - pda->source = get_widget_assert (xml, "weight-cases-treeview"); - - act->entry = get_widget_assert (xml, "weight-cases-entry"); - act->off = get_widget_assert (xml,"weight-cases-radiobutton1"); - act->on = get_widget_assert (xml, "radiobutton2"); - act->status = get_widget_assert (xml, "weight-status-label"); - GtkWidget *selector = get_widget_assert (xml, "weight-cases-selector"); - - g_signal_connect (selector, "selected", G_CALLBACK (on_select), act); - g_signal_connect (selector, "de-selected", G_CALLBACK (on_deselect), act); - g_signal_connect (act->off, "toggled", G_CALLBACK (on_toggle), act); - - g_object_set (pda->source, - "selection-mode", GTK_SELECTION_SINGLE, - "predicate", var_is_numeric, - NULL); - - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), - is_currently_in_entry); - } - + GtkBuilder *xml = builder_new ( "weight.ui"); + + pda->dialog = get_widget_assert (xml, "weight-cases-dialog"); + pda->source = get_widget_assert (xml, "weight-cases-treeview"); + + act->entry = get_widget_assert (xml, "weight-cases-entry"); + act->off = get_widget_assert (xml,"weight-cases-radiobutton1"); + act->on = get_widget_assert (xml, "radiobutton2"); + act->status = get_widget_assert (xml, "weight-status-label"); + GtkWidget *selector = get_widget_assert (xml, "weight-cases-selector"); + + g_signal_connect (selector, "selected", G_CALLBACK (on_select), act); + g_signal_connect (selector, "de-selected", G_CALLBACK (on_deselect), act); + g_signal_connect (act->off, "toggled", G_CALLBACK (on_toggle), act); + + g_object_set (pda->source, + "selection-mode", GTK_SELECTION_SINGLE, + "predicate", var_is_numeric, + NULL); + + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_weight_class_init (PsppireDialogActionWeightClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_weight_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_weight_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }