2 * empathy-accounts-plugin.c
4 * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "empathy-accounts-plugin.h"
25 #include "empathy-accounts-plugin-widget.h"
27 G_DEFINE_TYPE (EmpathyAccountsPlugin, empathy_accounts_plugin, AP_TYPE_PLUGIN)
30 widget_done_cb (EmpathyAccountsPluginWidget *widget,
33 ap_plugin_emit_finished (plugin);
37 empathy_accounts_plugin_build_widget (ApPlugin *plugin)
41 widget = empathy_accounts_plugin_widget_new (ap_plugin_get_account (plugin));
43 g_signal_connect (widget, "done",
44 G_CALLBACK (widget_done_cb), plugin);
50 store_delete_cb (AgAccount *account,
54 GSimpleAsyncResult *result = user_data;
58 g_debug ("Failed to delete account with ID '%u': %s",
59 account->id, error->message);
61 g_simple_async_result_set_from_error (result, error);
64 g_simple_async_result_complete (result);
65 g_object_unref (result);
69 empathy_accounts_plugin_delete_account (ApPlugin *plugin,
70 GAsyncReadyCallback callback,
74 GSimpleAsyncResult *result;
76 result = g_simple_async_result_new (G_OBJECT (plugin),
77 callback, user_data, ap_plugin_delete_account);
79 account = ap_plugin_get_account (plugin);
81 ag_account_delete (account);
82 ag_account_store (account, store_delete_cb, result);
86 empathy_accounts_plugin_act_headless (ApPlugin *plugin)
91 empathy_accounts_plugin_class_init (
92 EmpathyAccountsPluginClass *klass)
94 ApPluginClass *pclass = AP_PLUGIN_CLASS (klass);
96 pclass->build_widget = empathy_accounts_plugin_build_widget;
97 pclass->delete_account = empathy_accounts_plugin_delete_account;
98 pclass->act_headless = empathy_accounts_plugin_act_headless;
102 empathy_accounts_plugin_init (EmpathyAccountsPlugin *self)
107 ap_module_get_object_type (void)
109 return EMPATHY_TYPE_ACCOUNTS_PLUGIN;