1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /* |
---|
3 | * Bonobo PersistFile |
---|
4 | * |
---|
5 | * Author: |
---|
6 | * Matt Loper (matt@gnome-support.com) |
---|
7 | * |
---|
8 | * Copyright 1999, 2000 Helix Code, Inc. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef _BONOBO_PERSIST_FILE_H_ |
---|
12 | #define _BONOBO_PERSIST_FILE_H_ |
---|
13 | |
---|
14 | #include <bonobo/bonobo-persist.h> |
---|
15 | |
---|
16 | BEGIN_GNOME_DECLS |
---|
17 | |
---|
18 | #define BONOBO_PERSIST_FILE_TYPE (bonobo_persist_file_get_type ()) |
---|
19 | #define BONOBO_PERSIST_FILE(o) (GTK_CHECK_CAST ((o), BONOBO_PERSIST_FILE_TYPE, BonoboPersistFile)) |
---|
20 | #define BONOBO_PERSIST_FILE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_PERSIST_FILE_TYPE, BonoboPersistFileClass)) |
---|
21 | #define BONOBO_IS_PERSIST_FILE(o) (GTK_CHECK_TYPE ((o), BONOBO_PERSIST_FILE_TYPE)) |
---|
22 | #define BONOBO_IS_PERSIST_FILE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_PERSIST_FILE_TYPE)) |
---|
23 | |
---|
24 | typedef struct _BonoboPersistFilePrivate BonoboPersistFilePrivate; |
---|
25 | typedef struct _BonoboPersistFile BonoboPersistFile; |
---|
26 | |
---|
27 | typedef int (*BonoboPersistFileIOFn) (BonoboPersistFile *pf, |
---|
28 | const CORBA_char *filename, |
---|
29 | CORBA_Environment *ev, |
---|
30 | void *closure); |
---|
31 | |
---|
32 | struct _BonoboPersistFile { |
---|
33 | BonoboPersist persist; |
---|
34 | |
---|
35 | gboolean is_dirty; |
---|
36 | char *filename; |
---|
37 | |
---|
38 | /* |
---|
39 | * For the sample routines, NULL if we use the ::save and ::load |
---|
40 | * methods from the class |
---|
41 | */ |
---|
42 | BonoboPersistFileIOFn save_fn; |
---|
43 | BonoboPersistFileIOFn load_fn; |
---|
44 | void *closure; |
---|
45 | |
---|
46 | BonoboPersistFilePrivate *priv; |
---|
47 | }; |
---|
48 | |
---|
49 | typedef struct { |
---|
50 | BonoboPersistClass parent_class; |
---|
51 | |
---|
52 | POA_Bonobo_PersistFile__epv epv; |
---|
53 | |
---|
54 | /* methods */ |
---|
55 | int (*load) (BonoboPersistFile *ps, |
---|
56 | const CORBA_char *filename, |
---|
57 | CORBA_Environment *ev); |
---|
58 | |
---|
59 | int (*save) (BonoboPersistFile *ps, |
---|
60 | const CORBA_char *filename, |
---|
61 | CORBA_Environment *ev); |
---|
62 | |
---|
63 | char *(*get_current_file) (BonoboPersistFile *ps, |
---|
64 | CORBA_Environment *ev); |
---|
65 | |
---|
66 | } BonoboPersistFileClass; |
---|
67 | |
---|
68 | GtkType bonobo_persist_file_get_type (void); |
---|
69 | void bonobo_persist_file_set_dirty (BonoboPersistFile *ps, |
---|
70 | gboolean dirty); |
---|
71 | |
---|
72 | BonoboPersistFile *bonobo_persist_file_new (BonoboPersistFileIOFn load_fn, |
---|
73 | BonoboPersistFileIOFn save_fn, |
---|
74 | void *closure); |
---|
75 | |
---|
76 | BonoboPersistFile *bonobo_persist_file_construct (BonoboPersistFile *ps, |
---|
77 | BonoboPersistFileIOFn load_fn, |
---|
78 | BonoboPersistFileIOFn save_fn, |
---|
79 | void *closure); |
---|
80 | |
---|
81 | END_GNOME_DECLS |
---|
82 | |
---|
83 | #endif /* _BONOBO_PERSIST_FILE_H_ */ |
---|