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
This commit is contained in:
bertrand
2000-03-12 05:09:43 +00:00
committed by Bertrand Guiheneuf
parent 679fa9316e
commit f669ff481f
9 changed files with 418 additions and 5 deletions
+2
View File
@@ -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 \
+5 -1
View File
@@ -13,7 +13,11 @@ module GNOME {
module Evolution {
interface Shell : GNOME::Unknown {
/*
* add a service to the shell.
*
*/
void AddService (string service);
};
};
};
+7
View File
@@ -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]);
}
+7 -1
View File
@@ -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 */
/*
+242
View File
@@ -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);
}
+140
View File
@@ -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_ */