** Fix for bug #551805
authorMilan Crha <mcrha@redhat.com>
Thu, 11 Sep 2008 16:02:40 +0000 (16:02 +0000)
committerMilan Crha <mcrha@src.gnome.org>
Thu, 11 Sep 2008 16:02:40 +0000 (16:02 +0000)
2008-09-11  Milan Crha  <mcrha@redhat.com>

** Fix for bug #551805

* backends/google/e-cal-backend-google-utils.c:
(e_cal_backend_google_utils_create_cache):
Create new timeout source only when none set yet.
* backends/google/e-cal-backend-google-utils.h:
* backends/google/e-cal-backend-google-utils.c:
(e_cal_backend_google_utils_update): Honour function prototype.
* backends/google/e-cal-backend-google-utils.c:
(e_cal_backend_google_utils_connect): Honour return data type.
* backends/google/e-cal-backend-google.h:
* backends/google/e-cal-backend-google.c:
(struct _ECalBackendGooglePrivate),
(e_cal_backend_google_set_timeout_id),
(e_cal_backend_google_get_timeout_id): Honour return data type.

svn path=/trunk/; revision=9523

calendar/ChangeLog
calendar/backends/google/e-cal-backend-google-utils.c
calendar/backends/google/e-cal-backend-google-utils.h
calendar/backends/google/e-cal-backend-google.c
calendar/backends/google/e-cal-backend-google.h

index 4288c1c..69ef3ec 100644 (file)
@@ -1,3 +1,21 @@
+2008-09-11  Milan Crha  <mcrha@redhat.com>
+
+       ** Fix for bug #551805
+
+       * backends/google/e-cal-backend-google-utils.c:
+       (e_cal_backend_google_utils_create_cache):
+       Create new timeout source only when none set yet.
+       * backends/google/e-cal-backend-google-utils.h:
+       * backends/google/e-cal-backend-google-utils.c:
+       (e_cal_backend_google_utils_update): Honour function prototype.
+       * backends/google/e-cal-backend-google-utils.c:
+       (e_cal_backend_google_utils_connect): Honour return data type.
+       * backends/google/e-cal-backend-google.h:
+       * backends/google/e-cal-backend-google.c:
+       (struct _ECalBackendGooglePrivate),
+       (e_cal_backend_google_set_timeout_id),
+       (e_cal_backend_google_get_timeout_id): Honour return data type.
+
 2008-09-05  Andre Klapper  <a9016009@gmx.de>
 
        * libedata-cal/e-cal-backend-util.c: 
index 3ad69a6..4810824 100644 (file)
@@ -132,7 +132,6 @@ static gpointer
 e_cal_backend_google_utils_create_cache (ECalBackendGoogle *cbgo)
 {
        ESource *source;
-       guint timeout_id;
        int x;
        const gchar *refresh_interval = NULL;
        ECalBackendCache *cache;
@@ -152,10 +151,14 @@ e_cal_backend_google_utils_create_cache (ECalBackendGoogle *cbgo)
        else
                x = 30;
 
-       timeout_id = g_timeout_add (x * 60000,
-                                 (GSourceFunc) get_deltas_timeout,
-                                 (gpointer)cbgo);
-       e_cal_backend_google_set_timeout_id (cbgo, timeout_id);
+       if (!e_cal_backend_google_get_timeout_id (cbgo)) {
+               guint timeout_id;
+
+               timeout_id = g_timeout_add (x * 60000,
+                                         (GSourceFunc) get_deltas_timeout,
+                                         (gpointer)cbgo);
+               e_cal_backend_google_set_timeout_id (cbgo, timeout_id);
+       }
 
        return GINT_TO_POINTER (GNOME_Evolution_Calendar_Success);
 }
@@ -169,7 +172,7 @@ e_cal_backend_google_utils_create_cache (ECalBackendGoogle *cbgo)
  *
  * Return value: TRUE if update is successful FALSE otherwise .
  **/
