[evolution-patches] e-webcal automatically select new sources
- From: William Jon McCann <mccannwj pha jhu edu>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] e-webcal automatically select new sources
- Date: Wed, 28 Apr 2004 16:46:35 -0400
Hi,
Here is a patch that will automatically "select" new sources.
The idea is that if the user wants to subscribe to the calendar then
they consent to selecting the calendar and there is no need to require
the user to do this manually.
Please let me know if this looks ok.
Thanks,
Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-webcal/ChangeLog,v
retrieving revision 1.8
diff -p -u -r1.8 ChangeLog
--- ChangeLog 21 Apr 2004 15:00:26 -0000 1.8
+++ ChangeLog 28 Apr 2004 20:41:35 -0000
@@ -1,3 +1,9 @@
+2004-04-28 William Jon McCann <mccann jhu edu>
+
+ * src/evolution-webcal-notify.c (select_source)
+ (e_webcal_query_user): Automatically select new source so user doesn't
+ have to manually start up evolution to select it.
+
2004-04-20 Rodney Dawes <dobey ximian com>
* Makefile.am: Use @libexecdir@ instead of $(exec_prefix)/libexec for
Index: src/evolution-webcal-notify.c
===================================================================
RCS file: /cvs/gnome/evolution-webcal/src/evolution-webcal-notify.c,v
retrieving revision 1.6
diff -p -u -r1.6 evolution-webcal-notify.c
--- src/evolution-webcal-notify.c 16 Apr 2004 22:41:57 -0000 1.6
+++ src/evolution-webcal-notify.c 28 Apr 2004 20:41:36 -0000
@@ -23,8 +23,15 @@
#include "evolution-webcal-notify.h"
#define WEBCAL_BASE_URI "webcal://"
-#define CALENDAR_SOURCES_KEY "/apps/evolution/calendar/sources"
-#define TASKS_SOURCES_KEY "/apps/evolution/tasks/sources"
+
+#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar"
+#define TASKS_CONFIG_PREFIX "/apps/evolution/tasks"
+
+#define SELECTED_CALENDARS_KEY CALENDAR_CONFIG_PREFIX "/display/selected_calendars"
+#define SELECTED_TASKS_KEY CALENDAR_CONFIG_PREFIX "/tasks/selected_tasks"
+
+#define CALENDAR_SOURCES_KEY CALENDAR_CONFIG_PREFIX "/sources"
+#define TASKS_SOURCES_KEY TASKS_CONFIG_PREFIX "/sources"
typedef struct {
GtkWidget * dialog;
@@ -168,9 +175,36 @@ void e_webcal_display_error (const gchar
}
}
+static void select_source (ESource * source, icalcomponent_kind kind)
+{
+ const char * key = NULL;
+ GConfClient * config = NULL;
+ GSList * list;
+
+ g_return_if_fail (source != NULL);
+
+ if (kind == ICAL_VEVENT_COMPONENT)
+ key = SELECTED_CALENDARS_KEY;
+ else if (kind == ICAL_VTODO_COMPONENT)
+ key = SELECTED_TASKS_KEY;
+ else
+ return;
+
+ config = gconf_client_get_default ();
+
+ list = gconf_client_get_list (config, key, GCONF_VALUE_STRING, NULL);
+ list = g_slist_append (list, (char *) e_source_peek_uid (source));
+ gconf_client_set_list (config, key, GCONF_VALUE_STRING, list, NULL);
+
+ g_slist_free (list);
+
+ g_object_unref (config);
+}
+
void e_webcal_query_user (const gchar * name, const gchar * desc,
const gchar * caluri,
- gboolean has_events, gboolean has_tasks) {
+ gboolean has_events, gboolean has_tasks)
+{
EIcalShareDialog * dialog;
GtkObject * spinadj;
GtkWidget * tspinb, * toption;
@@ -426,11 +460,13 @@ void e_webcal_query_user (const gchar *
if (has_events) {
e_source_group_add_source (events_group, source, -1);
e_source_list_sync (events_sources, NULL);
+ select_source (source, ICAL_VEVENT_COMPONENT);
}
if (has_tasks) {
e_source_group_add_source (tasks_group, source, -1);
e_source_list_sync (tasks_sources, NULL);
+ select_source (source, ICAL_VTODO_COMPONENT);
}
/* We fall through to the CANCEL/default cases to handle all the unreffing
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]