1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /** |
---|
3 | * bonobo-persist-stream.c: PersistStream implementation. Can be used as a |
---|
4 | * base class, or directly for implementing objects that use PersistStream. |
---|
5 | * |
---|
6 | * Author: |
---|
7 | * Miguel de Icaza (miguel@kernel.org) |
---|
8 | * |
---|
9 | * Copyright 1999 Helix Code, Inc. |
---|
10 | */ |
---|
11 | #ifndef _BONOBO_PERSIST_STREAM_H_ |
---|
12 | #define _BONOBO_PERSIST_STREAM_H_ |
---|
13 | |
---|
14 | #include <bonobo/bonobo-persist.h> |
---|
15 | |
---|
16 | BEGIN_GNOME_DECLS |
---|
17 | |
---|
18 | #define BONOBO_PERSIST_STREAM_TYPE (bonobo_persist_stream_get_type ()) |
---|
19 | #define BONOBO_PERSIST_STREAM(o) (GTK_CHECK_CAST ((o), BONOBO_PERSIST_STREAM_TYPE, BonoboPersistStream)) |
---|
20 | #define BONOBO_PERSIST_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_PERSIST_STREAM_TYPE, BonoboPersistStreamClass)) |
---|
21 | #define BONOBO_IS_PERSIST_STREAM(o) (GTK_CHECK_TYPE ((o), BONOBO_PERSIST_STREAM_TYPE)) |
---|
22 | #define BONOBO_IS_PERSIST_STREAM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_PERSIST_STREAM_TYPE)) |
---|
23 | |
---|
24 | typedef struct _BonoboPersistStreamPrivate BonoboPersistStreamPrivate; |
---|
25 | typedef struct _BonoboPersistStream BonoboPersistStream; |
---|
26 | |
---|
27 | typedef void (*BonoboPersistStreamIOFn) (BonoboPersistStream *ps, |
---|
28 | const Bonobo_Stream stream, |
---|
29 | Bonobo_Persist_ContentType type, |
---|
30 | void *closure, |
---|
31 | CORBA_Environment *ev); |
---|
32 | |
---|
33 | typedef CORBA_long (*BonoboPersistStreamMaxFn) (BonoboPersistStream *ps, |
---|
34 | void *closure, |
---|
35 | CORBA_Environment *ev); |
---|
36 | |
---|
37 | typedef Bonobo_Persist_ContentTypeList * (*BonoboPersistStreamTypesFn) (BonoboPersistStream *ps, |
---|
38 | void *closure, |
---|
39 | CORBA_Environment *ev); |
---|
40 | |
---|
41 | struct _BonoboPersistStream { |
---|
42 | BonoboPersist persist; |
---|
43 | |
---|
44 | gboolean is_dirty; |
---|
45 | |
---|
46 | /* |
---|
47 | * For the sample routines, NULL if we use the |
---|
48 | * methods from the class |
---|
49 | */ |
---|
50 | BonoboPersistStreamIOFn save_fn; |
---|
51 | BonoboPersistStreamIOFn load_fn; |
---|
52 | BonoboPersistStreamMaxFn max_fn; |
---|
53 | BonoboPersistStreamTypesFn types_fn; |
---|
54 | |
---|
55 | void *closure; |
---|
56 | |
---|
57 | BonoboPersistStreamPrivate *priv; |
---|
58 | }; |
---|
59 | |
---|
60 | typedef struct { |
---|
61 | BonoboPersistClass parent_class; |
---|
62 | |
---|
63 | POA_Bonobo_PersistStream__epv epv; |
---|
64 | |
---|
65 | /* methods */ |
---|
66 | void (*load) (BonoboPersistStream *ps, |
---|
67 | Bonobo_Stream stream, |
---|
68 | Bonobo_Persist_ContentType type, |
---|
69 | CORBA_Environment *ev); |
---|
70 | void (*save) (BonoboPersistStream *ps, |
---|
71 | Bonobo_Stream stream, |
---|
72 | Bonobo_Persist_ContentType type, |
---|
73 | CORBA_Environment *ev); |
---|
74 | CORBA_long (*get_size_max) (BonoboPersistStream *ps, |
---|
75 | CORBA_Environment *ev); |
---|
76 | Bonobo_Persist_ContentTypeList * (*get_content_types) (BonoboPersistStream *ps, |
---|
77 | CORBA_Environment *ev); |
---|
78 | |
---|
79 | } BonoboPersistStreamClass; |
---|
80 | |
---|
81 | GtkType bonobo_persist_stream_get_type (void); |
---|
82 | void bonobo_persist_stream_set_dirty (BonoboPersistStream *ps, |
---|
83 | gboolean dirty); |
---|
84 | |
---|
85 | BonoboPersistStream *bonobo_persist_stream_new (BonoboPersistStreamIOFn load_fn, |
---|
86 | BonoboPersistStreamIOFn save_fn, |
---|
87 | BonoboPersistStreamMaxFn max_fn, |
---|
88 | BonoboPersistStreamTypesFn types_fn, |
---|
89 | void *closure); |
---|
90 | |
---|
91 | BonoboPersistStream *bonobo_persist_stream_construct (BonoboPersistStream *ps, |
---|
92 | BonoboPersistStreamIOFn load_fn, |
---|
93 | BonoboPersistStreamIOFn save_fn, |
---|
94 | BonoboPersistStreamMaxFn max_fn, |
---|
95 | BonoboPersistStreamTypesFn types_fn, |
---|
96 | void *closure); |
---|
97 | |
---|
98 | END_GNOME_DECLS |
---|
99 | |
---|
100 | #endif /* _BONOBO_PERSIST_STREAM_H_ */ |
---|