| 177 { |
177 { |
| 178 return &conn_ui_ops; |
178 return &conn_ui_ops; |
| 179 } |
179 } |
| 180 |
180 |
| 181 static void |
181 static void |
| 182 account_removed_cb(PurpleAccount *account, gpointer user_data) |
182 account_removed_cb(G_GNUC_UNUSED PurpleAccountManager *manager, |
| |
183 PurpleAccount *account, G_GNUC_UNUSED gpointer data) |
| 183 { |
184 { |
| 184 g_hash_table_remove(auto_reconns, account); |
185 g_hash_table_remove(auto_reconns, account); |
| 185 } |
186 } |
| 186 |
187 |
| 187 |
188 |
| 188 /************************************************************************** |
189 /************************************************************************** |
| 189 * GTK connection glue |
190 * GTK connection glue |
| 190 **************************************************************************/ |
191 **************************************************************************/ |
| 191 |
192 |
| 192 void * |
|
| 193 pidgin_connection_get_handle(void) |
|
| 194 { |
|
| 195 static int handle; |
|
| 196 |
|
| 197 return &handle; |
|
| 198 } |
|
| 199 |
|
| 200 void |
193 void |
| 201 pidgin_connection_init(void) |
194 pidgin_connection_init(void) |
| 202 { |
195 { |
| |
196 PurpleAccountManager *manager = purple_account_manager_get_default(); |
| |
197 |
| 203 auto_reconns = g_hash_table_new_full( |
198 auto_reconns = g_hash_table_new_full( |
| 204 g_direct_hash, g_direct_equal, |
199 g_direct_hash, g_direct_equal, |
| 205 NULL, free_auto_recon); |
200 NULL, free_auto_recon); |
| 206 |
201 |
| 207 purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
202 g_signal_connect(manager, "removed", G_CALLBACK(account_removed_cb), NULL); |
| 208 pidgin_connection_get_handle(), |
|
| 209 G_CALLBACK(account_removed_cb), NULL); |
|
| 210 } |
203 } |
| 211 |
204 |
| 212 void |
205 void |
| 213 pidgin_connection_uninit(void) |
206 pidgin_connection_uninit(void) |
| 214 { |
207 { |
| 215 purple_signals_disconnect_by_handle(pidgin_connection_get_handle()); |
208 PurpleAccountManager *manager = purple_account_manager_get_default(); |
| |
209 |
| |
210 g_signal_handlers_disconnect_by_func(manager, |
| |
211 G_CALLBACK(account_removed_cb), NULL); |
| 216 |
212 |
| 217 g_hash_table_destroy(auto_reconns); |
213 g_hash_table_destroy(auto_reconns); |
| 218 } |
214 } |