annotate plugins/gevolution/gevolution.c @ 8999:8f838ae3e710

[gaim-migrate @ 9774] " This patch renames the existing received-*-msg signals to receiving-*msg to fit the naming of other signals where a pointer to the message is passed (writing, sending, displaying) It adds new received-*-msg signals which are emitted after the receiving signals, in line with the other conversation signals (wrote, sent, displayed) This is necessary to allow plugins which depend on the final received message to work alongside plugins which may modify the message. One known example of this is festival-gaim alongside gaim-encryption - festival-gaim would try to "speak" the encrypted text: http://sf.net/tracker/?func=detail&aid=943216&group_id=89763&atid=591320 I've tested this with gaim-encryption and festival-gaim (locally modified so gaim-encryption uses the receiving signal and festival uses the received signal) All in-tree users of received-*-msg are updated to use receiving-*-msg if they do modify the message, the conversation-signals documentation is updated, the signals-test.c & signal-test.tcl plugins are also updated." --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 21 May 2004 14:33:32 +0000
parents 294ae6548d4e
children 826013efffcb
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"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include "gtkinternal.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "gtkblist.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "connection.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "debug.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "prefs.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "signals.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "gtkconv.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "gtkplugin.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "gtkutils.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "gevolution.h"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include <libedata-book/Evolution-DataServer-Addressbook.h>
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include <libebook/e-book-listener.h>
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include <libebook/e-book-async.h>
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include <libedata-book/e-data-book-factory.h>
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include <bonobo/bonobo-main.h>
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #define GEVOLUTION_PLUGIN_ID "gtk-x11-gevolution"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #define E_DATA_BOOK_FACTORY_OAF_ID \
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 "OAFIID:GNOME_Evolution_DataServer_BookFactory"
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 enum
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 COLUMN_AUTOADD,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 COLUMN_ICON,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 COLUMN_SCREENNAME,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 COLUMN_DATA,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 NUM_COLUMNS
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 };
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 static GaimBlistUiOps *backup_blist_ui_ops = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 static GaimBlistUiOps *blist_ui_ops = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 static EBook *book = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 static gulong timer = 0;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 static gulong book_view_tag = 0;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 static EBookView *book_view = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 update_ims_from_contact(EContact *contact, const char *name,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 const char *prpl_id, EContactField field)
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 GList *ims = e_contact_get(contact, field);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 GList *l, *l2;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 if (ims == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 GaimConnection *gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 GaimAccount *account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 if (strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 if (!gaim_account_get_bool(account, "gevo-autoadd", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 for (l2 = ims; l2 != NULL; l2 = l2->next)
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_find_buddy(account, l2->data) != NULL)
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 gevo_add_buddy(account, _("Buddies"), l2->data, name);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 g_list_foreach(ims, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 g_list_free(ims);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 update_buddies_from_contact(EContact *contact)
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 const char *name;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 name = e_contact_get_const(contact, E_CONTACT_FULL_NAME);
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 update_ims_from_contact(contact, name, "prpl-oscar", E_CONTACT_IM_AIM);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 update_ims_from_contact(contact, name, "prpl-jabber", E_CONTACT_IM_JABBER);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 update_ims_from_contact(contact, name, "prpl-yahoo", E_CONTACT_IM_YAHOO);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 update_ims_from_contact(contact, name, "prpl-msn", E_CONTACT_IM_MSN);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 update_ims_from_contact(contact, name, "prpl-oscar", E_CONTACT_IM_ICQ);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 }
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 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 contacts_changed_cb(EBookView *book_view, const GList *contacts)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 const GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 if (gaim_connections_get_all() == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 return;
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 for (l = contacts; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 EContact *contact = (EContact *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 update_buddies_from_contact(contact);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 }
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 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 request_add_buddy(GaimAccount *account, const char *username,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 const char *group, const char *alias)
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 if (book == NULL)
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 backup_blist_ui_ops->request_add_buddy(account, username, group,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 else
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 gevo_add_buddy_dialog_show(account, username, group, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 }
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 got_book_view_cb(EBook *book, EBookStatus status, EBookView *view,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 gpointer user_data)
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 book_view_tag = 0;
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 if (status != E_BOOK_ERROR_OK)
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 gaim_debug_error("evolution", "Unable to retrieve book view! :(\n");
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 return;
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 book_view = view;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 g_object_ref(book_view);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 g_signal_connect(G_OBJECT(book_view), "contacts_changed",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 G_CALLBACK(contacts_changed_cb), book);
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 g_signal_connect(G_OBJECT(book_view), "contacts_added",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 G_CALLBACK(contacts_changed_cb), book);
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 e_book_view_start(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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 signed_on_cb(GaimConnection *gc)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 EBookQuery *query;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 gboolean status;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 GList *contacts;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 GList *l;
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 if (book == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 return;
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 query = e_book_query_any_field_contains("");
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 status = e_book_get_contacts(book, query, &contacts, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 e_book_query_unref(query);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 if (!status)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 for (l = contacts; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 EContact *contact = E_CONTACT(l->data);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 update_buddies_from_contact(contact);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 g_object_unref(contact);
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 g_list_free(contacts);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 }
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 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 menu_item_activate_cb(GtkWidget *item, GaimBuddy *buddy)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 gevo_associate_buddy_dialog_new(buddy);
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 drawing_menu_cb(GtkWidget *menu, GaimBuddy *buddy)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 GtkWidget *item;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 if (gevo_prpl_is_supported(buddy->account, buddy))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 item = gtk_menu_item_new_with_label(_("Add to Address Book"));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 g_signal_connect(G_OBJECT(item), "activate",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 G_CALLBACK(menu_item_activate_cb), buddy);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 load_timeout(gpointer data)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 GaimPlugin *plugin = (GaimPlugin *)data;
8127
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
226 EBookQuery *query;
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 timer = 0;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 if (!gevo_load_addressbook(&book, NULL))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232
8127
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
233 query = e_book_query_any_field_contains("");
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
234
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
235 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
236 got_book_view_cb, NULL);
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
237
96ee7b21c1ae [gaim-migrate @ 8832]
Christian Hammond <chipx86@chipx86.com>
parents: 8089
diff changeset
238 e_book_query_unref(query);
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 gaim_signal_connect(GAIM_GTK_BLIST(gaim_get_blist()), "drawing-menu",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 plugin, GAIM_CALLBACK(drawing_menu_cb), NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 plugin_load(GaimPlugin *plugin)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 if (!bonobo_init_full(NULL, NULL, bonobo_activation_orb_get(),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 gaim_debug_error("evolution", "Unable to initialize bonobo.\n");
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 bonobo_activate();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 backup_blist_ui_ops = gaim_blist_get_ui_ops();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 blist_ui_ops = g_memdup(backup_blist_ui_ops, sizeof(GaimBlistUiOps));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 blist_ui_ops->request_add_buddy = request_add_buddy;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 gaim_blist_set_ui_ops(blist_ui_ops);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 plugin, GAIM_CALLBACK(signed_on_cb), NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 timer = g_timeout_add(1, load_timeout, plugin);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 plugin_unload(GaimPlugin *plugin)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 gaim_blist_set_ui_ops(backup_blist_ui_ops);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 g_free(blist_ui_ops);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 backup_blist_ui_ops = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 blist_ui_ops = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 if (book_view != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 e_book_view_stop(book_view);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 g_object_unref(book_view);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 book_view = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 if (book != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 g_object_unref(book);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 book = NULL;
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 bonobo_debug_shutdown();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 }
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 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 plugin_destroy(GaimPlugin *plugin)
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 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 autoadd_toggled_cb(GtkCellRendererToggle *renderer, gchar *path_str,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 gpointer data)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 GaimAccount *account;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 GtkTreeModel *model = (GtkTreeModel *)data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 gboolean autoadd;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 gtk_tree_model_get(model, &iter,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 COLUMN_DATA, &account,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 COLUMN_AUTOADD, &autoadd,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 -1);
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 gaim_account_set_bool(account, "gevo-autoadd", !autoadd);
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 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 COLUMN_AUTOADD, !autoadd,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 -1);
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 static GtkWidget *
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 get_config_frame(GaimPlugin *plugin)
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 GtkWidget *ret;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 GtkWidget *vbox;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 GtkWidget *label;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 GtkWidget *sw;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 GtkWidget *treeview;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 GtkTreeViewColumn *column;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 GtkCellRenderer *renderer;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 GdkPixbuf *pixbuf, *scale = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 GtkListStore *model;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 /* Outside container */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 ret = gtk_vbox_new(FALSE, 18);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 /* Configuration frame */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 vbox = gaim_gtk_make_frame(ret, _("Evolution Integration Configuration"));
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 /* Label */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 label = gtk_label_new(_("Select all accounts that buddies should be "
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 "auto-added to."));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 gtk_widget_show(label);
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 /* Scrolled window */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 sw = gtk_scrolled_window_new(0, 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 GTK_POLICY_AUTOMATIC,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 GTK_POLICY_ALWAYS);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 GTK_SHADOW_IN);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 gtk_widget_set_size_request(sw, 300, 300);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 gtk_widget_show(sw);
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 /* Create the list model for the treeview. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 model = gtk_list_store_new(NUM_COLUMNS,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 G_TYPE_STRING, G_TYPE_POINTER);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 /* Setup the treeview */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 gtk_container_add(GTK_CONTAINER(sw), treeview);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 gtk_widget_show(treeview);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 /* Setup the column */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 column = gtk_tree_view_column_new();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 gtk_tree_view_column_set_title(column, _("Account"));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 /* Checkbox */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 renderer = gtk_cell_renderer_toggle_new();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 g_signal_connect(G_OBJECT(renderer), "toggled",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 G_CALLBACK(autoadd_toggled_cb), model);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 gtk_tree_view_column_pack_start(column, renderer, FALSE);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 gtk_tree_view_column_add_attribute(column, renderer,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 "active", COLUMN_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 /* Icon */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 renderer = gtk_cell_renderer_pixbuf_new();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 gtk_tree_view_column_pack_start(column, renderer, FALSE);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 gtk_tree_view_column_add_attribute(column, renderer,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 "pixbuf", COLUMN_ICON);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 /* Screenname */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 renderer = gtk_cell_renderer_text_new();
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 gtk_tree_view_column_pack_start(column, renderer, TRUE);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 gtk_tree_view_column_add_attribute(column, renderer,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 "text", COLUMN_SCREENNAME);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 /* Populate */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 GaimAccount *account = (GaimAccount *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 GtkTreeIter iter;
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 gaim_debug_info("evolution", "Adding account\n");
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 gtk_list_store_append(model, &iter);
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 pixbuf = create_prpl_icon(account);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 if (pixbuf != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 GDK_INTERP_BILINEAR);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 if (!gaim_account_is_connected(account))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 gtk_list_store_set(model, &iter,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 COLUMN_AUTOADD,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 gaim_account_get_bool(account, "gevo-autoadd",
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 FALSE),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 COLUMN_ICON, scale,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 COLUMN_SCREENNAME,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 gaim_account_get_username(account),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 COLUMN_DATA, account,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 -1);
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 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 if (scale != NULL) g_object_unref(G_OBJECT(scale));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 gtk_widget_show_all(ret);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 return ret;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 static GaimGtkPluginUiInfo ui_info =
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 get_config_frame
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 };
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 static GaimPluginInfo info =
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8127
diff changeset
453 GAIM_PLUGIN_API_VERSION, /**< api_version */
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 GAIM_PLUGIN_STANDARD, /**< type */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 0, /**< flags */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 NULL, /**< dependencies */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 GAIM_PRIORITY_DEFAULT, /**< priority */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 GEVOLUTION_PLUGIN_ID, /**< id */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 N_("Evolution Integration"), /**< name */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 VERSION, /**< version */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 /** summary */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 N_("Provides integration with Ximian Evolution."),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 /** description */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 N_("Provides integration with Ximian Evolution."),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 GAIM_WEBSITE, /**< homepage */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 plugin_load, /**< load */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 plugin_unload, /**< unload */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 plugin_destroy, /**< destroy */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 &ui_info, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
475 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
476 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
477 NULL
8089
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 init_plugin(GaimPlugin *plugin)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 /* TODO: Change to core-remote when possible. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 /* info.dependencies = g_list_append(info.dependencies, "gtk-remote"); */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 /*
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 * I'm going to rant a little bit here...
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 *
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 * 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
490 * segfault when destroyed. The backtraces are within gmodule somewhere.
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 * 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
492 * However, plugins are only destroyed when Gaim is shutting down. After
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 * destroying the plugins, gaim ends, and anything else is of course
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 * freed. That includes this, if we make the module resident, which
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 * prevents us from being able to actually unload it.
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 *
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 * 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
498 * and it works.
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 g_module_make_resident(plugin->handle);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 }
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 GAIM_INIT_PLUGIN(gevolution, init_plugin, info)