X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-value-entry.c;h=f3d7f99a8e6b9db5948e743b155c8b42bb95a6c7;hb=37c21ba9301956091823dea7d84ff0400330bd4b;hp=30b18219d785cd74de6c159352ca7ebcddd78004;hpb=17ca35e4ca8abf4ba0c0ae82920b985fa17648cf;p=pspp diff --git a/src/ui/gui/psppire-value-entry.c b/src/ui/gui/psppire-value-entry.c index 30b18219d7..f3d7f99a8e 100644 --- a/src/ui/gui/psppire-value-entry.c +++ b/src/ui/gui/psppire-value-entry.c @@ -78,7 +78,10 @@ psppire_value_entry_set_property (GObject *object, break; case PROP_FORMAT: - psppire_value_entry_set_format (obj, g_value_get_boxed (value)); + { + const struct fmt_spec *f = g_value_get_boxed (value); + psppire_value_entry_set_format (obj, *f); + } break; case PROP_ENCODING: @@ -146,7 +149,6 @@ psppire_value_entry_text_changed (GtkEntryBuffer *buffer, static void on_entry_activate (GtkWidget *w) { - PsppireValueEntry *ve = PSPPIRE_VALUE_ENTRY (w); g_signal_emit (w, signals [EDIT_DONE], 0); } @@ -366,7 +368,7 @@ psppire_value_entry_set_variable (PsppireValueEntry *obj, if (var != NULL) { psppire_value_entry_set_value_labels (obj, var_get_value_labels (var)); - obj->format = *var_get_print_format (var); + obj->format = var_get_print_format (var); psppire_value_entry_set_encoding (obj, var_get_encoding (var)); } else @@ -387,7 +389,7 @@ psppire_value_entry_set_value_labels (PsppireValueEntry *obj, if (val_labs != NULL) { int width = val_labs_get_width (val_labs); - if (width != fmt_var_width (&obj->format)) + if (width != fmt_var_width (obj->format)) obj->format = fmt_default_for_width (width); } @@ -405,12 +407,12 @@ psppire_value_entry_get_value_labels (const PsppireValueEntry *obj) void psppire_value_entry_set_format (PsppireValueEntry *obj, - const struct fmt_spec *format) + struct fmt_spec format) { - if (!fmt_equal (format, &obj->format)) + if (!fmt_equal (format, obj->format)) { obj->cur_value = NULL; - obj->format = *format; + obj->format = format; if (obj->val_labs && val_labs_get_width (obj->val_labs) != fmt_var_width (format)) @@ -420,10 +422,10 @@ psppire_value_entry_set_format (PsppireValueEntry *obj, } } -const struct fmt_spec * +struct fmt_spec psppire_value_entry_get_format (const PsppireValueEntry *obj) { - return &obj->format; + return obj->format; } void @@ -445,17 +447,17 @@ psppire_value_entry_get_encoding (const PsppireValueEntry *obj) void psppire_value_entry_set_width (PsppireValueEntry *obj, int width) { - if (width != fmt_var_width (&obj->format)) + if (width != fmt_var_width (obj->format)) { struct fmt_spec format = fmt_default_for_width (width); - psppire_value_entry_set_format (obj, &format); + psppire_value_entry_set_format (obj, format); } } int psppire_value_entry_get_width (const PsppireValueEntry *obj) { - return fmt_var_width (&obj->format); + return fmt_var_width (obj->format); } void @@ -482,7 +484,7 @@ psppire_value_entry_set_value (PsppireValueEntry *obj, } } - string = value_to_text__ (*value, &obj->format, obj->encoding); + string = value_to_text__ (*value, obj->format, obj->encoding); gtk_entry_set_text (entry, string); g_free (string); } @@ -495,7 +497,7 @@ psppire_value_entry_get_value (PsppireValueEntry *obj, GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (obj))); GtkTreeIter iter; - g_return_val_if_fail (fmt_var_width (&obj->format) == width, FALSE); + g_return_val_if_fail (fmt_var_width (obj->format) == width, FALSE); if (obj->cur_value) { @@ -518,7 +520,7 @@ psppire_value_entry_get_value (PsppireValueEntry *obj, new_text = gtk_entry_get_text (entry); return data_in_msg (ss_cstr (new_text), UTF8, - obj->format.type, + obj->format.type, settings_get_fmt_settings (), value, width, obj->encoding); } }