- README: add note about new configure item
- configure.ac: make Osmo address book configurable (default disabled)
- libbalsa/Makefile.am: add new sources
- libbalsa/libbalsa.c: initialise address book type
- libbalsa/libbalsa.h: include header
- src/address-book-config.c: implement configuration dialogue
- src/pref-manager.c: add to pref manager
diff --git a/README b/README
index 3c25ee8..ec9630f 100644
--- a/README
+++ b/README
@@ -95,6 +95,10 @@ address book is in the works but needs some finishing touches.
 --with-rubrica
 	Use libxml2 for Rubrica2 address book support.
 
+--with-osmo
+	Enable experimental support for read-only DBus access to the Osmo
+	contacts.  Note that Osmo svn rev. 1099 or later is required.
+
 --with-canberra
 	Use libcanberra-gtk3 for filter sounds.
 
diff --git a/configure.ac b/configure.ac
index 7b74c11..0f45556 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,11 @@ AC_ARG_WITH([rubrica],
                   [add Rubrica2 address book support (needs libxml2, default=no)]),
 		  [with_rubrica=$withval],[with_rubrica=no])
 
+AC_ARG_WITH([osmo],
+   AC_HELP_STRING([--with-osmo],
+                  [add Osmo address book support (experimental, needs osmo > svn rev. 1099, default=no)]),
+		  [with_osmo=$withval],[with_osmo=no])
+
 AC_ARG_WITH([sqlite],
    AC_HELP_STRING([--with-sqlite=DIR],
                   [Use SQLite for GPE address books (default=no)]),
@@ -532,6 +537,15 @@ else
     AC_MSG_RESULT([no])
 fi
 
+# Osmo address book support
+AC_MSG_CHECKING(whether to include experimental Osmo support)
+if test x$with_osmo != xno ; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(HAVE_OSMO,1,[If defined, enable Osmo address book support.])
+else
+    AC_MSG_RESULT([no])
+fi
+
 # LibESMTP configuration.
 #
 AC_MSG_CHECKING([whether to build ESMTP support])
diff --git a/libbalsa/Makefile.am b/libbalsa/Makefile.am
index 8be3815..d3f2c2a 100644
--- a/libbalsa/Makefile.am
+++ b/libbalsa/Makefile.am
@@ -54,6 +54,8 @@ libbalsa_a_SOURCES = 		\
 	address-book-ldap.h	\
 	address-book-ldif.c	\
 	address-book-ldif.h	\
+	address-book-osmo.c	\
+	address-book-osmo.h	\
 	address-book-rubrica.c	\
 	address-book-rubrica.h	\
 	address-book-text.c	\
@@ -140,6 +142,8 @@ libbalsa_a_SOURCES = 		\
 	rfc2445.h		\
 	rfc3156.c		\
 	rfc3156.h		\
+	rfc6350.c		\
+	rfc6350.h		\
 	send.c			\
 	send.h			\
 	server.c		\
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 3fd6293..f24a5b1 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -124,6 +124,9 @@ libbalsa_init(LibBalsaInformationFunc information_callback)
 #if HAVE_RUBRICA
     LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA;
 #endif
+#if HAVE_OSMO
+    LIBBALSA_TYPE_ADDRESS_BOOK_OSMO;
+#endif
 }
 
 
diff --git a/libbalsa/libbalsa.h b/libbalsa/libbalsa.h
index 6458651..49b00c1 100644
--- a/libbalsa/libbalsa.h
+++ b/libbalsa/libbalsa.h
@@ -62,6 +62,9 @@ typedef struct _LibbalsaVfs LibbalsaVfs;
 #if HAVE_RUBRICA
 #include "address-book-rubrica.h"
 #endif
+#if HAVE_OSMO
+#include "address-book-osmo.h"
+#endif
 
 #include "mailbox.h"
 #include "mailbox_local.h"
diff --git a/src/address-book-config.c b/src/address-book-config.c
index f245524..ad71756 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -78,6 +78,9 @@ static GtkWidget *create_gpe_dialog(AddressBookConfig * abc);
 #ifdef HAVE_RUBRICA
 static GtkWidget *create_rubrica_dialog(AddressBookConfig * abc);
 #endif
+#ifdef HAVE_OSMO
+static GtkWidget *create_osmo_dialog(AddressBookConfig *abc);
+#endif
 
 static void help_button_cb(AddressBookConfig * abc);
 static gboolean handle_close(AddressBookConfig * abc);
@@ -303,6 +306,10 @@ create_dialog_from_type(AddressBookConfig * abc)
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA) {
         return create_rubrica_dialog(abc);
 #endif
+#ifdef HAVE_OSMO
+    } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
+    	return create_osmo_dialog(abc);
+#endif
     } else {
         g_assert_not_reached();
     }
