From 0be9b1f878c2f54a0c7f2f5024125813022d81b1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 20 Apr 2011 19:06:35 -0400 Subject: Adapt to CamelService changes. --- plugins/groupwise-features/install-shared.c | 30 ++++++++++------- plugins/groupwise-features/proxy-login.c | 13 ++++++-- plugins/groupwise-features/proxy-login.h | 2 +- plugins/groupwise-features/proxy.c | 6 +--- plugins/groupwise-features/share-folder-common.c | 42 ++++++++++++++---------- 5 files changed, 56 insertions(+), 37 deletions(-) (limited to 'plugins/groupwise-features') diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index 969ea0c30d..3899dab95b 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -59,7 +59,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) gchar *parent_name; gchar *container_id; const gchar *item_id; - CamelStore *store; + CamelService *service = NULL; CamelFolder *folder; EAccount *account; CamelProvider *provider; @@ -69,6 +69,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) gtk_widget_destroy (GTK_WIDGET (emfs)); } else { CamelSession *session; + CamelURL *url; EShell *shell; shell = e_shell_get_default (); @@ -91,24 +92,30 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) else parent_name = NULL; } - store = (CamelStore *) camel_session_get_service ( - session, uri, CAMEL_PROVIDER_STORE, NULL); - if (store == NULL) { + + url = camel_url_new (uri, NULL); + if (url != NULL) { + service = camel_session_get_service_by_url ( + session, url); + camel_url_free (url); + } + + if (!CAMEL_IS_STORE (service)) { g_strfreev (names); return; } - cnc = get_cnc (store); + cnc = get_cnc (CAMEL_STORE (service)); if (E_IS_GW_CONNECTION (cnc)) { container_id = get_container_id (cnc, parent_name); if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { - CamelService *service; CamelURL *url; /* FIXME Not passing a GCancellable or GError here. */ folder = camel_store_get_folder_sync ( - store, "Mailbox", 0, NULL, NULL); + CAMEL_STORE (service), + "Mailbox", 0, NULL, NULL); /*changes = camel_folder_change_info_new (); camel_folder_change_info_remove_uid (changes, (gchar *) item_id); camel_folder_summary_remove_uid (folder->summary, item_id);*/ @@ -119,12 +126,12 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) CAMEL_MESSAGE_DELETED); camel_folder_summary_touch (folder->summary); /* camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", changes); */ - service = CAMEL_SERVICE (store); url = camel_service_get_camel_url (service); uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); account = e_get_account_by_source_url (uri); uri = account->source->url; - em_folder_tree_model_remove_store (model, store); + em_folder_tree_model_remove_store ( + model, CAMEL_STORE (service)); provider = camel_provider_get (uri, NULL); if (provider == NULL) { g_strfreev (names); @@ -137,8 +144,9 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) return; } - em_folder_tree_model_add_store (model, store, account->name); - g_object_unref (store); + em_folder_tree_model_add_store ( + model, CAMEL_STORE (service), + account->name); } } diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 61e32216a4..2559dc2079 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -350,6 +350,8 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) proxy_cnc = e_gw_connection_get_proxy_connection (cnc, user_name, password, email, &permissions); if (proxy_cnc) { + CamelService *service; + parent = camel_url_new (e_account_get_string (srcAccount, E_ACCOUNT_SOURCE_URL), NULL); parent_source_url = camel_url_to_string (parent, CAMEL_URL_HIDE_PASSWORD); uri = camel_url_copy (parent); @@ -367,7 +369,12 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) e_account_list_change (accounts, srcAccount); e_account_list_save (accounts); g_object_set_data ((GObject *)dstAccount, "permissions", GINT_TO_POINTER(permissions)); - mail_get_store (session, e_account_get_string (dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); + + service = camel_session_get_service ( + CAMEL_SESSION (session), dstAccount->uid); + if (CAMEL_IS_STORE (service)) + proxy_login_add_new_store ( + CAMEL_STORE (service), dstAccount); g_free (proxy_source_url); g_free (parent_source_url); @@ -386,12 +393,12 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) } static void -proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) +proxy_login_add_new_store (CamelStore *store, + EAccount *account) { EShell *shell; EShellBackend *shell_backend; EMailSession *session; - EAccount *account = user_data; gint permissions = GPOINTER_TO_INT(g_object_get_data ((GObject *)account, "permissions")); shell = e_shell_get_default (); diff --git a/plugins/groupwise-features/proxy-login.h b/plugins/groupwise-features/proxy-login.h index 3c4ba8c392..496e0cb1c1 100644 --- a/plugins/groupwise-features/proxy-login.h +++ b/plugins/groupwise-features/proxy-login.h @@ -52,7 +52,7 @@ struct _proxyLoginClass { GType proxy_login_get_type (void); proxyLogin * proxy_login_new (void); -static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data); +static void proxy_login_add_new_store (CamelStore *store, EAccount *account); static void proxy_login_setup_tree_view (void); proxyLogin* proxy_dialog_new (void); static void proxy_soap_login (gchar *email, GtkWindow *error_parent); diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index 555d3f716b..849d4ea3d4 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -658,9 +658,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) g_object_ref (account); store = (CamelOfflineStore *) camel_session_get_service ( - CAMEL_SESSION (session), - e_account_get_string (account, E_ACCOUNT_SOURCE_URL), - CAMEL_PROVIDER_STORE, NULL); + CAMEL_SESSION (session), account->uid); if (store == NULL) return NULL; @@ -724,8 +722,6 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) } } - g_object_unref (store); - return NULL; } diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 521bd3a54c..19d46bad0b 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -249,7 +249,8 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) EMFolderSelector *emfs = ssi->emfs; const gchar *uri, *path; EMailSession *session; - CamelStore *store; + CamelService *service = NULL; + CamelURL *url; if (response != GTK_RESPONSE_OK) { gtk_widget_destroy ((GtkWidget *) emfs); @@ -263,18 +264,24 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) d(printf ("Creating new folder: %s (%s)\n", path, uri)); - store = (CamelStore *) camel_session_get_service ( - CAMEL_SESSION (session), uri, CAMEL_PROVIDER_STORE, NULL); - if (store == NULL) + url = camel_url_new (uri, NULL); + if (url != NULL) { + service = camel_session_get_service_by_url ( + CAMEL_SESSION (session), url); + camel_url_free (url); + } + + if (!CAMEL_IS_STORE (service)) return; - if (!(si = em_folder_tree_model_lookup_store_info (ssi->model, store))) { + si = em_folder_tree_model_lookup_store_info ( + ssi->model, CAMEL_STORE (service)); + if (si == NULL) { g_assert_not_reached (); - g_object_unref (store); return; } - if (CAMEL_IS_VEE_STORE (store)) { + if (CAMEL_IS_VEE_STORE (service)) { EFilterRule *rule; rule = em_vfolder_rule_new (session); @@ -287,7 +294,6 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) create_folder (si->store, path, new_folder_created_cb, ssi); } - g_object_unref (store); } static void @@ -299,7 +305,8 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m struct ShareInfo *ssi; const gchar *uri; EGwConnection *cnc; - CamelStore *store; + CamelService *service = NULL; + CamelURL *url; ssi = g_new0 (struct ShareInfo, 1); if (response != GTK_RESPONSE_OK) { @@ -309,12 +316,17 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m /* i want store at this point to get cnc not sure proper or not*/ uri = em_folder_selector_get_selected_uri (emfs); - store = (CamelStore *) camel_session_get_service ( - session, uri, CAMEL_PROVIDER_STORE, NULL); - if (store == NULL) + + url = camel_url_new (uri, NULL); + if (url != NULL) { + service = camel_session_get_service_by_url (session, url); + camel_url_free (url); + } + + if (!CAMEL_IS_STORE (service)) return; - cnc = get_cnc (store); + cnc = get_cnc (CAMEL_STORE (service)); users_dialog = gtk_dialog_new_with_buttons ( _("Users"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); w = gtk_label_new_with_mnemonic (_("Enter the users and set permissions")); @@ -330,10 +342,6 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m gtk_window_resize (GTK_WINDOW (users_dialog), 350, 300); gtk_widget_show (users_dialog); g_signal_connect (users_dialog, "response", G_CALLBACK (users_dialog_response), ssi); - - g_object_unref (store); - return; - } void -- cgit v1.2.3