diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-06-21 23:45:48 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-06-21 23:45:48 +0800 |
commit | 497532febe6989b31c7665ba375b9c2f14d2b7da (patch) | |
tree | 7a78d3734cbf6b9ee30b9427a1f5c96f8c3d0abb /libwombat | |
parent | bb396a2b28d4c028aadfe1e3c6470d77352cc5e2 (diff) | |
download | gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar.gz gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar.bz2 gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar.lz gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar.xz gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.tar.zst gsoc2013-evolution-497532febe6989b31c7665ba375b9c2f14d2b7da.zip |
created new directory for the libwombat library
2001-06-21 Rodrigo Moya <rodrigo@ximian.com>
* created new directory for the libwombat library
svn path=/trunk/; revision=10360
Diffstat (limited to 'libwombat')
-rw-r--r-- | libwombat/.cvsignore | 10 | ||||
-rw-r--r-- | libwombat/ChangeLog | 3 | ||||
-rw-r--r-- | libwombat/Makefile.am | 24 | ||||
-rw-r--r-- | libwombat/wombat-client.c | 173 | ||||
-rw-r--r-- | libwombat/wombat-client.h | 73 |
5 files changed, 283 insertions, 0 deletions
diff --git a/libwombat/.cvsignore b/libwombat/.cvsignore new file mode 100644 index 0000000000..58fd701471 --- /dev/null +++ b/libwombat/.cvsignore @@ -0,0 +1,10 @@ +Makefile.in +Makefile +*.lo +wombat.h +wombat-common.c +wombat-skels.c +wombat-stubs.c +.deps +.libs +libwombat.la diff --git a/libwombat/ChangeLog b/libwombat/ChangeLog new file mode 100644 index 0000000000..681abfd605 --- /dev/null +++ b/libwombat/ChangeLog @@ -0,0 +1,3 @@ +2001-06-21 Rodrigo Moya <rodrigo@ximian.com> + + * created new directory for the libwombat library diff --git a/libwombat/Makefile.am b/libwombat/Makefile.am new file mode 100644 index 0000000000..5731584704 --- /dev/null +++ b/libwombat/Makefile.am @@ -0,0 +1,24 @@ +# CORBA stuff + +IDLS = $(top_builddir)/wombat/wombat.idl +IDL_GENERATED = \ + wombat.h \ + wombat-common.c \ + wombat-skels.c \ + wombat-stubs.c + +$(IDL_GENERATED): $(IDLS) + $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ + $(top_builddir)/wombat/wombat.idl + +# Wombat library +lib_LTLIBRARIES = libwombat.la + +wombatincludedir = $(includedir)/evolution/wombat +wombatinclude_HEADERS = \ + wombat-client.h + +libwombat_la_SOURCES = \ + $(IDL_GENERATED) \ + wombat-client.c \ + $(wombatinclude_HEADERS) diff --git a/libwombat/wombat-client.c b/libwombat/wombat-client.c new file mode 100644 index 0000000000..5b66b8f066 --- /dev/null +++ b/libwombat/wombat-client.c @@ -0,0 +1,173 @@ +/* Wombat client library + * + * Copyright (C) 2001 Ximian, Inc. + * + * Author: Rodrigo Moya <rodrigo@ximian.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. + */ + +#include "wombat-client.h" + +#define PARENT_TYPE BONOBO_X_OBJECT_TYPE + +struct _WombatClientPrivate { + WombatClientGetPasswordFn get_password; + WombatClientForgetPasswordFn forget_password; + gpointer fn_data; +}; + +static void wombat_client_class_init (WombatClientClass *klass); +static void wombat_client_init (WombatClient *client); +static void wombat_client_destroy (GtkObject *objct); + +/* + * CORBA interface implementation + */ +static CORBA_char * +impl_GNOME_Evolution_WombatClient_getPassword (PortableServer_Servant servant, + CORBA_char *prompt, + CORBA_char *key, + CORBA_Environment *ev) +{ + WombatClient *client; + + client = WOMBAT_CLIENT (bonobo_x_object (servant)); + g_return_val_if_fail (WOMBAT_IS_CLIENT (client), NULL); + g_return_val_if_fail (client->priv != NULL, NULL); + + if (client->priv->get_password != NULL) + return client->priv->get_password (client, prompt, key, client->priv->fn_data); + + return NULL; +} + +static void +impl_GNOME_Evolution_WombatClient_forgetPassword (PortableServer_Servant servant, + CORBA_char *key, + CORBA_Environment *ev) +{ + WombatClient *client; + + client = WOMBAT_CLIENT (bonobo_x_object (servant)); + g_return_if_fail (WOMBAT_IS_CLIENT (client)); + g_return_if_fail (client->priv != NULL); + + if (client->priv->forget_password != NULL) + client->priv->forget_password (client, key, client->priv->fn_data); +} + +/* + * WombatClient class implementation + */ +static void +wombat_client_class_init (WombatClientClass *klass) +{ + GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); + POA_GNOME_Evolution_WombatClient__epv *epv = &klass->epv; + + object_class->destroy = wombat_client_destroy; + + epv->getPassword = impl_GNOME_Evolution_WombatClient_getPassword; + epv->forgetPassword = impl_GNOME_Evolution_WombatClient_forgetPassword; +} + +static void +wombat_client_init (WombatClient *client) +{ + client->priv = g_new0 (WombatClientPrivate, 1); +} + +static void +wombat_client_destroy (GtkObject *object) +{ + GtkObjectClass *parent_class; + WombatClient *client = (WombatClient *) object; + + g_return_if_fail (WOMBAT_IS_CLIENT (client)); + + /* free memory */ + if (client->priv != NULL) { + g_free (client->priv); + } + + /* call parent class' destroy handler */ + parent_class = GTK_OBJECT_CLASS (gtk_type_class (PARENT_TYPE)); + if (parent_class->destroy != NULL) + parent_class->destroy (GTK_OBJECT(client)); +} + +/** + * wombat_client_get_type + */ +GtkType +wombat_client_get_type (void) +{ + static GtkType type = 0; + + if (!type) { + GtkTypeInfo info = { + "WombatClient", + sizeof (WombatClient), + sizeof (WombatClientClass), + (GtkClassInitFunc) wombat_client_class_init, + (GtkObjectInitFunc) wombat_client_init, + (GtkArgSetFunc) NULL, + (GtkArgSetFunc) NULL + }; + type = bonobo_x_type_unique( + PARENT_TYPE, + POA_GNOME_Evolution_WombatClient__init, NULL, + GTK_STRUCT_OFFSET (WombatClientClass, epv), + &info); + } + return type; +} + +/** + * wombat_client_construct + */ +WombatClient * +wombat_client_construct (WombatClient *client, + WombatClientGetPasswordFn get_password_fn, + WombatClientForgetPasswordFn forget_password_fn, + gpointer fn_data) +{ + g_return_val_if_fail (WOMBAT_IS_CLIENT (client), NULL); + g_return_val_if_fail (client->priv != NULL, NULL); + + client->priv->get_password = get_password_fn; + client->priv->forget_password = forget_password_fn; + client->priv->fn_data = fn_data; + + return client; +} + +/** + * wombat_client_new + */ +WombatClient * +wombat_client_new (WombatClientGetPasswordFn get_password_fn, + WombatClientForgetPasswordFn forget_password_fn, + gpointer fn_data) +{ + WombatClient *client; + + client = WOMBAT_CLIENT (gtk_type_new (WOMBAT_TYPE_CLIENT)); + return wombat_client_construct (client, + get_password_fn, + forget_password_fn, + fn_data); +} diff --git a/libwombat/wombat-client.h b/libwombat/wombat-client.h new file mode 100644 index 0000000000..afec05db39 --- /dev/null +++ b/libwombat/wombat-client.h @@ -0,0 +1,73 @@ +/* Wombat client library + * + * Copyright (C) 2001 Ximian, Inc. + * + * Author: Rodrigo Moya <rodrigo@ximian.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. + */ + +#ifndef WOMBAT_CLIENT_H +#define WOMBAT_CLIENT_H + +#include <libgnome/gnome-defs.h> +#include <bonobo/bonobo-xobject.h> +#include "wombat.h" + +BEGIN_GNOME_DECLS + +#define WOMBAT_TYPE_CLIENT (wombat_client_get_type()) +#define WOMBAT_CLIENT(obj) GTK_CHECK_CAST(obj, WOMBAT_TYPE_CLIENT, WombatClient) +#define WOMBAT_CLIENT_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, WOMBAT_TYPE_CLIENT, WombatClientClass) +#define WOMBAT_IS_CLIENT(obj) GTK_CHECK_TYPE(obj, WOMBAT_TYPE_CLIENT) +#define WOMBAT_IS_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), WOMBAT_TYPE_CLIENT)) + +typedef struct _WombatClient WombatClient; +typedef struct _WombatClientClass WombatClientClass; +typedef struct _WombatClientPrivate WombatClientPrivate; + +struct _WombatClient { + BonoboXObject object; + WombatClientPrivate *priv; +}; + +struct _WombatClientClass { + BonoboXObjectClass parent_class; + + POA_GNOME_Evolution_WombatClient__epv epv; +}; + +typedef gchar * (* WombatClientGetPasswordFn) (WombatClient *client, + const gchar *prompt, + const gchar *key, + gpointer user_data); +typedef void (* WombatClientForgetPasswordFn) (WombatClient *client, + const gchar *key, + gpointer user_data); + +GtkType wombat_client_get_type (void); + +WombatClient *wombat_client_construct (WombatClient *client, + WombatClientGetPasswordFn get_password_fn, + WombatClientForgetPasswordFn forget_password_fn, + gpointer fn_data); +WombatClient *wombat_client_new (WombatClientGetPasswordFn get_password_fn, + WombatClientForgetPasswordFn forget_password_fn, + gpointer fn_data); + + +END_GNOME_DECLS + +#endif |