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