[evolution/account-mgmt: 50/52] Adapt vcard-inline plugin to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 50/52] Adapt vcard-inline plugin to the new ESource API.
- Date: Tue, 20 Mar 2012 20:38:34 +0000 (UTC)
commit cec18533aa2db562e6ae7d9286c672d74ab99076
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 28 11:25:50 2011 -0400
Adapt vcard-inline plugin to the new ESource API.
plugins/vcard-inline/vcard-inline.c | 50 +++++++++++++++++-----------------
1 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index cfe461b..03df702 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -25,14 +25,16 @@
#include <libebook/e-book-client.h>
#include <libebook/e-contact.h>
#include <gtkhtml/gtkhtml-embedded.h>
+#include <libedataserver/e-source-address-book.h>
#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-selector-dialog.h>
-#include "addressbook/gui/merging/eab-contact-merging.h"
-#include "addressbook/gui/widgets/eab-contact-display.h"
-#include "addressbook/util/eab-book-util.h"
-#include "mail/em-format-hook.h"
-#include "mail/em-format-html.h"
+#include <shell/e-shell.h>
+#include <addressbook/gui/merging/eab-contact-merging.h>
+#include <addressbook/gui/widgets/eab-contact-display.h>
+#include <addressbook/util/eab-book-util.h>
+#include <mail/em-format-hook.h>
+#include <mail/em-format-html.h>
#define d(x)
@@ -42,7 +44,6 @@ struct _VCardInlinePObject {
EMFormatHTMLPObject object;
GSList *contact_list;
- ESourceList *source_list;
GtkWidget *contact_display;
GtkWidget *message_label;
};
@@ -70,11 +71,6 @@ org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object)
e_client_util_free_object_slist (vcard_object->contact_list);
vcard_object->contact_list = NULL;
- if (vcard_object->source_list != NULL) {
- g_object_unref (vcard_object->source_list);
- vcard_object->source_list = NULL;
- }
-
if (vcard_object->contact_display != NULL) {
g_object_unref (vcard_object->contact_display);
vcard_object->contact_display = NULL;
@@ -123,8 +119,10 @@ org_gnome_vcard_inline_client_loaded_cb (ESource *source,
GAsyncResult *result,
GSList *contact_list)
{
+ EShell *shell;
EClient *client = NULL;
EBookClient *book_client;
+ ESourceRegistry *registry;
GSList *iter;
GError *error = NULL;
@@ -143,11 +141,15 @@ org_gnome_vcard_inline_client_loaded_cb (ESource *source,
book_client = E_BOOK_CLIENT (client);
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+
for (iter = contact_list; iter != NULL; iter = iter->next) {
EContact *contact;
contact = E_CONTACT (iter->data);
- eab_merging_book_add_contact (book_client, contact, NULL, NULL);
+ eab_merging_book_add_contact (
+ registry, book_client, contact, NULL, NULL);
}
g_object_unref (client);
@@ -159,13 +161,18 @@ org_gnome_vcard_inline_client_loaded_cb (ESource *source,
static void
org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
{
+ EShell *shell;
ESource *source;
+ ESourceRegistry *registry;
GSList *contact_list;
+ const gchar *extension_name;
GtkWidget *dialog;
- g_return_if_fail (vcard_object->source_list != NULL);
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
- dialog = e_source_selector_dialog_new (NULL, vcard_object->source_list);
+ dialog = e_source_selector_dialog_new (NULL, registry, extension_name);
e_source_selector_dialog_select_default_source (
E_SOURCE_SELECTOR_DIALOG (dialog));
@@ -185,9 +192,9 @@ org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
contact_list = e_client_util_copy_object_slist (NULL, vcard_object->contact_list);
e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE,
- NULL, e_client_utils_authenticate_handler, NULL,
- (GAsyncReadyCallback) org_gnome_vcard_inline_client_loaded_cb,
+ source, E_CLIENT_SOURCE_TYPE_CONTACTS,
+ FALSE, NULL, (GAsyncReadyCallback)
+ org_gnome_vcard_inline_client_loaded_cb,
contact_list);
}
@@ -301,12 +308,7 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
widget = gtk_button_new_with_label (_("Save in Address Book"));
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
- /* This depends on having a source list. */
- if (vcard_object->source_list != NULL)
- gtk_widget_show (widget);
- else
- gtk_widget_hide (widget);
+ gtk_widget_show (widget);
g_signal_connect_swapped (
widget, "clicked",
@@ -340,8 +342,6 @@ org_gnome_vcard_inline_format (gpointer ep,
vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
org_gnome_vcard_inline_decode (vcard_object, target->part);
- e_book_client_get_sources (&vcard_object->source_list, NULL);
-
content = g_strdup_printf ("<object classid=%s></object>", classid);
camel_stream_write_string (target->stream, content, NULL, NULL);
g_free (content);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]