From 165bf85c4d07928acf01c43c49c7e65c16b28ac8 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 1 May 2000 00:23:53 +0000 Subject: added e-ldap-server-dialog.c (glade_DATA): added ldap-server-dialog.glade * gui/component/Makefile.am (evolution_addressbook_SOURCES): added e-ldap-server-dialog.c (glade_DATA): added ldap-server-dialog.glade * gui/component/ldap-server-dialog.glade: new file. * gui/component/e-ldap-server-dialog.h: new file. * gui/component/e-ldap-server-dialog.c: new file, contains logic associated with ldap server dialog. * gui/component/addressbook.c (control_deactivate): remove the directory server menu item. (null_cb): do nothing callback for e_book_load_uri call. should change to (at the very least) pop up a dialog if there was an error. (new_server_cb): new function - really just switches to a particular ldap server, since the information isn't saved anywhere. (control_activate): add directory server menu item. svn path=/trunk/; revision=2700 --- addressbook/gui/component/addressbook.c | 77 ++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 31 deletions(-) (limited to 'addressbook/gui/component/addressbook.c') diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index d634d5a926..e559c39ea4 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -20,6 +20,7 @@ #include #include "e-minicard-view.h" #include "e-contact-editor.h" +#include "e-ldap-server-dialog.h" #ifdef USING_OAF #define CONTROL_FACTORY_ID "OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" @@ -32,6 +33,7 @@ control_deactivate (BonoboControl *control, BonoboUIHandler *uih) { /* how to remove a menu item */ bonobo_ui_handler_menu_remove (uih, "/Actions/New Contact"); + bonobo_ui_handler_menu_remove (uih, "/Actions/New Directory Server"); /* remove our toolbar */ bonobo_ui_handler_dock_remove (uih, "/Toolbar"); @@ -42,34 +44,6 @@ do_nothing_cb (BonoboUIHandler *uih, void *user_data, const char *path) { printf ("Yow! I am called back!\n"); } - - -#define BLANK_VCARD \ -"BEGIN:VCARD -" \ -"FN: -" \ -"N: -" \ -"BDAY: -" \ -"TEL;WORK: -" \ -"TEL;CELL: -" \ -"EMAIL;INTERNET: -" \ -"EMAIL;INTERNET: -" \ -"ADR;WORK;POSTAL: -" \ -"ADR;HOME;POSTAL;INTL: -" \ -"END:VCARD -" \ -" -" - static void card_added_cb (EBook* book, EBookStatus status, const char *id, @@ -121,6 +95,42 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) } +static void +null_cb (EBook *book, EBookStatus status, gpointer closure) +{ +} + +static void +new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path) +{ + EMinicardView *minicard_view = E_MINICARD_VIEW (user_data); + ELDAPServer server; + char *uri; + EBook *book; + + /* fill in the defaults */ + server.host = g_strdup(""); + server.port = 389; + server.description = g_strdup(""); + server.rootdn = g_strdup(""); + + e_ldap_server_editor_show (&server); + + gtk_object_get(GTK_OBJECT(minicard_view), "book", &book, NULL); + g_assert (E_IS_BOOK (book)); + + /* XXX write out the new server info */ + + /* now update the view */ + uri = g_strdup_printf ("ldap://%s:%d/%s", server.host, server.port, server.rootdn); + + e_book_unload_uri (book); + + if (! e_book_load_uri (book, uri, null_cb, NULL)) { + g_warning ("error calling load_uri!\n"); + } +} + static void find_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) { @@ -143,7 +153,6 @@ find_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - /* If the user clicks "okay"...*/ if (result == 0) { search_text = gtk_entry_get_text(GTK_ENTRY(search_entry)); @@ -221,7 +230,6 @@ make_quick_search_widget (GtkSignalFunc start_search_func, return search_vbox; } - static void control_activate (BonoboControl *control, BonoboUIHandler *uih, EMinicardView *minicard_view) @@ -242,6 +250,13 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih, 0, 0, new_contact_cb, (gpointer)minicard_view); + bonobo_ui_handler_menu_new_item (uih, "/Actions/New Directory Server", + N_("N_ew Directory Server"), + NULL, -1, + BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, + 0, 0, new_server_cb, + (gpointer)minicard_view); + toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); @@ -261,7 +276,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih, FALSE, TRUE, 0); gtk_widget_show_all (hbox); - + toolbar_control = bonobo_control_new (hbox); bonobo_ui_handler_dock_add ( uih, "/Toolbar", -- cgit v1.2.3