diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-12-17 12:23:36 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-12-17 12:23:36 +0800 |
commit | 216085f3c1c253bb9c3418af484ff571c8111414 (patch) | |
tree | a75ab1da17079ff8b8aa37d79d052f765ee2c29a /addressbook/gui/component | |
parent | 0a13fd3702b265298268ece517c3c99e519c7b79 (diff) | |
download | gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar.gz gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar.bz2 gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar.lz gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar.xz gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.tar.zst gsoc2013-evolution-216085f3c1c253bb9c3418af484ff571c8111414.zip |
Make a public function that shows an error dialog, which can be used when
2003-12-16 Hans Petter Jansson <hpj@ximian.com>
* gui/component/addressbook.c (addressbook_show_load_error_dialog):
Make a public function that shows an error dialog, which can be used
when a source fails to load.
(book_open_cb): Call addressbook_show_load_error_dialog () on error.
(set_prop): Don't reuse the book when loading a new source. This was
confusing the contact-editor, which gets the book passed in.
* gui/contact-editor/e-contact-editor.c (e_contact_editor_class_init):
Make "source_book" and "target_book" distinct properties.
(new_target_cb): Implement.
(source_selected): Implement.
(contact_moved_cb): Implement.
(contact_added_cb): Handle the case where source_book != target_book as
a move - if the add was successful, remove contact from source book.
(save_contact): Handle case where source_book != target_book.
(delete_cb): "book" renamed to "source_book".
(e_contact_editor_init): Set up source_selected signal.
(e_contact_editor_dispose): Dispose of both source and target books.
(e_contact_editor_new): "book" renamed to "source_book".
(e_contact_editor_set_property): If a source book is set, and we don't
have a target book, make target_book == source_book. Allow setting
target book, and base editability on that. If we're editing an existing
contact, treat book change as a change, and update command state.
(e_contact_editor_get_property): Allow getting target book.
(set_source_field): Indicate the selected book.
svn path=/trunk/; revision=23958
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 129 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.h | 1 |
2 files changed, 68 insertions, 62 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index f415c903e9..7d67f447a2 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -473,6 +473,69 @@ addressbook_view_unref (AddressbookView *view) } } +void +addressbook_show_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status) +{ + char *label_string; + GtkWidget *warning_dialog; + GtkWidget *href = NULL; + gchar *uri; + + g_return_if_fail (source != NULL); + + uri = e_source_get_uri (source); + + if (!strncmp (uri, "file:", 5)) { + label_string = + _("We were unable to open this addressbook. Please check that the\n" + "path exists and that you have permission to access it."); + } + else if (!strncmp (uri, "ldap:", 5)) { + /* special case for ldap: contact folders so we can tell the user about openldap */ +#if HAVE_LDAP + label_string = + _("We were unable to open this addressbook. This either\n" + "means you have entered an incorrect URI, or the LDAP server\n" + "is unreachable."); +#else + label_string = + _("This version of Evolution does not have LDAP support\n" + "compiled in to it. If you want to use LDAP in Evolution\n" + "you must compile the program from the CVS sources after\n" + "retrieving OpenLDAP from the link below.\n"); + href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); +#endif + } else { + /* other network folders */ + label_string = + _("We were unable to open this addressbook. This either\n" + "means you have entered an incorrect URI, or the server\n" + "is unreachable."); + } + + warning_dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_CLOSE, + label_string, + NULL); + + g_signal_connect (warning_dialog, + "response", + G_CALLBACK (gtk_widget_destroy), + warning_dialog); + + gtk_window_set_title (GTK_WINDOW (warning_dialog), _("Unable to open addressbook")); + + if (href) + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), + href, FALSE, FALSE, 0); + + gtk_widget_show_all (warning_dialog); + + g_free (uri); +} + static void book_open_cb (EBook *book, EBookStatus status, gpointer closure) { @@ -486,65 +549,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) view->book = book; } else { - char *label_string; - GtkWidget *warning_dialog; - GtkWidget *href = NULL; - gchar *uri; - view->failed_to_load = TRUE; - - uri = e_source_get_uri (view->source); - - if (!strncmp (uri, "file:", 5)) { - label_string = - _("We were unable to open this addressbook. Please check that the\n" - "path exists and that you have permission to access it."); - } - else if (!strncmp (uri, "ldap:", 5)) { - /* special case for ldap: contact folders so we can tell the user about openldap */ -#if HAVE_LDAP - label_string = - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or the LDAP server\n" - "is unreachable."); -#else - label_string = - _("This version of Evolution does not have LDAP support\n" - "compiled in to it. If you want to use LDAP in Evolution\n" - "you must compile the program from the CVS sources after\n" - "retrieving OpenLDAP from the link below.\n"); - href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); -#endif - } else { - /* other network folders */ - label_string = - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or the server\n" - "is unreachable."); - } - - warning_dialog = gtk_message_dialog_new ( - NULL /* XXX */, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_CLOSE, - label_string, - NULL); - - g_signal_connect (warning_dialog, - "response", - G_CALLBACK (gtk_widget_destroy), - warning_dialog); - - gtk_window_set_title (GTK_WINDOW (warning_dialog), _("Unable to open addressbook")); - - if (href) - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), - href, FALSE, FALSE, 0); - - gtk_widget_show_all (warning_dialog); - - g_free (uri); + addressbook_show_load_error_dialog (NULL /* XXX */, view->source, status); } } @@ -765,13 +771,12 @@ set_prop (BonoboPropertyBag *bag, case PROPERTY_SOURCE_UID_IDX: if (view->book) { - /* we've already had a uri set on this view, so unload it */ - e_book_async_unload_uri (view->book); + g_object_unref (view->book); view->source = NULL; - } else { - view->book = e_book_new (); } + view->book = e_book_new (); + view->failed_to_load = FALSE; uid = BONOBO_ARG_GET_STRING (arg); diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index fb05287133..16395789e2 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -14,6 +14,7 @@ void addressbook_load_uri (EBook *book, const char *uri, EBook #endif void addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure); void addressbook_load_default_book (EBookCallback open_response, gpointer closure); +void addressbook_show_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status); BonoboControl *addressbook_new_control (void); |