app: implemented sync action
Useful when the local calendar differs from the remote calendar (i.e. you added an event at Google Calendar).
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
3887951323
commit
2e8b677d6a
@@ -90,6 +90,10 @@ static void on_client_connected (GObject *sour
|
||||
GAsyncResult *result,
|
||||
gpointer user_data);
|
||||
|
||||
static void on_client_refreshed (GObject *source_object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data);
|
||||
|
||||
static void on_event_updated (GObject *source_object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data);
|
||||
@@ -282,6 +286,27 @@ on_client_connected (GObject *source_object,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_client_refreshed (GObject *source_object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
if (e_client_refresh_finish (E_CLIENT (source_object), result, &error))
|
||||
{
|
||||
/* FIXME: add notification to UI */
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: do something when there was some error */
|
||||
g_warning ("Error synchronizing client");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* on_component_updated:
|
||||
* @source_object: {@link ECalClient} source
|
||||
@@ -600,6 +625,35 @@ gcal_manager_get_default_source (GcalManager *manager)
|
||||
return source_uid;
|
||||
}
|
||||
|
||||
void
|
||||
gcal_manager_refresh (GcalManager *manager)
|
||||
{
|
||||
GcalManagerPrivate *priv;
|
||||
GList *clients;
|
||||
GList *l;
|
||||
|
||||
priv = gcal_manager_get_instance_private (manager);
|
||||
clients = g_hash_table_get_values (priv->clients);
|
||||
|
||||
/* refresh clients */
|
||||
for (l = clients; l != NULL; l = l->next)
|
||||
{
|
||||
GcalManagerUnit *unit;
|
||||
|
||||
unit = (GcalManagerUnit*) l->data;
|
||||
|
||||
if (! e_client_check_refresh_supported (E_CLIENT (unit->client)))
|
||||
continue;
|
||||
|
||||
e_client_refresh (E_CLIENT (unit->client),
|
||||
NULL,
|
||||
on_client_refreshed,
|
||||
manager);
|
||||
}
|
||||
|
||||
g_list_free (clients);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gcal_manager_is_client_writable (GcalManager *manager,
|
||||
ESource *source)
|
||||
|
||||
Reference in New Issue
Block a user