[evolution-kolab/ek-wip-porting: 6/8] EPlugin: fixed ESource generation for calendar types
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting: 6/8] EPlugin: fixed ESource generation for calendar types
- Date: Thu, 15 Mar 2012 22:59:24 +0000 (UTC)
commit 25275ac6b71e270ecb1b9426626f45e5810c08e1
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Thu Mar 15 23:49:44 2012 +0100
EPlugin: fixed ESource generation for calendar types
* writing ESources for events, tasks and memos works again
* this makes these types configurable again
src/eplugin/e-kolab-account-setup.c | 47 +++++++++++++++++++++-------------
1 files changed, 29 insertions(+), 18 deletions(-)
---
diff --git a/src/eplugin/e-kolab-account-setup.c b/src/eplugin/e-kolab-account-setup.c
index 4623694..4c5be1a 100644
--- a/src/eplugin/e-kolab-account-setup.c
+++ b/src/eplugin/e-kolab-account-setup.c
@@ -31,8 +31,10 @@
#include <glib/gi18n-lib.h>
#include <addressbook/gui/widgets/eab-config.h>
+#include <shell/e-shell.h>
#include <e-util/e-plugin-util.h>
#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-list.h>
@@ -77,20 +79,24 @@ typedef struct {
/* internal statics (non-UI) */
static void
-ensure_kolab_sourcetype_source_group (ECalSourceType type)
+ensure_kolab_sourcetype_source_group (const gchar *backendname)
{
- /* find the original code in google-source.c */
- ESourceList *slist = NULL;
+ EShellBackend *backend = NULL;
+ ESourceList *source_list = NULL;
- if (!e_cal_get_sources (&slist, type, NULL)) {
- g_warning ("Could not get calendar source list from GConf");
- return;
- }
+ backend = e_shell_get_backend_by_name (e_shell_get_default (),
+ backendname);
+ g_return_if_fail (backend != NULL);
+
+ g_object_get (G_OBJECT (backend), "source-list", &source_list, NULL);
+ g_return_if_fail (source_list != NULL);
- e_source_list_ensure_group (slist,
+ e_source_list_ensure_group (source_list,
KOLAB_CAMEL_PROVIDER_NAME,
- KOLAB_CAMEL_URI_PREFIX, FALSE);
- g_object_unref (slist);
+ KOLAB_CAMEL_URI_PREFIX,
+ FALSE);
+
+ g_object_unref (source_list);
}
/*----------------------------------------------------------------------------*/
@@ -304,9 +310,9 @@ set_calendar_source_from_ui_cb (kolab_ui_data *uidata)
void
e_kolab_account_setup_ensure_calendar_source_groups (void)
{
- ensure_kolab_sourcetype_source_group (E_CAL_SOURCE_TYPE_EVENT);
- ensure_kolab_sourcetype_source_group (E_CAL_SOURCE_TYPE_TODO);
- ensure_kolab_sourcetype_source_group (E_CAL_SOURCE_TYPE_JOURNAL);
+ ensure_kolab_sourcetype_source_group ("calendar");
+ ensure_kolab_sourcetype_source_group ("tasks");
+ ensure_kolab_sourcetype_source_group ("memos");
}
void
@@ -336,8 +342,8 @@ e_kolab_account_setup_backend_create (EPlugin *epl,
EConfigHookItemFactoryData *data,
KolabWidgetTypeID widget_type)
{
- EABConfigTargetSource *t = (EABConfigTargetSource *) data->target;
- GtkWidget *parent = data->parent;
+ EABConfigTargetSource *t = NULL;
+ GtkWidget *parent = NULL;
GtkWidget *real_parent = NULL;
GtkWidget *vbox = NULL;
GtkWidget *kolab_vbox = NULL;
@@ -345,23 +351,28 @@ e_kolab_account_setup_backend_create (EPlugin *epl,
GtkWidget *section = NULL;
GtkWidget *spacer = NULL;
GtkWidget *label = NULL;
- ESource *source = t->source;
+ ESource *source = NULL;
ESourceGroup *group = NULL;
/* const gchar *base_uri = NULL; */
kolab_ui_data *uidata = NULL;
- gint i;
gchar *tmp_str = NULL;
+ gint i = 0;
g_assert (E_IS_PLUGIN (epl));
+ g_assert (data != NULL);
/* Have to check wether this is to be done for the appropriate backend... */
+ t = (EABConfigTargetSource *) data->target;
+ parent = data->parent;
+ source = t->source;
+
group = e_source_peek_group (source);
/* base_uri = e_source_group_peek_base_uri (group); */
g_object_set_data (G_OBJECT (epl), KOLAB_EPLUGIN_WIDGET_NAME, NULL);
- if (! e_plugin_util_is_group_proto (group, KOLAB_CAMEL_PROVIDER_PROTOCOL)) {
+ if (! e_plugin_util_is_group_proto (group, KOLAB_CAMEL_PROVIDER_NAME)) {
/* TODO: cleanup needed */
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]