pidgin/gtkdebug.c

changeset 29746
f7a7722bee2f
parent 29745
ebf70b1934f1
child 29747
4256b05bd720
equal deleted inserted replaced
29745:ebf70b1934f1 29746:f7a7722bee2f
41 # include <regex.h> 41 # include <regex.h>
42 #endif /* HAVE_REGEX_H */ 42 #endif /* HAVE_REGEX_H */
43 43
44 #include <gdk/gdkkeysyms.h> 44 #include <gdk/gdkkeysyms.h>
45 45
46 /* TODO: I'm too lazy to change all these until we bump required GTK+ version */
47 #if GTK_CHECK_VERSION(2,4,0)
48 #undef GTK_TOGGLE_BUTTON
49 #undef gtk_toggle_button_get_active
50 #undef gtk_toggle_button_set_active
51 #undef GtkToggleButton
52
53 #define GTK_TOGGLE_BUTTON GTK_TOGGLE_TOOL_BUTTON
54 #define gtk_toggle_button_get_active gtk_toggle_tool_button_get_active
55 #define gtk_toggle_button_set_active gtk_toggle_tool_button_set_active
56 #define GtkToggleButton GtkToggleToolButton
57 #endif
58
59 typedef struct 46 typedef struct
60 { 47 {
61 GtkWidget *window; 48 GtkWidget *window;
62 GtkWidget *text; 49 GtkWidget *text;
63 50
261 } 248 }
262 249
263 static void 250 static void
264 pause_cb(GtkWidget *w, DebugWindow *win) 251 pause_cb(GtkWidget *w, DebugWindow *win)
265 { 252 {
266 win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); 253 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w));
267 254
268 #ifdef HAVE_REGEX_H 255 #ifdef HAVE_REGEX_H
269 if(!win->paused) { 256 if(!win->paused) {
270 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 257 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
271 regex_filter_all(win); 258 regex_filter_all(win);
272 else 259 else
273 regex_show_all(win); 260 regex_show_all(win);
274 } 261 }
275 #endif /* HAVE_REGEX_H */ 262 #endif /* HAVE_REGEX_H */
456 } 443 }
457 444
458 /* we check if the filter is on in case it was only of the options that 445 /* we check if the filter is on in case it was only of the options that
459 * got changed, and not the expression. 446 * got changed, and not the expression.
460 */ 447 */
461 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 448 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
462 regex_filter_all(win); 449 regex_filter_all(win);
463 } 450 }
464 451
465 static void 452 static void
466 regex_pref_filter_cb(const gchar *name, PurplePrefType type, 453 regex_pref_filter_cb(const gchar *name, PurplePrefType type,
470 gboolean active = GPOINTER_TO_INT(val), current; 457 gboolean active = GPOINTER_TO_INT(val), current;
471 458
472 if(!win || !win->window) 459 if(!win || !win->window)
473 return; 460 return;
474 461
475 current = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)); 462 current = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter));
476 if(active != current) 463 if(active != current)
477 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), active); 464 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), active);
478 } 465 }
479 466
480 static void 467 static void
481 regex_pref_expression_cb(const gchar *name, PurplePrefType type, 468 regex_pref_expression_cb(const gchar *name, PurplePrefType type,
482 gconstpointer val, gpointer data) 469 gconstpointer val, gpointer data)
494 DebugWindow *win = (DebugWindow *)data; 481 DebugWindow *win = (DebugWindow *)data;
495 gboolean active = GPOINTER_TO_INT(val); 482 gboolean active = GPOINTER_TO_INT(val);
496 483
497 win->invert = active; 484 win->invert = active;
498 485
499 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 486 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
500 regex_filter_all(win); 487 regex_filter_all(win);
501 } 488 }
502 489
503 static void 490 static void
504 regex_pref_highlight_cb(const gchar *name, PurplePrefType type, 491 regex_pref_highlight_cb(const gchar *name, PurplePrefType type,
507 DebugWindow *win = (DebugWindow *)data; 494 DebugWindow *win = (DebugWindow *)data;
508 gboolean active = GPOINTER_TO_INT(val); 495 gboolean active = GPOINTER_TO_INT(val);
509 496
510 win->highlight = active; 497 win->highlight = active;
511 498
512 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 499 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
513 regex_filter_all(win); 500 regex_filter_all(win);
514 } 501 }
515 502
516 static void 503 static void
517 regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path, 504 regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path,
533 return; 520 return;
534 521
535 gtk_tree_model_get(model, iter, 0, &text, 1, &level, -1); 522 gtk_tree_model_get(model, iter, 0, &text, 1, &level, -1);
536 523
537 if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) { 524 if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) {
538 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { 525 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
539 regex_match(win, text); 526 regex_match(win, text);
540 } else { 527 } else {
541 gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); 528 gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0);
542 } 529 }
543 } 530 }
557 return FALSE; 544 return FALSE;
558 } 545 }
559 546
560 static void 547 static void
561 regex_changed_cb(GtkWidget *w, DebugWindow *win) { 548 regex_changed_cb(GtkWidget *w, DebugWindow *win) {
562 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { 549 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
563 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), 550 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
564 FALSE); 551 FALSE);
565 } 552 }
566 553
567 if(win->timer == 0) 554 if(win->timer == 0)
568 win->timer = purple_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win); 555 win->timer = purple_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win);
572 559
573 static void 560 static void
574 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { 561 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) {
575 if(e->keyval == GDK_Return && 562 if(e->keyval == GDK_Return &&
576 GTK_WIDGET_IS_SENSITIVE(win->filter) && 563 GTK_WIDGET_IS_SENSITIVE(win->filter) &&
577 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 564 !gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
578 { 565 {
579 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), TRUE); 566 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), TRUE);
580 } 567 }
581 } 568 }
582 569
583 static void 570 static void
584 regex_menu_cb(GtkWidget *item, const gchar *pref) { 571 regex_menu_cb(GtkWidget *item, const gchar *pref) {
599 G_CALLBACK(regex_menu_cb), 586 G_CALLBACK(regex_menu_cb),
600 PIDGIN_PREFS_ROOT "/debug/highlight", win->highlight); 587 PIDGIN_PREFS_ROOT "/debug/highlight", win->highlight);
601 } 588 }
602 589
603 static void 590 static void
604 regex_filter_toggled_cb(GtkToggleButton *button, DebugWindow *win) { 591 regex_filter_toggled_cb(GtkToggleToolButton *button, DebugWindow *win) {
605 gboolean active; 592 gboolean active;
606 593
607 active = gtk_toggle_button_get_active(button); 594 active = gtk_toggle_tool_button_get_active(button);
608 595
609 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active); 596 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active);
610 597
611 if(!GTK_IS_IMHTML(win->text)) 598 if(!GTK_IS_IMHTML(win->text))
612 return; 599 return;
622 { 609 {
623 DebugWindow *win = data; 610 DebugWindow *win = data;
624 611
625 if (GPOINTER_TO_INT(value) != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel))) 612 if (GPOINTER_TO_INT(value) != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel)))
626 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), GPOINTER_TO_INT(value)); 613 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), GPOINTER_TO_INT(value));
627 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) 614 if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
628 regex_filter_all(win); 615 regex_filter_all(win);
629 else 616 else
630 regex_show_all(win); 617 regex_show_all(win);
631 } 618 }
632 #endif /* HAVE_REGEX_H */ 619 #endif /* HAVE_REGEX_H */
690 GtkWidget *vbox; 677 GtkWidget *vbox;
691 GtkWidget *toolbar; 678 GtkWidget *toolbar;
692 GtkWidget *frame; 679 GtkWidget *frame;
693 gint width, height; 680 gint width, height;
694 void *handle; 681 void *handle;
695 #if GTK_CHECK_VERSION(2,4,0)
696 GtkToolItem *item; 682 GtkToolItem *item;
697 #if !GTK_CHECK_VERSION(2,12,0) 683 #if !GTK_CHECK_VERSION(2,12,0)
698 GtkTooltips *tooltips; 684 GtkTooltips *tooltips;
699 #endif
700 #else
701 GtkWidget *image;
702 #endif 685 #endif
703 686
704 win = g_new0(DebugWindow, 1); 687 win = g_new0(DebugWindow, 1);
705 688
706 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/width"); 689 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/width");
738 gtk_container_add(GTK_CONTAINER(win->window), vbox); 721 gtk_container_add(GTK_CONTAINER(win->window), vbox);
739 722
740 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { 723 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) {
741 /* Setup our top button bar thingie. */ 724 /* Setup our top button bar thingie. */
742 toolbar = gtk_toolbar_new(); 725 toolbar = gtk_toolbar_new();
743 #if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,12,0) 726 #if !GTK_CHECK_VERSION(2,12,0)
744 tooltips = gtk_tooltips_new(); 727 tooltips = gtk_tooltips_new();
745 #endif 728 #endif
746 #if !GTK_CHECK_VERSION(2,14,0) 729 #if !GTK_CHECK_VERSION(2,14,0)
747 gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); 730 gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE);
748 #endif 731 #endif
758 741
759 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); 742 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
760 743
761 #ifndef HAVE_REGEX_H 744 #ifndef HAVE_REGEX_H
762 /* Find button */ 745 /* Find button */
763 #if GTK_CHECK_VERSION(2,4,0)
764 item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); 746 item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND);
765 #if GTK_CHECK_VERSION(2,12,0) 747 #if GTK_CHECK_VERSION(2,12,0)
766 gtk_tool_item_set_tooltip_text(item, _("Find")); 748 gtk_tool_item_set_tooltip_text(item, _("Find"));
767 #else 749 #else
768 gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); 750 gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL);
769 #endif 751 #endif
770 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); 752 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win);
771 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 753 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
772 #else
773 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND,
774 _("Find"), NULL, G_CALLBACK(find_cb),
775 win, -1);
776 #endif
777 #endif /* HAVE_REGEX_H */ 754 #endif /* HAVE_REGEX_H */
778 755
779 /* Save */ 756 /* Save */
780 #if GTK_CHECK_VERSION(2,4,0)
781 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); 757 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
782 #if GTK_CHECK_VERSION(2,12,0) 758 #if GTK_CHECK_VERSION(2,12,0)
783 gtk_tool_item_set_tooltip_text(item, _("Save")); 759 gtk_tool_item_set_tooltip_text(item, _("Save"));
784 #else 760 #else
785 gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL); 761 gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL);
786 #endif 762 #endif
787 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win); 763 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win);
788 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 764 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
789 #else
790 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE,
791 _("Save"), NULL, G_CALLBACK(save_cb),
792 win, -1);
793 #endif
794 765
795 /* Clear button */ 766 /* Clear button */
796 #if GTK_CHECK_VERSION(2,4,0)
797 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR); 767 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
798 #if GTK_CHECK_VERSION(2,12,0) 768 #if GTK_CHECK_VERSION(2,12,0)
799 gtk_tool_item_set_tooltip_text(item, _("Clear")); 769 gtk_tool_item_set_tooltip_text(item, _("Clear"));
800 #else 770 #else
801 gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL); 771 gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL);
802 #endif 772 #endif
803 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win); 773 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win);
804 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 774 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
805 #else 775
806 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR,
807 _("Clear"), NULL, G_CALLBACK(clear_cb),
808 win, -1);
809 #endif
810
811 #if GTK_CHECK_VERSION(2,4,0)
812 item = gtk_separator_tool_item_new(); 776 item = gtk_separator_tool_item_new();
813 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 777 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
814 #else
815 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
816 #endif
817 778
818 /* Pause */ 779 /* Pause */
819 #if GTK_CHECK_VERSION(2,4,0)
820 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); 780 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE);
821 #if GTK_CHECK_VERSION(2,12,0) 781 #if GTK_CHECK_VERSION(2,12,0)
822 gtk_tool_item_set_tooltip_text(item, _("Pause")); 782 gtk_tool_item_set_tooltip_text(item, _("Pause"));
823 #else 783 #else
824 gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL); 784 gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL);
825 #endif 785 #endif
826 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); 786 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win);
827 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 787 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
828 #else
829 image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU);
830 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
831 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
832 NULL, _("Pause"), _("Pause"),
833 NULL, image,
834 G_CALLBACK(pause_cb), win);
835 #endif
836 788
837 #ifdef HAVE_REGEX_H 789 #ifdef HAVE_REGEX_H
838 /* regex stuff */ 790 /* regex stuff */
839 #if GTK_CHECK_VERSION(2,4,0)
840 item = gtk_separator_tool_item_new(); 791 item = gtk_separator_tool_item_new();
841 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 792 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
842 #else
843 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
844 #endif
845 793
846 /* regex toggle button */ 794 /* 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)); 795 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")); 796 gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter"));
850 #if GTK_CHECK_VERSION(2,12,0) 797 #if GTK_CHECK_VERSION(2,12,0)
851 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter")); 798 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter"));
852 #else 799 #else
853 gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL); 800 gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL);
854 #endif 801 #endif
855 g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win); 802 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)); 803 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter));
857 #else
858 image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
859 win->filter =
860 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
861 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
862 NULL, _("Filter"), _("Filter"),
863 NULL, image,
864 G_CALLBACK(regex_filter_toggled_cb),
865 win);
866 #endif
867 804
868 /* we purposely disable the toggle button here in case 805 /* we purposely disable the toggle button here in case
869 * /purple/gtk/debug/expression has an empty string. If it does not have 806 * /purple/gtk/debug/expression has an empty string. If it does not have
870 * an empty string, the change signal will get called and make the 807 * an empty string, the change signal will get called and make the
871 * toggle button sensitive. 808 * toggle button sensitive.
872 */ 809 */
873 gtk_widget_set_sensitive(win->filter, FALSE); 810 gtk_widget_set_sensitive(win->filter, FALSE);
874 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), 811 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
875 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter")); 812 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter"));
876 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter", 813 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter",
877 regex_pref_filter_cb, win); 814 regex_pref_filter_cb, win);
878 815
879 /* regex entry */ 816 /* regex entry */
880 win->expression = gtk_entry_new(); 817 win->expression = gtk_entry_new();
881 #if GTK_CHECK_VERSION(2,4,0)
882 item = gtk_tool_item_new(); 818 item = gtk_tool_item_new();
883 #if GTK_CHECK_VERSION(2,12,0) 819 #if GTK_CHECK_VERSION(2,12,0)
884 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options.")); 820 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options."));
885 #else 821 #else
886 gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL); 822 gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL);
887 #endif 823 #endif
888 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); 824 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression));
889 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 825 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
890 #else 826
891 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
892 GTK_TOOLBAR_CHILD_WIDGET, win->expression,
893 NULL, _("Right click for more options."),
894 NULL, NULL, NULL, NULL);
895 #endif
896 /* this needs to be before the text is set from the pref if we want it 827 /* this needs to be before the text is set from the pref if we want it
897 * to colorize a stored expression. 828 * to colorize a stored expression.
898 */ 829 */
899 g_signal_connect(G_OBJECT(win->expression), "changed", 830 g_signal_connect(G_OBJECT(win->expression), "changed",
900 G_CALLBACK(regex_changed_cb), win); 831 G_CALLBACK(regex_changed_cb), win);
916 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", 847 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight",
917 regex_pref_highlight_cb, win); 848 regex_pref_highlight_cb, win);
918 849
919 #endif /* HAVE_REGEX_H */ 850 #endif /* HAVE_REGEX_H */
920 851
921 #if GTK_CHECK_VERSION(2,4,0)
922 item = gtk_separator_tool_item_new(); 852 item = gtk_separator_tool_item_new();
923 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 853 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
924 #else 854
925 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
926 #endif
927
928 #if GTK_CHECK_VERSION(2,4,0)
929 item = gtk_tool_item_new(); 855 item = gtk_tool_item_new();
930 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); 856 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level ")));
931 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 857 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
932 #else 858
933 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
934 GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")),
935 NULL, _("Select the debug filter level."),
936 NULL, NULL, NULL, NULL);
937 #endif
938 win->filterlevel = gtk_combo_box_new_text(); 859 win->filterlevel = gtk_combo_box_new_text();
939 #if GTK_CHECK_VERSION(2,4,0)
940 item = gtk_tool_item_new(); 860 item = gtk_tool_item_new();
941 #if GTK_CHECK_VERSION(2,12,0) 861 #if GTK_CHECK_VERSION(2,12,0)
942 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); 862 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level."));
943 #else 863 #else
944 gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL); 864 gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL);
945 #endif 865 #endif
946 gtk_container_add(GTK_CONTAINER(item), win->filterlevel); 866 gtk_container_add(GTK_CONTAINER(item), win->filterlevel);
947 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 867 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
948 #else 868
949 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
950 GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel,
951 NULL, _("Select the debug filter level."),
952 NULL, NULL, NULL, NULL);
953 #endif
954 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); 869 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All"));
955 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); 870 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc"));
956 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); 871 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info"));
957 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); 872 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning"));
958 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); 873 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error "));

mercurial