aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/tools
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-26 04:23:49 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-26 06:36:08 +0800
commit4d1bf133ce8dd5d46a010f96031d57cb3cb8e9cb (patch)
treef5789ef1edf5843d69ce72a9e50e917a6c83fd45 /addressbook/tools
parentb31f2ad72010e397fa7514b4d61f2adf716f1038 (diff)
downloadgsoc2013-evolution-4d1bf133ce8dd5d46a010f96031d57cb3cb8e9cb.tar.gz
gsoc2013-evolution-4d1bf133ce8dd5d46a010f96031d57cb3cb8e9cb.tar.zst
gsoc2013-evolution-4d1bf133ce8dd5d46a010f96031d57cb3cb8e9cb.zip
evolution-addressbook-export: Make ActionContext a struct.
Defining this as a union makes the code needlessly verbose.
Diffstat (limited to 'addressbook/tools')
-rw-r--r--addressbook/tools/evolution-addressbook-export-list-cards.c18
-rw-r--r--addressbook/tools/evolution-addressbook-export-list-folders.c4
-rw-r--r--addressbook/tools/evolution-addressbook-export.c14
-rw-r--r--addressbook/tools/evolution-addressbook-export.h26
4 files changed, 25 insertions, 37 deletions
diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c
index 89fd75834f..a884e6e0a6 100644
--- a/addressbook/tools/evolution-addressbook-export-list-cards.c
+++ b/addressbook/tools/evolution-addressbook-export-list-cards.c
@@ -612,29 +612,29 @@ action_list_cards (GSList *contacts,
length = g_slist_length (contacts);
if (length <= 0) {
- g_warning ("Couldn't load addressbook correctly!!!! %s####", p_actctx->action_list_cards.addressbook_source_uid ?
- p_actctx->action_list_cards.addressbook_source_uid : "NULL");
+ g_warning ("Couldn't load addressbook correctly!!!! %s####", p_actctx->addressbook_source_uid ?
+ p_actctx->addressbook_source_uid : "NULL");
exit (-1);
}
- if (p_actctx->action_list_cards.output_file == NULL) {
+ if (p_actctx->output_file == NULL) {
outputfile = stdout;
} else {
/* fopen output file */
- if (!(outputfile = g_fopen (p_actctx->action_list_cards.output_file, "w"))) {
+ if (!(outputfile = g_fopen (p_actctx->output_file, "w"))) {
g_warning (_("Can not open file"));
exit (-1);
}
}
- if (p_actctx->action_list_cards.IsVCard == TRUE)
+ if (p_actctx->IsVCard == TRUE)
format = CARD_FORMAT_VCARD;
else
format = CARD_FORMAT_CSV;
output_n_cards_file (outputfile, contacts, length, 0, format);
- if (p_actctx->action_list_cards.output_file != NULL) {
+ if (p_actctx->output_file != NULL) {
fclose (outputfile);
}
}
@@ -703,7 +703,7 @@ action_list_cards_init (ESourceRegistry *registry,
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FAILED);
- uid = p_actctx->action_list_cards.addressbook_source_uid;
+ uid = p_actctx->addressbook_source_uid;
if (uid != NULL)
source = e_source_registry_ref_source (registry, uid);
@@ -722,8 +722,8 @@ action_list_cards_init (ESourceRegistry *registry,
if (error != NULL) {
g_warning (
"Couldn't load addressbook %s: %s",
- p_actctx->action_list_cards.addressbook_source_uid ?
- p_actctx->action_list_cards.addressbook_source_uid :
+ p_actctx->addressbook_source_uid ?
+ p_actctx->addressbook_source_uid :
"'default'", error->message);
g_error_free (error);
exit (-1);
diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c
index 29c44dbeba..c1d2b41202 100644
--- a/addressbook/tools/evolution-addressbook-export-list-folders.c
+++ b/addressbook/tools/evolution-addressbook-export-list-folders.c
@@ -41,8 +41,8 @@ action_list_folders_init (ESourceRegistry *registry,
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FAILED);
- if (p_actctx->action_list_folders.output_file != NULL) {
- if (!(outputfile = g_fopen (p_actctx->action_list_folders.output_file, "w"))) {
+ if (p_actctx->output_file != NULL) {
+ if (!(outputfile = g_fopen (p_actctx->output_file, "w"))) {
g_warning (_("Can not open file"));
exit (-1);
}
diff --git a/addressbook/tools/evolution-addressbook-export.c b/addressbook/tools/evolution-addressbook-export.c
index 0b83036da9..428877bf95 100644
--- a/addressbook/tools/evolution-addressbook-export.c
+++ b/addressbook/tools/evolution-addressbook-export.c
@@ -158,22 +158,22 @@ main (gint argc,
if (current_action == ACTION_LIST_FOLDERS) {
actctx.action_type = current_action;
if (opt_output_file == NULL) {
- actctx.action_list_folders.output_file = NULL;
+ actctx.output_file = NULL;
} else {
- actctx.action_list_folders.output_file = g_strdup (opt_output_file);
+ actctx.output_file = g_strdup (opt_output_file);
}
action_list_folders_init (registry, &actctx);
} else if (current_action == ACTION_LIST_CARDS) {
actctx.action_type = current_action;
if (opt_output_file == NULL) {
- actctx.action_list_cards.output_file = NULL;
+ actctx.output_file = NULL;
} else {
- actctx.action_list_cards.output_file = g_strdup (opt_output_file);
+ actctx.output_file = g_strdup (opt_output_file);
}
- actctx.action_list_cards.IsCSV = IsCSV;
- actctx.action_list_cards.IsVCard = IsVCard;
- actctx.action_list_cards.addressbook_source_uid =
+ actctx.IsCSV = IsCSV;
+ actctx.IsVCard = IsVCard;
+ actctx.addressbook_source_uid =
g_strdup (opt_addressbook_source_uid);
action_list_cards_init (registry, &actctx);
diff --git a/addressbook/tools/evolution-addressbook-export.h b/addressbook/tools/evolution-addressbook-export.h
index 090446b177..ca78eb823e 100644
--- a/addressbook/tools/evolution-addressbook-export.h
+++ b/addressbook/tools/evolution-addressbook-export.h
@@ -37,30 +37,18 @@ G_BEGIN_DECLS
#define DEFAULT_SIZE_NUMBER 100
-union _ActionContext
-{
+struct _ActionContext {
guint action_type;
+ gchar *output_file;
- struct
- {
- gint action_type;
- gchar *output_file;
- }
- action_list_folders;
-
- struct
- {
- gint action_type;
- gchar *output_file;
- gint IsCSV;
- gint IsVCard;
- gchar *addressbook_source_uid;
- }
- action_list_cards;
+ /* for cards only */
+ gint IsCSV;
+ gint IsVCard;
+ gchar *addressbook_source_uid;
};
-typedef union _ActionContext ActionContext;
+typedef struct _ActionContext ActionContext;
/* action_list_folders */
guint action_list_folders_init (ESourceRegistry *registry,