pidgin/gtkconv.c

branch
soc.2013.gobjectification
changeset 34874
e03d555394c5
parent 34865
764a33b41ac7
parent 34280
ae59d7295d76
child 34892
65e25c679ca5
child 36459
b52f5391d12d
equal deleted inserted replaced
34873:777795d0a0ca 34874:e03d555394c5
63 #include "gtkprefs.h" 63 #include "gtkprefs.h"
64 #include "gtkprivacy.h" 64 #include "gtkprivacy.h"
65 #include "gtkthemes.h" 65 #include "gtkthemes.h"
66 #include "gtkutils.h" 66 #include "gtkutils.h"
67 #include "gtkwebview.h" 67 #include "gtkwebview.h"
68 #include "gtkwebviewtoolbar.h"
69 #include "pidginstock.h" 68 #include "pidginstock.h"
70 #include "pidgintooltip.h" 69 #include "pidgintooltip.h"
71 #include "smileyparser.h" 70 #include "smileyparser.h"
72 71
73 #include "gtknickcolors.h" 72 #include "gtknickcolors.h"
1238 static void 1237 static void
1239 menu_insert_link_cb(GtkAction *action, gpointer data) 1238 menu_insert_link_cb(GtkAction *action, gpointer data)
1240 { 1239 {
1241 PidginWindow *win = data; 1240 PidginWindow *win = data;
1242 PidginConversation *gtkconv; 1241 PidginConversation *gtkconv;
1243 GtkWebViewToolbar *toolbar; 1242 GtkWebView *entry;
1244 1243
1245 gtkconv = pidgin_conv_window_get_active_gtkconv(win); 1244 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1246 toolbar = GTK_WEBVIEWTOOLBAR(gtkconv->toolbar); 1245 entry = GTK_WEBVIEW(gtkconv->entry);
1247 1246
1248 gtk_webviewtoolbar_activate(toolbar, GTK_WEBVIEWTOOLBAR_ACTION_LINK); 1247 gtk_webview_activate_toolbar(entry, GTK_WEBVIEW_ACTION_LINK);
1249 } 1248 }
1250 1249
1251 static void 1250 static void
1252 menu_insert_image_cb(GtkAction *action, gpointer data) 1251 menu_insert_image_cb(GtkAction *action, gpointer data)
1253 { 1252 {
1254 PidginWindow *win = data; 1253 PidginWindow *win = data;
1255 PidginConversation *gtkconv; 1254 PidginConversation *gtkconv;
1256 GtkWebViewToolbar *toolbar; 1255 GtkWebView *entry;
1257 1256
1258 gtkconv = pidgin_conv_window_get_active_gtkconv(win); 1257 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1259 toolbar = GTK_WEBVIEWTOOLBAR(gtkconv->toolbar); 1258 entry = GTK_WEBVIEW(gtkconv->entry);
1260 1259
1261 gtk_webviewtoolbar_activate(toolbar, GTK_WEBVIEWTOOLBAR_ACTION_IMAGE); 1260 gtk_webview_activate_toolbar(entry, GTK_WEBVIEW_ACTION_IMAGE);
1262 } 1261 }
1263 1262
1264 static void 1263 static void
1265 menu_alias_cb(GtkAction *action, gpointer data) 1264 menu_alias_cb(GtkAction *action, gpointer data)
1266 { 1265 {
2273 2272
2274 gtkconv = PIDGIN_CONVERSATION(conv); 2273 gtkconv = PIDGIN_CONVERSATION(conv);
2275 old_conv = gtkconv->active_conv; 2274 old_conv = gtkconv->active_conv;
2276 2275
2277 purple_debug_info("gtkconv", "setting active conversation on toolbar %p\n", 2276 purple_debug_info("gtkconv", "setting active conversation on toolbar %p\n",
2278 conv);
2279 gtk_webviewtoolbar_switch_active_conversation(GTK_WEBVIEWTOOLBAR(gtkconv->toolbar),
2280 conv); 2277 conv);
2281 2278
2282 if (old_conv == conv) 2279 if (old_conv == conv)
2283 return; 2280 return;
2284 2281
3565 GtkActionGroup *action_group; 3562 GtkActionGroup *action_group;
3566 GError *error; 3563 GError *error;
3567 GtkWidget *menuitem; 3564 GtkWidget *menuitem;
3568 3565
3569 action_group = gtk_action_group_new("ConversationActions"); 3566 action_group = gtk_action_group_new("ConversationActions");
3567 #ifdef ENABLE_NLS
3568 gtk_action_group_set_translation_domain(action_group, PACKAGE);
3569 #endif
3570 gtk_action_group_add_actions(action_group, 3570 gtk_action_group_add_actions(action_group,
3571 menu_entries, 3571 menu_entries,
3572 G_N_ELEMENTS(menu_entries), 3572 G_N_ELEMENTS(menu_entries),
3573 win); 3573 win);
3574 gtk_action_group_add_toggle_actions(action_group, 3574 gtk_action_group_add_toggle_actions(action_group,
3575 menu_toggle_entries, 3575 menu_toggle_entries,
3576 G_N_ELEMENTS(menu_toggle_entries), 3576 G_N_ELEMENTS(menu_toggle_entries),
3577 win); 3577 win);
3578 #ifdef ENABLE_NLS
3579 gtk_action_group_set_translation_domain(action_group,
3580 PACKAGE);
3581 #endif
3582 3578
3583 win->menu.ui = gtk_ui_manager_new(); 3579 win->menu.ui = gtk_ui_manager_new();
3584 gtk_ui_manager_insert_action_group(win->menu.ui, action_group, 0); 3580 gtk_ui_manager_insert_action_group(win->menu.ui, action_group, 0);
3585 3581
3586 accel_group = gtk_ui_manager_get_accel_group(win->menu.ui); 3582 accel_group = gtk_ui_manager_get_accel_group(win->menu.ui);
5418 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE); 5414 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gtkconv->infopane), rend, FALSE);
5419 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL); 5415 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL);
5420 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); 5416 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
5421 5417
5422 /* Setup the webkit widget */ 5418 /* Setup the webkit widget */
5423 frame = pidgin_create_webview(FALSE, &gtkconv->webview, NULL, &webview_sw); 5419 frame = pidgin_create_webview(FALSE, &gtkconv->webview, &webview_sw);
5424 gtk_widget_set_size_request(gtkconv->webview, -1, 0); 5420 gtk_widget_set_size_request(gtkconv->webview, -1, 0);
5425 5421
5426 load_conv_theme(gtkconv); 5422 load_conv_theme(gtkconv);
5427 5423
5428 if (chat) { 5424 if (chat) {
5458 5454
5459 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); 5455 gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
5460 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0); 5456 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE, FALSE, 0);
5461 gtk_widget_show(gtkconv->lower_hbox); 5457 gtk_widget_show(gtkconv->lower_hbox);
5462 5458
5463 /* Setup the toolbar, entry widget and all signals */ 5459 /* Setup the entry widget and all signals */
5464 frame = pidgin_create_webview(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL); 5460 frame = pidgin_create_webview(TRUE, &gtkconv->entry, NULL);
5465 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0); 5461 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), frame, TRUE, TRUE, 0);
5466 gtk_widget_show(frame); 5462 gtk_widget_show(frame);
5467 5463
5468 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); 5464 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry");
5469 gtk_webview_set_protocol_name(GTK_WEBVIEW(gtkconv->entry), 5465 gtk_webview_set_protocol_name(GTK_WEBVIEW(gtkconv->entry),
5844 gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging"); 5840 gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging");
5845 purple_conversation_set_logging(conv, logging); 5841 purple_conversation_set_logging(conv, logging);
5846 } 5842 }
5847 5843
5848 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")) 5844 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
5849 gtk_widget_show(gtkconv->toolbar); 5845 gtk_webview_show_toolbar(GTK_WEBVIEW(gtkconv->entry));
5850 else 5846 else
5851 gtk_widget_hide(gtkconv->toolbar); 5847 gtk_webview_hide_toolbar(GTK_WEBVIEW(gtkconv->entry));
5852 5848
5853 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) 5849 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
5854 gtk_widget_show(gtkconv->infopane_hbox); 5850 gtk_widget_show(gtkconv->infopane_hbox);
5855 else 5851 else
5856 gtk_widget_hide(gtkconv->infopane_hbox); 5852 gtk_widget_hide(gtkconv->infopane_hbox);
7252 else 7248 else
7253 buttons &= ~GTK_WEBVIEW_CUSTOM_SMILEY; 7249 buttons &= ~GTK_WEBVIEW_CUSTOM_SMILEY;
7254 7250
7255 gtk_webview_set_format_functions(GTK_WEBVIEW(gtkconv->entry), buttons); 7251 gtk_webview_set_format_functions(GTK_WEBVIEW(gtkconv->entry), buttons);
7256 if (account != NULL) 7252 if (account != NULL)
7257 gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); 7253 gtk_webview_set_protocol_name(GTK_WEBVIEW(gtkconv->entry), purple_account_get_protocol_id(account));
7258 7254
7259 /* Deal with menu items */ 7255 /* Deal with menu items */
7260 gtk_action_set_sensitive(win->menu.view_log, TRUE); 7256 gtk_action_set_sensitive(win->menu.view_log, TRUE);
7261 gtk_action_set_sensitive(win->menu.add_pounce, TRUE); 7257 gtk_action_set_sensitive(win->menu.add_pounce, TRUE);
7262 gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); 7258 gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL));
7977 gtk_toggle_action_set_active( 7973 gtk_toggle_action_set_active(
7978 GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), 7974 GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar),
7979 (gboolean)GPOINTER_TO_INT(value)); 7975 (gboolean)GPOINTER_TO_INT(value));
7980 7976
7981 if ((gboolean)GPOINTER_TO_INT(value)) 7977 if ((gboolean)GPOINTER_TO_INT(value))
7982 gtk_widget_show(gtkconv->toolbar); 7978 gtk_webview_show_toolbar(GTK_WEBVIEW(gtkconv->entry));
7983 else 7979 else
7984 gtk_widget_hide(gtkconv->toolbar); 7980 gtk_webview_hide_toolbar(GTK_WEBVIEW(gtkconv->entry));
7985 7981
7986 g_idle_add((GSourceFunc)resize_webview_cb, gtkconv); 7982 g_idle_add((GSourceFunc)resize_webview_cb, gtkconv);
7987 } 7983 }
7988 } 7984 }
7989 7985

mercurial