aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-03-12 13:09:43 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-12 13:09:43 +0800
commitf669ff481f57cf5b609ea2e8fe30cfb8dece8587 (patch)
treee0b812f92689476aed9751bfda46b3071af159a5
parent679fa9316ef0cfb3fea44adeb4ab4a7795ae71ed (diff)
downloadgsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar.gz
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar.bz2
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar.lz
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar.xz
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.tar.zst
gsoc2013-evolution-f669ff481f57cf5b609ea2e8fe30cfb8dece8587.zip
add a field refering to a service associated to the efolder. In the case
2000-03-12 bertrand <bertrand@helixcode.com> * shell/e-folder.h: add a field refering to a service associated to the efolder. In the case of distant folders, it is generally a server. * shell/e-service.c: New class. Models a service. A service is an object with an URI and a root folder. It genreally reporesents a distant folder. A service is generally a ressource shared amongst several folders. * shell/e-service.h: 2000-03-10 bertrand <bertrand@helixcode.com> * camel-service.h: cosmetic changes. svn path=/trunk/; revision=2100
-rw-r--r--ChangeLog13
-rw-r--r--camel/camel-service.c2
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/Shell.idl6
-rw-r--r--shell/e-folder.c7
-rw-r--r--shell/e-folder.h8
-rw-r--r--shell/e-service.c242
-rw-r--r--shell/e-service.h140
-rw-r--r--tests/ui-tests/message-browser.c3
9 files changed, 418 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b1bdb6a3e..27c3e01135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-03-12 bertrand <bertrand@helixcode.com>
+
+ * shell/e-folder.h: add a field refering to a
+ service associated to the efolder. In the case of
+ distant folders, it is generally a server.
+
+ * shell/e-service.c: New class. Models a service.
+ A service is an object with an URI and a root folder.
+ It genreally reporesents a distant folder.
+ A service is generally a ressource shared amongst
+ several folders.
+ * shell/e-service.h:
+
2000-03-10 Christopher James Lahey <clahey@helixcode.com>
* e-util/e-canvas.c, e-util/e-canvas.h: Designed a new system for
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 184e0961cc..86e871dd73 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -38,7 +38,7 @@ static gboolean _connect_with_url (CamelService *service, Gurl *url,
CamelException *ex);
static gboolean _disconnect(CamelService *service, CamelException *ex);
static gboolean _is_connected (CamelService *service);
-static void _finalize (GtkObject *object);
+static void _finalize (GtkObject *object);
static gboolean _set_url (CamelService *service, Gurl *url,
CamelException *ex);
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 878c94a11b..1ad4872aad 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -21,6 +21,8 @@ evolution_SOURCES = \
e-folder.h \
e-init.c \
e-init.h \
+ e-service.c \
+ e-service.h \
e-shell.c \
e-shell.h \
e-shell-shortcut.c \
diff --git a/shell/Shell.idl b/shell/Shell.idl
index 0d615b6b3b..d776713b51 100644
--- a/shell/Shell.idl
+++ b/shell/Shell.idl
@@ -13,7 +13,11 @@ module GNOME {
module Evolution {
interface Shell : GNOME::Unknown {
-
+ /*
+ * add a service to the shell.
+ *
+ */
+ void AddService (string service);
};
};
};
diff --git a/shell/e-folder.c b/shell/e-folder.c
index 8a7d5dfe6b..62e27cdfad 100644
--- a/shell/e-folder.c
+++ b/shell/e-folder.c
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
/*
* e-folder.c: Abstract class for Evolution folders
*
@@ -6,6 +8,8 @@
*
* (C) 2000 Helix Code, Inc.
*/
+
+
#include <config.h>
#include <gtk/gtksignal.h>
#include <libgnome/libgnome.h>
@@ -56,6 +60,7 @@ e_folder_class_init (GtkObjectClass *object_class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
+
/* Register our signals */
gtk_object_class_add_signals (
object_class, efolder_signals, LAST_SIGNAL);
@@ -244,3 +249,5 @@ e_folder_set_view_name (EFolder *efolder, const char *view_name)
gtk_signal_emit (GTK_OBJECT (efolder),
efolder_signals [CHANGED]);
}
+
+
diff --git a/shell/e-folder.h b/shell/e-folder.h
index d262859c3d..0de9ae6576 100644
--- a/shell/e-folder.h
+++ b/shell/e-folder.h
@@ -1,3 +1,7 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+
+
#ifndef _E_FOLDER_H_
#define _E_FOLDER_H_
@@ -28,12 +32,14 @@ typedef struct {
EFolderType type;
+ EService *eservice; /* an Efolder should have an eservice */
+
/*
* General properties
*/
char *uri; /* Location */
char *name; /* Short name */
- char *desc; /* Full description */
+ char *desc; /* Full description */
char *home_page; /* Home page for this folder */
/*
diff --git a/shell/e-service.c b/shell/e-service.c
new file mode 100644
index 0000000000..f567487ef4
--- /dev/null
+++ b/shell/e-service.c
@@ -0,0 +1,242 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * e-service.c: Abstract class for Evolution services
+ *
+ * Author:
+ * Bertrand Guiheneuf (bg@aful.org)
+ * Miguel de Icaza (miguel@helixcode.com)
+ *
+ * (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
+ */
+
+
+
+
+#include <config.h>
+#include <libgnome/libgnome.h>
+#include "e-util/e-util.h"
+#include "e-service.h"
+
+#define PARENT_TYPE gtk_object_get_type ()
+
+static GtkObjectClass *parent_class;
+
+#define EFC(o) E_SERVICE_CLASS (GTK_OBJECT (o)->klass)
+
+
+
+static void
+e_service_destroy (GtkObject *object)
+{
+ EService *eservice = E_SERVICE (object);
+
+ if (eservice->uri)
+ g_free (eservice->uri);
+
+ if (eservice->desc)
+ g_free (eservice->desc);
+
+ if (eservice->home_page)
+ g_free (eservice->home_page);
+
+ parent_class->destroy (object);
+}
+
+static void
+e_service_class_init (GtkObjectClass *object_class)
+{
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ object_class->destroy = e_service_destroy;
+
+
+}
+
+static void
+e_service_init (GtkObject *object)
+{
+}
+
+E_MAKE_TYPE (e_service, "EService", EService, e_service_class_init, e_service_init, PARENT_TYPE)
+
+
+EFolder *
+e_service_get_root_efolder (EService *eservice)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+
+
+}
+
+
+
+void
+e_service_set_uri (EService *eservice, const char *uri)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+ g_return_if_fail (uri != NULL);
+
+ if (eservice->uri)
+ g_free (eservice->uri);
+
+ eservice->uri = g_strdup (uri);
+}
+
+const char *
+e_service_get_uri (EService *eservice)
+{
+ g_return_val_if_fail (eservice != NULL, NULL);
+ g_return_val_if_fail (E_IS_SERVICE (eservice), NULL);
+
+ return eservice->uri;
+}
+
+void
+e_service_set_description (EService *eservice, const char *desc)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+ g_return_if_fail (desc != NULL);
+
+ if (eservice->desc)
+ g_free (eservice->desc);
+
+ eservice->desc = g_strdup (desc);
+}
+
+const char *
+e_service_get_description (EService *eservice)
+{
+ g_return_val_if_fail (eservice != NULL, NULL);
+ g_return_val_if_fail (E_IS_SERVICE (eservice), NULL);
+
+ return eservice->desc;
+}
+
+void
+e_service_set_home_page (EService *eservice, const char *home_page)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+ g_return_if_fail (home_page != NULL);
+
+ if (eservice->home_page)
+ g_free (eservice->home_page);
+
+ eservice->home_page = g_strdup (home_page);
+}
+
+const char *
+e_service_get_home_page (EService *eservice)
+{
+ g_return_val_if_fail (eservice != NULL, NULL);
+ g_return_val_if_fail (E_IS_SERVICE (eservice), NULL);
+
+ return eservice->home_page;
+}
+
+const char *
+e_service_get_type_name (EService *eservice)
+{
+ g_return_val_if_fail (eservice != NULL, NULL);
+ g_return_val_if_fail (E_IS_SERVICE (eservice), NULL);
+
+ switch (eservice->type){
+ case E_SERVICE_MAIL:
+ return _("A service containing mail items");
+
+ case E_SERVICE_CONTACTS:
+ return _("A service containing contacts");
+
+ case E_SERVICE_CALENDAR:
+ return _("A service containing calendar entries");
+
+ case E_SERVICE_TASKS:
+ return _("A service containing tasks");
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+void
+e_service_construct (EService *eservice, EServiceType type,
+ const char *uri, const char *name,
+ const char *desc, const char *home_page)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+
+
+ /* EServices are self-owned */
+ GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (eservice), GTK_FLOATING);
+
+ if (uri)
+ eservice->uri = g_strdup (uri);
+ if (name)
+ eservice->name = g_strdup (name);
+ if (desc)
+ eservice->desc = g_strdup (desc);
+ if (home_page)
+ eservice->home_page = g_strdup (home_page);
+
+ eservice->type = type;
+}
+
+EService *
+e_service_new (EServiceType type,
+ const char *uri, const char *name,
+ const char *desc, const char *home_page)
+{
+ EService *eservice;
+
+ eservice = gtk_type_new (e_service_get_type ());
+
+ e_service_construct (eservice, type, uri, name, desc, home_page);
+ return eservice;
+}
+
+const char *
+e_service_get_name (EService *eservice)
+{
+ g_return_val_if_fail (eservice != NULL, NULL);
+ g_return_val_if_fail (E_IS_SERVICE (eservice), NULL);
+
+ return eservice->name;
+}
+
+void
+e_service_set_name (EService *eservice, const char *name)
+{
+ g_return_if_fail (eservice != NULL);
+ g_return_if_fail (E_IS_SERVICE (eservice));
+
+ if (eservice->name)
+ g_free (eservice->name);
+
+ eservice->name = g_strdup (name);
+}
+
+
diff --git a/shell/e-service.h b/shell/e-service.h
new file mode 100644
index 0000000000..54d54d6b38
--- /dev/null
+++ b/shell/e-service.h
@@ -0,0 +1,140 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-stream-fs.h : abstract class for the Evolution services */
+
+/*
+ *
+ * Author :
+ * Bertrand Guiheneuf <bertrand@helixcode.com>
+ * Miguel de Icaza (miguel@helixcode.com)
+ *
+ * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
+ *
+ * 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
+ */
+
+
+/*
+ * this class represents a service, that is, an object
+ * we can get e-folders from.
+ *
+ * In the case of the mail, it represents :
+ * - a store to get mail folder from (an imap server,
+ * an mbox toplevel directory
+ * or
+ * - a mail transport thanks to which you can send
+ * mail from.
+ *
+ * This class may probably handle the connection
+ * operations, and probably allow the some kind of
+ * configuration of the authentication methods
+ * used.
+ *
+ *
+ * NOTE : this class shares a lot of code and properties
+ * with the folder class. It may be a good idea to determine
+ * exactely if it would be useful to make both classes
+ * be children of another parent abstract class.
+ * for the moment, we don't really show the service to
+ * the user in the UI, so that there is not an urgent
+ * need to create the abstract parent class.
+ *
+ * - ber.
+ *
+ */
+
+
+#ifndef _E_SERVICE_H_
+#define _E_SERVICE_H_
+
+#include <gtk/gtkobject.h>
+
+#define E_SERVICE_TYPE (e_service_get_type ())
+#define E_SERVICE(o) (GTK_CHECK_CAST ((o), E_SERVICE_TYPE, EService))
+#define E_SERVICE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SERVICE_TYPE, EServiceClass))
+#define E_IS_SERVICE(o) (GTK_CHECK_TYPE ((o), E_SERVICE_TYPE))
+#define E_IS_SERVICE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SERVICE_TYPE))
+
+
+typedef enum {
+ E_SERVICE_MAIL = 1 << 0,
+ E_SERVICE_CONTACTS = 1 << 1,
+ E_SERVICE_CALENDAR = 1 << 2,
+ E_SERVICE_TASKS = 1 << 3,
+ E_SERVICE_OTHER = 1 << 4
+} EServiceType;
+
+typedef struct {
+ GtkObject parent_object;
+
+ EFolder *root_efolder; /* a service may have a root EFolder */
+
+ /*
+ * General properties
+ */
+ char *uri; /* Location */
+ char *name; /* Short name */
+ char *desc; /* Full description */
+ char *home_page; /* Home page for this service */
+
+ EServiceType type; /* type of the service */
+
+
+} EService;
+
+typedef struct {
+ GtkObjectClass parent_class;
+
+} EServiceClass;
+
+GtkType e_service_get_type (void);
+void e_service_construct (EService *eservice,
+ EServiceType type,
+ const char *uri,
+ const char *name,
+ const char *desc,
+ const char *home_page);
+EService *e_service_new (EServiceType type,
+ const char *uri,
+ const char *name,
+ const char *desc,
+ const char *home_page);
+
+EFolder *e_service_get_root_efolder (EService *eservice);
+
+void e_service_set_uri (EService *eservice,
+ const char *uri);
+const char *e_service_get_uri (EService *eservice);
+
+void e_service_set_description (EService *eservice,
+ const char *desc);
+const char *e_service_get_description (EService *eservice);
+
+void e_service_set_home_page (EService *eservice,
+ const char *desc);
+const char *e_service_get_home_page (EService *eservice);
+
+const char *e_service_get_name (EService *eservice);
+void e_service_set_name (EService *eservice,
+ const char *name);
+
+
+const char *e_service_get_type_name (EService *eservice);
+
+#endif /* _E_SERVICE_H_ */
+
+
+
+
diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c
index 6b38c44107..35c71580e7 100644
--- a/tests/ui-tests/message-browser.c
+++ b/tests/ui-tests/message-browser.c
@@ -770,8 +770,7 @@ main (int argc, char *argv[])
g_error ("Cannot bonobo_init");
- gnome_init ("MessageBrowser", "1.0", argc, argv);
-
+
gdk_rgb_init ();
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());