| 186 |
186 |
| 187 if (!console || console->gc != gc) |
187 if (!console || console->gc != gc) |
| 188 return; |
188 return; |
| 189 str = purple_xmlnode_to_pretty_str(*packet, NULL); |
189 str = purple_xmlnode_to_pretty_str(*packet, NULL); |
| 190 formatted = g_strdup_printf("<div class=incoming>%s</div>", str); |
190 formatted = g_strdup_printf("<div class=incoming>%s</div>", str); |
| 191 gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
191 pidgin_webview_append_html(PIDGIN_WEBVIEW(console->webview), formatted); |
| 192 g_free(formatted); |
192 g_free(formatted); |
| 193 g_free(str); |
193 g_free(str); |
| 194 } |
194 } |
| 195 |
195 |
| 196 static void |
196 static void |
| 207 if (!node) |
207 if (!node) |
| 208 return; |
208 return; |
| 209 |
209 |
| 210 str = purple_xmlnode_to_pretty_str(node, NULL); |
210 str = purple_xmlnode_to_pretty_str(node, NULL); |
| 211 formatted = g_strdup_printf("<div class=outgoing>%s</div>", str); |
211 formatted = g_strdup_printf("<div class=outgoing>%s</div>", str); |
| 212 gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
212 pidgin_webview_append_html(PIDGIN_WEBVIEW(console->webview), formatted); |
| 213 g_free(formatted); |
213 g_free(formatted); |
| 214 g_free(str); |
214 g_free(str); |
| 215 purple_xmlnode_free(node); |
215 purple_xmlnode_free(node); |
| 216 } |
216 } |
| 217 |
217 |
| 228 gc = console->gc; |
228 gc = console->gc; |
| 229 |
229 |
| 230 if (gc) |
230 if (gc) |
| 231 protocol = purple_connection_get_protocol(gc); |
231 protocol = purple_connection_get_protocol(gc); |
| 232 |
232 |
| 233 text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); |
233 text = pidgin_webview_get_body_text(PIDGIN_WEBVIEW(widget)); |
| 234 |
234 |
| 235 if (protocol) |
235 if (protocol) |
| 236 purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
236 purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
| 237 |
237 |
| 238 g_free(text); |
238 g_free(text); |
| 239 gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); |
239 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(console->entry), ""); |
| 240 |
240 |
| 241 return TRUE; |
241 return TRUE; |
| 242 } |
242 } |
| 243 |
243 |
| 244 static void |
244 static void |
| 276 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
276 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 277 |
277 |
| 278 gtk_widget_set_size_request(console->sw, -1, height + 6); |
278 gtk_widget_set_size_request(console->sw, -1, height + 6); |
| 279 #endif |
279 #endif |
| 280 |
280 |
| 281 str = gtk_webview_get_body_text(GTK_WEBVIEW(webview)); |
281 str = pidgin_webview_get_body_text(PIDGIN_WEBVIEW(webview)); |
| 282 if (!str) |
282 if (!str) |
| 283 return; |
283 return; |
| 284 xmlstr = g_strdup_printf("<xml>%s</xml>", str); |
284 xmlstr = g_strdup_printf("<xml>%s</xml>", str); |
| 285 node = purple_xmlnode_from_str(xmlstr, -1); |
285 node = purple_xmlnode_from_str(xmlstr, -1); |
| 286 if (node) { |
286 if (node) { |
| 287 gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); |
287 pidgin_webview_clear_formatting(PIDGIN_WEBVIEW(console->entry)); |
| 288 } else { |
288 } else { |
| 289 gtk_webview_toggle_backcolor(GTK_WEBVIEW(console->entry), "#ffcece"); |
289 pidgin_webview_toggle_backcolor(PIDGIN_WEBVIEW(console->entry), "#ffcece"); |
| 290 } |
290 } |
| 291 g_free(str); |
291 g_free(str); |
| 292 g_free(xmlstr); |
292 g_free(xmlstr); |
| 293 if (node) |
293 if (node) |
| 294 purple_xmlnode_free(node); |
294 purple_xmlnode_free(node); |
| 361 to && *to ? to : "", |
361 to && *to ? to : "", |
| 362 to && *to ? "'" : "", |
362 to && *to ? "'" : "", |
| 363 g_random_int(), |
363 g_random_int(), |
| 364 gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); |
364 gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); |
| 365 |
365 |
| 366 gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
366 pidgin_webview_load_html_string_with_selection(PIDGIN_WEBVIEW(console->entry), stanza); |
| 367 gtk_widget_grab_focus(console->entry); |
367 gtk_widget_grab_focus(console->entry); |
| 368 g_free(to); |
368 g_free(to); |
| 369 g_free(stanza); |
369 g_free(stanza); |
| 370 |
370 |
| 371 gtk_widget_destroy(dialog); |
371 gtk_widget_destroy(dialog); |
| 516 |
516 |
| 517 *priority ? "<priority>" : "", |
517 *priority ? "<priority>" : "", |
| 518 *priority ? priority : "", |
518 *priority ? priority : "", |
| 519 *priority ? "</priority>" : ""); |
519 *priority ? "</priority>" : ""); |
| 520 |
520 |
| 521 gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
521 pidgin_webview_load_html_string_with_selection(PIDGIN_WEBVIEW(console->entry), stanza); |
| 522 gtk_widget_grab_focus(console->entry); |
522 gtk_widget_grab_focus(console->entry); |
| 523 g_free(stanza); |
523 g_free(stanza); |
| 524 g_free(to); |
524 g_free(to); |
| 525 g_free(status); |
525 g_free(status); |
| 526 g_free(priority); |
526 g_free(priority); |
| 657 |
657 |
| 658 *thread ? "<thread>" : "", |
658 *thread ? "<thread>" : "", |
| 659 *thread ? thread : "", |
659 *thread ? thread : "", |
| 660 *thread ? "</thread>" : ""); |
660 *thread ? "</thread>" : ""); |
| 661 |
661 |
| 662 gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
662 pidgin_webview_load_html_string_with_selection(PIDGIN_WEBVIEW(console->entry), stanza); |
| 663 gtk_widget_grab_focus(console->entry); |
663 gtk_widget_grab_focus(console->entry); |
| 664 g_free(stanza); |
664 g_free(stanza); |
| 665 g_free(to); |
665 g_free(to); |
| 666 g_free(body); |
666 g_free(body); |
| 667 g_free(thread); |
667 g_free(thread); |
| 688 console->accounts = g_list_append(console->accounts, gc); |
688 console->accounts = g_list_append(console->accounts, gc); |
| 689 console->count++; |
689 console->count++; |
| 690 |
690 |
| 691 if (console->count == 1) { |
691 if (console->count == 1) { |
| 692 console->gc = gc; |
692 console->gc = gc; |
| 693 gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
693 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(console->webview), EMPTY_HTML); |
| 694 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
694 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 695 } else |
695 } else |
| 696 gtk_widget_show_all(console->hbox); |
696 gtk_widget_show_all(console->hbox); |
| 697 } |
697 } |
| 698 |
698 |
| 788 } |
788 } |
| 789 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
789 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 790 gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
790 gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 791 g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); |
791 g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); |
| 792 |
792 |
| 793 console->webview = gtk_webview_new(FALSE); |
793 console->webview = pidgin_webview_new(FALSE); |
| 794 gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
794 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(console->webview), EMPTY_HTML); |
| 795 if (console->count == 0) { |
795 if (console->count == 0) { |
| 796 char *tmp = g_strdup_printf("<div class=info>%s</div>", |
796 char *tmp = g_strdup_printf("<div class=info>%s</div>", |
| 797 _("Not connected to XMPP")); |
797 _("Not connected to XMPP")); |
| 798 gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); |
798 pidgin_webview_append_html(PIDGIN_WEBVIEW(console->webview), tmp); |
| 799 g_free(tmp); |
799 g_free(tmp); |
| 800 } |
800 } |
| 801 gtk_box_pack_start(GTK_BOX(vbox), |
801 gtk_box_pack_start(GTK_BOX(vbox), |
| 802 pidgin_make_scrollable(console->webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), |
802 pidgin_make_scrollable(console->webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), |
| 803 TRUE, TRUE, 0); |
803 TRUE, TRUE, 0); |
| 818 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
818 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 819 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); |
819 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); |
| 820 |
820 |
| 821 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
821 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
| 822 |
822 |
| 823 console->entry = gtk_webview_new(TRUE); |
823 console->entry = pidgin_webview_new(TRUE); |
| 824 gtk_webview_set_whole_buffer_formatting_only(GTK_WEBVIEW(console->entry), TRUE); |
824 pidgin_webview_set_whole_buffer_formatting_only(PIDGIN_WEBVIEW(console->entry), TRUE); |
| 825 g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
825 g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 826 |
826 |
| 827 console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1); |
827 console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1); |
| 828 gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
828 gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
| 829 g_signal_connect(G_OBJECT(console->entry), "changed", G_CALLBACK(entry_changed_cb), NULL); |
829 g_signal_connect(G_OBJECT(console->entry), "changed", G_CALLBACK(entry_changed_cb), NULL); |