Mercurial > pidgin.yaz
comparison pidgin/gtkimhtmltoolbar.c @ 29701:28880022598c
Temporary workaround to not break ABI, to allow this in for 2.7.0
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Mon, 16 Nov 2009 18:54:40 +0000 |
parents | b1284d63b969 |
children | 163f6c3cbdd9 |
comparison
equal
deleted
inserted
replaced
29700:9bc902d88fa2 | 29701:28880022598c |
---|---|
922 gtk_widget_grab_focus(toolbar->imhtml); | 922 gtk_widget_grab_focus(toolbar->imhtml); |
923 } | 923 } |
924 | 924 |
925 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) | 925 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) |
926 { | 926 { |
927 PurpleConversation *conv = toolbar->active_conv; | 927 PurpleConversation *conv = |
928 g_object_get_data(G_OBJECT(toolbar), "active_conv"); | |
928 const gchar *who = purple_conversation_get_name(conv); | 929 const gchar *who = purple_conversation_get_name(conv); |
929 PurpleConnection *gc = purple_conversation_get_gc(conv); | 930 PurpleConnection *gc = purple_conversation_get_gc(conv); |
930 | 931 |
931 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->attention), FALSE, | 932 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); |
932 toolbar); | 933 /*toggle_button_set_active_block(GTK_TOGGLE_BUTTON( |
934 g_object_get_data(G_OBJECT(toolbar->imhtml), "attention")), FALSE, toolbar);*/ | |
933 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL)); | 935 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL)); |
934 purple_prpl_send_attention(gc, who, 0); | 936 purple_prpl_send_attention(gc, who, 0); |
935 } | 937 } |
936 | 938 |
937 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) | 939 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
1252 {"", NULL, NULL, NULL}, | 1254 {"", NULL, NULL, NULL}, |
1253 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, | 1255 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, |
1254 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, | 1256 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, |
1255 {"", NULL, NULL, NULL}, | 1257 {"", NULL, NULL, NULL}, |
1256 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, | 1258 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, |
1257 {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, | 1259 /*{PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, |
1258 _("Send Attention")}, | 1260 g_object_get_data(G_OBJECT(toolbar->imhtml), "attention"), _("Send Attention")},*/ |
1259 {NULL, NULL, NULL, NULL} | 1261 {NULL, NULL, NULL, NULL} |
1260 }; | 1262 }; |
1261 int iter; | 1263 int iter; |
1262 | 1264 |
1263 hbox = gtk_hbox_new(FALSE, 0); | 1265 hbox = gtk_hbox_new(FALSE, 0); |
1271 gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); | 1273 gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); |
1272 } else | 1274 } else |
1273 button = gtk_vseparator_new(); | 1275 button = gtk_vseparator_new(); |
1274 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 1276 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1275 } | 1277 } |
1278 /* create the attention button (this is a bit hacky to not break ABI) */ | |
1279 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION); | |
1280 g_signal_connect(G_OBJECT(button), "clicked", | |
1281 G_CALLBACK(send_attention_cb), toolbar); | |
1282 g_object_set_data(G_OBJECT(toolbar), "attention", button); | |
1283 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); | |
1284 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1276 | 1285 |
1277 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); | 1286 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); |
1278 g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); | 1287 g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); |
1279 } | 1288 } |
1280 | 1289 |
1478 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | 1487 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
1479 label = gtk_label_new_with_mnemonic(_("_Attention!")); | 1488 label = gtk_label_new_with_mnemonic(_("_Attention!")); |
1480 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | 1489 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
1481 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); | 1490 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); |
1482 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", | 1491 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", |
1483 G_CALLBACK(gtk_button_clicked), toolbar->attention); | 1492 G_CALLBACK(gtk_button_clicked), |
1493 g_object_get_data(G_OBJECT(toolbar), "attention")); | |
1484 gtk_widget_show_all(attention_button); | 1494 gtk_widget_show_all(attention_button); |
1485 | 1495 |
1486 g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", | 1496 g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(toolbar), "attention")), |
1497 "notify::sensitive", | |
1487 G_CALLBACK(button_sensitiveness_changed), attention_button); | 1498 G_CALLBACK(button_sensitiveness_changed), attention_button); |
1488 | 1499 |
1489 /* set attention button to be greyed out until we get a conversation */ | 1500 /* set attention button to be greyed out until we get a conversation */ |
1490 gtk_widget_set_sensitive(toolbar->attention, FALSE); | 1501 gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(toolbar), "attention"), |
1502 FALSE); | |
1491 | 1503 |
1492 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); | 1504 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); |
1493 g_object_set_data(G_OBJECT(hbox), "lean-view", box); | 1505 g_object_set_data(G_OBJECT(hbox), "lean-view", box); |
1494 gtk_widget_show(box); | 1506 gtk_widget_show(box); |
1495 | 1507 |
1574 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, | 1586 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, |
1575 PurpleConversation *conv) | 1587 PurpleConversation *conv) |
1576 { | 1588 { |
1577 PurpleConnection *gc = purple_conversation_get_gc(conv); | 1589 PurpleConnection *gc = purple_conversation_get_gc(conv); |
1578 PurplePlugin *prpl = purple_connection_get_prpl(gc); | 1590 PurplePlugin *prpl = purple_connection_get_prpl(gc); |
1579 | 1591 GtkWidget *attention = |
1580 purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n", | 1592 g_object_get_data(G_OBJECT(toolbar), "attention"); |
1581 conv); | 1593 |
1582 toolbar->active_conv = conv; | 1594 g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); |
1583 | 1595 |
1584 /* gray out attention button on protocols that don't support it | 1596 /* gray out attention button on protocols that don't support it |
1585 for the time being it is always disabled for chats */ | 1597 for the time being it is always disabled for chats */ |
1586 gtk_widget_set_sensitive(toolbar->attention, | 1598 gtk_widget_set_sensitive(attention, |
1587 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && | 1599 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
1588 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); | 1600 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); |
1589 } | 1601 } |
1590 | 1602 |