annotate plugins/gevolution/gevolution.c @ 13990:ff4ee4ac4408

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