Mercurial > pidgin.yaz
comparison pidgin/gtkimhtmltoolbar.c @ 29680:ce876e58cf6a
propagate from branch 'im.pidgin.pidgin' (head 6a70c2c1325aeb644bff8476f94c5a25f83044fb)
to branch 'im.pidgin.cpw.attention_ui' (head d6820cc133d1dfee9b288131b6b7a92fb082e658)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Wed, 22 Apr 2009 07:56:16 +0000 |
parents | 38a5df43d525 ae24e54a5014 |
children | b1284d63b969 |
comparison
equal
deleted
inserted
replaced
26716:474a0cb44f58 | 29680:ce876e58cf6a |
---|---|
31 #include "notify.h" | 31 #include "notify.h" |
32 #include "prefs.h" | 32 #include "prefs.h" |
33 #include "request.h" | 33 #include "request.h" |
34 #include "pidginstock.h" | 34 #include "pidginstock.h" |
35 #include "util.h" | 35 #include "util.h" |
36 #include "debug.h" | |
36 | 37 |
37 #include "gtkdialogs.h" | 38 #include "gtkdialogs.h" |
38 #include "gtkimhtmltoolbar.h" | 39 #include "gtkimhtmltoolbar.h" |
39 #include "gtksmiley.h" | 40 #include "gtksmiley.h" |
40 #include "gtkthemes.h" | 41 #include "gtkthemes.h" |
909 #endif | 910 #endif |
910 | 911 |
911 toolbar->smiley_dialog = dialog; | 912 toolbar->smiley_dialog = dialog; |
912 | 913 |
913 gtk_widget_grab_focus(toolbar->imhtml); | 914 gtk_widget_grab_focus(toolbar->imhtml); |
915 } | |
916 | |
917 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) | |
918 { | |
919 PurpleConversation *conv = toolbar->active_conv; | |
920 const gchar *who = purple_conversation_get_name(conv); | |
921 PurpleConnection *gc = purple_conversation_get_gc(conv); | |
922 | |
923 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->attention), FALSE, | |
924 toolbar); | |
925 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL)); | |
926 purple_prpl_send_attention(gc, who, 0); | |
914 } | 927 } |
915 | 928 |
916 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) | 929 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
917 { | 930 { |
918 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_IMHTML_BOLD); | 931 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_IMHTML_BOLD); |
1230 {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, | 1243 {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, |
1231 {"", NULL, NULL, NULL}, | 1244 {"", NULL, NULL, NULL}, |
1232 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, | 1245 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, |
1233 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, | 1246 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, |
1234 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, | 1247 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, |
1248 {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, | |
1249 _("Send Attention")}, | |
1235 {NULL, NULL, NULL, NULL} | 1250 {NULL, NULL, NULL, NULL} |
1236 }; | 1251 }; |
1237 int iter; | 1252 int iter; |
1238 | 1253 |
1239 hbox = gtk_hbox_new(FALSE, 0); | 1254 hbox = gtk_hbox_new(FALSE, 0); |
1295 GtkWidget *image; | 1310 GtkWidget *image; |
1296 GtkWidget *label; | 1311 GtkWidget *label; |
1297 GtkWidget *insert_button; | 1312 GtkWidget *insert_button; |
1298 GtkWidget *font_button; | 1313 GtkWidget *font_button; |
1299 GtkWidget *smiley_button; | 1314 GtkWidget *smiley_button; |
1315 GtkWidget *attention_button; | |
1300 GtkWidget *font_menu; | 1316 GtkWidget *font_menu; |
1301 GtkWidget *insert_menu; | 1317 GtkWidget *insert_menu; |
1302 GtkWidget *menuitem; | 1318 GtkWidget *menuitem; |
1303 GtkWidget *sep; | 1319 GtkWidget *sep; |
1304 int i; | 1320 int i; |
1436 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | 1452 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
1437 gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); | 1453 gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); |
1438 g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), toolbar->smiley); | 1454 g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), toolbar->smiley); |
1439 gtk_widget_show_all(smiley_button); | 1455 gtk_widget_show_all(smiley_button); |
1440 | 1456 |
1457 /* Sep */ | |
1458 sep = gtk_vseparator_new(); | |
1459 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); | |
1460 gtk_widget_show_all(sep); | |
1461 | |
1462 /* Attention */ | |
1463 attention_button = gtk_button_new(); | |
1464 gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); | |
1465 bbox = gtk_hbox_new(FALSE, 3); | |
1466 gtk_container_add(GTK_CONTAINER(attention_button), bbox); | |
1467 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, | |
1468 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); | |
1469 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | |
1470 label = gtk_label_new_with_mnemonic(_("_Attention!")); | |
1471 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
1472 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); | |
1473 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", | |
1474 G_CALLBACK(gtk_button_clicked), toolbar->attention); | |
1475 gtk_widget_show_all(attention_button); | |
1476 | |
1477 g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", | |
1478 G_CALLBACK(button_sensitiveness_changed), attention_button); | |
1479 | |
1480 /* set attention button to be greyed out until we get a conversation */ | |
1481 gtk_widget_set_sensitive(toolbar->attention, FALSE); | |
1482 | |
1441 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); | 1483 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); |
1442 g_object_set_data(G_OBJECT(hbox), "lean-view", box); | 1484 g_object_set_data(G_OBJECT(hbox), "lean-view", box); |
1443 gtk_widget_show(box); | 1485 gtk_widget_show(box); |
1444 | 1486 |
1445 purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", | 1487 purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
1517 void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) | 1559 void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) |
1518 { | 1560 { |
1519 g_free(toolbar->sml); | 1561 g_free(toolbar->sml); |
1520 toolbar->sml = g_strdup(proto_id); | 1562 toolbar->sml = g_strdup(proto_id); |
1521 } | 1563 } |
1564 | |
1565 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, | |
1566 PurpleConversation *conv) | |
1567 { | |
1568 PurpleConnection *gc = purple_conversation_get_gc(conv); | |
1569 PurplePlugin *prpl = purple_connection_get_prpl(gc); | |
1570 | |
1571 purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n", | |
1572 conv); | |
1573 toolbar->active_conv = conv; | |
1574 | |
1575 /* gray out attention button on protocols that don't support it | |
1576 for the time being it is always disabled for chats */ | |
1577 gtk_widget_set_sensitive(toolbar->attention, | |
1578 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && | |
1579 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); | |
1580 } | |
1581 |