Rename package to sharing-twitter-multi (maemo- prefix is unnecessary)
[maemo-sharing-twitter-multi:maemo-sharing-twitter-multi.git] / src / plugin.c
1 /*
2  * This file is part of sharing-twitter-multi
3  *
4  * Copyright (C) 2010 Igalia, S.L.
5  * Authors: Alberto Garcia <agarcia@igalia.com>
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 3 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software. If not, see <http://www.gnu.org/licenses/>
17  */
18
19 #include "twitmulti.h"
20
21 #include <hildon/hildon.h>
22 #include <sharing-plugin-interface.h>
23 #include <curl/curl.h>
24
25 guint
26 sharing_plugin_interface_init           (gboolean *dead_mans_switch)
27 {
28   *dead_mans_switch = FALSE;
29   curl_global_init (CURL_GLOBAL_ALL);
30   return 0;
31 }
32
33 guint
34 sharing_plugin_interface_uninit         (gboolean *dead_mans_switch)
35 {
36   *dead_mans_switch = FALSE;
37   curl_global_cleanup ();
38   return 0;
39 }
40
41 SharingPluginInterfaceSendResult
42 sharing_plugin_interface_send           (SharingTransfer *transfer,
43                                          ConIcConnection *con,
44                                          gboolean        *dead_mans_switch)
45 {
46   return twitmulti_share_file (transfer, con, dead_mans_switch);
47 }
48
49 SharingPluginInterfaceAccountSetupResult
50 sharing_plugin_interface_account_setup  (GtkWindow       *parent,
51                                          SharingService  *service,
52                                          SharingAccount **worked_on,
53                                          osso_context_t  *osso)
54 {
55   if (twitmulti_account_setup (*worked_on, parent))
56     return SHARING_ACCOUNT_SETUP_SUCCESS;
57   else
58     return SHARING_ACCOUNT_SETUP_ERROR_UNKNOWN;
59 }
60
61 SharingPluginInterfaceAccountValidateResult
62 sharing_plugin_interface_account_validate
63                                         (SharingAccount  *account,
64                                          ConIcConnection *con,
65                                          gboolean        *cont,
66                                          gboolean        *dead_mans_switch)
67 {
68   if (twitmulti_account_validate (account, dead_mans_switch))
69     return SHARING_ACCOUNT_VALIDATE_SUCCESS;
70   else
71     return SHARING_ACCOUNT_VALIDATE_ERROR_UNKNOWN;
72 }
73
74 SharingPluginInterfaceEditAccountResult
75 sharing_plugin_interface_edit_account   (GtkWindow       *parent,
76                                          SharingAccount  *account,
77                                          ConIcConnection *con,
78                                          gboolean        *dead_mans_switch)
79 {
80   return twitmulti_account_edit (parent, account, con, dead_mans_switch);
81 }