X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Fui%2Fgui%2Fwidgets.c;h=da62642870f01f05ae2b70bef2094d84637b631e;hb=52e144652645cab108fb2db0a970f1ace2cbf2ea;hp=c66c42a58f18f974d9b625c8a12da4666b791644;hpb=dc4c35e3d2af8279de05afa3fc5a582a593c91fe;p=pspp diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c index c66c42a58f..da62642870 100644 --- a/src/ui/gui/widgets.c +++ b/src/ui/gui/widgets.c @@ -1,14 +1,14 @@ #include -#include +#include #include "widgets.h" +#include "gettext.h" #include "psppire-dialog.h" #include "psppire-selector.h" -#include "psppire-vbuttonbox.h" -#include "psppire-hbuttonbox.h" +#include "psppire-buttonbox.h" #include "psppire-keypad.h" #include "psppire-acr.h" #include "psppire-dictview.h" @@ -42,7 +42,8 @@ #include "psppire-dialog-action-oneway.h" #include "psppire-means-layer.h" #include "psppire-dialog-action-rank.h" -#include "psppire-dialog-action-recode.h" +#include "psppire-dialog-action-recode-same.h" +#include "psppire-dialog-action-recode-different.h" #include "psppire-dialog-action-regression.h" #include "psppire-dialog-action-reliability.h" #include "psppire-dialog-action-roc.h" @@ -91,7 +92,8 @@ static const get_type_func dialog_action_types[]= psppire_dialog_action_indep_samps_get_type, psppire_dialog_action_var_info_get_type, psppire_dialog_action_rank_get_type, - psppire_dialog_action_recode_get_type, + psppire_dialog_action_recode_same_get_type, + psppire_dialog_action_recode_different_get_type, psppire_dialog_action_reliability_get_type, psppire_dialog_action_regression_get_type, psppire_dialog_action_roc_get_type, @@ -136,26 +138,43 @@ tx_string_to_int (const GValue *src, GValue *dest) g_value_set_int (dest, x); } +static void +enum_to_string (const GValue *src, GValue *dest) +{ + gint n = g_value_get_enum (src); + GType t = G_VALUE_TYPE (src); + GEnumClass *ec = g_type_class_ref (t); + GEnumValue *ev = g_enum_get_value (ec, n); + + g_value_set_string (dest, gettext (ev->value_nick)); +} + GType align_enum_type; GType measure_enum_type; GType role_enum_type; + extern const GEnumValue align[]; extern const GEnumValue measure[]; extern const GEnumValue role[]; + + static void preregister_misc (void) { - g_value_register_transform_func (G_TYPE_STRING, G_TYPE_DOUBLE, tx_string_to_double); - g_value_register_transform_func (G_TYPE_STRING, G_TYPE_INT, tx_string_to_int); - align_enum_type = g_enum_register_static ("PsppAlignment", align); measure_enum_type = g_enum_register_static ("PsppMeasure", measure); role_enum_type = g_enum_register_static ("PsppRole", role); + g_value_register_transform_func (G_TYPE_STRING, G_TYPE_DOUBLE, tx_string_to_double); + g_value_register_transform_func (G_TYPE_STRING, G_TYPE_INT, tx_string_to_int); + + g_value_register_transform_func (measure_enum_type, G_TYPE_STRING, enum_to_string); + g_value_register_transform_func (align_enum_type, G_TYPE_STRING, enum_to_string); + g_value_register_transform_func (role_enum_type, G_TYPE_STRING, enum_to_string); } @@ -168,8 +187,7 @@ preregister_widgets (void) psppire_val_chooser_get_type (); psppire_dialog_get_type (); psppire_selector_get_type (); - psppire_vbutton_box_get_type (); - psppire_hbutton_box_get_type (); + psppire_buttonbox_get_type (); psppire_keypad_get_type (); psppire_acr_get_type (); psppire_dict_view_get_type ();