]> git.sur5r.net Git - glabels/commitdiff
2007-10-09 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Wed, 10 Oct 2007 02:15:17 +0000 (02:15 +0000)
committerJim Evins <evins@snaught.com>
Wed, 10 Oct 2007 02:15:17 +0000 (02:15 +0000)
* src/merge-evolution.c:
Create address book if it does not exist.  Also, be more robust about handling
error conditions -- don't just assume GError has been set.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@677 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/src/merge-evolution.c

index e0dac1404a19d9cd0ccd8b50342795b27705ffc4..8f80daacee2876132074f87bd4962d9e3635d969 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-09  Jim Evins  <evins@snaught.com>
+
+       * src/merge-evolution.c:
+               Create address book if it does not exist.  Also, be more robust about handling
+               error conditions -- don't just assume GError has been set.
+
 2007-10-08  Jim Evins  <evins@snaught.com>
 
        * libglabels/template.c:
index 78c66fc532b26b5f1802575292fec9e0d381d783..cf5d283ec6e4d152abad9acbfc06590c6cc0c089 100644 (file)
@@ -267,7 +267,7 @@ gl_merge_evolution_open (glMerge *merge)
         gboolean status;
         GList *fields, *iter;
         EContactField *field_id;
-        GError *error;
+        GError *error = NULL;
 
         gl_debug (DEBUG_MERGE, "BEGIN");
 
@@ -281,15 +281,23 @@ gl_merge_evolution_open (glMerge *merge)
 
         merge_evolution->priv->book = e_book_new_system_addressbook(&error);
         if (!merge_evolution->priv->book) {
-                g_warning (_("Couldn't open addressbook: %s"), error->message);
+                g_warning (_("Couldn't open addressbook."));
+                if (error)
+                {
+                        g_warning ("e_book_new_system_addressbook: %s", error->message);
+                        g_error_free (error);
+                }
                 e_book_query_unref(query);
-                g_error_free (error);
                 return;
         }
 
-        if (!e_book_open(merge_evolution->priv->book, TRUE, &error)) {
-                g_warning (_("Couldn't open addressbook: %s"), error->message);
-                g_error_free (error);
+        if (!e_book_open(merge_evolution->priv->book, FALSE, &error)) {
+                g_warning (_("Couldn't open addressbook."));
+                if (error)
+                {
+                        g_warning ("e_book_open: %s", error->message);
+                        g_error_free (error);
+                }
                 e_book_query_unref(query);
                 g_object_unref(merge_evolution->priv->book);
                 merge_evolution->priv->book = NULL;
@@ -297,11 +305,14 @@ gl_merge_evolution_open (glMerge *merge)
         }
 
         /* fetch the list of fields supported by this address book */
-        status = e_book_get_supported_fields(merge_evolution->priv->book,
-                                                                                 &fields, &error);
+        status = e_book_get_supported_fields(merge_evolution->priv->book, &fields, &error);
         if (status == FALSE) {
-                g_warning (_("Couldn't list available fields: %s"), error->message);
-                g_error_free (error);
+                g_warning (_("Couldn't list available fields."));
+                if (error)
+                {
+                        g_warning ("e_book_get_supported_fields: %s", error->message);
+                        g_error_free (error);
+                }
                 e_book_query_unref(query);
                 g_object_unref(merge_evolution->priv->book);
                 merge_evolution->priv->book = NULL;
@@ -332,8 +343,12 @@ gl_merge_evolution_open (glMerge *merge)
                                       &merge_evolution->priv->contacts,
                                       &error);
         if (status == FALSE) {
-                g_warning (_("Couldn't get contacts: %s"), error->message);
-                g_error_free (error);
+                g_warning (_("Couldn't get contacts."));
+                if (error)
+                {
+                        g_warning ("e_book_get_contacts: %s", error->message);
+                        g_error_free (error);
+                }
                 e_book_query_unref(query);
                 free_field_list(merge_evolution->priv->fields);
                 g_object_unref(merge_evolution->priv->book);