From c1446b213ae0b1f16de23f332789f79ac1b404a0 Mon Sep 17 00:00:00 2001 From: Diego Gonzalez Date: Sat, 6 Aug 2005 17:22:29 +0000 Subject: [PATCH] handle protocol errors from EDS. 2005-08-06 Diego Gonzalez * gnome-about-me.c (about_me_setup_dialog): handle protocol errors from EDS. This make the capplet not crash and fixes bug 312450, but the real problem is on EDS, not here. --- capplets/about-me/ChangeLog | 8 ++++++++ capplets/about-me/gnome-about-me.c | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/capplets/about-me/ChangeLog b/capplets/about-me/ChangeLog index 65eb58d81..84ec1e48d 100644 --- a/capplets/about-me/ChangeLog +++ b/capplets/about-me/ChangeLog @@ -1,3 +1,11 @@ +2005-08-06 Diego Gonzalez + + * gnome-about-me.c (about_me_setup_dialog): handle protocol errors + from EDS. + + This make the capplet not crash and fixes bug 312450, but the real + problem is on EDS, not here. + 2005-08-06 Diego Gonzalez * gnome-about-me-password.c (update_password): change signature and diff --git a/capplets/about-me/gnome-about-me.c b/capplets/about-me/gnome-about-me.c index ef58211a6..99e795cee 100644 --- a/capplets/about-me/gnome-about-me.c +++ b/capplets/about-me/gnome-about-me.c @@ -652,7 +652,7 @@ about_me_passwd_clicked_cb (GtkWidget *button, GnomeAboutMe *me) gnome_about_me_password (GTK_WINDOW (WID ("about-me-dialog"))); } -static void +static gint about_me_setup_dialog (void) { GtkWidget *widget; @@ -702,6 +702,12 @@ about_me_setup_dialog (void) /* Get the self contact */ if (!e_book_get_self (&me->contact, &me->book, &error)) { + if (error->code == E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED) { + about_me_error (NULL, _("There was an error while trying to get the addressbook information\n" \ + "Evolution Data Server can't handle the protocol")); + return -1; + } + me->create_self = TRUE; me->contact = e_contact_new (); @@ -731,7 +737,7 @@ about_me_setup_dialog (void) if (pwent == NULL) { about_me_error (GTK_WINDOW (WID ("about-me-dialog")), _("Unknown login ID, the user database might be corrupted")); - return ; + return -1; } gchar **tok; tok = g_strsplit (pwent->pw_gecos, ",", 0); @@ -783,6 +789,8 @@ about_me_setup_dialog (void) about_me_load_info (me); gtk_widget_show_all (main_dialog); + + return 0; } int @@ -797,8 +805,11 @@ main (int argc, char **argv) GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, NULL); - about_me_setup_dialog (); - gtk_main (); + if (about_me_setup_dialog () == -1) { + return -1; + } else { + gtk_main (); + } return 0; }