aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-component.c11
-rw-r--r--addressbook/gui/component/addressbook-storage.c51
2 files changed, 44 insertions, 18 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 961f706620..0e304e2604 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -67,9 +67,12 @@ static char *accepted_dnd_types[] = {
static const EvolutionShellComponentFolderType folder_types[] = {
{ "contacts", "evolution-contacts.png", N_("Contacts"), N_("Folder containing contact information"),
TRUE, accepted_dnd_types, NULL },
+ { "ldap-contacts", "ldap-16.png", N_("LDAP Server"), N_("LDAP server containing contact information"),
+ TRUE, accepted_dnd_types, NULL },
{ NULL }
};
+#define IS_CONTACT_TYPE(x) (g_strcasecmp((x), "contacts") == 0 || g_strcasecmp ((x), "ldap-contacts") == 0)
/* EvolutionShellComponent methods and signals. */
@@ -82,7 +85,7 @@ create_view (EvolutionShellComponent *shell_component,
{
BonoboControl *control;
- if (g_strcasecmp (type, "contacts") != 0)
+ if (!IS_CONTACT_TYPE (type))
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
control = addressbook_factory_new_control ();
@@ -103,7 +106,7 @@ create_folder (EvolutionShellComponent *shell_component,
CORBA_Environment ev;
GNOME_Evolution_ShellComponentListener_Result result;
- if (g_strcasecmp (type, "contacts") != 0)
+ if (!IS_CONTACT_TYPE (type))
result = GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE;
else
result = GNOME_Evolution_ShellComponentListener_OK;
@@ -127,7 +130,7 @@ remove_folder (EvolutionShellComponent *shell_component,
CORBA_exception_init(&ev);
- if (strcmp (type, "contacts") != 0) {
+ if (!IS_CONTACT_TYPE (type)) {
GNOME_Evolution_ShellComponentListener_notifyResult (listener,
GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
&ev);
@@ -195,7 +198,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
char *source_path;
char *destination_path;
- if (strcmp (type, "contacts") != 0) {
+ if (!IS_CONTACT_TYPE (type)) {
GNOME_Evolution_ShellComponentListener_notifyResult (listener,
GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
&ev);
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index efff59a732..6154969b14 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -102,30 +102,53 @@ addressbook_storage_setup (EvolutionShellComponent *shell_component,
}
#ifdef HAVE_LDAP
-static int
-remove_ldap_folder (EvolutionStorage *storage,
+static void
+notify_listener (const Bonobo_Listener listener,
+ GNOME_Evolution_Storage_Result corba_result)
+{
+ CORBA_any any;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ any._type = TC_GNOME_Evolution_Storage_Result;
+ any._value = &corba_result;
+
+ Bonobo_Listener_event (listener, "result", &any, &ev);
+
+ CORBA_exception_free (&ev);
+}
+
+static void
+remove_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener,
const CORBA_char *path, const CORBA_char *physical_uri,
gpointer data)
{
+
addressbook_storage_remove_source (path + 1);
addressbook_storage_write_sources();
- return GNOME_Evolution_Storage_OK;
+
+ notify_listener (listener, GNOME_Evolution_Storage_OK);
}
-static int
-create_ldap_folder (EvolutionStorage *storage,
+
+static void
+create_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener,
const CORBA_char *path, const CORBA_char *type,
const CORBA_char *description, const CORBA_char *parent_physical_uri,
- int *result, gpointer data)
+ gpointer data)
{
- if (strcmp (type, "contacts"))
- return GNOME_Evolution_Storage_UNSUPPORTED_TYPE;
-
- if (strcmp (parent_physical_uri, "")) /* ldap servers can't have subfolders */
- return GNOME_Evolution_Storage_INVALID_URI;
+ if (strcmp (type, "ldap-contacts")) {
+ notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE);
+ return;
+ }
+ if (strcmp (parent_physical_uri, "")) {/* ldap servers can't have subfolders */
+ notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI);
+ return;
+ }
addressbook_create_new_source (path + 1, NULL);
- return GNOME_Evolution_Storage_OK;
+ notify_listener (listener, GNOME_Evolution_Storage_OK);
}
#endif
@@ -341,7 +364,7 @@ load_source_data (const char *file_path)
path = g_strdup_printf ("/%s", source->name);
evolution_storage_new_folder (storage, path, source->name,
- "contacts", source->uri,
+ "ldap-contacts", source->uri,
source->description, 0);
sources = g_list_append (sources, source);
@@ -443,7 +466,7 @@ addressbook_storage_add_source (AddressbookSource *source)
/* And then to the ui */
addressbook_get_other_contact_storage();
path = g_strdup_printf ("/%s", source->name);
- evolution_storage_new_folder (storage, path, source->name, "contacts",
+ evolution_storage_new_folder (storage, path, source->name, "ldap-contacts",
source->uri, source->description, 0);
g_free (path);