1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* camel-object.h: Base class for Camel 3 * 4 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 5 * 6 * This library is free software: you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published by 8 * the Free Software Foundation. 9 * 10 * This library is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 13 * for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with this library. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * Authors: Dan Winship <danw@ximian.com> 19 * Michael Zucchi <notzed@ximian.com> 20 */ 21 22 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION) 23 #error "Only <camel/camel.h> can be included directly." 24 #endif 25 26 #ifndef CAMEL_OBJECT_H 27 #define CAMEL_OBJECT_H 28 29 #include <stdio.h> /* FILE */ 30 #include <stdlib.h> /* gsize */ 31 #include <stdarg.h> 32 #include <gio/gio.h> 33 34 /* Standard GObject macros */ 35 #define CAMEL_TYPE_OBJECT \ 36 (camel_object_get_type ()) 37 #define CAMEL_OBJECT(obj) \ 38 (G_TYPE_CHECK_INSTANCE_CAST \ 39 ((obj), CAMEL_TYPE_OBJECT, CamelObject)) 40 #define CAMEL_OBJECT_CLASS(cls) \ 41 (G_TYPE_CHECK_CLASS_CAST \ 42 ((cls), CAMEL_TYPE_OBJECT, CamelObjectClass)) 43 #define CAMEL_IS_OBJECT(obj) \ 44 (G_TYPE_CHECK_INSTANCE_TYPE \ 45 ((obj), CAMEL_TYPE_OBJECT)) 46 #define CAMEL_IS_OBJECT_CLASS(cls) \ 47 (G_TYPE_CHECK_CLASS_TYPE \ 48 ((cls), CAMEL_TYPE_OBJECT)) 49 #define CAMEL_OBJECT_GET_CLASS(obj) \ 50 (G_TYPE_INSTANCE_GET_CLASS \ 51 ((obj), CAMEL_TYPE_OBJECT, CamelObjectClass)) 52 53 /** 54 * CAMEL_ERROR: 55 * 56 * Since: 2.32 57 **/ 58 #define CAMEL_ERROR \ 59 (camel_error_quark ()) 60 61 G_BEGIN_DECLS 62 63 typedef struct _CamelObject CamelObject; 64 typedef struct _CamelObjectClass CamelObjectClass; 65 typedef struct _CamelObjectPrivate CamelObjectPrivate; 66 67 /** 68 * CamelParamFlags: 69 * @CAMEL_PARAM_PERSISTENT: 70 * The parameter is persistent, which means its value is saved to 71 * #CamelObject:state-filename during camel_object_state_write(), 72 * and restored during camel_object_state_read(). 73 * 74 * These flags extend #GParamFlags. Most of the time you will use them 75 * in conjunction with g_object_class_install_property(). 76 * 77 * Since: 2.32 78 **/ 79 typedef enum { 80 CAMEL_PARAM_PERSISTENT = 1 << (G_PARAM_USER_SHIFT + 0) 81 } CamelParamFlags; 82 83 /** 84 * CamelError: 85 * @CAMEL_ERROR_GENERIC: a generic (fallback) error code 86 * 87 * Since: 2.32 88 **/ 89 typedef enum { 90 CAMEL_ERROR_GENERIC /* lazy fallback error */ 91 } CamelError; 92 93 struct _CamelObject { 94 GObject parent; 95 CamelObjectPrivate *priv; 96 }; 97 98 struct _CamelObjectClass { 99 GObjectClass parent_class; 100 101 gint (*state_read) (CamelObject *object, 102 FILE *fp); 103 gint (*state_write) (CamelObject *object, 104 FILE *fp); 105 106 /* Padding for future expansion */ 107 gpointer reserved[20]; 108 }; 109 110 GType camel_object_get_type (void); 111 GQuark camel_error_quark (void) G_GNUC_CONST; 112 gint camel_object_state_read (CamelObject *object); 113 gint camel_object_state_write (CamelObject *object); 114 const gchar * camel_object_get_state_filename (CamelObject *object); 115 void camel_object_set_state_filename (CamelObject *object, 116 const gchar *state_filename); 117 118 G_END_DECLS 119 120 #endif /* CAMEL_OBJECT_H */ 121