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=e5ed663e9f1998c1c2409a668288d4e5d496beda;hp=eb8e5bd3af7519ff53797a2827124d4282b34889;hpb=745ee355670b71d243c2cf1cc162352e2ee00360;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-weight.c b/src/ui/gui/psppire-dialog-action-weight.c index eb8e5bd3af..280d3c3c48 100644 --- a/src/ui/gui/psppire-dialog-action-weight.c +++ b/src/ui/gui/psppire-dialog-action-weight.c @@ -119,51 +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); - - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_weight_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_weight_parent_class)->activate (pda); + 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; }