| 718 gtk_container_add(GTK_CONTAINER(win->window), vbox); |
738 gtk_container_add(GTK_CONTAINER(win->window), vbox); |
| 719 |
739 |
| 720 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { |
740 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { |
| 721 /* Setup our top button bar thingie. */ |
741 /* Setup our top button bar thingie. */ |
| 722 toolbar = gtk_toolbar_new(); |
742 toolbar = gtk_toolbar_new(); |
| |
743 #if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,12,0) |
| |
744 tooltips = gtk_tooltips_new(); |
| |
745 #endif |
| |
746 #if !GTK_CHECK_VERSION(2,14,0) |
| 723 gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); |
747 gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); |
| |
748 #endif |
| 724 gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE); |
749 gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE); |
| 725 g_signal_connect(G_OBJECT(toolbar), "button-press-event", G_CALLBACK(toolbar_context), win); |
750 g_signal_connect(G_OBJECT(toolbar), "button-press-event", G_CALLBACK(toolbar_context), win); |
| 726 |
751 |
| 727 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), |
752 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), |
| 728 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")); |
753 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")); |
| 733 |
758 |
| 734 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
759 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
| 735 |
760 |
| 736 #ifndef HAVE_REGEX_H |
761 #ifndef HAVE_REGEX_H |
| 737 /* Find button */ |
762 /* Find button */ |
| |
763 #if GTK_CHECK_VERSION(2,4,0) |
| |
764 item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); |
| |
765 #if GTK_CHECK_VERSION(2,12,0) |
| |
766 gtk_tool_item_set_tooltip_text(item, _("Find")); |
| |
767 #else |
| |
768 gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); |
| |
769 #endif |
| |
770 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); |
| |
771 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
772 #else |
| 738 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, |
773 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, |
| 739 _("Find"), NULL, G_CALLBACK(find_cb), |
774 _("Find"), NULL, G_CALLBACK(find_cb), |
| 740 win, -1); |
775 win, -1); |
| |
776 #endif |
| 741 #endif /* HAVE_REGEX_H */ |
777 #endif /* HAVE_REGEX_H */ |
| 742 |
778 |
| 743 /* Save */ |
779 /* Save */ |
| |
780 #if GTK_CHECK_VERSION(2,4,0) |
| |
781 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); |
| |
782 #if GTK_CHECK_VERSION(2,12,0) |
| |
783 gtk_tool_item_set_tooltip_text(item, _("Save")); |
| |
784 #else |
| |
785 gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL); |
| |
786 #endif |
| |
787 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win); |
| |
788 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
789 #else |
| 744 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, |
790 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, |
| 745 _("Save"), NULL, G_CALLBACK(save_cb), |
791 _("Save"), NULL, G_CALLBACK(save_cb), |
| 746 win, -1); |
792 win, -1); |
| |
793 #endif |
| 747 |
794 |
| 748 /* Clear button */ |
795 /* Clear button */ |
| |
796 #if GTK_CHECK_VERSION(2,4,0) |
| |
797 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR); |
| |
798 #if GTK_CHECK_VERSION(2,12,0) |
| |
799 gtk_tool_item_set_tooltip_text(item, _("Clear")); |
| |
800 #else |
| |
801 gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL); |
| |
802 #endif |
| |
803 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win); |
| |
804 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
805 #else |
| 749 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, |
806 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, |
| 750 _("Clear"), NULL, G_CALLBACK(clear_cb), |
807 _("Clear"), NULL, G_CALLBACK(clear_cb), |
| 751 win, -1); |
808 win, -1); |
| 752 |
809 #endif |
| |
810 |
| |
811 #if GTK_CHECK_VERSION(2,4,0) |
| |
812 item = gtk_separator_tool_item_new(); |
| |
813 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
814 #else |
| 753 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
815 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
| |
816 #endif |
| 754 |
817 |
| 755 /* Pause */ |
818 /* Pause */ |
| |
819 #if GTK_CHECK_VERSION(2,4,0) |
| |
820 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); |
| |
821 #if GTK_CHECK_VERSION(2,12,0) |
| |
822 gtk_tool_item_set_tooltip_text(item, _("Pause")); |
| |
823 #else |
| |
824 gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL); |
| |
825 #endif |
| |
826 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); |
| |
827 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
828 #else |
| 756 image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU); |
829 image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU); |
| 757 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
830 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
| 758 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
831 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
| 759 NULL, _("Pause"), _("Pause"), |
832 NULL, _("Pause"), _("Pause"), |
| 760 NULL, image, |
833 NULL, image, |
| 761 G_CALLBACK(pause_cb), win); |
834 G_CALLBACK(pause_cb), win); |
| |
835 #endif |
| 762 |
836 |
| 763 #ifdef HAVE_REGEX_H |
837 #ifdef HAVE_REGEX_H |
| 764 /* regex stuff */ |
838 /* regex stuff */ |
| |
839 #if GTK_CHECK_VERSION(2,4,0) |
| |
840 item = gtk_separator_tool_item_new(); |
| |
841 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
842 #else |
| 765 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
843 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
| |
844 #endif |
| 766 |
845 |
| 767 /* regex toggle button */ |
846 /* regex toggle button */ |
| |
847 #if GTK_CHECK_VERSION(2,4,0) |
| |
848 win->filter = GTK_WIDGET(gtk_toggle_tool_button_new_from_stock(GTK_STOCK_FIND)); |
| |
849 gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter")); |
| |
850 #if GTK_CHECK_VERSION(2,12,0) |
| |
851 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter")); |
| |
852 #else |
| |
853 gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL); |
| |
854 #endif |
| |
855 g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win); |
| |
856 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter)); |
| |
857 #else |
| 768 image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); |
858 image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); |
| 769 win->filter = |
859 win->filter = |
| 770 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
860 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
| 771 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
861 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
| 772 NULL, _("Filter"), _("Filter"), |
862 NULL, _("Filter"), _("Filter"), |
| 773 NULL, image, |
863 NULL, image, |
| 774 G_CALLBACK(regex_filter_toggled_cb), |
864 G_CALLBACK(regex_filter_toggled_cb), |
| 775 win); |
865 win); |
| |
866 #endif |
| |
867 |
| 776 /* we purposely disable the toggle button here in case |
868 /* we purposely disable the toggle button here in case |
| 777 * /purple/gtk/debug/expression has an empty string. If it does not have |
869 * /purple/gtk/debug/expression has an empty string. If it does not have |
| 778 * an empty string, the change signal will get called and make the |
870 * an empty string, the change signal will get called and make the |
| 779 * toggle button sensitive. |
871 * toggle button sensitive. |
| 780 */ |
872 */ |
| 784 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter", |
876 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter", |
| 785 regex_pref_filter_cb, win); |
877 regex_pref_filter_cb, win); |
| 786 |
878 |
| 787 /* regex entry */ |
879 /* regex entry */ |
| 788 win->expression = gtk_entry_new(); |
880 win->expression = gtk_entry_new(); |
| |
881 #if GTK_CHECK_VERSION(2,4,0) |
| |
882 item = gtk_tool_item_new(); |
| |
883 #if GTK_CHECK_VERSION(2,12,0) |
| |
884 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options.")); |
| |
885 #else |
| |
886 gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL); |
| |
887 #endif |
| |
888 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); |
| |
889 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
890 #else |
| 789 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
891 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
| 790 GTK_TOOLBAR_CHILD_WIDGET, win->expression, |
892 GTK_TOOLBAR_CHILD_WIDGET, win->expression, |
| 791 NULL, _("Right click for more options."), |
893 NULL, _("Right click for more options."), |
| 792 NULL, NULL, NULL, NULL); |
894 NULL, NULL, NULL, NULL); |
| |
895 #endif |
| 793 /* this needs to be before the text is set from the pref if we want it |
896 /* this needs to be before the text is set from the pref if we want it |
| 794 * to colorize a stored expression. |
897 * to colorize a stored expression. |
| 795 */ |
898 */ |
| 796 g_signal_connect(G_OBJECT(win->expression), "changed", |
899 g_signal_connect(G_OBJECT(win->expression), "changed", |
| 797 G_CALLBACK(regex_changed_cb), win); |
900 G_CALLBACK(regex_changed_cb), win); |
| 813 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", |
916 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", |
| 814 regex_pref_highlight_cb, win); |
917 regex_pref_highlight_cb, win); |
| 815 |
918 |
| 816 #endif /* HAVE_REGEX_H */ |
919 #endif /* HAVE_REGEX_H */ |
| 817 |
920 |
| |
921 #if GTK_CHECK_VERSION(2,4,0) |
| |
922 item = gtk_separator_tool_item_new(); |
| |
923 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
924 #else |
| 818 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
925 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
| 819 |
926 #endif |
| |
927 |
| |
928 #if GTK_CHECK_VERSION(2,4,0) |
| |
929 item = gtk_tool_item_new(); |
| |
930 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); |
| |
931 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
932 #else |
| 820 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
933 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
| 821 GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")), |
934 GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")), |
| 822 NULL, _("Select the debug filter level."), |
935 NULL, _("Select the debug filter level."), |
| 823 NULL, NULL, NULL, NULL); |
936 NULL, NULL, NULL, NULL); |
| 824 |
937 #endif |
| 825 win->filterlevel = gtk_combo_box_new_text(); |
938 win->filterlevel = gtk_combo_box_new_text(); |
| |
939 #if GTK_CHECK_VERSION(2,4,0) |
| |
940 item = gtk_tool_item_new(); |
| |
941 #if GTK_CHECK_VERSION(2,12,0) |
| |
942 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); |
| |
943 #else |
| |
944 gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL); |
| |
945 #endif |
| |
946 gtk_container_add(GTK_CONTAINER(item), win->filterlevel); |
| |
947 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| |
948 #else |
| 826 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
949 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
| 827 GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel, |
950 GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel, |
| 828 NULL, _("Select the debug filter level."), |
951 NULL, _("Select the debug filter level."), |
| 829 NULL, NULL, NULL, NULL); |
952 NULL, NULL, NULL, NULL); |
| |
953 #endif |
| 830 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); |
954 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); |
| 831 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); |
955 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); |
| 832 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); |
956 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); |
| 833 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); |
957 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); |
| 834 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); |
958 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); |