diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-26 04:28:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-26 06:36:08 +0800 |
commit | 361dd78922ab2332a576bb7695466387b021c97a (patch) | |
tree | 8b69ce583f61891d786d9cbdd1ae0aaa11e58cd0 /addressbook/tools | |
parent | 4d1bf133ce8dd5d46a010f96031d57cb3cb8e9cb (diff) | |
download | gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar.gz gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar.bz2 gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar.lz gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar.xz gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.tar.zst gsoc2013-evolution-361dd78922ab2332a576bb7695466387b021c97a.zip |
evolution-addressbook-export: Add ESourceRegistry to ActionContext.
Diffstat (limited to 'addressbook/tools')
4 files changed, 15 insertions, 15 deletions
diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c index a884e6e0a6..86c5cb34d2 100644 --- a/addressbook/tools/evolution-addressbook-export-list-cards.c +++ b/addressbook/tools/evolution-addressbook-export-list-cards.c @@ -689,9 +689,9 @@ set_pre_defined_field (GSList **pre_defined_fields) } guint -action_list_cards_init (ESourceRegistry *registry, - ActionContext *p_actctx) +action_list_cards_init (ActionContext *p_actctx) { + ESourceRegistry *registry; EClient *client; EBookClient *book_client; EBookQuery *query; @@ -701,8 +701,7 @@ action_list_cards_init (ESourceRegistry *registry, gchar *query_str; GError *error = NULL; - g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FAILED); - + registry = p_actctx->registry; uid = p_actctx->addressbook_source_uid; if (uid != NULL) diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c index c1d2b41202..946deb6cb3 100644 --- a/addressbook/tools/evolution-addressbook-export-list-folders.c +++ b/addressbook/tools/evolution-addressbook-export-list-folders.c @@ -32,14 +32,14 @@ #include "evolution-addressbook-export.h" guint -action_list_folders_init (ESourceRegistry *registry, - ActionContext *p_actctx) +action_list_folders_init (ActionContext *p_actctx) { + ESourceRegistry *registry; GList *list, *iter; FILE *outputfile = NULL; const gchar *extension_name; - g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FAILED); + registry = p_actctx->registry; if (p_actctx->output_file != NULL) { if (!(outputfile = g_fopen (p_actctx->output_file, "w"))) { diff --git a/addressbook/tools/evolution-addressbook-export.c b/addressbook/tools/evolution-addressbook-export.c index 428877bf95..685fab27f7 100644 --- a/addressbook/tools/evolution-addressbook-export.c +++ b/addressbook/tools/evolution-addressbook-export.c @@ -74,7 +74,6 @@ gint main (gint argc, gchar **argv) { - ESourceRegistry *registry; ActionContext actctx; GOptionContext *context; GError *error = NULL; @@ -120,7 +119,7 @@ main (gint argc, exit (-1); } - registry = e_source_registry_new_sync (NULL, &error); + actctx.registry = e_source_registry_new_sync (NULL, &error); if (error != NULL) { g_printerr ("%s\n", error->message); g_error_free (error); @@ -162,7 +161,7 @@ main (gint argc, } else { actctx.output_file = g_strdup (opt_output_file); } - action_list_folders_init (registry, &actctx); + action_list_folders_init (&actctx); } else if (current_action == ACTION_LIST_CARDS) { actctx.action_type = current_action; @@ -176,13 +175,15 @@ main (gint argc, actctx.addressbook_source_uid = g_strdup (opt_addressbook_source_uid); - action_list_cards_init (registry, &actctx); + action_list_cards_init (&actctx); } else { g_warning (_("Unhandled error")); exit (-1); } + g_object_unref (actctx.registry); + /*FIXME:should free actctx's some gchar * field, such as output_file! but since the program will end, so that will not cause mem leak. */ return 0; diff --git a/addressbook/tools/evolution-addressbook-export.h b/addressbook/tools/evolution-addressbook-export.h index ca78eb823e..28168c40ff 100644 --- a/addressbook/tools/evolution-addressbook-export.h +++ b/addressbook/tools/evolution-addressbook-export.h @@ -40,6 +40,8 @@ G_BEGIN_DECLS struct _ActionContext { guint action_type; + + ESourceRegistry *registry; gchar *output_file; /* for cards only */ @@ -51,12 +53,10 @@ struct _ActionContext { typedef struct _ActionContext ActionContext; /* action_list_folders */ -guint action_list_folders_init (ESourceRegistry *registry, - ActionContext *p_actctx); +guint action_list_folders_init (ActionContext *p_actctx); /*action list cards*/ -guint action_list_cards_init (ESourceRegistry *registry, - ActionContext *p_actctx); +guint action_list_cards_init (ActionContext *p_actctx); G_END_DECLS |