aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorJP Rosevear <jpr@novell.com>2005-01-10 10:36:41 +0800
committerJP Rosevear <jpr@src.gnome.org>2005-01-10 10:36:41 +0800
commitf448e25de6f7d9bb1dfe943a9f82d4e4da747c5d (patch)
tree2d91ba3c7a366e8acda17f82bcd3a00d9c51e623 /calendar/gui
parent4722208003c3c4307530a18ce07303134a20bd15 (diff)
downloadgsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar.gz
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar.bz2
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar.lz
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar.xz
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.tar.zst
gsoc2013-evolution-f448e25de6f7d9bb1dfe943a9f82d4e4da747c5d.zip
handle calendar:// uris
2005-01-09 JP Rosevear <jpr@novell.com> * gui/calendar-component.c (impl_handleURI): handle calendar:// uris svn path=/trunk/; revision=28303
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-component.c66
1 files changed, 65 insertions, 1 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 2c408c94e7..942325a234 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -34,6 +34,7 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserverui/e-source-selector.h>
#include <shell/e-user-creatable-items-handler.h>
+#include <e-util/e-url.h>
#include "e-pub-utils.h"
#include "e-calendar-view.h"
#include "calendar-config-keys.h"
@@ -617,9 +618,71 @@ conf_changed_callback (GConfClient *client,
e_pub_publish (TRUE);
}
+/* Evolution::Component CORBA methods. */
+static void
+impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
+{
+ CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
+ CalendarComponentPrivate *priv;
+ priv = calendar_component->priv;
-/* Evolution::Component CORBA methods. */
+ if (!strncmp (uri, "calendar:", 9)) {
+ EUri *euri = e_uri_new (uri);
+ const char *p;
+ char *header, *content;
+ size_t len, clen;
+ time_t start = -1, end = -1;
+
+ p = euri->query;
+ while (*p) {
+ len = strcspn (p, "=&");
+
+ /* If it's malformed, give up. */
+ if (p[len] != '=')
+ break;
+
+ header = (char *) p;
+ header[len] = '\0';
+ p += len + 1;
+
+ clen = strcspn (p, "&");
+
+ content = g_strndup (p, clen);
+
+ if (!g_ascii_strcasecmp (header, "startdate")) {
+ start = time_from_isodate (content);
+ } else if (!g_ascii_strcasecmp (header, "enddate")) {
+ end = time_from_isodate (content);
+ }
+
+ g_free (content);
+
+ p += clen;
+ if (*p == '&') {
+ p++;
+ if (!strcmp (p, "amp;"))
+ p += 4;
+ }
+ }
+
+ if (start != -1) {
+ GList *l;
+
+ if (end == -1)
+ end = start;
+
+ l = g_list_last (priv->views);
+ if (l) {
+ CalendarComponentView *view = l->data;
+
+ gnome_calendar_set_selected_time_range (view->calendar, start, end);
+ }
+ }
+
+ e_uri_free (euri);
+ }
+}
static void
impl_upgradeFromVersion (PortableServer_Servant servant,
@@ -1378,6 +1441,7 @@ calendar_component_class_init (CalendarComponentClass *class)
epv->createControls = impl_createControls;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
+ epv->handleURI = impl_handleURI;
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;