@@ -348,6 +355,60 @@ create_generic_dialog(AddressBookConfig * abc, const gchar * type)
     return dialog;
 }
 
+#ifdef HAVE_OSMO
+static GtkWidget *
+create_osmo_dialog(AddressBookConfig *abc)
+{
+    GtkWidget *dialog;
+    GtkWidget *content_area;
+    gchar *title;
+    const gchar *action;
+    const gchar *name;
+    GtkWidget *grid;
+    GtkWidget *label;
+    LibBalsaAddressBook *ab;
+    GtkSizeGroup *size_group;
+
+    ab = abc->address_book;
+    if (ab) {
+        title = g_strdup_printf(_("Modify Osmo Address Book"));
+        action = _("_Apply");
+        name = ab->name;
+    } else {
+        title = g_strdup_printf(_("Add Osmo Address Book"));
+        action = _("_Add");
+        name = NULL;
+    }
+
+    dialog =
+        gtk_dialog_new_with_buttons(title, abc->parent,
+                                    libbalsa_dialog_flags(),
+                                    _("_Help"), GTK_RESPONSE_HELP,
+                                    action, GTK_RESPONSE_APPLY,
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    NULL);
+    g_free(title);
+#if HAVE_MACOSX_DESKTOP
+    libbalsa_macosx_menu_for_parent(dialog, abc->parent);
+#endif
+    size_group = libbalsa_create_size_group(dialog);
+
+    grid = libbalsa_create_grid();
+    content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+    gtk_container_add(GTK_CONTAINER(content_area), grid);
+    gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), grid);
+    label = libbalsa_create_grid_label(_("A_ddress Book Name:"), grid, 0);
+    gtk_size_group_add_widget(size_group, label);
+    abc->name_entry =
+        libbalsa_create_grid_entry(grid, NULL, NULL, 0, name, label);
+    add_radio_buttons(grid, 1, abc);
+    g_signal_connect(G_OBJECT(dialog), "response",
+                     G_CALLBACK(edit_book_response), abc);
+
+    return dialog;
+}
+#endif /* HAVE_OSMO */
+
 static GtkWidget *
 create_externq_dialog(AddressBookConfig * abc)
 {
@@ -679,6 +740,10 @@ create_book(AddressBookConfig * abc)
             address_book = libbalsa_address_book_rubrica_new(name, path);
         g_free(path);
 #endif
+#ifdef HAVE_OSMO
+    } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
+    	address_book = libbalsa_address_book_osmo_new(name);
+#endif
     } else
         g_assert_not_reached();
 
@@ -766,6 +831,10 @@ modify_book(AddressBookConfig * abc)
 #if HAVE_SQLITE
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_GPE) {
 #endif /* HAVE_SQLITE */
+#if HAVE_OSMO
+    } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
+    	/* nothing to do here */
+#endif
     } else
         g_assert_not_reached();
 
@@ -833,6 +902,16 @@ add_rubrica_cb(GtkWidget * widget, AddressBookConfig * abc)
 }
 #endif /* HAVE_SQLITE */
 
+#ifdef HAVE_OSMO
+static void
+add_osmo_cb(GtkWidget * widget, AddressBookConfig * abc)
+{
+    abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_OSMO;
+    abc->window = create_osmo_dialog(abc);
+    gtk_widget_show_all(abc->window);
+}
+#endif /* HAVE_OSMO */
+
 GtkWidget *
 balsa_address_book_add_menu(BalsaAddressBookCallback callback,
                             GtkWindow * parent)
@@ -885,5 +964,12 @@ balsa_address_book_add_menu(BalsaAddressBookCallback callback,
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 #endif /* HAVE_RUBRICA */
 
+#ifdef HAVE_OSMO
+    menuitem = gtk_menu_item_new_with_label(_("Osmo Address Book"));
+    g_signal_connect(G_OBJECT(menuitem), "activate",
+                     G_CALLBACK(add_osmo_cb), abc);
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+#endif
+
     return menu;
 }
diff --git a/src/pref-manager.c b/src/pref-manager.c
index b4d5296..28875b5 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -1376,6 +1376,10 @@ update_address_books(void)
         else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book))
             type = "Rubrica";
 #endif
+#if HAVE_OSMO
+        else if (LIBBALSA_IS_ADDRESS_BOOK_OSMO(address_book))
+        	type = "Osmo";
+#endif
         else
             type = _("Unknown");
 

Attachment: pgpV7boU9wUb8.pgp
Description: PGP signature

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list

Reply via email to