diff options
-rw-r--r-- | sync/ChangeLog | 13 | ||||
-rw-r--r-- | sync/data/sync.glade | 65 | ||||
-rw-r--r-- | sync/src/sync_collection.c | 35 | ||||
-rw-r--r-- | sync/src/sync_main.c | 24 |
4 files changed, 88 insertions, 49 deletions
diff --git a/sync/ChangeLog b/sync/ChangeLog index 9038bb1..a1d0120 100644 --- a/sync/ChangeLog +++ b/sync/ChangeLog @@ -1,5 +1,18 @@ 2006-12-19 Chris Lord <chris@openedhand.com> + * data/sync.glade: + Replace the error label with an error text-view + + * src/sync_collection.c: (sync_collection_conflict_cb), + (sync_collection_finished_cb), (sync_collection_failed_cb), + (sync_collection_get_groups), (sync_collection_start): + Make SyncCollection work serially + + * src/sync_main.c: (sync_item_activated_cb), (main): + Enable all three SyncML sync-types, now that they execute serially + +2006-12-19 Chris Lord <chris@openedhand.com> + * src/sync_collection.c: (sync_collection_class_init): Fix conflict signal (I think?) diff --git a/sync/data/sync.glade b/sync/data/sync.glade index fd18ec7..d6d6fb3 100644 --- a/sync/data/sync.glade +++ b/sync/data/sync.glade @@ -955,32 +955,6 @@ </child> <child> - <widget class="GtkLabel" id="sync_error_label"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - - <child> <widget class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="label" translatable="yes"><big><b>A synchronisation error occurred</b></big></property> @@ -1025,6 +999,45 @@ <property name="x_options">fill</property> </packing> </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTextView" id="sync_error_textview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="overwrite">False</property> + <property name="accepts_tab">False</property> + <property name="justification">GTK_JUSTIFY_LEFT</property> + <property name="wrap_mode">GTK_WRAP_WORD</property> + <property name="cursor_visible">False</property> + <property name="pixels_above_lines">0</property> + <property name="pixels_below_lines">0</property> + <property name="pixels_inside_wrap">0</property> + <property name="left_margin">0</property> + <property name="right_margin">0</property> + <property name="indent">0</property> + <property name="text" translatable="yes"></property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> </widget> <packing> <property name="tab_expand">True</property> 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); |