Mercurial > pidgin.yaz
comparison libpurple/account.c @ 20958:2002a6a32b0c
Using i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) for
compilation, I can't compile account.c because of the 'bool' component of
PurpleAccountSetting - it's apparently treating it as a type. Changing it to
'boolean' is more consistent with the naming of the other parts of the union,
in any case. The error given is:
---
account.c:55: error: two or more data types in declaration specifiers
account.c:55: warning: declaration does not declare anything
account.c: In function 'setting_to_xmlnode':
account.c:107: error: syntax error before '_Bool'
----
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 15 Oct 2007 23:55:05 +0000 |
parents | 0cb113dfb096 |
children | 14afe5a92fc2 |
comparison
equal
deleted
inserted
replaced
20957:1ec2b67e9bc1 | 20958:2002a6a32b0c |
---|---|
50 | 50 |
51 union | 51 union |
52 { | 52 { |
53 int integer; | 53 int integer; |
54 char *string; | 54 char *string; |
55 gboolean bool; | 55 gboolean boolean; |
56 | 56 |
57 } value; | 57 } value; |
58 | 58 |
59 } PurpleAccountSetting; | 59 } PurpleAccountSetting; |
60 | 60 |
102 xmlnode_set_attrib(child, "type", "string"); | 102 xmlnode_set_attrib(child, "type", "string"); |
103 xmlnode_insert_data(child, setting->value.string, -1); | 103 xmlnode_insert_data(child, setting->value.string, -1); |
104 } | 104 } |
105 else if (setting->type == PURPLE_PREF_BOOLEAN) { | 105 else if (setting->type == PURPLE_PREF_BOOLEAN) { |
106 xmlnode_set_attrib(child, "type", "bool"); | 106 xmlnode_set_attrib(child, "type", "bool"); |
107 snprintf(buf, sizeof(buf), "%d", setting->value.bool); | 107 snprintf(buf, sizeof(buf), "%d", setting->value.boolean); |
108 xmlnode_insert_data(child, buf, -1); | 108 xmlnode_insert_data(child, buf, -1); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 static void | 112 static void |
1576 g_return_if_fail(name != NULL); | 1576 g_return_if_fail(name != NULL); |
1577 | 1577 |
1578 setting = g_new0(PurpleAccountSetting, 1); | 1578 setting = g_new0(PurpleAccountSetting, 1); |
1579 | 1579 |
1580 setting->type = PURPLE_PREF_BOOLEAN; | 1580 setting->type = PURPLE_PREF_BOOLEAN; |
1581 setting->value.bool = value; | 1581 setting->value.boolean = value; |
1582 | 1582 |
1583 g_hash_table_insert(account->settings, g_strdup(name), setting); | 1583 g_hash_table_insert(account->settings, g_strdup(name), setting); |
1584 | 1584 |
1585 schedule_accounts_save(); | 1585 schedule_accounts_save(); |
1586 } | 1586 } |
1662 | 1662 |
1663 setting = g_new0(PurpleAccountSetting, 1); | 1663 setting = g_new0(PurpleAccountSetting, 1); |
1664 | 1664 |
1665 setting->type = PURPLE_PREF_BOOLEAN; | 1665 setting->type = PURPLE_PREF_BOOLEAN; |
1666 setting->ui = g_strdup(ui); | 1666 setting->ui = g_strdup(ui); |
1667 setting->value.bool = value; | 1667 setting->value.boolean = value; |
1668 | 1668 |
1669 table = get_ui_settings_table(account, ui); | 1669 table = get_ui_settings_table(account, ui); |
1670 | 1670 |
1671 g_hash_table_insert(table, g_strdup(name), setting); | 1671 g_hash_table_insert(table, g_strdup(name), setting); |
1672 | 1672 |
1937 if (setting == NULL) | 1937 if (setting == NULL) |
1938 return default_value; | 1938 return default_value; |
1939 | 1939 |
1940 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); | 1940 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); |
1941 | 1941 |
1942 return setting->value.bool; | 1942 return setting->value.boolean; |
1943 } | 1943 } |
1944 | 1944 |
1945 int | 1945 int |
1946 purple_account_get_ui_int(const PurpleAccount *account, const char *ui, | 1946 purple_account_get_ui_int(const PurpleAccount *account, const char *ui, |
1947 const char *name, int default_value) | 1947 const char *name, int default_value) |
2003 if ((setting = g_hash_table_lookup(table, name)) == NULL) | 2003 if ((setting = g_hash_table_lookup(table, name)) == NULL) |
2004 return default_value; | 2004 return default_value; |
2005 | 2005 |
2006 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); | 2006 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); |
2007 | 2007 |
2008 return setting->value.bool; | 2008 return setting->value.boolean; |
2009 } | 2009 } |
2010 | 2010 |
2011 PurpleLog * | 2011 PurpleLog * |
2012 purple_account_get_log(PurpleAccount *account, gboolean create) | 2012 purple_account_get_log(PurpleAccount *account, gboolean create) |
2013 { | 2013 { |