pidgin/gtkdebug.c

branch
cpw.qulogic.gtk3
changeset 32377
885ae4f931f1
parent 32375
9ccb07c70f2a
parent 29747
4256b05bd720
equal deleted inserted replaced
32376:dd86e84c21a5 32377:885ae4f931f1
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);
747 gtk_tool_item_set_is_important(item, TRUE);
765 #if GTK_CHECK_VERSION(2,12,0) 748 #if GTK_CHECK_VERSION(2,12,0)
766 gtk_tool_item_set_tooltip_text(item, _("Find")); 749 gtk_tool_item_set_tooltip_text(item, _("Find"));
767 #else 750 #else
768 gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); 751 gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL);
769 #endif 752 #endif
770 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); 753 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win);
771 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 754 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 */ 755 #endif /* HAVE_REGEX_H */
778 756
779 /* Save */ 757 /* Save */
780 #if GTK_CHECK_VERSION(2,4,0)
781 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); 758 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
759 gtk_tool_item_set_is_important(item, TRUE);
782 #if GTK_CHECK_VERSION(2,12,0) 760 #if GTK_CHECK_VERSION(2,12,0)
783 gtk_tool_item_set_tooltip_text(item, _("Save")); 761 gtk_tool_item_set_tooltip_text(item, _("Save"));
784 #else 762 #else
785 gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL); 763 gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL);
786 #endif 764 #endif
787 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win); 765 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win);
788 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 766 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 767
795 /* Clear button */ 768 /* Clear button */
796 #if GTK_CHECK_VERSION(2,4,0)
797 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR); 769 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
770 gtk_tool_item_set_is_important(item, TRUE);
798 #if GTK_CHECK_VERSION(2,12,0) 771 #if GTK_CHECK_VERSION(2,12,0)
799 gtk_tool_item_set_tooltip_text(item, _("Clear")); 772 gtk_tool_item_set_tooltip_text(item, _("Clear"));
800 #else 773 #else
801 gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL); 774 gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL);
802 #endif 775 #endif
803 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win); 776 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win);
804 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 777 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
805 #else 778
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(); 779 item = gtk_separator_tool_item_new();
813 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 780 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
814 #else
815 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
816 #endif
817 781
818 /* Pause */ 782 /* Pause */
819 #if GTK_CHECK_VERSION(2,4,0)
820 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); 783 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE);
784 gtk_tool_item_set_is_important(item, TRUE);
821 #if GTK_CHECK_VERSION(2,12,0) 785 #if GTK_CHECK_VERSION(2,12,0)
822 gtk_tool_item_set_tooltip_text(item, _("Pause")); 786 gtk_tool_item_set_tooltip_text(item, _("Pause"));
823 #else 787 #else
824 gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL); 788 gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL);
825 #endif 789 #endif
826 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); 790 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win);
827 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 791 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 792
837 #ifdef HAVE_REGEX_H 793 #ifdef HAVE_REGEX_H
838 /* regex stuff */ 794 /* regex stuff */
839 #if GTK_CHECK_VERSION(2,4,0)
840 item = gtk_separator_tool_item_new(); 795 item = gtk_separator_tool_item_new();
841 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 796 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
842 #else
843 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
844 #endif
845 797
846 /* regex toggle button */ 798 /* regex toggle button */
847 #if GTK_CHECK_VERSION(2,4,0)
848 item = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_FIND); 799 item = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_FIND);
800 gtk_tool_item_set_is_important(item, TRUE);
801 win->filter = GTK_WIDGET(item);
849 gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter")); 802 gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter"));
850 #if GTK_CHECK_VERSION(2,12,0) 803 #if GTK_CHECK_VERSION(2,12,0)
851 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter")); 804 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter"));
852 #else 805 #else
853 gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL); 806 gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL);
854 #endif 807 #endif
855 g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win); 808 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)); 809 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter));
857 win->filter = GTK_WIDGET(item);
858 #else
859 image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
860 win->filter =
861 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
862 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
863 NULL, _("Filter"), _("Filter"),
864 NULL, image,
865 G_CALLBACK(regex_filter_toggled_cb),
866 win);
867 #endif
868 810
869 /* we purposely disable the toggle button here in case 811 /* we purposely disable the toggle button here in case
870 * /purple/gtk/debug/expression has an empty string. If it does not have 812 * /purple/gtk/debug/expression has an empty string. If it does not have
871 * an empty string, the change signal will get called and make the 813 * an empty string, the change signal will get called and make the
872 * toggle button sensitive. 814 * toggle button sensitive.
873 */ 815 */
874 gtk_widget_set_sensitive(win->filter, FALSE); 816 gtk_widget_set_sensitive(win->filter, FALSE);
875 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), 817 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
876 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter")); 818 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter"));
877 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter", 819 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter",
878 regex_pref_filter_cb, win); 820 regex_pref_filter_cb, win);
879 821
880 /* regex entry */ 822 /* regex entry */
881 win->expression = gtk_entry_new(); 823 win->expression = gtk_entry_new();
882 #if GTK_CHECK_VERSION(2,4,0)
883 item = gtk_tool_item_new(); 824 item = gtk_tool_item_new();
884 #if GTK_CHECK_VERSION(2,12,0) 825 #if GTK_CHECK_VERSION(2,12,0)
885 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options.")); 826 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options."));
886 #else 827 #else
887 gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL); 828 gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL);
888 #endif 829 #endif
889 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); 830 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression));
890 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 831 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
891 #else 832
892 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
893 GTK_TOOLBAR_CHILD_WIDGET, win->expression,
894 NULL, _("Right click for more options."),
895 NULL, NULL, NULL, NULL);
896 #endif
897 /* this needs to be before the text is set from the pref if we want it 833 /* this needs to be before the text is set from the pref if we want it
898 * to colorize a stored expression. 834 * to colorize a stored expression.
899 */ 835 */
900 g_signal_connect(G_OBJECT(win->expression), "changed", 836 g_signal_connect(G_OBJECT(win->expression), "changed",
901 G_CALLBACK(regex_changed_cb), win); 837 G_CALLBACK(regex_changed_cb), win);
917 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", 853 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight",
918 regex_pref_highlight_cb, win); 854 regex_pref_highlight_cb, win);
919 855
920 #endif /* HAVE_REGEX_H */ 856 #endif /* HAVE_REGEX_H */
921 857
922 #if GTK_CHECK_VERSION(2,4,0)
923 item = gtk_separator_tool_item_new(); 858 item = gtk_separator_tool_item_new();
924 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 859 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
925 #else 860
926 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
927 #endif
928
929 #if GTK_CHECK_VERSION(2,4,0)
930 item = gtk_tool_item_new(); 861 item = gtk_tool_item_new();
931 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); 862 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level ")));
932 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 863 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
933 #else 864
934 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
935 GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")),
936 NULL, _("Select the debug filter level."),
937 NULL, NULL, NULL, NULL);
938 #endif
939 win->filterlevel = gtk_combo_box_new_text(); 865 win->filterlevel = gtk_combo_box_new_text();
940 #if GTK_CHECK_VERSION(2,4,0)
941 item = gtk_tool_item_new(); 866 item = gtk_tool_item_new();
942 #if GTK_CHECK_VERSION(2,12,0) 867 #if GTK_CHECK_VERSION(2,12,0)
943 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); 868 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level."));
944 #else 869 #else
945 gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL); 870 gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL);
946 #endif 871 #endif
947 gtk_container_add(GTK_CONTAINER(item), win->filterlevel); 872 gtk_container_add(GTK_CONTAINER(item), win->filterlevel);
948 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); 873 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
949 #else 874
950 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
951 GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel,
952 NULL, _("Select the debug filter level."),
953 NULL, NULL, NULL, NULL);
954 #endif
955 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); 875 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All"));
956 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); 876 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc"));
957 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); 877 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info"));
958 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); 878 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning"));
959 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); 879 gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error "));

mercurial