Mercurial > pidgin
annotate plugins/gevolution/eds-utils.c @ 12116:e75ef7aa913e
[gaim-migrate @ 14416]
" This patch implements a replacement for the queuing
system from 1.x. It also obsoletes a previous patch
[#1338873] I submitted to prioritize the unseen states
in gtk conversations.
The attached envelope.png is ripped from the
msgunread.png already included in gaim. It should be
dropped in the pixmaps directory (Makefile.am is
updated accordingly in this patch).
The two separate queuing preferences from 1.x, queuing
messages while away and queuing all new messages (from
docklet), are replaced with a single 3-way preference
for conversations. The new preference is "Hide new IM
conversations". This preference can be set to never,
away and always.
When a gtk conversation is created, it may be placed in
a hidden conversation window instead of being placed
normally. This decision is based upon the preference
and possibly the away state of the account the
conversation is being created for. This *will* effect
conversations the user explicitly requests to be
created, so in these cases the caller must be sure to
present the conversation to the user, using
gaim_gtkconv_present_conversation(). This is done
already in gtkdialogs.c which handles creating
conversations requested by the user from gaim proper
(menus, double-clicking on budy in blist, etc.).
The main advantage to not queuing messages is that the
conversations exist, the message is written to the
conversation (and logged if appropriate) and the unseen
state is set on the conversation. This means no
additional features are needed to track whether there
are queued messages or not, just use the unseen state
on conversations.
Since conversations may not be visible (messages
"queued"), gaim proper needs some notification that
there are messages waiting. I opted for a menutray icon
that shows up when an im conversation has an unseen
message. Clicking this icon will focus (and show if
hidden) the first conversation with an unseen message.
This is essentially the same behavior of the docklet in
cvs right now, except that the icon is only visible
when there is a conversation with an unread message.
The api that is added is flexible enough to allow
either the docklet or the new blist menutray icon to be
visible for conversations of any/all types and for
unseen messages >= any state. Currently they are set to
only IM conversations and only unseen states >= TEXT
(system messages and no log messages will not trigger
blinking the docklet or showing the blist tray icon),
but these could be made preferences relatively easily
in the future. Other plugins could probably benefit as
well: gaim_gtk_conversations_get_first_unseen().
There is probably some limit to comment size, so I'll
stop rambling now. If anyone has more
questions/comments, catch me in #gaim, here or on
gaim-devel."
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Wed, 16 Nov 2005 18:17:01 +0000 |
| parents | 8d7c99f20e4c |
| children | fc464a0abccc |
| rev | line source |
|---|---|
| 10083 | 1 /* |
| 2 * Evolution integration plugin for Gaim | |
| 3 * | |
| 4 * Copyright (C) 2004 Henry Jen. | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or | |
| 7 * modify it under the terms of the GNU General Public License as | |
| 8 * published by the Free Software Foundation; either version 2 of the | |
| 9 * License, or (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, but | |
| 12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 * General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 19 * 02111-1307, USA. | |
| 20 */ | |
| 21 | |
| 22 #include "internal.h" | |
| 23 #include "gtkblist.h" | |
| 24 #include "gtkgaim.h" | |
| 25 #include "gtkutils.h" | |
| 26 #include "gtkimhtml.h" | |
| 27 | |
| 28 #include "debug.h" | |
| 29 #include "gevolution.h" | |
| 30 | |
| 31 GtkTreeModel * | |
| 32 gevo_addrbooks_model_new() | |
| 33 { | |
| 34 return GTK_TREE_MODEL(gtk_list_store_new(NUM_ADDRBOOK_COLUMNS, | |
| 35 G_TYPE_STRING, G_TYPE_STRING)); | |
| 36 } | |
| 37 | |
| 38 void | |
| 39 gevo_addrbooks_model_unref(GtkTreeModel *model) | |
| 40 { | |
| 41 GtkTreeIter iter; | |
| 42 | |
| 43 g_return_if_fail(model != NULL); | |
| 44 g_return_if_fail(GTK_IS_LIST_STORE(model)); | |
| 45 | |
| 46 if (!gtk_tree_model_get_iter_first(model, &iter)) | |
| 47 return; | |
| 48 | |
| 49 g_object_unref(model); | |
| 50 } | |
| 51 | |
| 52 void | |
| 53 gevo_addrbooks_model_populate(GtkTreeModel *model) | |
| 54 { | |
| 55 ESourceList *addressbooks; | |
| 56 GError *err; | |
| 57 GSList *groups, *g; | |
| 58 GtkTreeIter iter; | |
| 59 GtkListStore *list; | |
| 60 | |
| 61 g_return_if_fail(model != NULL); | |
| 62 g_return_if_fail(GTK_IS_LIST_STORE(model)); | |
| 63 | |
| 64 list = GTK_LIST_STORE(model); | |
| 65 | |
| 66 if (!e_book_get_addressbooks(&addressbooks, &err)) | |
| 67 { | |
| 68 gaim_debug_error("evolution", | |
| 69 "Unable to fetch list of address books.\n"); | |
| 70 | |
| 71 gtk_list_store_append(list, &iter); | |
| 72 gtk_list_store_set(list, &iter, | |
| 73 ADDRBOOK_COLUMN_NAME, _("None"), | |
| 74 ADDRBOOK_COLUMN_URI, NULL, | |
| 75 -1); | |
| 76 | |
| 77 return; | |
| 78 } | |
| 79 | |
| 80 groups = e_source_list_peek_groups(addressbooks); | |
| 81 | |
| 82 if (groups == NULL) | |
| 83 { | |
| 84 gtk_list_store_append(list, &iter); | |
| 85 gtk_list_store_set(list, &iter, | |
| 86 ADDRBOOK_COLUMN_NAME, _("None"), | |
| 87 ADDRBOOK_COLUMN_URI, NULL, | |
| 88 -1); | |
| 89 | |
| 90 return; | |
| 91 } | |
| 92 | |
| 93 for (g = groups; g != NULL; g = g->next) | |
| 94 { | |
| 95 GSList *sources, *s; | |
| 96 | |
| 97 sources = e_source_group_peek_sources(g->data); | |
| 98 | |
| 99 for (s = sources; s != NULL; s = s->next) | |
| 100 { | |
| 101 ESource *source = E_SOURCE(s->data); | |
| 102 | |
| 103 g_object_ref(source); | |
| 104 | |
| 105 gtk_list_store_append(list, &iter); | |
| 106 gtk_list_store_set(list, &iter, | |
| 107 ADDRBOOK_COLUMN_NAME, e_source_peek_name(source), | |
| 108 ADDRBOOK_COLUMN_URI, e_source_get_uri(source), | |
| 109 -1); | |
| 110 } | |
| 111 } | |
| 112 | |
| 113 g_object_unref(addressbooks); | |
| 114 } | |
|
11117
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
115 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
116 EContact * |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
117 gevo_run_query_in_uri(const gchar *uri, EBookQuery *query) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
118 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
119 EBook *book; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
120 gboolean status; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
121 GList *cards; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
122 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
123 if (!gevo_load_addressbook(uri, &book, NULL)) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
124 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
125 gaim_debug_error("evolution", |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
126 "Error retrieving addressbook\n"); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
127 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
128 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
129 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
130 status = e_book_get_contacts(book, query, &cards, NULL); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
131 if (!status) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
132 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
133 gaim_debug_error("evolution", "Error %d in getting card list\n", |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
134 status); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
135 g_object_unref(book); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
136 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
137 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
138 g_object_unref(book); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
139 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
140 if (cards != NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
141 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
142 EContact *contact = E_CONTACT(cards->data); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
143 GList *cards2 = cards->next; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
144 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
145 if (cards2 != NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
146 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
147 /* Break off the first contact and free the rest. */ |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
148 cards->next = NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
149 cards2->prev = NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
150 g_list_foreach(cards2, (GFunc)g_object_unref, NULL); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
151 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
152 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
153 /* Free the whole list. */ |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
154 g_list_free(cards); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
155 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
156 return contact; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
157 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
158 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
159 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
160 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
161 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
162 /* |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
163 * Search for a buddy in the Evolution contacts. |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
164 * |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
165 * @param buddy The buddy to search for. |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
166 * @param query An optional query. This function takes ownership of @a query, |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
167 * so callers must e_book_query_ref() it in advance (to obtain a |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
168 * second reference) if they want to reuse @a query. |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
169 */ |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
170 EContact * |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
171 gevo_search_buddy_in_contacts(GaimBuddy *buddy, EBookQuery *query) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
172 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
173 ESourceList *addressbooks; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
174 GError *err; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
175 EBookQuery *full_query; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
176 GSList *groups, *g; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
177 EContact *result; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
178 EContactField protocol_field = gevo_prpl_get_field(buddy->account, buddy); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
179 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
180 if (protocol_field == 0) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
181 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
182 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
183 if (query != NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
184 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
185 EBookQuery *queries[2]; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
186 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
187 queries[0] = query; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
188 queries[1] = e_book_query_field_test(protocol_field, E_BOOK_QUERY_IS, buddy->name); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
189 if (queries[1] == NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
190 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
191 gaim_debug_error("evolution", "Error in creating protocol query\n"); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
192 e_book_query_unref(query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
193 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
194 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
195 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
196 full_query = e_book_query_and(2, queries, TRUE); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
197 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
198 else |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
199 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
200 full_query = e_book_query_field_test(protocol_field, E_BOOK_QUERY_IS, buddy->name); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
201 if (full_query == NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
202 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
203 gaim_debug_error("evolution", "Error in creating protocol query\n"); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
204 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
205 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
206 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
207 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
208 if (!e_book_get_addressbooks(&addressbooks, &err)) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
209 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
210 gaim_debug_error("evolution", |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
211 "Unable to fetch list of address books.\n"); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
212 e_book_query_unref(full_query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
213 if (err != NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
214 g_error_free(err); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
215 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
216 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
217 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
218 groups = e_source_list_peek_groups(addressbooks); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
219 if (groups == NULL) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
220 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
221 g_object_unref(addressbooks); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
222 e_book_query_unref(full_query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
223 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
224 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
225 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
226 for (g = groups; g != NULL; g = g->next) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
227 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
228 GSList *sources, *s; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
229 sources = e_source_group_peek_sources(g->data); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
230 for (s = sources; s != NULL; s = s->next) |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
231 { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
232 result = gevo_run_query_in_uri(e_source_get_uri(E_SOURCE(s->data)), full_query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
233 if (result != NULL) { |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
234 g_object_unref(addressbooks); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
235 e_book_query_unref(full_query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
236 return result; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
237 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
238 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
239 } |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
240 |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
241 g_object_unref(addressbooks); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
242 e_book_query_unref(full_query); |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
243 return NULL; |
|
5a8bc4b1f5b6
[gaim-migrate @ 13173]
Richard Laager <rlaager@wiktel.com>
parents:
10313
diff
changeset
|
244 } |
