New address book.
authorMatch Grun <match@dimensional.com>
Sun, 2 Sep 2001 01:09:09 +0000 (01:09 +0000)
committerMatch Grun <match@dimensional.com>
Sun, 2 Sep 2001 01:09:09 +0000 (01:09 +0000)
src/addressbook.c
src/addrindex.c
src/syldap.c

index becf2ec..4626378 100644 (file)
@@ -128,16 +128,12 @@ static GdkPixmap *addressxpm;
 static GdkBitmap *addressxpmmask;
 static GdkPixmap *vcardxpm;
 static GdkBitmap *vcardxpmmask;
-#ifdef USE_JPILOT
 static GdkPixmap *jpilotxpm;
 static GdkBitmap *jpilotxpmmask;
 static GdkPixmap *categoryxpm;
 static GdkBitmap *categoryxpmmask;
-#endif
-#ifdef USE_LDAP
 static GdkPixmap *ldapxpm;
 static GdkBitmap *ldapxpmmask;
-#endif
 
 // Message buffer
 static gchar addressbook_msgbuf[ ADDRESSBOOK_MSGBUF_SIZE ];
@@ -487,6 +483,7 @@ static void addressbook_create( void ) {
        GList *nodeIf;
        AdapterInterface *adapter;
        AddressTypeControlItem *atci;
+       AddressInterface *iface;
 
        gchar *titles[N_COLS] = {_("Name"), _("E-Mail address"), _("Remarks")};
        gchar *text;
@@ -682,16 +679,19 @@ static void addressbook_create( void ) {
        while( nodeIf ) {
                adapter = nodeIf->data;
                nodeIf = g_list_next( nodeIf );
-               atci = adapter->atci;
-               text = atci->displayName;
-               adapter->treeNode =
-                       gtk_ctree_insert_node( GTK_CTREE(ctree),
-                               NULL, NULL, &text, FOLDER_SPACING,
-                               interfacexpm, interfacexpmmask,
-                               interfacexpm, interfacexpmmask,
-                               FALSE, FALSE );
-               menu_set_sensitive( menu_factory, atci->menuCommand, adapter->haveLibrary );
-               gtk_ctree_node_set_row_data( GTK_CTREE(ctree), adapter->treeNode, adapter );
+               iface = adapter->interface;
+               if( iface->useInterface ) {
+                       atci = adapter->atci;
+                       text = atci->displayName;
+                       adapter->treeNode =
+                               gtk_ctree_insert_node( GTK_CTREE(ctree),
+                                       NULL, NULL, &text, FOLDER_SPACING,
+                                       interfacexpm, interfacexpmmask,
+                                       interfacexpm, interfacexpmmask,
+                                       FALSE, FALSE );
+                       menu_set_sensitive( menu_factory, atci->menuCommand, adapter->haveLibrary );
+                       gtk_ctree_node_set_row_data( GTK_CTREE(ctree), adapter->treeNode, adapter );
+               }
        }
 
        // Popup menu
@@ -2292,18 +2292,20 @@ static void addressbook_load_tree( void ) {
                iface = adapter->interface;
                atci = adapter->atci;
                if( iface ) {
-                       // Load data sources below interface node
-                       nodeDS = iface->listSource;
-                       while( nodeDS ) {
-                               ds = nodeDS->data;
-                               newNode = NULL;
-                               name = addrindex_ds_get_name( ds );
-                               ads = addressbook_create_ds_adapter( ds, atci->objectType, name );
-                               newNode = addressbook_add_object( node, ADDRESS_OBJECT(ads) );
-                               nodeDS = g_list_next( nodeDS );
+                       if( iface->useInterface ) {
+                               // Load data sources below interface node
+                               nodeDS = iface->listSource;
+                               while( nodeDS ) {
+                                       ds = nodeDS->data;
+                                       newNode = NULL;
+                                       name = addrindex_ds_get_name( ds );
+                                       ads = addressbook_create_ds_adapter( ds, atci->objectType, name );
+                                       newNode = addressbook_add_object( node, ADDRESS_OBJECT(ads) );
+                                       nodeDS = g_list_next( nodeDS );
+                               }
+                               gtk_ctree_expand( ctree, node );
                        }
                }
-               gtk_ctree_expand( ctree, node );
                nodeIf = g_list_next( nodeIf );
        }
 }
index 7e1e0d8..a8d1f9b 100644 (file)
@@ -169,8 +169,8 @@ static void addrindex_build_if_list( AddressIndex *addrIndex ) {
 
        iface = addrindex_create_interface( ADDR_IF_JPILOT, "J-Pilot", TAG_IF_JPILOT, TAG_DS_JPILOT );
 #ifdef USE_JPILOT
-       iface->useInterface = TRUE;
        iface->haveLibrary = jpilot_test_pilot_lib();
+       iface->useInterface = iface->haveLibrary;
        iface->getModifyFlag = ( void * ) jpilot_get_modified;
        iface->getAccessFlag = ( void * ) jpilot_get_accessed;
        iface->getReadFlag   = ( void * ) jpilot_get_read_flag;
@@ -192,6 +192,7 @@ static void addrindex_build_if_list( AddressIndex *addrIndex ) {
        iface = addrindex_create_interface( ADDR_IF_LDAP, "LDAP", TAG_IF_LDAP, TAG_DS_LDAP );
 #ifdef USE_LDAP
        iface->haveLibrary = syldap_test_ldap_lib();
+       iface->useInterface = iface->haveLibrary;
        iface->getAccessFlag = ( void * ) syldap_get_accessed;
        // iface->getModifyFlag = ( void * ) syldap_get_modified;
        // iface->getReadFlag   = ( void * ) syldap_get_read_flag;
@@ -896,7 +897,7 @@ static void addrindex_write_ldap( FILE *fp, AddressDataSource *ds, gint lvl ) {
 static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
        AddressDataSource *ds = g_new0( AddressDataSource, 1 );
        GList *list = addrindex_read_attributes( file );
-       ds->data = list;
+       ds->rawDataSource = list;
        return ds;
 }
 
index be39416..1cdb7d8 100644 (file)
@@ -1026,7 +1026,7 @@ gboolean syldap_test_connect( SyldapServer *ldapServer ) {
 */
 gboolean syldap_test_ldap_lib() {
        void *handle, *fun;
-
+       
        // Get library
        handle = dlopen( LDAP_LINK_LIB_NAME_1, RTLD_LAZY );
        if( ! handle ) {