aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--calendar/ChangeLog13
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar.oaf.in24
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar.oafinfo24
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in24
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo24
-rw-r--r--calendar/gui/Makefile.am5
-rw-r--r--calendar/gui/calendar-component.c26
-rw-r--r--calendar/gui/calendar-summary.c135
-rw-r--r--calendar/gui/calendar-summary.h32
-rw-r--r--calendar/gui/component-factory.c26
-rw-r--r--calendar/gui/evolution-calendar.oafinfo24
11 files changed, 354 insertions, 3 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index f4e735fa62..39db7bad06 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,16 @@
+2000-10-09 Iain Holmes <iain@helixcode.com>
+
+ * Makefile.am: Added the executive-summary library and cflags
+
+ * gui/evolution-calendar.oafinfo: Added oaf servers for the
+ executive summary and executive summary factory.
+
+ * gui/calendar-summary.[ch]: New files to create the summary.
+
+ * gui/component-factory.c (summary_fn): Create the executive
+ summary component.
+ (component_factory_init): Start the summary factory as well.
+
2000-10-06 Federico Mena Quintero <federico@helixcode.com>
* gui/weekday-picker.[ch]: New widget to pick weekdays.
diff --git a/calendar/gui/GNOME_Evolution_Calendar.oaf.in b/calendar/gui/GNOME_Evolution_Calendar.oaf.in
index c8a4907854..25279ccaeb 100644
--- a/calendar/gui/GNOME_Evolution_Calendar.oaf.in
+++ b/calendar/gui/GNOME_Evolution_Calendar.oaf.in
@@ -26,4 +26,28 @@
</oaf_server>
+<oaf_server iid="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
+ type="exe"
+ location="evolution-calendar">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the Calendar Summary component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-executive-summary-component:evolution-calendar:c80742c0-c7ae-4f53-9df2-33221864729c"
+ type="factory"
+ location="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Evolution calendar executive summary component."/>
+</oaf_server>
+
</oaf_info>
diff --git a/calendar/gui/GNOME_Evolution_Calendar.oafinfo b/calendar/gui/GNOME_Evolution_Calendar.oafinfo
index c8a4907854..25279ccaeb 100644
--- a/calendar/gui/GNOME_Evolution_Calendar.oafinfo
+++ b/calendar/gui/GNOME_Evolution_Calendar.oafinfo
@@ -26,4 +26,28 @@
</oaf_server>
+<oaf_server iid="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
+ type="exe"
+ location="evolution-calendar">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the Calendar Summary component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-executive-summary-component:evolution-calendar:c80742c0-c7ae-4f53-9df2-33221864729c"
+ type="factory"
+ location="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Evolution calendar executive summary component."/>
+</oaf_server>
+
</oaf_info>
diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in
index c8a4907854..25279ccaeb 100644
--- a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in
+++ b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in
@@ -26,4 +26,28 @@
</oaf_server>
+<oaf_server iid="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
+ type="exe"
+ location="evolution-calendar">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the Calendar Summary component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-executive-summary-component:evolution-calendar:c80742c0-c7ae-4f53-9df2-33221864729c"
+ type="factory"
+ location="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Evolution calendar executive summary component."/>
+</oaf_server>
+
</oaf_info>
diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo
index c8a4907854..25279ccaeb 100644
--- a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo
+++ b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo
@@ -26,4 +26,28 @@
</oaf_server>
+<oaf_server iid="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
+ type="exe"
+ location="evolution-calendar">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the Calendar Summary component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-executive-summary-component:evolution-calendar:c80742c0-c7ae-4f53-9df2-33221864729c"
+ type="factory"
+ location="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Evolution calendar executive summary component."/>
+</oaf_server>
+
</oaf_info>
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 6c46f05d4e..9731104200 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -33,7 +33,8 @@ LINK_FLAGS = \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
- $(top_builddir)/libical/src/libical/libical.a
+ $(top_builddir)/libical/src/libical/libical.a \
+ $(top_builddir)/executive-summary/evolution-services/libevolution-services.la
gladedir = $(datadir)/evolution/glade
@@ -50,6 +51,8 @@ evolution_calendar_SOURCES = \
calendar-commands.h \
calendar-model.c \
calendar-model.h \
+ calendar-summary.c \
+ calendar-summary.h \
control-factory.c \
control-factory.h \
component-factory.c \
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index fce8512725..351beee6b3 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -24,14 +24,19 @@
#include <config.h>
#include <bonobo.h>
#include "evolution-shell-component.h"
+#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
#include "control-factory.h"
+#include "calendar-summary.h"
#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"
+#define SUMMARY_FACTORY_ID "OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
static BonoboGenericFactory *factory = NULL;
+static BonoboGenericFactory *summary_factory = NULL;
+static char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
@@ -68,6 +73,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
Evolution_Shell shell_interface,
const char *evolution_homedir)
{
+ evolution_dir = g_strdup (evolution_homedir);
owner_count ++;
}
@@ -77,6 +83,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient shell_client,
void *data)
{
+ g_free (evolution_dir);
owner_count --;
if (owner_count <= 0)
gtk_main_quit();
@@ -101,15 +108,32 @@ factory_fn (BonoboGenericFactory *factory,
return BONOBO_OBJECT (shell_component);
}
+static BonoboObject *
+summary_fn (BonoboGenericFactory *factory,
+ void *closure)
+{
+ ExecutiveSummaryComponent *summary_component;
+
+ summary_component = executive_summary_component_new (NULL,
+ create_summary_view,
+ NULL,
+ evolution_dir);
+ return BONOBO_OBJECT (summary_component);
+}
+
void
component_factory_init (void)
{
- if (factory != NULL)
+ if (factory != NULL && factory != NULL)
return;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL);
+ summary_factory = bonobo_generic_factory_new (SUMMARY_FACTORY_ID, summary_fn, NULL);
if (factory == NULL)
g_error ("Cannot initialize Evolution's calendar component.");
+
+ if (summary_factory == NULL)
+ g_error ("Cannot initialize Evolution's calendar summary component.");
}
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 ("");
+}
diff --git a/calendar/gui/calendar-summary.h b/calendar/gui/calendar-summary.h
new file mode 100644
index 0000000000..8e21262db3
--- /dev/null
+++ b/calendar/gui/calendar-summary.h
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+#ifndef CALENDAR_SUMMARY_H
+#define CALENDAR_SUMMARY_H
+
+char * create_summary_view (ExecutiveSummaryComponent *component,
+ char **title,
+ char **icon,
+ void *closure);
+
+#endif
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index fce8512725..351beee6b3 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -24,14 +24,19 @@
#include <config.h>
#include <bonobo.h>
#include "evolution-shell-component.h"
+#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
#include "control-factory.h"
+#include "calendar-summary.h"
#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"
+#define SUMMARY_FACTORY_ID "OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
static BonoboGenericFactory *factory = NULL;
+static BonoboGenericFactory *summary_factory = NULL;
+static char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
@@ -68,6 +73,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
Evolution_Shell shell_interface,
const char *evolution_homedir)
{
+ evolution_dir = g_strdup (evolution_homedir);
owner_count ++;
}
@@ -77,6 +83,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient shell_client,
void *data)
{
+ g_free (evolution_dir);
owner_count --;
if (owner_count <= 0)
gtk_main_quit();
@@ -101,15 +108,32 @@ factory_fn (BonoboGenericFactory *factory,
return BONOBO_OBJECT (shell_component);
}
+static BonoboObject *
+summary_fn (BonoboGenericFactory *factory,
+ void *closure)
+{
+ ExecutiveSummaryComponent *summary_component;
+
+ summary_component = executive_summary_component_new (NULL,
+ create_summary_view,
+ NULL,
+ evolution_dir);
+ return BONOBO_OBJECT (summary_component);
+}
+
void
component_factory_init (void)
{
- if (factory != NULL)
+ if (factory != NULL && factory != NULL)
return;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL);
+ summary_factory = bonobo_generic_factory_new (SUMMARY_FACTORY_ID, summary_fn, NULL);
if (factory == NULL)
g_error ("Cannot initialize Evolution's calendar component.");
+
+ if (summary_factory == NULL)
+ g_error ("Cannot initialize Evolution's calendar summary component.");
}
diff --git a/calendar/gui/evolution-calendar.oafinfo b/calendar/gui/evolution-calendar.oafinfo
index c8a4907854..25279ccaeb 100644
--- a/calendar/gui/evolution-calendar.oafinfo
+++ b/calendar/gui/evolution-calendar.oafinfo
@@ -26,4 +26,28 @@
</oaf_server>
+<oaf_server iid="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af"
+ type="exe"
+ location="evolution-calendar">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME:GenericFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Factory for the Calendar Summary component."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:evolution-executive-summary-component:evolution-calendar:c80742c0-c7ae-4f53-9df2-33221864729c"
+ type="factory"
+ location="OAFIID:evolution-executive-summary-component-factory:evolution-calendar:6b45a890-fbc0-4f20-97d8-b8e344c059af">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:Evolution:SummaryComponent:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ value="Evolution calendar executive summary component."/>
+</oaf_server>
+
</oaf_info>