Mercurial > pidgin
changeset 31948:d3e36e7af9e7
Hide PurpleValue.
author | masca@cpw.pidgin.im |
---|---|
date | Thu, 25 Aug 2011 04:15:16 +0000 |
parents | 77a59b2615d0 |
children | 16b33ffd75f8 |
files | libpurple/status.c libpurple/value.c libpurple/value.h |
diffstat | 3 files changed, 48 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/status.c Wed Aug 24 04:38:46 2011 +0000 +++ b/libpurple/status.c Thu Aug 25 04:15:16 2011 +0000 @@ -763,29 +763,29 @@ specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id); - if (value->type == PURPLE_TYPE_STRING) + if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { const gchar *string_data = l->data; l = l->next; - if (purple_strequal(string_data, value->data.string_data)) + if (purple_strequal(string_data, purple_value_get_string(value))) continue; purple_status_set_attr_string(status, id, string_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_INT) + else if (purple_value_get_type(value) == PURPLE_TYPE_INT) { int int_data = GPOINTER_TO_INT(l->data); l = l->next; - if (int_data == value->data.int_data) + if (int_data == purple_value_get_int(value)) continue; purple_status_set_attr_int(status, id, int_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_BOOLEAN) + else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { gboolean boolean_data = GPOINTER_TO_INT(l->data); l = l->next; - if (boolean_data == value->data.boolean_data) + if (boolean_data == purple_value_get_boolean(value)) continue; purple_status_set_attr_boolean(status, id, boolean_data); changed = TRUE; @@ -809,7 +809,7 @@ if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) { PurpleValue *default_value; default_value = purple_status_attr_get_value(attr); - if (default_value->type == PURPLE_TYPE_STRING) { + if (purple_value_get_type(default_value) == PURPLE_TYPE_STRING) { const char *cur = purple_status_get_attr_string(status, attr->id); const char *def = purple_value_get_string(default_value); if ((cur == NULL && def == NULL) @@ -819,14 +819,14 @@ } purple_status_set_attr_string(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_INT) { + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) { int cur = purple_status_get_attr_int(status, attr->id); int def = purple_value_get_int(default_value); if (cur == def) continue; purple_status_set_attr_int(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_BOOLEAN) { + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) { gboolean cur = purple_status_get_attr_boolean(status, attr->id); gboolean def = purple_value_get_boolean(default_value); if (cur == def)
--- a/libpurple/value.c Wed Aug 24 04:38:46 2011 +0000 +++ b/libpurple/value.c Thu Aug 25 04:15:16 2011 +0000 @@ -29,6 +29,44 @@ #define OUTGOING_FLAG 0x01 +/** + * A wrapper for a type, subtype, and specific type of value. + */ +struct _PurpleValue +{ + PurpleType type; + unsigned short flags; + + union + { + char char_data; + unsigned char uchar_data; + gboolean boolean_data; + short short_data; + unsigned short ushort_data; + int int_data; + unsigned int uint_data; + long long_data; + unsigned long ulong_data; + gint64 int64_data; + guint64 uint64_data; + char *string_data; + void *object_data; + void *pointer_data; + int enum_data; + void *boxed_data; + + } data; + + union + { + unsigned int subtype; + char *specific_type; + + } u; + +}; + PurpleValue * purple_value_new(PurpleType type, ...) {
--- a/libpurple/value.h Wed Aug 24 04:38:46 2011 +0000 +++ b/libpurple/value.h Thu Aug 25 04:15:16 2011 +0000 @@ -86,40 +86,7 @@ /** * A wrapper for a type, subtype, and specific type of value. */ -typedef struct -{ - PurpleType type; - unsigned short flags; - - union - { - char char_data; - unsigned char uchar_data; - gboolean boolean_data; - short short_data; - unsigned short ushort_data; - int int_data; - unsigned int uint_data; - long long_data; - unsigned long ulong_data; - gint64 int64_data; - guint64 uint64_data; - char *string_data; - void *object_data; - void *pointer_data; - int enum_data; - void *boxed_data; - - } data; - - union - { - unsigned int subtype; - char *specific_type; - - } u; - -} PurpleValue; +typedef struct _PurpleValue PurpleValue; #ifdef __cplusplus extern "C" {