Mercurial > pidgin.yaz
comparison pidgin/gtkimhtmltoolbar.c @ 32791:f7072a6dc43d
Move the Attention toolbar button into the GtkIMHtmlToolbar struct.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 24 Oct 2011 06:04:43 +0000 |
parents | 3e7a7e14af62 |
children | 4a34689eeb33 |
comparison
equal
deleted
inserted
replaced
32790:3e7a7e14af62 | 32791:f7072a6dc43d |
---|---|
1237 {"", NULL, NULL, NULL}, | 1237 {"", NULL, NULL, NULL}, |
1238 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, | 1238 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, |
1239 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, | 1239 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, |
1240 {"", NULL, NULL, NULL}, | 1240 {"", NULL, NULL, NULL}, |
1241 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, | 1241 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, |
1242 {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, _("Send Attention")}, | |
1242 {NULL, NULL, NULL, NULL} | 1243 {NULL, NULL, NULL, NULL} |
1243 }; | 1244 }; |
1244 int iter; | 1245 int iter; |
1245 | 1246 |
1246 hbox = gtk_hbox_new(FALSE, 0); | 1247 hbox = gtk_hbox_new(FALSE, 0); |
1255 gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); | 1256 gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); |
1256 } else | 1257 } else |
1257 button = gtk_vseparator_new(); | 1258 button = gtk_vseparator_new(); |
1258 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 1259 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1259 } | 1260 } |
1260 /* create the attention button (this is a bit hacky to not break ABI) */ | |
1261 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION); | |
1262 g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); | |
1263 g_signal_connect(G_OBJECT(button), "clicked", | |
1264 G_CALLBACK(send_attention_cb), toolbar); | |
1265 g_object_set_data(G_OBJECT(toolbar), "attention", button); | |
1266 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); | |
1267 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1268 | 1261 |
1269 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); | 1262 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); |
1270 g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); | 1263 g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); |
1271 } | 1264 } |
1272 | 1265 |
1325 GtkWidget *attention_button; | 1318 GtkWidget *attention_button; |
1326 GtkWidget *font_menu; | 1319 GtkWidget *font_menu; |
1327 GtkWidget *insert_menu; | 1320 GtkWidget *insert_menu; |
1328 GtkWidget *menuitem; | 1321 GtkWidget *menuitem; |
1329 GtkWidget *sep; | 1322 GtkWidget *sep; |
1330 GObject *wide_attention_button; | |
1331 int i; | 1323 int i; |
1332 struct { | 1324 struct { |
1333 const char *label; | 1325 const char *label; |
1334 GtkWidget **button; | 1326 GtkWidget **button; |
1335 gboolean check; | 1327 gboolean check; |
1476 sep = gtk_vseparator_new(); | 1468 sep = gtk_vseparator_new(); |
1477 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); | 1469 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); |
1478 gtk_widget_show_all(sep); | 1470 gtk_widget_show_all(sep); |
1479 | 1471 |
1480 /* Attention */ | 1472 /* Attention */ |
1481 wide_attention_button = g_object_get_data(G_OBJECT(toolbar), "attention"); | |
1482 | |
1483 attention_button = gtk_button_new(); | 1473 attention_button = gtk_button_new(); |
1484 gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); | 1474 gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); |
1485 bbox = gtk_hbox_new(FALSE, 3); | 1475 bbox = gtk_hbox_new(FALSE, 3); |
1486 gtk_container_add(GTK_CONTAINER(attention_button), bbox); | 1476 gtk_container_add(GTK_CONTAINER(attention_button), bbox); |
1487 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, | 1477 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, |
1489 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); | 1479 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
1490 label = gtk_label_new_with_mnemonic(_("_Attention!")); | 1480 label = gtk_label_new_with_mnemonic(_("_Attention!")); |
1491 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | 1481 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
1492 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); | 1482 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); |
1493 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", | 1483 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", |
1494 G_CALLBACK(gtk_button_clicked), wide_attention_button); | 1484 G_CALLBACK(gtk_button_clicked), toolbar->attention); |
1495 gtk_widget_show_all(attention_button); | 1485 gtk_widget_show_all(attention_button); |
1496 | 1486 |
1497 g_signal_connect(wide_attention_button, "notify::sensitive", | 1487 g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", |
1498 G_CALLBACK(button_sensitiveness_changed), attention_button); | 1488 G_CALLBACK(button_sensitiveness_changed), attention_button); |
1499 g_signal_connect(wide_attention_button, "notify::visible", | 1489 g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible", |
1500 G_CALLBACK(button_visibility_changed), attention_button); | 1490 G_CALLBACK(button_visibility_changed), attention_button); |
1501 | 1491 |
1502 /* set attention button to be greyed out until we get a conversation */ | 1492 /* set attention button to be greyed out until we get a conversation */ |
1503 gtk_widget_set_sensitive(GTK_WIDGET(wide_attention_button), FALSE); | 1493 gtk_widget_set_sensitive(toolbar->attention, FALSE); |
1504 | 1494 |
1505 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); | 1495 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); |
1506 g_object_set_data(G_OBJECT(hbox), "lean-view", box); | 1496 g_object_set_data(G_OBJECT(hbox), "lean-view", box); |
1507 gtk_widget_show(box); | 1497 gtk_widget_show(box); |
1508 | 1498 |
1581 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, | 1571 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, |
1582 PurpleConversation *conv) | 1572 PurpleConversation *conv) |
1583 { | 1573 { |
1584 PurpleConnection *gc = purple_conversation_get_connection(conv); | 1574 PurpleConnection *gc = purple_conversation_get_connection(conv); |
1585 PurplePlugin *prpl = purple_connection_get_prpl(gc); | 1575 PurplePlugin *prpl = purple_connection_get_prpl(gc); |
1586 GtkWidget *attention = | |
1587 g_object_get_data(G_OBJECT(toolbar), "attention"); | |
1588 | 1576 |
1589 g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); | 1577 g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); |
1590 | 1578 |
1591 /* gray out attention button on protocols that don't support it | 1579 /* gray out attention button on protocols that don't support it |
1592 for the time being it is always disabled for chats */ | 1580 for the time being it is always disabled for chats */ |
1593 gtk_widget_set_sensitive(attention, | 1581 gtk_widget_set_sensitive(toolbar->attention, |
1594 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && | 1582 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
1595 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); | 1583 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); |
1596 } | 1584 } |
1597 | 1585 |