static void action_contact_new_list_cb (GtkAction *action, EBookShellView *book_shell_view) { EShell *shell; EShellView *shell_view; EShellWindow *shell_window; EBookShellContent *book_shell_content; EAddressbookView *view; EAddressbookModel *model; EContact *contact; EABEditor *editor; EBookClient *book; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); book_shell_content = book_shell_view->priv->book_shell_content; view = e_book_shell_content_get_current_view (book_shell_content); g_return_if_fail (view != NULL); model = e_addressbook_view_get_model (view); book = e_addressbook_model_get_client (model); g_return_if_fail (book != NULL); contact = e_contact_new (); editor = e_contact_list_editor_new (shell, book, contact, TRUE, TRUE); eab_editor_show (editor); g_object_unref (contact); }
static void map_window_show_contact_editor_cb (EContactMapWindow *window, const gchar *contact_uid, gpointer user_data) { EShell *shell = e_shell_get_default (); EBookShellView *book_shell_view = user_data; EBookShellSidebar *book_shell_sidebar; ESource *source; ESourceSelector *selector; EBookClient *book_client; EContact *contact; EABEditor *editor; GError *error = NULL; book_shell_sidebar = book_shell_view->priv->book_shell_sidebar; selector = e_book_shell_sidebar_get_selector (book_shell_sidebar); source = e_source_selector_get_primary_selection (selector); g_return_if_fail (source != NULL); book_client = e_book_client_new (source, &error); if (error) { g_warning ("Error loading addressbook: %s", error->message); g_error_free (error); if (book_client) g_object_unref (book_client); return; } e_book_client_get_contact_sync (book_client, contact_uid, &contact, NULL, &error); if (error) { g_warning ("Error getting contact from addressbook: %s", error->message); g_error_free (error); g_object_unref (book_client); return; } editor = e_contact_editor_new (shell, book_client, contact, FALSE, TRUE); g_signal_connect (editor, "contact-modified", G_CALLBACK (contact_editor_contact_modified_cb), window); g_signal_connect_swapped (editor, "editor-closed", G_CALLBACK (g_object_unref), editor); eab_editor_show (editor); g_object_unref (book_client); }
static void map_window_show_contact_editor_cb (EContactMapWindow *window, const gchar *contact_uid, gpointer user_data) { EBookShellView *book_shell_view = user_data; EBookShellSidebar *book_shell_sidebar; EShell *shell; EShellView *shell_view; EShellBackend *shell_backend; ESource *source; ESourceSelector *selector; EClient *client; EClientCache *client_cache; EContact *contact; EABEditor *editor; GError *error = NULL; book_shell_sidebar = book_shell_view->priv->book_shell_sidebar; selector = e_book_shell_sidebar_get_selector (book_shell_sidebar); source = e_source_selector_ref_primary_selection (selector); g_return_if_fail (source != NULL); shell_view = E_SHELL_VIEW (book_shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); shell = e_shell_backend_get_shell (shell_backend); client_cache = e_shell_get_client_cache (shell); /* FIXME This blocks. Needs to be asynchronous. */ client = e_client_cache_get_client_sync ( client_cache, source, E_SOURCE_EXTENSION_ADDRESS_BOOK, (guint32) -1, NULL, &error); g_object_unref (source); /* Sanity check. */ g_return_if_fail ( ((client != NULL) && (error == NULL)) || ((client == NULL) && (error != NULL))); if (error != NULL) { g_warning ("Error loading addressbook: %s", error->message); g_error_free (error); return; } e_book_client_get_contact_sync ( E_BOOK_CLIENT (client), contact_uid, &contact, NULL, &error); if (error != NULL) { g_warning ("Error getting contact from addressbook: %s", error->message); g_error_free (error); g_object_unref (client); return; } editor = e_contact_editor_new ( shell, E_BOOK_CLIENT (client), contact, FALSE, TRUE); g_signal_connect ( editor, "contact-modified", G_CALLBACK (contact_editor_contact_modified_cb), window); eab_editor_show (editor); g_object_unref (client); }