Imported Upstream version 1.1.0.99.1
[platform/upstream/syncevolution.git] / src / dbus / syncevo-session.h
1 /*
2  * Copyright (C) 2009 Intel Corporation
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) version 3.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301  USA
18  */
19
20 #ifndef __SYNCEVO_SESSION_H__
21 #define __SYNCEVO_SESSION_H__
22
23 #include <glib-object.h>
24 #include "syncevo-dbus-types.h"
25
26 G_BEGIN_DECLS 
27
28 enum SyncevoSessionError{
29     SYNCEVO_SESSION_ERROR_NO_DBUS_OBJECT = 1,
30 };
31
32 #define SYNCEVO_SESSION_DBUS_SERVICE "org.syncevolution"
33 #define SYNCEVO_SESSION_DBUS_INTERFACE "org.syncevolution.Session"
34
35 #define SYNCEVO_TYPE_SESSION (syncevo_session_get_type ())
36 #define SYNCEVO_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SYNCEVO_TYPE_SESSION, SyncevoSession))
37 #define SYNCEVO_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SYNCEVO_TYPE_SESSION))
38
39 typedef struct _SyncevoSession {
40     GObject parent_object;
41 } SyncevoSession;
42
43 typedef struct _SyncevoSessionClass {
44     GObjectClass parent_class;
45
46     void (*status_changed) (SyncevoSession *session,
47                             SyncevoSessionStatus status,
48                             guint error_code,
49                             SyncevoSourceStatuses *source_statuses);
50
51     void (*progress_changed) (SyncevoSession *session,
52                               int progress,
53                               SyncevoSourceProgresses *source_progresses);
54
55 } SyncevoSessionClass;
56
57 GType syncevo_session_get_type (void);
58
59 typedef void (*SyncevoSessionGenericCb) (SyncevoSession *session,
60                                          GError *error,
61                                          gpointer userdata);
62
63 typedef void (*SyncevoSessionGetConfigNameCb) (SyncevoSession *session,
64                                                char *name,
65                                                GError *error,
66                                                gpointer userdata);
67 void syncevo_session_get_config_name (SyncevoSession *session,
68                                       SyncevoSessionGetConfigNameCb callback,
69                                       gpointer userdata);
70
71 typedef void (*SyncevoSessionGetConfigCb) (SyncevoSession *session,
72                                            SyncevoConfig *config,
73                                            GError *error,
74                                            gpointer userdata);
75 void syncevo_session_get_config (SyncevoSession *session,
76                                  gboolean template,
77                                  SyncevoSessionGetConfigCb callback,
78                                  gpointer userdata);
79
80 void syncevo_session_set_config (SyncevoSession *session,
81                                  gboolean update,
82                                  gboolean temporary,
83                                  SyncevoConfig *config,
84                                  SyncevoSessionGenericCb callback,
85                                  gpointer userdata);
86
87 typedef void (*SyncevoSessionGetReportsCb) (SyncevoSession *session,
88                                             SyncevoReports *reports,
89                                             GError *error,
90                                             gpointer userdata);
91 void syncevo_session_get_reports (SyncevoSession *session,
92                                   guint start,
93                                   guint count,
94                                   SyncevoSessionGetReportsCb callback,
95                                   gpointer userdata);
96
97 void syncevo_session_sync (SyncevoSession *session,
98                            SyncevoSyncMode mode,
99                            SyncevoSourceModes *source_modes,
100                            SyncevoSessionGenericCb callback,
101                            gpointer userdata);
102
103 void syncevo_session_abort (SyncevoSession *session,
104                             SyncevoSessionGenericCb callback,
105                             gpointer userdata);
106
107 void syncevo_session_suspend (SyncevoSession *session,
108                               SyncevoSessionGenericCb callback,
109                               gpointer userdata);
110
111 typedef void (*SyncevoSessionGetStatusCb) (SyncevoSession *session,
112                                            SyncevoSessionStatus status,
113                                            guint error_code,
114                                            SyncevoSourceStatuses *source_statuses,
115                                            GError *error,
116                                            gpointer userdata);
117 void syncevo_session_get_status (SyncevoSession *session,
118                                  SyncevoSessionGetStatusCb callback,
119                                  gpointer userdata);
120
121 typedef void (*SyncevoSessionGetProgressCb) (SyncevoSession *session,
122                                              guint progress,
123                                              SyncevoSourceProgresses *source_progresses,
124                                              GError *error,
125                                              gpointer userdata);
126 void syncevo_session_get_progress (SyncevoSession *session,
127                                    SyncevoSessionGetProgressCb callback,
128                                    gpointer userdata);
129
130 void syncevo_session_check_source (SyncevoSession *session,
131                                    const char *source,
132                                    SyncevoSessionGenericCb callback,
133                                    gpointer userdata);
134
135 void syncevo_session_restore (SyncevoSession *session,
136                               const char *backup_dir,
137                               const gboolean before,
138                               const char **sources,
139                               SyncevoSessionGenericCb callback,
140                               gpointer userdata);
141
142 const char *syncevo_session_get_path (SyncevoSession *session);
143
144 SyncevoSession *syncevo_session_new (const char *path);
145
146 G_END_DECLS
147
148 #endif