[evolution-kolab] EPlugin: removed remaining e_source_get_uri() calls
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] EPlugin: removed remaining e_source_get_uri() calls
- Date: Mon, 30 Jul 2012 14:48:40 +0000 (UTC)
commit 69f45534dcc3f00e1dfb615b720b7b5aec47b923
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Jul 30 16:24:47 2012 +0200
EPlugin: removed remaining e_source_get_uri() calls
* using new ESource infrastructure so we don't need to
deal with the old (and no-longer-existing) ESource
uri strings
* cleansed out code (removed dead/commented code)
src/eplugin/e-kolab-plugin-ui.c | 62 +++++++++-------
src/eplugin/e-kolab-plugin.c | 127 ---------------------------------
src/eplugin/org-gnome-kolab.eplug.xml | 35 ---------
3 files changed, 36 insertions(+), 188 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 4501074..d74422a 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -45,6 +45,7 @@
#include <libekolab/kolab-data-imap-account.h>
#include <libekolab/kolab-util-backend.h>
+#include <libekolab/e-source-kolab-folder.h>
#include <libekolabutil/kolab-util-camel.h>
#include "e-kolab-folder-metadata.h"
@@ -224,9 +225,13 @@ kolab_plugin_ui_get_selected_source (EShellView *shell_view,
ESource **selected_source)
{
ESource *source = NULL;
- gchar *uri = NULL;
EShellSidebar *shell_sidebar = NULL;
ESourceSelector *selector = NULL;
+ ESourceBackend *extension = NULL;
+ const gchar *extension_name = NULL;
+ const gchar *backend_name = NULL;
+
+ gboolean is_kolab = FALSE;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (selected_source == NULL || *selected_source == NULL, FALSE);
@@ -237,15 +242,26 @@ kolab_plugin_ui_get_selected_source (EShellView *shell_view,
g_object_get (shell_sidebar, "selector", &selector, NULL);
g_return_val_if_fail (selector != NULL, FALSE);
- source = e_source_selector_peek_primary_selection (selector);
- uri = source ? e_source_get_uri (source) : NULL;
+ source = e_source_selector_ref_primary_selection (selector);
+ if (source == NULL)
+ goto exit;
+
+ extension_name = e_source_selector_get_extension_name (selector);
+ if (extension_name == NULL)
+ goto exit;
+
+ extension = e_source_get_extension (source, extension_name);
+ if (extension == NULL)
+ goto exit;
+
+ backend_name = e_source_backend_get_backend_name (extension);
+ if (backend_name == NULL)
+ goto exit;
+
/* check whether we have a Kolab ESource selected */
- if (uri && g_str_has_prefix (uri, KOLAB_CAMEL_URI_PREFIX))
- source = g_object_ref (source);
- else
- source = NULL;
+ is_kolab = g_str_has_prefix (backend_name, KOLAB_CAMEL_PROVIDER_PROTOCOL);
- g_free (uri);
+ exit:
g_object_unref (selector);
if (selected_source)
@@ -253,7 +269,7 @@ kolab_plugin_ui_get_selected_source (EShellView *shell_view,
else if (source)
g_object_unref (source);
- return source != NULL;
+ return is_kolab;
}
static gchar*
@@ -295,9 +311,8 @@ kolab_plugin_ui_path_from_pim_view (EShellView *shell_view,
{
gchar *selected_path = NULL;
ESource *source = NULL;
+ ESourceResource *resource = NULL;
gboolean is_source = FALSE;
- gchar *uri = NULL;
- gchar *proto = NULL;
g_assert (E_IS_SHELL_VIEW (shell_view));
@@ -309,28 +324,23 @@ kolab_plugin_ui_path_from_pim_view (EShellView *shell_view,
if (! is_source)
goto exit;
- uri = e_source_get_uri (source);
- if (uri == NULL)
+ if (! e_source_has_extension (source,
+ E_SOURCE_EXTENSION_KOLAB_FOLDER))
goto exit;
- proto = kolab_util_backend_get_protocol_from_uri (uri);
- if (g_strcmp0 (proto, KOLAB_CAMEL_PROVIDER_PROTOCOL) != 0) {
- g_warning ("%s()[%u] got wrong protocol '%s'",
- __func__, __LINE__, proto);
- goto exit;
- }
+ resource = E_SOURCE_RESOURCE (e_source_get_extension (source,
+ E_SOURCE_EXTENSION_KOLAB_FOLDER));
+
+ g_object_get (G_OBJECT (resource),
+ "id",
+ &selected_path,
+ NULL);
- selected_path = kolab_util_backend_get_relative_path_from_uri (uri);
if (selected_path == NULL)
g_warning ("%s()[%u] selected path is NULL", __func__, __LINE__);
*is_kolab_folder_node = TRUE;
exit:
- if (uri != NULL)
- g_free (uri);
- if (proto != NULL)
- g_free (proto);
-
return selected_path;
}
@@ -428,7 +438,7 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
is_source = kolab_plugin_ui_get_selected_source (shell_view,
&source);
if (is_source)
- sourcename = g_strdup (e_source_peek_name (source));
+ sourcename = e_source_dup_uid (source);
}
uidata = kolab_folder_prop_ui_data_new ();
diff --git a/src/eplugin/e-kolab-plugin.c b/src/eplugin/e-kolab-plugin.c
index 0acc2bb..9e0ee2f 100644
--- a/src/eplugin/e-kolab-plugin.c
+++ b/src/eplugin/e-kolab-plugin.c
@@ -53,9 +53,6 @@ e_plugin_lib_enable (EPlugin *epl,
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
*/
- /* TODO error propagation? */
- e_kolab_account_setup_ensure_calendar_source_groups ();
- e_kolab_account_setup_ensure_contacts_source_group ();
g_debug ("%s(): Kolab plugin enabled", __func__);
} else {
g_debug ("%s(): Kolab plugin disabled", __func__);
@@ -78,130 +75,6 @@ e_plugin_lib_enable (EPlugin *epl,
}
/*----------------------------------------------------------------------------*/
-/* calendar backend creation */
-
-gboolean
-e_kolab_plugin_calendar_check (EPlugin *epl,
- EConfigHookPageCheckData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (data != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-
- return TRUE;
-}
-
-void
-e_kolab_plugin_calendar_commit (EPlugin *epl,
- EConfigTarget *target)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (target != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
-
-GtkWidget*
-e_kolab_plugin_calendar_create (EPlugin *epl,
- EConfigHookItemFactoryData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (data != NULL);
-
- e_kolab_account_setup_backend_create (epl,
- data,
- KOLAB_WIDGET_TYPE_CALENDAR);
- return NULL;
-}
-
-/*----------------------------------------------------------------------------*/
-/* addressbook backend creation */
-
-gboolean
-e_kolab_plugin_addressbook_check (EPlugin *epl,
- EConfigHookPageCheckData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (data != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-
- return TRUE;
-}
-
-void
-e_kolab_plugin_addressbook_commit (EPlugin *epl,
- EConfigTarget *target)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (target != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
-
-GtkWidget*
-e_kolab_plugin_addressbook_create (EPlugin *epl,
- EConfigHookItemFactoryData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (data != NULL);
-
- e_kolab_account_setup_backend_create (epl,
- data,
- KOLAB_WIDGET_TYPE_CONTACT);
- return NULL;
-}
-
-/*----------------------------------------------------------------------------*/
-/* mail account setup */
-
-gboolean
-e_kolab_plugin_mail_account_check (EPlugin *epl,
- EConfigHookPageCheckData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (data != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-
- return TRUE;
-}
-
-void
-e_kolab_plugin_mail_account_commit (EPlugin *epl,
- EConfigTarget *target)
-{
- g_assert (E_IS_PLUGIN (epl));
- g_assert (target != NULL);
-
- /* FIXME implement me */
- g_warning ("%s: FIXME implement me", __func__);
-}
-
-GtkWidget*
-e_kolab_plugin_mail_account_setup (EPlugin *epl,
- EConfigHookItemFactoryData *data)
-{
- g_assert (E_IS_PLUGIN (epl));
-
- g_debug ("%s() called.\n", __func__);
- g_debug (" + epl: %p", (void*)epl);
- g_debug (" + data: %p", (void*)data);
-
- /* is NULL on New Account creation, add more stuff here */
- return NULL;
-
- /* more here to be stolen from e-mapi-account-setup.c */
- /* ... */
-}
-
-/*----------------------------------------------------------------------------*/
/* Kolab folder UI extensions init */
gboolean
diff --git a/src/eplugin/org-gnome-kolab.eplug.xml b/src/eplugin/org-gnome-kolab.eplug.xml
index d2345d4..d4a4539 100644
--- a/src/eplugin/org-gnome-kolab.eplug.xml
+++ b/src/eplugin/org-gnome-kolab.eplug.xml
@@ -52,40 +52,5 @@
</ui-manager>
</hook>
- <!--
-
- <hook class="org.gnome.evolution.plugin.kolab.mail.config:1.0">
- <group target="account"
- id="org.gnome.evolution.mail.config.accountWizard"
- check="e_kolab_plugin_mail_account_check"
- commit="e_kolab_plugin_mail_account_commit">
- <item type="item_table"
- path="10.receive/20.config/30.kolab"
- factory="e_kolab_plugin_mail_account_setup" />
- </group>
- </hook>
- <hook class="org.gnome.evolution.mail.config:1.0">
- <group target="account"
- id="org.gnome.evolution.mail.config.accountAssistant"
- check="e_kolab_plugin_mail_account_check"
- commit="e_kolab_plugin_mail_account_commit">
- <item type="item_table"
- path="10.receive/20.config/30.kolab"
- factory="e_kolab_plugin_mail_account_setup" />
- </group>
- </hook>
- <hook class="org.gnome.evolution.mail.config:1.0">
- <group target="account"
- id="org.gnome.evolution.mail.config.accountEditor"
- check="e_kolab_plugin_mail_account_check"
- commit="e_kolab_plugin_mail_account_commit">
- <item type="item_table"
- path="10.receive/20.config/30.kolab"
- factory="e_kolab_plugin_mail_account_setup" />
- </group>
- </hook>
-
- -->
-
</e-plugin>
</e-plugin-list>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]