diff options
author | Ross Burton <rburton@src.gnome.org> | 2004-01-09 20:18:33 +0800 |
---|---|---|
committer | Ross Burton <rburton@src.gnome.org> | 2004-01-09 20:18:33 +0800 |
commit | 51a593107b1a483263fd1cc92d2ad682958a4e7a (patch) | |
tree | ae7f6558dbad592f623ac8a629062d5714838842 | |
parent | af3f81fbeaebd6d45fb4142611c1338c576da29f (diff) | |
download | gsoc2013-evolution-51a593107b1a483263fd1cc92d2ad682958a4e7a.tar.gz gsoc2013-evolution-51a593107b1a483263fd1cc92d2ad682958a4e7a.tar.zst gsoc2013-evolution-51a593107b1a483263fd1cc92d2ad682958a4e7a.zip |
Update for API changes to e-book-async
svn path=/trunk/; revision=24130
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-completion.c | 25 | ||||
-rw-r--r-- | addressbook/gui/merging/eab-contact-compare.c | 16 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 8 | ||||
-rw-r--r-- | addressbook/printing/e-contact-print.c | 21 |
5 files changed, 46 insertions, 32 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index db60683b60..13f6e5b972 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2004-01-09 Ross Burton <ross@burtonini.com> + + * gui/component/select-names/e-select-names-completion.c: + * gui/merging/eab-contact-compare.c: + * gui/widgets/e-addressbook-model.c: + * printing/e-contact-print.c: + Update for API changes to e-book-async. + 2004-01-08 Ross Burton <ross@burtonini.com> * gui/contact-editor/contact-editor.glade: diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 39b5f7a008..b80611b9ff 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -465,11 +465,12 @@ static gint book_query_count = sizeof (book_queries) / sizeof (BookQuery); /* * Build up a big compound sexp corresponding to all of our queries. */ -static gchar * +static EBookQuery* book_query_sexp (ESelectNamesCompletion *comp) { gint i, j; - gchar **queryv, *query; + gchar **queryv; + EBookQuery *query; g_return_val_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp), NULL); @@ -486,12 +487,15 @@ book_query_sexp (ESelectNamesCompletion *comp) if (j == 0) { query = NULL; } else if (j == 1) { - query = queryv[0]; + query = e_book_query_from_string (queryv[0]); queryv[0] = NULL; } else { - gchar *tmp = g_strjoinv (" ", queryv); - query = g_strdup_printf ("(or %s)", tmp); + gchar *tmp, *tmp2; + tmp = g_strjoinv (" ", queryv); + tmp2 = g_strdup_printf ("(or %s)", tmp); + query = e_book_query_from_string (tmp2); g_free (tmp); + g_free (tmp2); } for (i=0; i<book_query_count; ++i) @@ -946,7 +950,7 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar e_select_names_completion_stop_query (comp); /* Stop any prior queries. */ if (comp->priv->books_not_ready == 0) { - gchar *sexp; + EBookQuery *query; if (strlen (query_text) < comp->priv->minimum_query_length) { e_completion_end_search (E_COMPLETION (comp)); @@ -956,8 +960,8 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar g_free (comp->priv->query_text); comp->priv->query_text = g_strdup (query_text); - sexp = book_query_sexp (comp); - if (sexp && *sexp) { + query = book_query_sexp (comp); + if (query) { GList *l; if (out) @@ -1005,7 +1009,8 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar book_data->cached_query_text = g_strdup (query_text); book_data->book_view_tag = e_book_async_get_book_view (book_data->book, - sexp, + query, + NULL, -1, e_select_names_completion_got_book_view_cb, book_data); comp->priv->pending_completion_seq++; } @@ -1024,7 +1029,7 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar g_free (comp->priv->query_text); comp->priv->query_text = NULL; } - g_free (sexp); + e_book_query_unref (query); } else { diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index 409b1bce81..de0c7b4675 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -617,7 +617,8 @@ use_common_book_cb (EBook *book, gpointer closure) GList *contact_email; gchar *query_parts[MAX_QUERY_PARTS]; gint p=0; - gchar *query, *qj; + gchar *qj; + EBookQuery *query = NULL; int i; if (book == NULL) { @@ -669,18 +670,21 @@ use_common_book_cb (EBook *book, gpointer closure) for(i = 0; query_parts[i] != NULL; i++) g_free(query_parts[i]); if (p > 0) { - query = g_strdup_printf ("(or %s)", qj); - g_free (qj); + char *s; + s = g_strdup_printf ("(or %s)", qj); + query = e_book_query_from_string (s); + g_free (s); } else { - query = qj; + query = e_book_query_from_string (qj); } - if (query && *query) + if (query) e_book_async_get_contacts (book, query, query_cb, info); else query_cb (book, E_BOOK_ERROR_OK, NULL, info); - g_free (query); + g_free (qj); + e_book_query_unref (query); } void diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 992b42b852..69a612234e 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -493,8 +493,6 @@ get_view (EABModel *model) gboolean success; if (model->book && model->query) { - char *query_string = e_book_query_to_string (model->query); - remove_book_view(model); free_data (model); @@ -502,20 +500,18 @@ get_view (EABModel *model) model->first_get_view = FALSE; if (e_book_check_static_capability (model->book, "do-initial-query")) { - success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model); + success = e_book_async_get_book_view (model->book, model->query, NULL, -1, book_view_loaded, model); } else { g_signal_emit (model, eab_model_signals [MODEL_CHANGED], 0); g_signal_emit (model, eab_model_signals [STOP_STATE_CHANGED], 0); - g_free (query_string); return; } } else - success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model); + success = e_book_async_get_book_view (model->book, model->query, NULL, -1, book_view_loaded, model); - g_free (query_string); } } diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index 1a9b83c62d..d826a71d41 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -67,7 +67,7 @@ struct _EContactPrintContext gboolean uses_book; int type; EBook *book; - gchar *query; + EBookQuery *query; GList *contacts; }; @@ -589,7 +589,7 @@ complete_sequence(EBookView *book_view, EBookViewStatus status, EContactPrintCon g_object_unref(ctxt->master); if (ctxt->book) g_object_unref(ctxt->book); - g_free(ctxt->query); + e_book_query_unref (ctxt->query); g_list_foreach(ctxt->contacts, (GFunc) g_object_unref, NULL); g_list_free(ctxt->contacts); g_object_unref(ctxt->style->headings_font); @@ -651,13 +651,13 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, EContac } static void -e_contact_do_print_contacts (EBook *book, char *query, EContactPrintContext *ctxt) +e_contact_do_print_contacts (EBook *book, EBookQuery *query, EContactPrintContext *ctxt) { - e_book_async_get_book_view(book, query, (EBookBookViewCallback) book_view_loaded, ctxt); + e_book_async_get_book_view(book, query, NULL, -1, (EBookBookViewCallback) book_view_loaded, ctxt); } static void -e_contact_do_print (EBook *book, char *query, EContactPrintContext *ctxt) +e_contact_do_print (EBook *book, EBookQuery *query, EContactPrintContext *ctxt) { switch ( ctxt->style->type ) { case E_CONTACT_PRINT_TYPE_CARDS: @@ -871,7 +871,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data) gboolean uses_book = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "uses_book")); gboolean uses_list = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "uses_list")); EBook *book = NULL; - char *query = NULL; + EBookQuery *query = NULL; EContact *contact = NULL; GList *contact_list = NULL; gdouble font_size; @@ -880,6 +880,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data) if (uses_book) { book = g_object_get_data(G_OBJECT(dialog), "book"); query = g_object_get_data(G_OBJECT(dialog), "query"); + e_book_query_ref (query); } else if (uses_list) { contact_list = g_object_get_data(G_OBJECT(dialog), "contact_list"); @@ -962,7 +963,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data) 72 * style->page_height)); #endif ctxt->book = book; - ctxt->query = g_strdup(query); + ctxt->query = query; if (uses_book) { ctxt->contacts = NULL; g_object_ref(book); @@ -986,7 +987,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data) e_free_object_list (contact_list); else g_object_unref(contact); - g_free(query); + e_book_query_unref (query); gtk_widget_destroy (dialog); g_free(style); g_free(ctxt); @@ -1008,7 +1009,7 @@ e_contact_print_dialog_new(EBook *book, char *query) g_object_set_data(G_OBJECT(dialog), "uses_book", GINT_TO_POINTER (TRUE)); g_object_set_data(G_OBJECT(dialog), "uses_list", GINT_TO_POINTER (FALSE)); g_object_set_data(G_OBJECT(dialog), "book", book); - g_object_set_data(G_OBJECT(dialog), "query", g_strdup(query)); + g_object_set_data(G_OBJECT(dialog), "query", e_book_query_from_string (query)); g_signal_connect(dialog, "response", G_CALLBACK(e_contact_print_response), NULL); g_signal_connect(dialog, @@ -1055,7 +1056,7 @@ e_contact_print_preview(EBook *book, char *query) 72 * style->page_height)); #endif ctxt->book = book; - ctxt->query = g_strdup(query); + ctxt->query = e_book_query_from_string (query); ctxt->contacts = NULL; g_object_ref(book); e_contact_do_print(book, ctxt->query, ctxt); |