Mercurial > pidgin
comparison pidgin/gtkconv.c @ 32675:59b0cf585038
Apply some changes that don't require GTK+ 3.0.
applied changes from f017f92d2834b148a4583586bf9ba2d7a184e149
through 3a572d2b49759264dd54b77ac23764af78d630c6
Changelog: Hide some Facebook settings hacks for now.
applied changes from 3a572d2b49759264dd54b77ac23764af78d630c6
through 5a380480965863fe5303a11e5b54915402525a55
Changelog: We don't need this extra slash.
applied changes from 5a380480965863fe5303a11e5b54915402525a55
through 84f2abc2501c34fb226b46effa1713fe0fc7ae01
Changelog: Add back the More and plugin action menu entries.
applied changes from 9f9150c83aa41a5ad716a09dc9be9079a5235a85
through 5204b1b3816e4356312730935b2f3b6e9b940e1a
Changelog: Enable the menu-refreshing logic in the conversation
menu, now that the signal (un)blocking affects the
correct widget.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 08 Oct 2011 21:48:38 +0000 |
parents | 787609e41f20 |
children | 1c7c89f41081 |
comparison
equal
deleted
inserted
replaced
32674:8f2715fc36db | 32675:59b0cf585038 |
---|---|
3130 | 3130 |
3131 #ifdef USE_VV | 3131 #ifdef USE_VV |
3132 { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, | 3132 { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, |
3133 { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, | 3133 { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
3134 { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, | 3134 { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
3135 { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, | 3135 { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, |
3136 #endif | 3136 #endif |
3137 | 3137 |
3138 { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, | 3138 { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, |
3139 { "GetAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("Get _Attention"), NULL, NULL, G_CALLBACK(menu_get_attention_cb) }, | 3139 { "GetAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("Get _Attention"), NULL, NULL, G_CALLBACK(menu_get_attention_cb) }, |
3140 { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, G_CALLBACK(menu_add_pounce_cb) }, | 3140 { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, G_CALLBACK(menu_add_pounce_cb) }, |
3462 } | 3462 } |
3463 | 3463 |
3464 static void | 3464 static void |
3465 regenerate_options_items(PidginWindow *win) | 3465 regenerate_options_items(PidginWindow *win) |
3466 { | 3466 { |
3467 #if GTK_CHECK_VERSION(2,6,0) | |
3468 #else | |
3469 GtkWidget *menu; | 3467 GtkWidget *menu; |
3470 PidginConversation *gtkconv; | 3468 PidginConversation *gtkconv; |
3471 GList *list; | 3469 GList *list; |
3472 | 3470 #if GTK_CHECK_VERSION(2,6,0) |
3471 GtkWidget *more_menu; | |
3472 | |
3473 gtkconv = pidgin_conv_window_get_active_gtkconv(win); | |
3474 more_menu = gtk_ui_manager_get_widget(win->menu.ui, | |
3475 "/Conversation/ConversationMenu/MoreMenu"); | |
3476 gtk_widget_show(more_menu); | |
3477 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); | |
3478 #else | |
3473 gtkconv = pidgin_conv_window_get_active_gtkconv(win); | 3479 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
3474 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); | 3480 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); |
3481 #endif | |
3475 | 3482 |
3476 /* Remove the previous entries */ | 3483 /* Remove the previous entries */ |
3477 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) | 3484 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) |
3478 { | 3485 { |
3479 GtkWidget *w = list->data; | 3486 GtkWidget *w = list->data; |
3487 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | 3494 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
3488 gtk_widget_set_sensitive(item, FALSE); | 3495 gtk_widget_set_sensitive(item, FALSE); |
3489 } | 3496 } |
3490 | 3497 |
3491 gtk_widget_show_all(menu); | 3498 gtk_widget_show_all(menu); |
3492 #endif | |
3493 } | 3499 } |
3494 | 3500 |
3495 static void | 3501 static void |
3496 remove_from_list(GtkWidget *widget, PidginWindow *win) | 3502 remove_from_list(GtkWidget *widget, PidginWindow *win) |
3497 { | 3503 { |
3501 } | 3507 } |
3502 | 3508 |
3503 static void | 3509 static void |
3504 regenerate_plugins_items(PidginWindow *win) | 3510 regenerate_plugins_items(PidginWindow *win) |
3505 { | 3511 { |
3506 #if GTK_CHECK_VERSION(2,6,0) | |
3507 #else | |
3508 GList *action_items; | 3512 GList *action_items; |
3509 GtkWidget *menu; | 3513 GtkWidget *menu; |
3510 GList *list; | 3514 GList *list; |
3511 PidginConversation *gtkconv; | 3515 PidginConversation *gtkconv; |
3512 PurpleConversation *conv; | 3516 PurpleConversation *conv; |
3528 G_CALLBACK(remove_from_list), win); | 3532 G_CALLBACK(remove_from_list), win); |
3529 gtk_widget_destroy(action_items->data); | 3533 gtk_widget_destroy(action_items->data); |
3530 action_items = g_list_delete_link(action_items, action_items); | 3534 action_items = g_list_delete_link(action_items, action_items); |
3531 } | 3535 } |
3532 | 3536 |
3537 #if GTK_CHECK_VERSION(2,6,0) | |
3538 item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); | |
3539 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); | |
3540 #else | |
3533 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); | 3541 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); |
3542 #endif | |
3534 | 3543 |
3535 list = purple_conversation_get_extended_menu(conv); | 3544 list = purple_conversation_get_extended_menu(conv); |
3536 if (list) { | 3545 if (list) { |
3537 action_items = g_list_prepend(NULL, (item = pidgin_separator(menu))); | 3546 action_items = g_list_prepend(NULL, (item = pidgin_separator(menu))); |
3538 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); | 3547 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); |
3544 action_items = g_list_prepend(action_items, item); | 3553 action_items = g_list_prepend(action_items, item); |
3545 gtk_widget_show_all(item); | 3554 gtk_widget_show_all(item); |
3546 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); | 3555 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); |
3547 } | 3556 } |
3548 g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); | 3557 g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); |
3549 #endif | 3558 } |
3550 } | 3559 |
3551 | |
3552 #if 0 | |
3553 static void menubar_activated(GtkWidget *item, gpointer data) | 3560 static void menubar_activated(GtkWidget *item, gpointer data) |
3554 { | 3561 { |
3555 PidginWindow *win = data; | 3562 PidginWindow *win = data; |
3556 regenerate_media_items(win); | 3563 regenerate_media_items(win); |
3557 regenerate_options_items(win); | 3564 regenerate_options_items(win); |
3566 static void | 3573 static void |
3567 focus_out_from_menubar(GtkWidget *wid, PidginWindow *win) | 3574 focus_out_from_menubar(GtkWidget *wid, PidginWindow *win) |
3568 { | 3575 { |
3569 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time | 3576 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time |
3570 * the 'Conversation' menu pops up. */ | 3577 * the 'Conversation' menu pops up. */ |
3571 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); | 3578 GtkWidget *menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); |
3572 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); | 3579 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); |
3573 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), | 3580 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), |
3574 G_CALLBACK(focus_out_from_menubar), win); | 3581 G_CALLBACK(focus_out_from_menubar), win); |
3575 } | 3582 } |
3576 #endif | |
3577 | 3583 |
3578 static GtkWidget * | 3584 static GtkWidget * |
3579 setup_menubar(PidginWindow *win) | 3585 setup_menubar(PidginWindow *win) |
3580 { | 3586 { |
3581 GtkAccelGroup *accel_group; | 3587 GtkAccelGroup *accel_group; |
3582 const char *method; | 3588 const char *method; |
3583 GtkActionGroup *action_group; | 3589 GtkActionGroup *action_group; |
3584 GError *error; | 3590 GError *error; |
3591 GtkWidget *menuitem; | |
3585 | 3592 |
3586 action_group = gtk_action_group_new("ConversationActions"); | 3593 action_group = gtk_action_group_new("ConversationActions"); |
3587 gtk_action_group_add_actions(action_group, | 3594 gtk_action_group_add_actions(action_group, |
3588 menu_entries, | 3595 menu_entries, |
3589 G_N_ELEMENTS(menu_entries), | 3596 G_N_ELEMENTS(menu_entries), |
3613 exit(EXIT_FAILURE); | 3620 exit(EXIT_FAILURE); |
3614 } | 3621 } |
3615 | 3622 |
3616 win->menu.menubar = | 3623 win->menu.menubar = |
3617 gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); | 3624 gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); |
3625 | |
3626 menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); | |
3627 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); | |
3618 | 3628 |
3619 win->menu.view_log = | 3629 win->menu.view_log = |
3620 gtk_ui_manager_get_action(win->menu.ui, | 3630 gtk_ui_manager_get_action(win->menu.ui, |
3621 "/Conversation/ConversationMenu/ViewLog"); | 3631 "/Conversation/ConversationMenu/ViewLog"); |
3622 | 3632 |