aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-summary.c
diff options
context:
space:
mode:
authorIain Holmes <iain@helixcode.com>2000-10-10 08:18:07 +0800
committerIain Holmes <iain@src.gnome.org>2000-10-10 08:18:07 +0800
commit1febeef6becb09f0b6838e3e6850fb7d1e538396 (patch)
treee4bf09b22a37faf70ca1f2e83ba7c0b09e000d74 /calendar/gui/calendar-summary.c
parentd9d237a838ee852028c6d93b26b01b13f93464ac (diff)
downloadgsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar.gz
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar.bz2
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar.lz
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar.xz
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.tar.zst
gsoc2013-evolution-1febeef6becb09f0b6838e3e6850fb7d1e538396.zip
Added the executive-summary library and cflags
2000-10-09 Iain Holmes <iain@helixcode.com> * Makefile.am: Added the executive-summary library and cflags * evolution-calendar.oafinfo: Added oaf servers for the executive summary and executive summary factory. * calendar-summary.[ch]: New files to create the summary. * component-factory.c (summary_fn): Create the executive summary component. (component_factory_init): Start the summary factory as well. svn path=/trunk/; revision=5807
Diffstat (limited to 'calendar/gui/calendar-summary.c')
-rw-r--r--calendar/gui/calendar-summary.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/calendar/gui/calendar-summary.c b/calendar/gui/calendar-summary.c
new file mode 100644
index 0000000000..9ce8c70dbb
--- /dev/null
+++ b/calendar/gui/calendar-summary.c
@@ -0,0 +1,135 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* calendar-summary.c
+ *
+ * Authors: Iain Holmes <iain@helixcode.com>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo.h>
+
+#include <gnome.h>
+
+#include <executive-summary/evolution-services/executive-summary-component.h>
+#include "cal-util/cal-component.h"
+#include "calendar-model.h"
+
+#include "calendar-summary.h"
+
+typedef struct {
+ ExecutiveSummaryComponent *component;
+ CalClient *client;
+} CalSummary;
+
+static char *
+generate_html_summary (CalSummary *summary)
+{
+ GList *uids, *l;
+ char *ret_html, *tmp;
+
+ ret_html = g_strdup ("<ul>");
+
+ uids = cal_client_get_uids (summary->client, CALOBJ_TYPE_ANY);
+ for (l = uids; l; l = l->next){
+ CalComponent *comp;
+ CalComponentText text;
+ CalClientGetStatus status;
+ char *uid;
+ char *tmp2;
+
+ uid = l->data;
+ status = cal_client_get_object (summary->client, uid, &comp);
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ continue;
+
+ cal_component_get_summary (comp, &text);
+
+ tmp2 = g_strdup_printf ("<li>%s</li>", text.value);
+
+ tmp = ret_html;
+ ret_html = g_strconcat (ret_html, tmp2, NULL);
+ g_free (tmp);
+ g_free (tmp2);
+ }
+
+ cal_obj_uid_list_free (uids);
+
+ tmp = ret_html;
+ ret_html = g_strconcat (ret_html, "</ul>", NULL);
+ g_free (tmp);
+
+ return ret_html;
+}
+
+static void
+cal_loaded (CalClient *client,
+ CalClientLoadStatus status,
+ CalSummary *summary)
+{
+ char *html;
+
+ if (status == CAL_CLIENT_LOAD_SUCCESS) {
+ html = generate_html_summary (summary);
+ executive_summary_component_update (summary->component, html);
+ g_free (html);
+ } else {
+ g_print ("Error loading %d\n", status);
+ executive_summary_component_update (summary->component, "");
+ }
+}
+
+char *
+create_summary_view (ExecutiveSummaryComponent *component,
+ char **title,
+ char **icon,
+ void *closure)
+{
+ char *ret_html;
+ char *evoldir;
+ char *calfile;
+ CalSummary *summary;
+ gboolean result;
+
+ evoldir = (char *) closure;
+
+ /* strdup the title and icon */
+ *title = g_strdup ("Things to do");
+ *icon = g_strdup ("evolution-tasks.png");
+
+ summary = g_new (CalSummary, 1);
+ summary->component = component;
+
+ calfile = g_strdup_printf ("%s/local/Calendar/calendar.ics", evoldir);
+ g_print ("calfile: %s\n", calfile);
+ summary->client = cal_client_new ();
+
+ result = cal_client_load_calendar (summary->client, calfile);
+ if (!result) {
+ g_warning ("%s: Could not load %s", __FUNCTION__, calfile);
+ return "";
+ }
+
+ gtk_signal_connect (GTK_OBJECT (summary->client), "cal_loaded",
+ GTK_SIGNAL_FUNC (cal_loaded), summary);
+
+ return g_strdup ("");
+}