aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/component-factory.c
blob: eddabd7b483b0a6a781c33a74af816107ad1f8f3 (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
74
75
/*
 * component-factory.c - Factory for Evolution's Addressbook component.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 *
 * Authors:
 *      Ettore Perazzoli <ettore@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#include <config.h>

#include <string.h>
#include "addressbook.h"
#include "addressbook-component.h"
#include "addressbook-config.h"
#include "addressbook-view.h"
#include "autocompletion-config.h"
#include "eab-popup-control.h"
#ifdef ENABLE_SMIME
#include "smime/gui/certificate-manager.h"
#endif
#include <bonobo/bonobo-shlib-factory.h>


#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory:" BASE_VERSION

#define COMPONENT_ID                   "OAFIID:GNOME_Evolution_Addressbook_Component:" BASE_VERSION
#define ADDRESS_POPUP_ID               "OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION
#define COMPLETION_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_Autocompletion_ConfigControl:" BASE_VERSION
#define CERTIFICATE_MANAGER_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_SMime_CertificateManager_ConfigControl:" BASE_VERSION

#define d(x)

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

    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, COMPLETION_CONFIG_CONTROL_ID) == 0)
        return BONOBO_OBJECT (autocompletion_config_control_new ());
#ifdef ENABLE_SMIME
        if (strcmp (component_id, CERTIFICATE_MANAGER_CONFIG_CONTROL_ID) == 0)
                return BONOBO_OBJECT (certificate_manager_config_control_new ());
#endif

    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)