-gboolean
+gpointer
 e_cal_backend_google_utils_update (gpointer handle)
 {
        ECalBackendGoogle *cbgo;
@@ -187,9 +190,9 @@ e_cal_backend_google_utils_update (gpointer handle)
        gboolean needs_to_insert = FALSE;
        gchar *uri;
 
-       if (!handle) {
+       if (!handle || !E_IS_CAL_BACKEND_GOOGLE (handle)) {
                g_critical ("\n Invalid handle %s", G_STRLOC);
-               return FALSE;
+               return NULL;
        }
 
        g_static_mutex_lock (&updating);
@@ -264,7 +267,7 @@ e_cal_backend_google_utils_update (gpointer handle)
        }
 
        g_static_mutex_unlock (&updating);
-       return TRUE;
+       return NULL;
 }
 
 ECalBackendSyncStatus
@@ -283,7 +286,7 @@ e_cal_backend_google_utils_connect (ECalBackendGoogle *cbgo)
        GError *error = NULL;
        GThread *thread;
        gchar *username, *password;
-       gint timeout_id;
+       guint timeout_id;
        gboolean mode_changed;
        gchar *uri, *suri;
 
index 73ea8d7..0ecdb97 100644 (file)
@@ -42,7 +42,7 @@ e_go_item_get_entry (EGoItem *item);
 EGoItem *
 e_go_item_from_cal_component (ECalBackendGoogle *cbgo, ECalComponent *comp);
 
-gboolean
+gpointer
 e_cal_backend_google_utils_update (gpointer handle);
 
 GDataEntry *
index f96c66b..a21fc94 100644 (file)
@@ -73,7 +73,7 @@ struct _ECalBackendGooglePrivate {
        CalMode mode;
        EGoItem *item;
 
-       gint timeout_id;
+       guint timeout_id;
        gchar *username;
        gchar *password;
        gchar *uri;
@@ -1544,7 +1544,7 @@ e_cal_backend_google_set_entry (ECalBackendGoogle *cbgo, GDataEntry *entry)
  *
  **/
 void
-e_cal_backend_google_set_timeout_id (ECalBackendGoogle *cbgo,gint timeout_id )
+e_cal_backend_google_set_timeout_id (ECalBackendGoogle *cbgo, guint timeout_id)
 {
        ECalBackendGooglePrivate *priv;
        priv = cbgo->priv;
@@ -1689,7 +1689,7 @@ e_cal_backend_google_get_entry (ECalBackendGoogle *cbgo)
  * Gets the timeout id.
  *
  **/
-gint
+guint
 e_cal_backend_google_get_timeout_id (ECalBackendGoogle *cbgo)
 {
        ECalBackendGooglePrivate *priv;
index b83baeb..89e273f 100644 (file)
@@ -73,7 +73,7 @@ gboolean e_cal_backend_google_get_mode_changed (ECalBackendGoogle *cbgo);
 gchar * e_cal_backend_google_get_username (ECalBackendGoogle *cbgo);
 gchar * e_cal_backend_google_get_password (ECalBackendGoogle *cbgo);
 gchar * e_cal_backend_google_get_local_attachments_store (ECalBackendGoogle *cbgo);
-gint e_cal_backend_google_get_timeout_id (ECalBackendGoogle *cbgo);
+guint e_cal_backend_google_get_timeout_id (ECalBackendGoogle *cbgo);
 
 void e_cal_backend_google_set_entry (ECalBackendGoogle *cbgo, GDataEntry *entry);
 void e_cal_backend_google_set_cache (ECalBackendGoogle *cbgo, ECalBackendCache *cache);
@@ -84,7 +84,7 @@ void e_cal_backend_google_set_item (ECalBackendGoogle *cbgo, EGoItem *item);
 void e_cal_backend_google_set_mode_changed (ECalBackendGoogle *cbgo, gboolean mode_changed);
 void e_cal_backend_google_set_username (ECalBackendGoogle *cbgo, gchar *username);
 void e_cal_backend_google_set_password (ECalBackendGoogle *cbgo, gchar *password);
-void e_cal_backend_google_set_timeout_id (ECalBackendGoogle *cbgo,gint timeout_id);
+void e_cal_backend_google_set_timeout_id (ECalBackendGoogle *cbgo, guint timeout_id);
 
 G_END_DECLS
 #endif