pidgin/plugins/gevolution/gevolution.c

branch
soc.2013.gobjectification.plugins
changeset 36773
62148e91059f
parent 36637
9b0109ae118d
child 36934
e7268aeb3b89
equal deleted inserted replaced
36772:d728ec173fc5 36773:62148e91059f
331 plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL); 331 plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL);
332 332
333 return FALSE; 333 return FALSE;
334 } 334 }
335 335
336 static gboolean
337 plugin_load(PurplePlugin *plugin)
338 {
339 #if 0
340 bonobo_activate();
341 #endif
342
343 backup_blist_ui_ops = purple_blist_get_ui_ops();
344
345 blist_ui_ops = g_memdup(backup_blist_ui_ops, sizeof(PurpleBlistUiOps));
346 blist_ui_ops->request_add_buddy = request_add_buddy;
347
348 purple_blist_set_ui_ops(blist_ui_ops);
349
350 purple_signal_connect(purple_connections_get_handle(), "signed-on",
351 plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
352
353 timer = g_timeout_add(1, load_timeout, plugin);
354
355 return TRUE;
356 }
357
358 static gboolean
359 plugin_unload(PurplePlugin *plugin)
360 {
361 purple_blist_set_ui_ops(backup_blist_ui_ops);
362
363 g_free(blist_ui_ops);
364
365 backup_blist_ui_ops = NULL;
366 blist_ui_ops = NULL;
367
368 if (book_view != NULL)
369 {
370 e_book_view_stop(book_view);
371 g_object_unref(book_view);
372 book_view = NULL;
373 }
374
375 if (book != NULL)
376 {
377 g_object_unref(book);
378 book = NULL;
379 }
380
381 return TRUE;
382 }
383
384 static void
385 plugin_destroy(PurplePlugin *plugin)
386 {
387 #if 0
388 bonobo_debug_shutdown();
389 #endif
390 }
391
392 static void 336 static void
393 autoadd_toggled_cb(GtkCellRendererToggle *renderer, gchar *path_str, 337 autoadd_toggled_cb(GtkCellRendererToggle *renderer, gchar *path_str,
394 gpointer data) 338 gpointer data)
395 { 339 {
396 PurpleAccount *account; 340 PurpleAccount *account;
510 gtk_widget_show_all(ret); 454 gtk_widget_show_all(ret);
511 455
512 return ret; 456 return ret;
513 } 457 }
514 458
515 static PidginPluginUiInfo ui_info = 459 static PidginPluginInfo *
516 { 460 plugin_query(GError **error)
517 get_config_frame, /**< get_config_frame */ 461 {
518 0, /**< page_num */ 462 const gchar * const authors[] = {
519 /* Padding */ 463 "Christian Hammond <chipx86@chipx86.com>",
520 NULL, 464 NULL
521 NULL, 465 };
522 NULL, 466
523 NULL 467 return pidgin_plugin_info_new(
524 }; 468 "id", GEVOLUTION_PLUGIN_ID,
525 469 "name", N_("Evolution Integration"),
526 static PurplePluginInfo info = 470 "version", DISPLAY_VERSION,
527 { 471 "category", N_("Integration"),
528 PURPLE_PLUGIN_MAGIC, 472 "summary", N_("Provides integration with Evolution."),
529 PURPLE_MAJOR_VERSION, 473 "description", N_("Provides integration with Evolution."),
530 PURPLE_MINOR_VERSION, 474 "authors", authors,
531 PURPLE_PLUGIN_STANDARD, /**< type */ 475 "website", PURPLE_WEBSITE,
532 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ 476 "abi-version", PURPLE_ABI_VERSION,
533 0, /**< flags */ 477 "pidgin-config-frame", get_config_frame,
534 NULL, /**< dependencies */ 478 NULL
535 PURPLE_PRIORITY_DEFAULT, /**< priority */ 479 );
536 480 }
537 GEVOLUTION_PLUGIN_ID, /**< id */ 481
538 N_("Evolution Integration"), /**< name */ 482 static gboolean
539 DISPLAY_VERSION, /**< version */ 483 plugin_load(PurplePlugin *plugin, GError **error)
540 /** summary */
541 N_("Provides integration with Evolution."),
542 /** description */
543 N_("Provides integration with Evolution."),
544 "Christian Hammond <chipx86@chipx86.com>", /**< author */
545 PURPLE_WEBSITE, /**< homepage */
546
547 plugin_load, /**< load */
548 plugin_unload, /**< unload */
549 plugin_destroy, /**< destroy */
550
551 &ui_info, /**< ui_info */
552 NULL, /**< extra_info */
553 NULL,
554 NULL,
555
556 /* Padding */
557 NULL,
558 NULL,
559 NULL,
560 NULL
561 };
562
563 static void
564 init_plugin(PurplePlugin *plugin)
565 { 484 {
566 /* TODO: Change to core-remote when possible. */ 485 /* TODO: Change to core-remote when possible. */
567 /* info.dependencies = g_list_append(info.dependencies, "gtk-remote"); */ 486 /* info.dependencies = g_list_append(info.dependencies, "gtk-remote"); */
568 487
569 /* 488 /*
582 * 501 *
583 * And for some reason it's needed even when we don't init bonobo ourselves 502 * And for some reason it's needed even when we don't init bonobo ourselves
584 * at all, so the above explanation is suspect. This is required even with 503 * at all, so the above explanation is suspect. This is required even with
585 * e-d-s >= 2.29.1 where bonobo is no longer in the picture. 504 * e-d-s >= 2.29.1 where bonobo is no longer in the picture.
586 */ 505 */
587 g_module_make_resident(plugin->handle); 506 g_module_make_resident(gplugin_native_plugin_get_module(
507 GPLUGIN_NATIVE_PLUGIN(plugin)));
588 508
589 #if 0 509 #if 0
590 if (!bonobo_init_full(NULL, NULL, bonobo_activation_orb_get(), 510 if (!bonobo_init_full(NULL, NULL, bonobo_activation_orb_get(),
591 CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) 511 CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))
592 { 512 {
593 purple_debug_error("evolution", "Unable to initialize bonobo.\n"); 513 purple_debug_error("evolution", "Unable to initialize bonobo.\n");
594 } 514 }
595 #endif 515 #endif
596 } 516 #if 0
597 517 bonobo_activate();
598 PURPLE_INIT_PLUGIN(gevolution, init_plugin, info) 518 #endif
519
520 backup_blist_ui_ops = purple_blist_get_ui_ops();
521
522 blist_ui_ops = g_memdup(backup_blist_ui_ops, sizeof(PurpleBlistUiOps));
523 blist_ui_ops->request_add_buddy = request_add_buddy;
524
525 purple_blist_set_ui_ops(blist_ui_ops);
526
527 purple_signal_connect(purple_connections_get_handle(), "signed-on",
528 plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
529
530 timer = g_timeout_add(1, load_timeout, plugin);
531
532 return TRUE;
533 }
534
535 static gboolean
536 plugin_unload(PurplePlugin *plugin, GError **error)
537 {
538 purple_blist_set_ui_ops(backup_blist_ui_ops);
539
540 g_free(blist_ui_ops);
541
542 backup_blist_ui_ops = NULL;
543 blist_ui_ops = NULL;
544
545 if (book_view != NULL)
546 {
547 e_book_view_stop(book_view);
548 g_object_unref(book_view);
549 book_view = NULL;
550 }
551
552 if (book != NULL)
553 {
554 g_object_unref(book);
555 book = NULL;
556 }
557
558 #if 0
559 bonobo_debug_shutdown();
560 #endif
561
562 return TRUE;
563 }
564
565 PURPLE_PLUGIN_INIT(gevolution, plugin_query, plugin_load, plugin_unload);

mercurial