source: trunk/third/bonobo/bonobo/bonobo-persist.c @ 16750

Revision 16750, 2.4 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16749, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * bonobo-persist.c: a persistance interface
4 *
5 * Author:
6 *   Miguel de Icaza (miguel@kernel.org)
7 *
8 * Copyright 1999 Helix Code, Inc.
9 */
10#include <config.h>
11#include <gtk/gtksignal.h>
12#include <gtk/gtkmarshal.h>
13#include <bonobo/bonobo-persist.h>
14
15#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
16
17/* Parent GTK object class */
18static GtkObjectClass *bonobo_persist_parent_class;
19
20#define CLASS(o) BONOBO_PERSIST_CLASS(GTK_OBJECT(o)->klass)
21
22static inline BonoboPersist *
23bonobo_persist_from_servant (PortableServer_Servant servant)
24{
25        return BONOBO_PERSIST (bonobo_object_from_servant (servant));
26}
27
28static Bonobo_Persist_ContentTypeList *
29impl_Bonobo_Persist_getContentTypes (PortableServer_Servant servant,
30                                     CORBA_Environment     *ev)
31{
32        BonoboPersist *persist = bonobo_persist_from_servant (servant);
33
34        return CLASS (persist)->get_content_types (persist, ev);
35}
36
37static void
38bonobo_persist_destroy (GtkObject *object)
39{
40        bonobo_persist_parent_class->destroy (object);
41}
42
43static void
44bonobo_persist_class_init (BonoboPersistClass *klass)
45{
46        GtkObjectClass *object_class = (GtkObjectClass *) klass;
47        POA_Bonobo_Persist__epv *epv = &klass->epv;
48
49        bonobo_persist_parent_class = gtk_type_class (PARENT_TYPE);
50
51        /* Override and initialize methods */
52        object_class->destroy = bonobo_persist_destroy;
53
54        epv->getContentTypes = impl_Bonobo_Persist_getContentTypes;
55}
56
57static void
58bonobo_persist_init (GtkObject *object)
59{
60        /* nothing to do */
61}
62
63BONOBO_X_TYPE_FUNC_FULL (BonoboPersist,
64                           Bonobo_Persist,
65                           PARENT_TYPE,
66                           bonobo_persist);
67
68/**
69 * bonobo_persist_generate_content_types:
70 * @num: the number of content types specified
71 * @...: the content types (as strings)
72 *
73 * Returns: a ContentTypeList containing the given ContentTypes
74 **/
75Bonobo_Persist_ContentTypeList *
76bonobo_persist_generate_content_types (int num, ...)
77{
78        Bonobo_Persist_ContentTypeList *types;
79        va_list ap;
80        char *type;
81        int i;
82
83        types = Bonobo_Persist_ContentTypeList__alloc ();
84        CORBA_sequence_set_release (types, TRUE);
85        types->_length = types->_maximum = num;
86        types->_buffer = CORBA_sequence_Bonobo_Persist_ContentType_allocbuf (num);
87
88        va_start (ap, num);
89        for (i = 0; i < num; i++) {
90                type = va_arg (ap, char *);
91                types->_buffer[i] = CORBA_string_alloc (strlen (type) + 1);
92                strcpy (types->_buffer[i], type);
93        }
94        va_end (ap);
95
96        return types;
97}
Note: See TracBrowser for help on using the repository browser.