[balsa] Declare LibBalsaAddressBookExternq final
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Declare LibBalsaAddressBookExternq final
- Date: Wed, 15 May 2019 15:12:37 +0000 (UTC)
commit 3256107542464e6b80cf297356884a7ec4896663
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed May 15 11:11:09 2019 -0400
Declare LibBalsaAddressBookExternq final
Use G_DECLARE_FINAL_TYPE to declare LibBalsaAddressBookExternq
Make the structure private, and provide and use the necessary
getters and setters.
Adopt libbalsa_address_book_externq as the namespace, and
ab_externq as the identifier.
* libbalsa/address-book-extern.c
(libbalsa_address_book_externq_class_init),
(libbalsa_address_book_externq_init),
(libbalsa_address_book_externq_finalize),
(libbalsa_address_book_externq_new), (lbe_load_cb),
(libbalsa_address_book_externq_load), (parse_externq_file),
(libbalsa_address_book_externq_add_address),
(libbalsa_address_book_externq_save_config),
(libbalsa_address_book_externq_load_config),
(libbalsa_address_book_externq_alias_complete),
(libbalsa_address_book_externq_get_load),
(libbalsa_address_book_externq_get_save),
(libbalsa_address_book_externq_set_load),
(libbalsa_address_book_externq_set_save):
* libbalsa/address-book-extern.h:
* libbalsa/libbalsa.c (libbalsa_init):
* src/ab-main.c (bab_window_set_title),
(file_new_externq_activated), (get_main_menu), (bab_init):
* src/ab-window.c (balsa_ab_window_set_title):
* src/address-book-config.c (create_dialog_from_type),
(create_externq_dialog), (handle_close), (create_book),
(modify_book), (add_externq_cb):
* src/pref-manager.c (update_address_books):
ChangeLog | 34 +++++++
libbalsa/address-book-extern.c | 202 ++++++++++++++++++++++-------------------
libbalsa/address-book-extern.h | 46 ++++------
libbalsa/libbalsa.c | 2 +-
src/ab-main.c | 10 +-
src/ab-window.c | 2 +-
src/address-book-config.c | 38 ++++----
src/pref-manager.c | 4 +-
8 files changed, 190 insertions(+), 148 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d52d88e35..d4f2b1181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2019-05-15 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Use G_DECLARE_FINAL_TYPE to declare LibBalsaAddressBookExternq
+
+ Make the structure private, and provide and use the necessary
+ getters and setters.
+
+ Adopt libbalsa_address_book_externq as the namespace, and
+ ab_externq as the identifier.
+
+ * libbalsa/address-book-extern.c
+ (libbalsa_address_book_externq_class_init),
+ (libbalsa_address_book_externq_init),
+ (libbalsa_address_book_externq_finalize),
+ (libbalsa_address_book_externq_new), (lbe_load_cb),
+ (libbalsa_address_book_externq_load), (parse_externq_file),
+ (libbalsa_address_book_externq_add_address),
+ (libbalsa_address_book_externq_save_config),
+ (libbalsa_address_book_externq_load_config),
+ (libbalsa_address_book_externq_alias_complete),
+ (libbalsa_address_book_externq_get_load),
+ (libbalsa_address_book_externq_get_save),
+ (libbalsa_address_book_externq_set_load),
+ (libbalsa_address_book_externq_set_save):
+ * libbalsa/address-book-extern.h:
+ * libbalsa/libbalsa.c (libbalsa_init):
+ * src/ab-main.c (bab_window_set_title),
+ (file_new_externq_activated), (get_main_menu), (bab_init):
+ * src/ab-window.c (balsa_ab_window_set_title):
+ * src/address-book-config.c (create_dialog_from_type),
+ (create_externq_dialog), (handle_close), (create_book),
+ (modify_book), (add_externq_cb):
+ * src/pref-manager.c (update_address_books):
+
2019-05-14 Peter Bloomfield <pbloomfield bellsouth net>
Use G_DECLARE_DERIVABLE_TYPE to declare LibBalsaAddressBookText
diff --git a/libbalsa/address-book-extern.c b/libbalsa/address-book-extern.c
index 61b3ff583..7d4ab5b4c 100644
--- a/libbalsa/address-book-extern.c
+++ b/libbalsa/address-book-extern.c
@@ -55,10 +55,6 @@
#define LINE_LEN 256
#define LINE_LEN_STR "256"
-static LibBalsaAddressBookClass *parent_class = NULL;
-
-static void libbalsa_address_book_externq_class_init(LibBalsaAddressBookExternClass *klass);
-static void libbalsa_address_book_externq_init(LibBalsaAddressBookExtern *ab);
static void libbalsa_address_book_externq_finalize(GObject * object);
static LibBalsaABErr libbalsa_address_book_externq_load(LibBalsaAddressBook* ab,
@@ -81,7 +77,7 @@ static void libbalsa_address_book_externq_save_config(LibBalsaAddressBook *ab,
static void libbalsa_address_book_externq_load_config(LibBalsaAddressBook *ab,
const gchar * prefix);
-static gboolean parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
+static gboolean parse_externq_file(LibBalsaAddressBookExternq *ab_externq,
gchar *pattern,
void (*cb)(const gchar*,const gchar*,void*),
void *data);
@@ -89,42 +85,31 @@ static gboolean parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
static GList *libbalsa_address_book_externq_alias_complete(LibBalsaAddressBook *ab,
const gchar * prefix);
-GType libbalsa_address_book_externq_get_type(void)
-{
- static GType address_book_externq_type = 0;
-
- if (!address_book_externq_type) {
- static const GTypeInfo address_book_externq_info = {
- sizeof(LibBalsaAddressBookExternClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) libbalsa_address_book_externq_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(LibBalsaAddressBookExtern),
- 0, /* n_preallocs */
- (GInstanceInitFunc) libbalsa_address_book_externq_init
- };
-
- address_book_externq_type =
- g_type_register_static(LIBBALSA_TYPE_ADDRESS_BOOK,
- "LibBalsaAddressBookExtern",
- &address_book_externq_info, 0);
- }
+struct _LibBalsaAddressBookExternqClass {
+ LibBalsaAddressBookClass parent_class;
+};
- return address_book_externq_type;
+struct _LibBalsaAddressBookExternq {
+ LibBalsaAddressBook parent;
-}
+ gchar *load;
+ gchar *save;
+
+ GList *address_list;
+
+ time_t mtime;
+};
+
+G_DEFINE_TYPE(LibBalsaAddressBookExternq, libbalsa_address_book_externq,
+ LIBBALSA_TYPE_ADDRESS_BOOK)
static void
-libbalsa_address_book_externq_class_init(LibBalsaAddressBookExternClass *
+libbalsa_address_book_externq_class_init(LibBalsaAddressBookExternqClass *
klass)
{
LibBalsaAddressBookClass *address_book_class;
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent(klass);
-
object_class = G_OBJECT_CLASS(klass);
address_book_class = LIBBALSA_ADDRESS_BOOK_CLASS(klass);
@@ -149,47 +134,46 @@ libbalsa_address_book_externq_class_init(LibBalsaAddressBookExternClass *
}
static void
-libbalsa_address_book_externq_init(LibBalsaAddressBookExtern * ab)
+libbalsa_address_book_externq_init(LibBalsaAddressBookExternq * ab_externq)
{
- ab->load = NULL;
- ab->save = NULL;
- ab->address_list = NULL;
- ab->mtime = 0;
+ ab_externq->load = NULL;
+ ab_externq->save = NULL;
+ ab_externq->address_list = NULL;
+ ab_externq->mtime = 0;
}
static void
libbalsa_address_book_externq_finalize(GObject * object)
{
- LibBalsaAddressBookExtern *addr_externq;
+ LibBalsaAddressBookExternq *ab_externq;
- addr_externq = LIBBALSA_ADDRESS_BOOK_EXTERN(object);
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(object);
- g_free(addr_externq->load);
- g_free(addr_externq->save);
-
- g_list_foreach(addr_externq->address_list, (GFunc) g_object_unref, NULL);
- g_list_free(addr_externq->address_list);
- addr_externq->address_list = NULL;
+ g_free(ab_externq->load);
+ g_free(ab_externq->save);
+
+ g_list_free_full(ab_externq->address_list, g_object_unref);
+ ab_externq->address_list = NULL;
- G_OBJECT_CLASS(parent_class)->finalize(object);
+ G_OBJECT_CLASS(libbalsa_address_book_externq_parent_class)->finalize(object);
}
LibBalsaAddressBook *
libbalsa_address_book_externq_new(const gchar * name, const gchar * load,
const gchar * save)
{
- LibBalsaAddressBookExtern *abvc;
+ LibBalsaAddressBookExternq *ab_externq;
LibBalsaAddressBook *ab;
- abvc =
- LIBBALSA_ADDRESS_BOOK_EXTERN(g_object_new
- (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN,
+ ab_externq =
+ LIBBALSA_ADDRESS_BOOK_EXTERNQ(g_object_new
+ (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ,
NULL));
- ab = LIBBALSA_ADDRESS_BOOK(abvc);
+ ab = LIBBALSA_ADDRESS_BOOK(ab_externq);
libbalsa_address_book_set_name(ab, name);
- abvc->load = g_strdup(load);
- abvc->save = g_strdup(save);
+ ab_externq->load = g_strdup(load);
+ ab_externq->save = g_strdup(save);
return ab;
}
@@ -205,7 +189,7 @@ lbe_load_cb(const gchar *email, const gchar *name, void *data)
struct lbe_load_data *d = (struct lbe_load_data*)data;
LibBalsaAddress *address = libbalsa_address_new();
- /* The externq database doesn't support Id's, sorry! */
+ /* The extern database doesn't support Id's, sorry! */
address->nick_name = g_strdup(_("No-Id"));
address->address_list = g_list_append(address->address_list,
g_strdup(email));
@@ -222,27 +206,25 @@ libbalsa_address_book_externq_load(LibBalsaAddressBook * ab,
LibBalsaAddressBookLoadFunc callback,
gpointer closure)
{
+ LibBalsaAddressBookExternq *ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(ab);
gboolean rc = TRUE;
struct lbe_load_data data;
- LibBalsaAddressBookExtern *addr_externq = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
/* Erase the current address list */
- g_list_foreach(addr_externq->address_list, (GFunc) g_object_unref, NULL);
- g_list_free(addr_externq->address_list);
- addr_externq->address_list = NULL;
+ g_list_free_full(ab_externq->address_list, g_object_unref);
+ ab_externq->address_list = NULL;
if(callback) {
data.ab = ab;
data.callback = callback;
data.closure = closure;
- rc = parse_externq_file(addr_externq,
- " ", lbe_load_cb, &data);
+ rc = parse_externq_file(ab_externq, " ", lbe_load_cb, &data);
callback(ab, NULL, closure);
}
return rc ? LBABERR_OK : LBABERR_CANNOT_READ;
}
static gboolean
-parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
+parse_externq_file(LibBalsaAddressBookExternq *ab_externq,
gchar *pattern,
void (*cb)(const gchar *, const gchar *, void*),
void *data)
@@ -253,9 +235,9 @@ parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
gchar command[LINE_LEN];
/* Start the program */
- g_snprintf(command, sizeof(command), "%s \"%s\"",
- addr_externq->load, pattern);
-
+ g_snprintf(command, sizeof(command), "%s \"%s\"",
+ ab_externq->load, pattern);
+
gc = popen(command,"r");
if (gc == NULL)
@@ -289,17 +271,17 @@ parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
static LibBalsaABErr
libbalsa_address_book_externq_add_address(LibBalsaAddressBook * ab,
- LibBalsaAddress * new_address)
+ LibBalsaAddress * new_address)
{
gchar command[LINE_LEN];
- LibBalsaAddressBookExtern *ex;
+ LibBalsaAddressBookExternq *ab_externq;
FILE *gc;
- g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERN(ab), LBABERR_OK);
+ g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(ab), LBABERR_OK);
- ex = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
- if(ex->save) {
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(ab);
+ if (ab_externq->save != NULL) {
g_snprintf(command, sizeof(command), "%s \"%s\" \"%s\" \"%s\"",
- ex->save,
+ ab_externq->save,
(gchar *)g_list_first(new_address->address_list)->data,
new_address->full_name, "TODO");
@@ -330,37 +312,37 @@ libbalsa_address_book_externq_modify_address(LibBalsaAddressBook *ab,
static void
libbalsa_address_book_externq_save_config(LibBalsaAddressBook * ab,
- const gchar * prefix)
+ const gchar * prefix)
{
- LibBalsaAddressBookExtern *vc;
+ LibBalsaAddressBookExternq *ab_externq;
- g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERN(ab));
+ g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(ab));
- vc = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(ab);
- libbalsa_conf_set_string("Load", vc->load);
- libbalsa_conf_set_string("Save", vc->save);
+ libbalsa_conf_set_string("Load", ab_externq->load);
+ libbalsa_conf_set_string("Save", ab_externq->save);
- if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config)
- LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config(ab, prefix);
+ if (LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_externq_parent_class)->save_config)
+ LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_externq_parent_class)->save_config(ab, prefix);
}
static void
libbalsa_address_book_externq_load_config(LibBalsaAddressBook * ab,
- const gchar * prefix)
+ const gchar * prefix)
{
- LibBalsaAddressBookExtern *vc;
+ LibBalsaAddressBookExternq *ab_externq;
- g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERN(ab));
+ g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(ab));
- vc = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(ab);
- g_free(vc->load);
- vc->load = libbalsa_conf_get_string("Load");
- vc->save = libbalsa_conf_get_string("Save");
+ g_free(ab_externq->load);
+ ab_externq->load = libbalsa_conf_get_string("Load");
+ ab_externq->save = libbalsa_conf_get_string("Save");
- if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config)
- LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config(ab, prefix);
+ if (LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_externq_parent_class)->load_config)
+ LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_externq_parent_class)->load_config(ab, prefix);
}
static void
@@ -377,22 +359,58 @@ lbe_expand_cb(const gchar *email, const gchar *name, void *d)
static GList*
libbalsa_address_book_externq_alias_complete(LibBalsaAddressBook * ab,
- const gchar * prefix)
+ const gchar * prefix)
{
- LibBalsaAddressBookExtern *ex;
+ LibBalsaAddressBookExternq *ab_externq;
GList *res = NULL;
- g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERN(ab), NULL);
+ g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(ab), NULL);
- ex = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(ab);
if (!libbalsa_address_book_get_expand_aliases(ab))
return NULL;
- if(!parse_externq_file(ex, (gchar *)prefix, lbe_expand_cb, &res))
+ if (!parse_externq_file(ab_externq, (gchar *)prefix, lbe_expand_cb, &res))
return NULL;
res = g_list_reverse(res);
return res;
}
+
+/*
+ * Getters
+ */
+
+const gchar *
+libbalsa_address_book_externq_get_load(LibBalsaAddressBookExternq * ab_externq)
+{
+ return ab_externq->load;
+}
+
+const gchar *
+libbalsa_address_book_externq_get_save(LibBalsaAddressBookExternq * ab_externq)
+{
+ return ab_externq->save;
+}
+
+/*
+ * Setters
+ */
+
+void
+libbalsa_address_book_externq_set_load(LibBalsaAddressBookExternq * ab_externq,
+ const gchar * load)
+{
+ g_free(ab_externq->load);
+ ab_externq->load = g_strdup(load);
+}
+
+void
+libbalsa_address_book_externq_set_save(LibBalsaAddressBookExternq * ab_externq,
+ const gchar * save)
+{
+ g_free(ab_externq->save);
+ ab_externq->save = g_strdup(save);
+}
diff --git a/libbalsa/address-book-extern.h b/libbalsa/address-book-extern.h
index 5d137aaf5..c3110a9e8 100644
--- a/libbalsa/address-book-extern.h
+++ b/libbalsa/address-book-extern.h
@@ -28,36 +28,26 @@
#include "address-book.h"
#include <time.h>
-#define LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN (libbalsa_address_book_externq_get_type())
-#define LIBBALSA_ADDRESS_BOOK_EXTERN(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj,
LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN, LibBalsaAddressBookExtern))
-#define LIBBALSA_ADDRESS_BOOK_EXTERN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass,
LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN, LibBalsaAddressBookExternClass))
-#define LIBBALSA_IS_ADDRESS_BOOK_EXTERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj,
LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN))
-#define LIBBALSA_IS_ADDRESS_BOOK_EXTERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass,
LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN))
-
-typedef struct _LibBalsaAddressBookExtern LibBalsaAddressBookExtern;
-typedef struct _LibBalsaAddressBookExternClass
- LibBalsaAddressBookExternClass;
-
-struct _LibBalsaAddressBookExtern {
- LibBalsaAddressBook parent;
-
- gchar *load;
- gchar *save;
-
- GList *address_list;
-
- time_t mtime;
-};
-
-struct _LibBalsaAddressBookExternClass {
- LibBalsaAddressBookClass parent_class;
-};
-
-GType libbalsa_address_book_externq_get_type(void);
+#define LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ (libbalsa_address_book_externq_get_type())
+G_DECLARE_FINAL_TYPE(LibBalsaAddressBookExternq, libbalsa_address_book_externq,
+ LIBBALSA, ADDRESS_BOOK_EXTERNQ, LibBalsaAddressBook)
LibBalsaAddressBook *libbalsa_address_book_externq_new(const gchar * name,
- const gchar * load,
- const char * save);
+ const gchar * load,
+ const char * save);
+
+/*
+ * Getters
+ */
+const gchar *libbalsa_address_book_externq_get_load(LibBalsaAddressBookExternq * ab_externq);
+const gchar *libbalsa_address_book_externq_get_save(LibBalsaAddressBookExternq * ab_externq);
+/*
+ * Setters
+ */
+void libbalsa_address_book_externq_set_load(LibBalsaAddressBookExternq * ab_externq,
+ const gchar * load);
+void libbalsa_address_book_externq_set_save(LibBalsaAddressBookExternq * ab_externq,
+ const gchar * save);
#endif
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 168c03994..accb20dbc 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -97,7 +97,7 @@ libbalsa_init(void)
LIBBALSA_TYPE_MESSAGE;
LIBBALSA_TYPE_ADDRESS_BOOK_VCARD;
- LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN;
+ LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ;
LIBBALSA_TYPE_ADDRESS_BOOK_LDIF;
#if ENABLE_LDAP
LIBBALSA_TYPE_ADDRESS_BOOK_LDAP;
diff --git a/src/ab-main.c b/src/ab-main.c
index 6f44998e2..1ef8604a7 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -190,7 +190,7 @@ bab_window_set_title(LibBalsaAddressBook * address_book)
if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book))
type = "vCard";
- else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
+ else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(address_book))
type = "External query";
else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
type = "LDIF";
@@ -369,12 +369,12 @@ file_new_vcard_activated(GSimpleAction * action,
}
static void
-file_new_extern_activated(GSimpleAction * action,
+file_new_externq_activated(GSimpleAction * action,
GVariant * state,
gpointer user_data)
{
balsa_address_book_config_new_from_type
- (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN, address_book_change,
+ (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ, address_book_change,
contacts_app.window);
}
@@ -563,7 +563,7 @@ get_main_menu(GtkApplication * application)
{
static GActionEntry win_entries[] = {
{"file-new-vcard", file_new_vcard_activated},
- {"file-new-external", file_new_extern_activated},
+ {"file-new-external", file_new_externq_activated},
{"file-new-ldif", file_new_ldif_activated},
#if ENABLE_LDAP
{"file-new-ldap", file_new_ldap_activated},
@@ -1012,7 +1012,7 @@ static void
bab_init(void)
{
LIBBALSA_TYPE_ADDRESS_BOOK_VCARD;
- LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN;
+ LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ;
LIBBALSA_TYPE_ADDRESS_BOOK_LDIF;
#if ENABLE_LDAP
LIBBALSA_TYPE_ADDRESS_BOOK_LDAP;
diff --git a/src/ab-window.c b/src/ab-window.c
index 53bc209f3..ac292a382 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -685,7 +685,7 @@ balsa_ab_window_set_title(BalsaAbWindow *ab)
if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book))
type = "vCard";
- else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
+ else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(address_book))
type = "External query";
else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
type = "LDIF";
diff --git a/src/address-book-config.c b/src/address-book-config.c
index bbbe1f82a..49ee8cbb9 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -47,7 +47,7 @@ struct _AddressBookConfig {
GtkWidget *load;
GtkWidget *save;
} externq;
-
+
#ifdef ENABLE_LDAP
struct {
GtkWidget *host_name;
@@ -292,7 +292,7 @@ create_dialog_from_type(AddressBookConfig * abc)
{
if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD) {
return create_vcard_dialog(abc);
- } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
+ } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
return create_externq_dialog(abc);
} else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
return create_ldif_dialog(abc);
@@ -417,9 +417,9 @@ create_externq_dialog(AddressBookConfig * abc)
GtkWidget *dialog;
GtkWidget *grid;
GtkWidget *label;
- LibBalsaAddressBookExtern* ab;
+ LibBalsaAddressBookExternq* ab_externq;
- ab = (LibBalsaAddressBookExtern*)abc->address_book; /* may be NULL */
+ ab_externq = (LibBalsaAddressBookExternq*)abc->address_book; /* may be NULL */
grid = libbalsa_create_grid();
gtk_container_set_border_width(GTK_CONTAINER(grid), 5);
@@ -428,8 +428,8 @@ create_externq_dialog(AddressBookConfig * abc)
label = libbalsa_create_grid_label(_("A_ddress Book Name:"), grid, 0);
abc->name_entry =
libbalsa_create_grid_entry(grid, NULL, NULL, 0,
- ab != NULL ?
- libbalsa_address_book_get_name(LIBBALSA_ADDRESS_BOOK(ab)) : NULL,
+ ab_externq != NULL ?
+ libbalsa_address_book_get_name(LIBBALSA_ADDRESS_BOOK(ab_externq)) : NULL,
label);
label = gtk_label_new(_("Load program location:"));
@@ -460,13 +460,13 @@ create_externq_dialog(AddressBookConfig * abc)
add_radio_buttons(grid, 3, abc);
- if (ab) {
+ if (ab_externq != NULL) {
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
(abc->ab_specific.externq.load),
- ab->load);
+ libbalsa_address_book_externq_get_load(ab_externq));
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
(abc->ab_specific.externq.save),
- ab->save);
+ libbalsa_address_book_externq_get_save(ab_externq));
}
dialog = create_generic_dialog(abc, "Extern");
@@ -646,7 +646,7 @@ handle_close(AddressBookConfig * abc)
GTK_WINDOW(abc->window),
ADDRESS_BOOK_CONFIG_PATH_FILE))
return FALSE;
- } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
+ } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
if (chooser_bad_path(GTK_FILE_CHOOSER(abc->ab_specific.externq.load),
GTK_WINDOW(abc->window),
ADDRESS_BOOK_CONFIG_PATH_LOAD))
@@ -706,7 +706,7 @@ create_book(AddressBookConfig * abc)
if (path != NULL)
address_book = libbalsa_address_book_vcard_new(name, path);
g_free(path);
- } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
+ } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
#define GET_FILENAME(chooser) \
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser))
gchar *load = GET_FILENAME(abc->ab_specific.externq.load);
@@ -794,8 +794,8 @@ modify_book(AddressBookConfig * abc)
if (path != NULL)
libbalsa_address_book_text_set_path(ab_text, path);
- } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
- LibBalsaAddressBookExtern *externq;
+ } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
+ LibBalsaAddressBookExternq *ab_externq;
gchar *load =
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
(abc->ab_specific.externq.load));
@@ -803,14 +803,14 @@ modify_book(AddressBookConfig * abc)
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
(abc->ab_specific.externq.save));
- externq = LIBBALSA_ADDRESS_BOOK_EXTERN(address_book);
+ ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(address_book);
if (load) {
- g_free(externq->load);
- externq->load = load;;
+ libbalsa_address_book_externq_set_load(ab_externq, load);
+ g_free(load);
}
if (save) {
- g_free(externq->save);
- externq->save = save;
+ libbalsa_address_book_externq_set_save(ab_externq, save);
+ g_free(save);
}
#ifdef ENABLE_LDAP
} else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
@@ -871,7 +871,7 @@ add_vcard_cb(GtkWidget * widget, AddressBookConfig * abc)
static void
add_externq_cb(GtkWidget * widget, AddressBookConfig * abc)
{
- abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN;
+ abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ;
abc->window = create_externq_dialog(abc);
gtk_widget_show_all(abc->window);
}
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 43d7b636b..fb7b8ac7a 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -921,8 +921,8 @@ update_address_books(void)
type = "VCARD";
else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
type = "LDIF";
- else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
- type = "Extern";
+ else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERNQ(address_book))
+ type = "Externq";
#if ENABLE_LDAP
else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book))
type = "LDAP";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]