annotate pidgin/plugins/gevolution/gevolution.c @ 20171:e172db483c07

disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
author Luke Schierer <lschiere@pidgin.im>
date Thu, 20 Sep 2007 12:01:33 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20171
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /*
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
2 * Evolution integration plugin for Purple
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
3 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003 Christian Hammond.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * License, or (at your option) any later version.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * General Public License for more details.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 * 02111-1301, USA.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20 */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
21 #include "internal.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
22 #include "pidgin.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24 #include "connection.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25 #include "debug.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26 #include "prefs.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27 #include "notify.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 #include "signals.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29 #include "util.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 #include "version.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32 #include "gtkblist.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33 #include "gtkconv.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 #include "gtkplugin.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 #include "gtkutils.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 #include "gevolution.h"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 #include <libedata-book/Evolution-DataServer-Addressbook.h>
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41 #include <libedata-book/e-data-book-factory.h>
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42 #include <bonobo/bonobo-main.h>
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 #include <glib.h>
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46 #define GEVOLUTION_PLUGIN_ID "gtk-x11-gevolution"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48 #define E_DATA_BOOK_FACTORY_OAF_ID \
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 "OAFIID:GNOME_Evolution_DataServer_BookFactory"
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51 enum
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53 COLUMN_AUTOADD,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54 COLUMN_ICON,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 COLUMN_SCREENNAME,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56 COLUMN_DATA,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 NUM_COLUMNS
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58 };
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
59
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 static PurpleBlistUiOps *backup_blist_ui_ops = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61 static PurpleBlistUiOps *blist_ui_ops = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62 static EBook *book = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 static gulong timer = 0;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64 static gulong book_view_tag = 0;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
65 static EBookView *book_view = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 update_ims_from_contact(EContact *contact, const char *name,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 const char *prpl_id, EContactField field)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71 GList *ims = e_contact_get(contact, field);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
72 GList *l, *l2;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 if (ims == NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 for (l = purple_connections_get_all(); l != NULL; l = l->next)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 PurpleConnection *gc = (PurpleConnection *)l->data;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 PurpleAccount *account = purple_connection_get_account(gc);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 char *me;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 if (strcmp(purple_account_get_protocol_id(account), prpl_id))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 continue;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 if (!purple_account_get_bool(account, "gevo-autoadd", FALSE))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 continue;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 me = g_strdup(purple_normalize(account, purple_account_get_username(account)));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90 for (l2 = ims; l2 != NULL; l2 = l2->next)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92 if (purple_find_buddy(account, l2->data) != NULL ||
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 !strcmp(me, purple_normalize(account, l2->data)))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94 continue;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96 gevo_add_buddy(account, _("Buddies"), l2->data, name);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 g_free(me);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 g_list_foreach(ims, (GFunc)g_free, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102 g_list_free(ims);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 update_buddies_from_contact(EContact *contact)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 const char *name;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110 name = e_contact_get_const(contact, E_CONTACT_FULL_NAME);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 update_ims_from_contact(contact, name, "prpl-oscar", E_CONTACT_IM_AIM);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113 update_ims_from_contact(contact, name, "prpl-jabber", E_CONTACT_IM_JABBER);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 update_ims_from_contact(contact, name, "prpl-yahoo", E_CONTACT_IM_YAHOO);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 update_ims_from_contact(contact, name, "prpl-msn", E_CONTACT_IM_MSN);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 update_ims_from_contact(contact, name, "prpl-oscar", E_CONTACT_IM_ICQ);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 update_ims_from_contact(contact, name, "prpl-novell", E_CONTACT_IM_GROUPWISE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121 contacts_changed_cb(EBookView *book_view, GList *contacts)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 GList *l;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125 if (purple_connections_get_all() == NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
127
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 for (l = contacts; l != NULL; l = l->next)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
130 EContact *contact = (EContact *)l->data;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
131
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
132 update_buddies_from_contact(contact);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
133 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
134 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
135
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 request_add_buddy(PurpleAccount *account, const char *username,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 const char *group, const char *alias)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 if (book == NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 backup_blist_ui_ops->request_add_buddy(account, username, group,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143 alias);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
144 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145 else
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147 gevo_add_buddy_dialog_show(account, username, group, alias);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
152 got_book_view_cb(EBook *book, EBookStatus status, EBookView *view,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153 gpointer user_data)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
154 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
155 book_view_tag = 0;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157 if (status != E_BOOK_ERROR_OK)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 purple_debug_error("evolution", "Unable to retrieve book view! :(\n");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
164 book_view = view;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
165
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166 g_object_ref(book_view);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
167
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
168 g_signal_connect(G_OBJECT(book_view), "contacts_changed",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169 G_CALLBACK(contacts_changed_cb), book);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
170
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 g_signal_connect(G_OBJECT(book_view), "contacts_added",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172 G_CALLBACK(contacts_changed_cb), book);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174 e_book_view_start(view);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 signed_on_cb(PurpleConnection *gc)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 EBookQuery *query;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 gboolean status;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 GList *contacts;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 GList *l;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185 if (book == NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 query = e_book_query_any_field_contains("");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 status = e_book_get_contacts(book, query, &contacts, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 e_book_query_unref(query);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194 if (!status)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
195 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197 for (l = contacts; l != NULL; l = l->next)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
198 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199 EContact *contact = E_CONTACT(l->data);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
200
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
201 update_buddies_from_contact(contact);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
202
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
203 g_object_unref(contact);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
204 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
205
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
206 g_list_free(contacts);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
207 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
208
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
209 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
210 menu_item_activate_cb(PurpleBlistNode *node, gpointer user_data)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
211 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
212 PurpleBuddy *buddy = (PurpleBuddy *)node;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
213 gevo_associate_buddy_dialog_new(buddy);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
214 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
215
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
216 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
217 menu_item_send_mail_activate_cb(PurpleBlistNode *node, gpointer user_data)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
218 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
219 PurpleBuddy *buddy = (PurpleBuddy *)node;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
220 char *mail = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
221
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
222 mail = gevo_get_email_for_buddy(buddy);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
223
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
224 if (mail != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
225 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
226 char *app = g_find_program_in_path("evolution");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
227 if (app != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
228 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
229 char *command_line = g_strdup_printf("%s mailto:%s", app, mail);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
230 char *quoted = g_shell_quote(command_line);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
231 g_free(app);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
232 g_free(mail);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
233
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
234 g_spawn_command_line_async(quoted, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
235 g_free(command_line);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
236 g_free(quoted);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
237 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
238 else
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
239 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
240 purple_notify_error(NULL, NULL, _("Unable to send e-mail"),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
241 _("The evolution executable was not found in the PATH."));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
242 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
243 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
244 else
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
245 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
246 purple_notify_error(NULL, NULL, _("Unable to send e-mail"),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
247 _("An e-mail address was not found for this buddy."));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
248 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
249 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
250
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
251 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
252 blist_node_extended_menu_cb(PurpleBlistNode *node, GList **menu)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
253 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
254 PurpleMenuAction *act;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
255 PurpleBuddy *buddy;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
256 PurpleAccount *account;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
257 EContact *contact;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
258 char *mail;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
259
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
260 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
261 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
262
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
263 buddy = (PurpleBuddy *)node;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
264 account = purple_buddy_get_account(buddy);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
265
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
266 if (!gevo_prpl_is_supported(account, buddy))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
267 return;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
268
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
269 contact = gevo_search_buddy_in_contacts(buddy, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
270
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
271 if (contact == NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
272 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
273 act = purple_menu_action_new(_("Add to Address Book"),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
274 PURPLE_CALLBACK(menu_item_activate_cb),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
275 NULL, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
276 *menu = g_list_append(*menu, act);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
277 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
278 else
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
279 g_object_unref(contact);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
280
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
281 mail = gevo_get_email_for_buddy(buddy);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
282
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
283 if (mail != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
284 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
285 act = purple_menu_action_new(_("Send E-Mail"),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
286 PURPLE_CALLBACK(menu_item_send_mail_activate_cb), NULL, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
287 *menu = g_list_append(*menu, act);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
288 g_free(mail);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
289 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
290 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
291
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
292 /* TODO: Something in here leaks 1 reference to a bonobo object! */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
293 static gboolean
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
294 load_timeout(gpointer data)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
295 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
296 PurplePlugin *plugin = (PurplePlugin *)data;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
297 EBookQuery *query;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
298
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
299 timer = 0;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
300
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
301 /* Maybe this is it? */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
302 if (!gevo_load_addressbook(NULL, &book, NULL))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
303 return FALSE;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
304
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
305 query = e_book_query_any_field_contains("");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
306
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
307 /* Is it this? */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
308 book_view_tag = e_book_async_get_book_view(book, query, NULL, -1,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
309 got_book_view_cb, NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
310
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
311 e_book_query_unref(query);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
312
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
313 purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
314 plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
315
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
316 return FALSE;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
317 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
318
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
319 static gboolean
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
320 plugin_load(PurplePlugin *plugin)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
321 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
322 bonobo_activate();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
323
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
324 backup_blist_ui_ops = purple_blist_get_ui_ops();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
325
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
326 blist_ui_ops = g_memdup(backup_blist_ui_ops, sizeof(PurpleBlistUiOps));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
327 blist_ui_ops->request_add_buddy = request_add_buddy;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
328
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
329 purple_blist_set_ui_ops(blist_ui_ops);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
330
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
331 purple_signal_connect(purple_connections_get_handle(), "signed-on",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
332 plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
333
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
334 timer = g_timeout_add(1, load_timeout, plugin);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
335
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
336 return TRUE;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
337 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
338
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
339 static gboolean
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
340 plugin_unload(PurplePlugin *plugin)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
341 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
342 purple_blist_set_ui_ops(backup_blist_ui_ops);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
343
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
344 g_free(blist_ui_ops);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
345
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
346 backup_blist_ui_ops = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
347 blist_ui_ops = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
348
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
349 if (book_view != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
350 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
351 e_book_view_stop(book_view);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
352 g_object_unref(book_view);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
353 book_view = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
354 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
355
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
356 if (book != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
357 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
358 g_object_unref(book);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
359 book = NULL;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
360 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
361
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
362 return TRUE;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
363 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
364
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
365 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
366 plugin_destroy(PurplePlugin *plugin)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
367 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
368 bonobo_debug_shutdown();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
369 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
370
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
371 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
372 autoadd_toggled_cb(GtkCellRendererToggle *renderer, gchar *path_str,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
373 gpointer data)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
374 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
375 PurpleAccount *account;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
376 GtkTreeModel *model = (GtkTreeModel *)data;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
377 GtkTreeIter iter;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
378 gboolean autoadd;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
379
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
380 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
381 gtk_tree_model_get(model, &iter,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
382 COLUMN_DATA, &account,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
383 COLUMN_AUTOADD, &autoadd,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
384 -1);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
385
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
386 purple_account_set_bool(account, "gevo-autoadd", !autoadd);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
387
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
388 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
389 COLUMN_AUTOADD, !autoadd,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
390 -1);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
391 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
392
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
393 static GtkWidget *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
394 get_config_frame(PurplePlugin *plugin)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
395 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
396 GtkWidget *ret;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
397 GtkWidget *vbox;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
398 GtkWidget *label;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
399 GtkWidget *sw;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
400 GtkWidget *treeview;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
401 GtkTreeViewColumn *column;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
402 GtkCellRenderer *renderer;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
403 GdkPixbuf *pixbuf;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
404 GtkListStore *model;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
405 GList *l;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
406
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
407 /* Outside container */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
408 ret = gtk_vbox_new(FALSE, 18);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
409 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
410
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
411 /* Configuration frame */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
412 vbox = pidgin_make_frame(ret, _("Evolution Integration Configuration"));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
413
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
414 /* Label */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
415 label = gtk_label_new(_("Select all accounts that buddies should be "
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
416 "auto-added to."));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
417 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
418 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
419 gtk_widget_show(label);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
420
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
421 /* Scrolled window */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
422 sw = gtk_scrolled_window_new(0, 0);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
423 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
424 GTK_POLICY_AUTOMATIC,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
425 GTK_POLICY_ALWAYS);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
426 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
427 GTK_SHADOW_IN);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
428 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
429 gtk_widget_set_size_request(sw, 300, 300);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
430 gtk_widget_show(sw);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
431
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
432 /* Create the list model for the treeview. */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
433 model = gtk_list_store_new(NUM_COLUMNS,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
434 G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
435 G_TYPE_STRING, G_TYPE_POINTER);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
436
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
437 /* Setup the treeview */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
438 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
439 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
440 gtk_container_add(GTK_CONTAINER(sw), treeview);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
441 gtk_widget_show(treeview);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
442
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
443 /* Setup the column */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
444 column = gtk_tree_view_column_new();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
445 gtk_tree_view_column_set_title(column, _("Account"));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
446 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
447
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
448 /* Checkbox */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
449 renderer = gtk_cell_renderer_toggle_new();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
450
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
451 g_signal_connect(G_OBJECT(renderer), "toggled",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
452 G_CALLBACK(autoadd_toggled_cb), model);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
453
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
454 gtk_tree_view_column_pack_start(column, renderer, FALSE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
455 gtk_tree_view_column_add_attribute(column, renderer,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
456 "active", COLUMN_AUTOADD);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
457
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
458 /* Icon */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
459 renderer = gtk_cell_renderer_pixbuf_new();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
460 gtk_tree_view_column_pack_start(column, renderer, FALSE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
461 gtk_tree_view_column_add_attribute(column, renderer,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
462 "pixbuf", COLUMN_ICON);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
463
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
464 /* Screenname */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
465 renderer = gtk_cell_renderer_text_new();
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
466 gtk_tree_view_column_pack_start(column, renderer, TRUE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
467 gtk_tree_view_column_add_attribute(column, renderer,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
468 "text", COLUMN_SCREENNAME);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
469
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
470
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
471 /* Populate */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
472 for (l = purple_accounts_get_all(); l != NULL; l = l->next)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
473 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
474 PurpleAccount *account = (PurpleAccount *)l->data;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
475 GtkTreeIter iter;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
476
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
477 purple_debug_info("evolution", "Adding account\n");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
478
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
479 gtk_list_store_append(model, &iter);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
480
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
481 pixbuf = pidgin_create_prpl_icon(account, 0.5);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
482 if ((pixbuf != NULL) && (!purple_account_is_connected(account)))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
483 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
484
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
485 gtk_list_store_set(model, &iter,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
486 COLUMN_AUTOADD,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
487 purple_account_get_bool(account, "gevo-autoadd",
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
488 FALSE),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
489 COLUMN_ICON, pixbuf,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
490 COLUMN_SCREENNAME,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
491 purple_account_get_username(account),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
492 COLUMN_DATA, account,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
493 -1);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
494
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
495 if (pixbuf != NULL)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
496 g_object_unref(G_OBJECT(pixbuf));
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
497 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
498
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
499 gtk_widget_show_all(ret);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
500
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
501 return ret;
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
502 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
503
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
504 static PidginPluginUiInfo ui_info =
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
505 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
506 get_config_frame, /**< get_config_frame */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
507 0, /**< page_num */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
508 /* Padding */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
509 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
510 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
511 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
512 NULL
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
513 };
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
514
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
515 static PurplePluginInfo info =
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
516 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
517 PURPLE_PLUGIN_MAGIC,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
518 PURPLE_MAJOR_VERSION,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
519 PURPLE_MINOR_VERSION,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
520 PURPLE_PLUGIN_STANDARD, /**< type */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
521 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
522 0, /**< flags */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
523 NULL, /**< dependencies */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
524 PURPLE_PRIORITY_DEFAULT, /**< priority */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
525
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
526 GEVOLUTION_PLUGIN_ID, /**< id */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
527 N_("Evolution Integration"), /**< name */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
528 VERSION, /**< version */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
529 /** summary */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
530 N_("Provides integration with Evolution."),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
531 /** description */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
532 N_("Provides integration with Evolution."),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
533 "Christian Hammond <chipx86@chipx86.com>", /**< author */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
534 PURPLE_WEBSITE, /**< homepage */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
535
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
536 plugin_load, /**< load */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
537 plugin_unload, /**< unload */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
538 plugin_destroy, /**< destroy */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
539
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
540 &ui_info, /**< ui_info */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
541 NULL, /**< extra_info */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
542 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
543 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
544
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
545 /* Padding */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
546 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
547 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
548 NULL,
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
549 NULL
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
550 };
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
551
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
552 static void
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
553 init_plugin(PurplePlugin *plugin)
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
554 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
555 /* TODO: Change to core-remote when possible. */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
556 /* info.dependencies = g_list_append(info.dependencies, "gtk-remote"); */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
557
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
558 /*
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
559 * I'm going to rant a little bit here...
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
560 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
561 * For some reason, when we init bonobo from inside a plugin, it will
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
562 * segfault when destroyed. The backtraces are within gmodule somewhere.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
563 * There's not much I can do, and I'm not sure where the bug lies.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
564 * However, plugins are only destroyed when Purple is shutting down. After
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
565 * destroying the plugins, purple ends, and anything else is of course
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
566 * freed. That includes this, if we make the module resident, which
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
567 * prevents us from being able to actually unload it.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
568 *
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
569 * So, in conclusion, this is an evil hack, but it doesn't harm anything
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
570 * and it works.
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
571 */
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
572 g_module_make_resident(plugin->handle);
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
573
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
574 if (!bonobo_init_full(NULL, NULL, bonobo_activation_orb_get(),
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
575 CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
576 {
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
577 purple_debug_error("evolution", "Unable to initialize bonobo.\n");
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
578 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
579 }
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
580
e172db483c07 disapproval of revision '87db1277801f9f4bb6cf456b1344a263f51f2864'
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
581 PURPLE_INIT_PLUGIN(gevolution, init_plugin, info)