aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/publish-calendar/publish-calendar.c
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2006-01-25 15:29:18 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2006-01-25 15:29:18 +0800
commitdbfb80ad80a6cdbf624582a8f154a12227b3459b (patch)
tree9399a52e57e9fa60810dbe733c3737de68541db5 /plugins/publish-calendar/publish-calendar.c
parent49477d1708a89e9fc2d939b54b894d69624e8d0f (diff)
downloadgsoc2013-evolution-dbfb80ad80a6cdbf624582a8f154a12227b3459b.tar.gz
gsoc2013-evolution-dbfb80ad80a6cdbf624582a8f154a12227b3459b.tar.zst
gsoc2013-evolution-dbfb80ad80a6cdbf624582a8f154a12227b3459b.zip
Fixes #328224, 328408, 328389
svn path=/trunk/; revision=31303
Diffstat (limited to 'plugins/publish-calendar/publish-calendar.c')
-rw-r--r--plugins/publish-calendar/publish-calendar.c81
1 files changed, 56 insertions, 25 deletions
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index 8e2962da4c..9ca1713ea2 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -47,6 +47,20 @@ void online_state_changed (EPlugin *ep, ESEventTargetState *target);
void publish_calendar_context_activate (EPlugin *ep, ECalPopupTargetSource *target);
GtkWidget *publish_calendar_locations (EPlugin *epl, EConfigHookItemFactoryData *data);
static void update_timestamp (EPublishUri *uri);
+static void publish (EPublishUri *uri);
+
+static void
+publish_uri_async (EPublishUri *uri)
+{
+ GThread *thread = NULL;
+ GError *error = NULL;
+
+ thread = g_thread_create ((GThreadFunc) publish, uri, FALSE, &error);
+ if (!thread) {
+ g_warning (G_STRLOC ": %s", error->message);
+ g_error_free (error);
+ }
+}
static void
publish (EPublishUri *uri)
@@ -304,7 +318,7 @@ url_add_clicked (GtkButton *button, PublishUIData *ui)
url_list_changed (ui);
publish_uris = g_slist_prepend (publish_uris, uri);
add_timeout (uri);
- publish (uri);
+ publish_uri_async (uri);
} else {
g_free (uri);
}
@@ -338,7 +352,7 @@ url_edit_clicked (GtkButton *button, PublishUIData *ui)
g_source_remove (id);
add_timeout (uri);
url_list_changed (ui);
- publish (uri);
+ publish_uri_async (uri);
}
}
@@ -450,6 +464,9 @@ publish_calendar_locations (EPlugin *epl, EConfigHookItemFactoryData *data)
ui->treeview = glade_xml_get_widget (xml, "url list");
if (store == NULL)
store = gtk_list_store_new (URL_LIST_N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
+ else
+ gtk_list_store_clear (store);
+
gtk_tree_view_set_model (GTK_TREE_VIEW (ui->treeview), GTK_TREE_MODEL (store));
renderer = gtk_cell_renderer_toggle_new ();
@@ -530,39 +547,53 @@ action_publish (EPlugin *ep, ECalMenuTargetSelect *t)
}
-int
-e_plugin_lib_enable (EPlugin *ep, int enable)
+static void
+publish_uris_set_timeout (GSList *uris)
{
- GSList *uris, *l;
- GConfClient *client;
+ GSList *l;
- if (enable) {
- client = gconf_client_get_default ();
- uris = gconf_client_get_list (client, "/apps/evolution/calendar/publish/uris", GCONF_VALUE_STRING, NULL);
+ uri_timeouts = g_hash_table_new (g_direct_hash, g_direct_equal);
+ l = uris;
- uri_timeouts = g_hash_table_new (g_direct_hash, g_direct_equal);
+ while (l) {
+ gchar *xml = l->data;
- l = uris;
- while (l) {
- gchar *xml = l->data;
+ EPublishUri *uri = e_publish_uri_from_xml (xml);
- EPublishUri *uri = e_publish_uri_from_xml (xml);
+ if (!uri->location) {
+ g_free (uri);
+ continue;
+ }
- if (!uri->location) {
- g_free (uri);
- continue;
- }
+ publish_uris = g_slist_prepend (publish_uris, uri);
- publish_uris = g_slist_prepend (publish_uris, uri);
+ /* Add a timeout based on the last publish time */
+ add_offset_timeout (uri);
- /* Add a timeout based on the last publish time */
- add_offset_timeout (uri);
+ l = g_slist_next (l);
+ }
+ g_slist_foreach (uris, (GFunc) g_free, NULL);
+ g_slist_free (uris);
+}
+
+int
+e_plugin_lib_enable (EPlugin *ep, int enable)
+{
+ GSList *uris;
+ GConfClient *client;
+
+ if (enable) {
+ GThread *thread = NULL;
+ GError *error = NULL;
- l = g_slist_next (l);
- }
- g_slist_foreach (uris, (GFunc) g_free, NULL);
- g_slist_free (uris);
+ client = gconf_client_get_default ();
+ uris = gconf_client_get_list (client, "/apps/evolution/calendar/publish/uris", GCONF_VALUE_STRING, NULL);
+ thread = g_thread_create ((GThreadFunc) publish_uris_set_timeout, uris, FALSE, &error);
+ if (!thread) {
+ g_warning ("Could create thread to set timeout for publishing uris : %s", error->message);
+ g_error_free (error);
+ }
g_object_unref (client);
}