| 2448 if (action && action->callback) |
2448 if (action && action->callback) |
| 2449 action->callback(action); |
2449 action->callback(action); |
| 2450 } |
2450 } |
| 2451 |
2451 |
| 2452 static void |
2452 static void |
| 2453 build_menu_actions(GntMenuItem *item, GList *actions) |
2453 build_plugin_actions(GntMenuItem *item, PurplePluginInfo *plugin_info) |
| 2454 { |
2454 { |
| 2455 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
2455 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
| 2456 GList *l; |
2456 GList *actions, *l; |
| 2457 GntMenuItem *menuitem; |
2457 GntMenuItem *menuitem; |
| |
2458 |
| |
2459 actions = purple_plugin_info_get_actions(plugin_info); |
| 2458 |
2460 |
| 2459 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
2461 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
| 2460 for (l = actions; l; l = l->next) { |
2462 for (l = actions; l; l = l->next) { |
| 2461 if (l->data) { |
2463 if (l->data) { |
| 2462 PurplePluginAction *action = l->data; |
2464 PurplePluginAction *action = l->data; |
| 2467 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action); |
2469 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action); |
| 2468 } |
2470 } |
| 2469 } |
2471 } |
| 2470 } |
2472 } |
| 2471 |
2473 |
| |
2474 static void |
| |
2475 protocol_action(GntMenuItem *item, gpointer data) |
| |
2476 { |
| |
2477 PurpleProtocolAction *action = data; |
| |
2478 if (action && action->callback) |
| |
2479 action->callback(action); |
| |
2480 } |
| |
2481 |
| |
2482 static void |
| |
2483 build_protocol_actions(GntMenuItem *item, PurplePluginProtocolInfo *prpl_info) |
| |
2484 { |
| |
2485 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
| |
2486 GList *l; |
| |
2487 GntMenuItem *menuitem; |
| |
2488 |
| |
2489 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
| |
2490 for (l = prpl_info->actions; l; l = l->next) { |
| |
2491 if (l->data) { |
| |
2492 PurpleProtocolAction *action = l->data; |
| |
2493 menuitem = gnt_menuitem_new(action->label); |
| |
2494 gnt_menu_add_item(GNT_MENU(sub), menuitem); |
| |
2495 |
| |
2496 gnt_menuitem_set_callback(menuitem, protocol_action, action); |
| |
2497 g_object_set_data(G_OBJECT(menuitem), "protocol_action", action); |
| |
2498 } |
| |
2499 } |
| |
2500 } |
| |
2501 |
| 2472 static gboolean |
2502 static gboolean |
| 2473 buddy_recent_signed_on_off(gpointer data) |
2503 buddy_recent_signed_on_off(gpointer data) |
| 2474 { |
2504 { |
| 2475 PurpleBlistNode *node = data; |
2505 PurpleBlistNode *node = data; |
| 2476 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
2506 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
| 2546 continue; |
2576 continue; |
| 2547 } |
2577 } |
| 2548 |
2578 |
| 2549 item = gnt_menuitem_new(_(gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(plugin_info)))); |
2579 item = gnt_menuitem_new(_(gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(plugin_info)))); |
| 2550 gnt_menu_add_item(GNT_MENU(sub), item); |
2580 gnt_menu_add_item(GNT_MENU(sub), item); |
| 2551 build_menu_actions(item, purple_plugin_info_get_actions(plugin_info)); |
2581 build_plugin_actions(item, plugin_info); |
| 2552 |
2582 |
| 2553 g_object_unref(plugin_info); |
2583 g_object_unref(plugin_info); |
| 2554 } |
2584 } |
| 2555 } |
2585 } |
| 2556 |
2586 |
| 2582 prpl_info = purple_connection_get_protocol_info(gc); |
2612 prpl_info = purple_connection_get_protocol_info(gc); |
| 2583 |
2613 |
| 2584 if (prpl_info->actions != NULL) { |
2614 if (prpl_info->actions != NULL) { |
| 2585 item = gnt_menuitem_new(purple_account_get_username(account)); |
2615 item = gnt_menuitem_new(purple_account_get_username(account)); |
| 2586 gnt_menu_add_item(GNT_MENU(sub), item); |
2616 gnt_menu_add_item(GNT_MENU(sub), item); |
| 2587 build_menu_actions(item, prpl_info->actions); |
2617 build_protocol_actions(item, prpl_info); |
| 2588 } |
2618 } |
| 2589 } |
2619 } |
| 2590 } |
2620 } |
| 2591 |
2621 |
| 2592 static void |
2622 static void |