Mercurial > pidgin.yaz
comparison src/account.c @ 10428:04c663ccbcb1
[gaim-migrate @ 11680]
Shuffle some things around in blist.c and make some things more uniform.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 27 Dec 2004 04:43:49 +0000 |
parents | 16d63d8c26d8 |
children | e41f0668a648 |
comparison
equal
deleted
inserted
replaced
10427:16d63d8c26d8 | 10428:04c663ccbcb1 |
---|---|
54 | 54 |
55 | 55 |
56 static GaimAccountUiOps *account_ui_ops = NULL; | 56 static GaimAccountUiOps *account_ui_ops = NULL; |
57 | 57 |
58 static GList *accounts = NULL; | 58 static GList *accounts = NULL; |
59 static guint accounts_save_timer = 0; | 59 static guint save_timer = 0; |
60 static gboolean accounts_loaded = FALSE; | 60 static gboolean accounts_loaded = FALSE; |
61 | 61 |
62 | 62 |
63 /************************************************************************** | 63 /********************************************************************* |
64 * Writting to disk | 64 * Writting to disk * |
65 **************************************************************************/ | 65 *********************************************************************/ |
66 | 66 |
67 static void | 67 static void |
68 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) | 68 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) |
69 { | 69 { |
70 const char *name; | 70 const char *name; |
252 sync_accounts(void) | 252 sync_accounts(void) |
253 { | 253 { |
254 xmlnode *node; | 254 xmlnode *node; |
255 char *data; | 255 char *data; |
256 | 256 |
257 if (!accounts_loaded) { | 257 if (!accounts_loaded) |
258 { | |
258 gaim_debug_error("accounts", "Attempted to save accounts before they " | 259 gaim_debug_error("accounts", "Attempted to save accounts before they " |
259 "were read!\n"); | 260 "were read!\n"); |
260 } | 261 } |
261 | 262 |
262 node = accounts_to_xmlnode(); | 263 node = accounts_to_xmlnode(); |
268 | 269 |
269 static gboolean | 270 static gboolean |
270 save_cb(gpointer data) | 271 save_cb(gpointer data) |
271 { | 272 { |
272 sync_accounts(); | 273 sync_accounts(); |
273 accounts_save_timer = 0; | 274 save_timer = 0; |
274 return FALSE; | 275 return FALSE; |
275 } | 276 } |
276 | 277 |
277 static void | 278 static void |
278 schedule_accounts_save() | 279 schedule_accounts_save() |
279 { | 280 { |
280 if (accounts_save_timer == 0) | 281 if (save_timer == 0) |
281 accounts_save_timer = gaim_timeout_add(5000, save_cb, NULL); | 282 save_timer = gaim_timeout_add(5000, save_cb, NULL); |
282 } | 283 } |
283 | 284 |
284 | 285 |
285 /************************************************************************** | 286 /********************************************************************* |
286 * Reading from disk | 287 * Reading from disk * |
287 **************************************************************************/ | 288 *********************************************************************/ |
288 | 289 |
289 static void | 290 static void |
290 parse_settings(xmlnode *node, GaimAccount *account) | 291 parse_settings(xmlnode *node, GaimAccount *account) |
291 { | 292 { |
292 const char *ui; | 293 const char *ui; |
1166 | 1167 |
1167 g_return_val_if_fail(account != NULL, FALSE); | 1168 g_return_val_if_fail(account != NULL, FALSE); |
1168 | 1169 |
1169 gc = gaim_account_get_connection(account); | 1170 gc = gaim_account_get_connection(account); |
1170 | 1171 |
1171 /* XXX - The first way is better... but it doesn't work quite right yet */ | 1172 /* TODO: The first way is better... but it doesn't work quite right yet */ |
1172 /* return ((gc != NULL) && GAIM_CONNECTION_IS_CONNECTED(gc)); */ | 1173 /* return ((gc != NULL) && GAIM_CONNECTION_IS_CONNECTED(gc)); */ |
1173 return ((gc != NULL) && gaim_connection_get_state(gc) != GAIM_DISCONNECTED); | 1174 return ((gc != NULL) && gaim_connection_get_state(gc) != GAIM_DISCONNECTED); |
1174 } | 1175 } |
1175 | 1176 |
1176 const char * | 1177 const char * |
1705 } | 1706 } |
1706 | 1707 |
1707 void | 1708 void |
1708 gaim_accounts_uninit(void) | 1709 gaim_accounts_uninit(void) |
1709 { | 1710 { |
1710 if (accounts_save_timer != 0) | 1711 if (save_timer != 0) |
1711 { | 1712 { |
1712 gaim_timeout_remove(accounts_save_timer); | 1713 gaim_timeout_remove(save_timer); |
1713 accounts_save_timer = 0; | 1714 save_timer = 0; |
1714 sync_accounts(); | 1715 sync_accounts(); |
1715 } | 1716 } |
1716 | 1717 |
1717 gaim_signals_unregister_by_instance(gaim_accounts_get_handle()); | 1718 gaim_signals_unregister_by_instance(gaim_accounts_get_handle()); |
1718 } | 1719 } |