aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/component-factory.c
blob: 512ab72f2a18638d5ee7282350d0afb5391f24fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.c - Factory for Evolution's Addressbook component.
 *
 * Copyright (C) 2002 Ximian, Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * 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.
 *
 * Author: Ettore Perazzoli <ettore@ximian.com>
 */

#include <config.h>

#include <string.h>
#include "addressbook.h"
#include "addressbook-component.h"
#include "addressbook-config.h"
#include "eab-popup-control.h"
#include "eab-vcard-control.h"
#include "select-names/e-select-names-bonobo.h"

#include <bonobo/bonobo-shlib-factory.h>


#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory_2"

#define VCARD_CONTROL_ID               "OAFIID:GNOME_Evolution_Addressbook_VCard_Control"
#define ADDRESSBOOK_CONTROL_ID         "OAFIID:GNOME_Evolution_Addressbook_Control"
#define COMPONENT_ID                   "OAFIID:GNOME_Evolution_Addressbook_Component"
#define ADDRESS_POPUP_ID               "OAFIID:GNOME_Evolution_Addressbook_AddressPopup"
#define SELECT_NAMES_ID                "OAFIID:GNOME_Evolution_Addressbook_SelectNames"
#define LDAP_STORAGE_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl"


static BonoboObject *
factory (BonoboGenericFactory *factory,
     const char *component_id,
     void *closure)
{
    printf ("asked to activate component_id `%s'\n", component_id);

    if (strcmp (component_id, VCARD_CONTROL_ID) == 0)
        return BONOBO_OBJECT (eab_vcard_control_new ());
    if (strcmp (component_id, ADDRESSBOOK_CONTROL_ID) == 0)
        return BONOBO_OBJECT (addressbook_new_control ());
    if (strcmp (component_id, COMPONENT_ID) == 0) {
        BonoboObject *object = BONOBO_OBJECT (addressbook_component_peek ());
        bonobo_object_ref (object);
        return object;
    }
    if (strcmp (component_id, ADDRESS_POPUP_ID) == 0)
        return BONOBO_OBJECT (eab_popup_control_new ());
    if (strcmp (component_id, LDAP_STORAGE_CONFIG_CONTROL_ID) == 0)
        return BONOBO_OBJECT (addressbook_config_control_new ());
    if (strcmp (component_id, SELECT_NAMES_ID) == 0)
        return BONOBO_OBJECT (e_select_names_bonobo_new ());

    g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
    return NULL;
}

BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Addressbook component factory", factory, NULL)