annotate plugins/gevolution/eds-utils.c @ 10561:1db4f49de0c6

[gaim-migrate @ 11939] sf patch #1009209, from Malcolm Smith CHAP support for SOCKS5 Please test this. Normally I try to avoid commiting things that aren't bug fixes to oldstatus, but someone said (I think it was Felipe), "oldstatus is also good for testing things." Uh, or something like that. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 01 Feb 2005 04:29:44 +0000
parents 455c0830d108
children 5a8bc4b1f5b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10083
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * Evolution integration plugin for Gaim
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * Copyright (C) 2004 Henry Jen.
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * General Public License for more details.
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * 02111-1307, USA.
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 */
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 #include "internal.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "gtkblist.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "gtkgaim.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "gtkutils.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "gtkimhtml.h"
10313
455c0830d108 [gaim-migrate @ 11511]
Luke Schierer <lschiere@pidgin.im>
parents: 10083
diff changeset
27 #include "gtkgaim-disclosure.h"
10083
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "debug.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "gevolution.h"
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 GtkTreeModel *
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 gevo_addrbooks_model_new()
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 return GTK_TREE_MODEL(gtk_list_store_new(NUM_ADDRBOOK_COLUMNS,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 G_TYPE_STRING, G_TYPE_STRING));
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 void
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 gevo_addrbooks_model_unref(GtkTreeModel *model)
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 GtkTreeIter iter;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 g_return_if_fail(model != NULL);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 g_return_if_fail(GTK_IS_LIST_STORE(model));
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 if (!gtk_tree_model_get_iter_first(model, &iter))
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 return;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 g_object_unref(model);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 void
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 gevo_addrbooks_model_populate(GtkTreeModel *model)
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 ESourceList *addressbooks;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 GError *err;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 GSList *groups, *g;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 GtkTreeIter iter;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 GtkListStore *list;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 g_return_if_fail(model != NULL);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 g_return_if_fail(GTK_IS_LIST_STORE(model));
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 list = GTK_LIST_STORE(model);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 if (!e_book_get_addressbooks(&addressbooks, &err))
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 gaim_debug_error("evolution",
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 "Unable to fetch list of address books.\n");
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 gtk_list_store_append(list, &iter);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 gtk_list_store_set(list, &iter,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 ADDRBOOK_COLUMN_NAME, _("None"),
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 ADDRBOOK_COLUMN_URI, NULL,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 -1);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 return;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 groups = e_source_list_peek_groups(addressbooks);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 if (groups == NULL)
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 gtk_list_store_append(list, &iter);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 gtk_list_store_set(list, &iter,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 ADDRBOOK_COLUMN_NAME, _("None"),
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 ADDRBOOK_COLUMN_URI, NULL,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 -1);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 return;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 for (g = groups; g != NULL; g = g->next)
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 GSList *sources, *s;
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 sources = e_source_group_peek_sources(g->data);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 for (s = sources; s != NULL; s = s->next)
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 {
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 ESource *source = E_SOURCE(s->data);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 g_object_ref(source);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 gtk_list_store_append(list, &iter);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 gtk_list_store_set(list, &iter,
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 ADDRBOOK_COLUMN_NAME, e_source_peek_name(source),
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 ADDRBOOK_COLUMN_URI, e_source_get_uri(source),
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 -1);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 }
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 g_object_unref(addressbooks);
b40a9b094f48 [gaim-migrate @ 11079]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 }