pidgin/gtkconv.c

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

mercurial