summaryrefslogtreecommitdiffstats
path: root/sync/src
diff options
context:
space:
mode:
Diffstat (limited to 'sync/src')
-rw-r--r--sync/src/sync_collection.c35
-rw-r--r--sync/src/sync_main.c24
2 files changed, 36 insertions, 23 deletions
diff --git a/sync/src/sync_collection.c b/sync/src/sync_collection.c
index 27a1e15..f9dddca 100644
--- a/sync/src/sync_collection.c
+++ b/sync/src/sync_collection.c
@@ -30,6 +30,7 @@ typedef struct {
struct _SyncCollectionPrivate
{
GList *groups;
+ GList *current_group;
gboolean started;
gdouble progress;
@@ -208,10 +209,11 @@ sync_collection_conflict_cb (SyncGroup *group, SyncCollection *collection)
}
static void
-sync_collection_finished (SyncCollection *collection)
+sync_collection_finished_cb (SyncGroup *group, SyncCollection *collection)
{
SyncCollectionPrivate *priv = COLLECTION_PRIVATE (collection);
+ g_debug ("Group in collection finished syncing");
priv->num_finished ++;
if (priv->num_finished == priv->num_groups) {
GList *c;
@@ -247,17 +249,20 @@ sync_collection_finished (SyncCollection *collection)
g_signal_emit (collection, signals[FAILED], 0, error);
g_free (error);
}
+ } else {
+ SyncCollectionGroup *col_group;
+ priv->current_group = priv->current_group->next;
+ col_group = (SyncCollectionGroup *)priv->current_group->data;
+ if (!sync_group_start (col_group->group)) {
+ col_group->error = g_strdup (
+ "Error starting synchronisation");
+ sync_collection_finished_cb (col_group->group,
+ collection);
+ }
}
}
static void
-sync_collection_finished_cb (SyncGroup *group, SyncCollection *collection)
-{
- g_debug ("Group in collection finished syncing");
- sync_collection_finished (collection);
-}
-
-static void
sync_collection_failed_cb (SyncGroup *group, const gchar *error,
SyncCollection *collection)
{
@@ -267,7 +272,7 @@ sync_collection_failed_cb (SyncGroup *group, const gchar *error,
sync_collection_find_func))->data);
col_group->error = g_strdup (error);
- sync_collection_finished (collection);
+ sync_collection_finished_cb (col_group->group, collection);
}
static SyncCollectionGroup *
@@ -343,12 +348,14 @@ gboolean
sync_collection_start (SyncCollection *collection)
{
SyncCollectionPrivate *priv = COLLECTION_PRIVATE (collection);
- gboolean success = TRUE;
- g_list_foreach (priv->groups,
- sync_collection_start_func, &success);
-
- return success;
+ if (priv->groups) {
+ SyncCollectionGroup *col_group = (SyncCollectionGroup *)
+ priv->groups->data;
+ priv->current_group = priv->groups;
+ return sync_group_start (col_group->group);
+ } else
+ return FALSE;
}
gboolean
diff --git a/sync/src/sync_main.c b/sync/src/sync_main.c
index e60d2c1..5640d76 100644
--- a/sync/src/sync_main.c
+++ b/sync/src/sync_main.c
@@ -144,10 +144,16 @@ sync_finished_cb (SyncCollection *collection, SyncData *data)
static void
sync_failed_cb (SyncCollection *collection, const gchar *error, SyncData *data)
{
- GtkWidget *widget = glade_xml_get_widget (data->xml, "main_notebook");
+ GtkTextBuffer *buffer;
+ GtkWidget *widget;
+
+ widget = glade_xml_get_widget (data->xml, "main_notebook");
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), TAB_ERROR);
- widget = glade_xml_get_widget (data->xml, "sync_error_label");
- gtk_label_set_text (GTK_LABEL (widget), error);
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (
+ glade_xml_get_widget (data->xml, "sync_error_textview")));
+ gtk_text_buffer_set_text (buffer, error, -1);
+
g_source_remove (data->animate_id);
sync_collection_remove_all (collection);
}
@@ -186,7 +192,7 @@ sync_item_activated_cb (GtkIconView *iconview, GtkTreePath *arg1,
g_free (path);
/* Contacts SyncML item */
-/* item = sync_syncml_item_new ("Server",
+ item = sync_syncml_item_new ("Server",
"http://localhost:8080",
CONTACTS, "", "", "card");
group = sync_group_new_with_items (
@@ -194,11 +200,11 @@ sync_item_activated_cb (GtkIconView *iconview, GtkTreePath *arg1,
sync_collection_add_group (data->collection,
group);
g_object_unref (group);
- g_object_unref (item);*/
+ g_object_unref (item);
/* Events SyncML item */
item = sync_syncml_item_new ("Server",
- "http://localhost:14369",
+ "http://localhost:8080",
EVENTS, "", "", "cal");
group = sync_group_new_with_items (
item2, item);
@@ -208,7 +214,7 @@ sync_item_activated_cb (GtkIconView *iconview, GtkTreePath *arg1,
g_object_unref (item);
/* Todo SyncML item */
-/* item = sync_syncml_item_new ("Server",
+ item = sync_syncml_item_new ("Server",
"http://localhost:8080",
TODO, "", "", "cal");
group = sync_group_new_with_items (
@@ -216,7 +222,7 @@ sync_item_activated_cb (GtkIconView *iconview, GtkTreePath *arg1,
sync_collection_add_group (data->collection,
group);
g_object_unref (group);
- g_object_unref (item);*/
+ g_object_unref (item);
/* TODO: Check if notes sync works? */
g_object_unref (item2);
@@ -430,7 +436,7 @@ main (int argc, char **argv)
/* Create and start server */
server_item = sync_syncml_server_item_new ("Server", "", "",
- 14369, "card", "cal", "note");
+ 8080, "card", "cal", "note");
data.server_group = sync_group_new_with_items (
server_item, data.local_item);
g_object_unref (server_item);