| 459 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/filterlevel", |
459 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/filterlevel", |
| 460 gtk_combo_box_get_active(GTK_COMBO_BOX(combo))); |
460 gtk_combo_box_get_active(GTK_COMBO_BOX(combo))); |
| 461 } |
461 } |
| 462 |
462 |
| 463 static void |
463 static void |
| 464 toolbar_style_pref_changed_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) |
|
| 465 { |
|
| 466 gtk_toolbar_set_style(GTK_TOOLBAR(data), GPOINTER_TO_INT(value)); |
|
| 467 } |
|
| 468 |
|
| 469 static void |
|
| 470 toolbar_icon_pref_changed(GtkWidget *item, GtkWidget *toolbar) |
|
| 471 { |
|
| 472 int style = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), "user_data")); |
|
| 473 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/style", style); |
|
| 474 } |
|
| 475 |
|
| 476 static gboolean |
|
| 477 toolbar_context(GtkWidget *toolbar, gint x, gint y, gint button, gpointer null) |
|
| 478 { |
|
| 479 GtkWidget *menu, *item; |
|
| 480 const char *text[3]; |
|
| 481 GtkToolbarStyle value[3]; |
|
| 482 int i; |
|
| 483 |
|
| 484 text[0] = _("_Icon Only"); value[0] = GTK_TOOLBAR_ICONS; |
|
| 485 text[1] = _("_Text Only"); value[1] = GTK_TOOLBAR_TEXT; |
|
| 486 text[2] = _("_Both Icon & Text"); value[2] = GTK_TOOLBAR_BOTH_HORIZ; |
|
| 487 |
|
| 488 menu = gtk_menu_new(); |
|
| 489 |
|
| 490 for (i = 0; i < 3; i++) { |
|
| 491 item = gtk_check_menu_item_new_with_mnemonic(text[i]); |
|
| 492 g_object_set_data(G_OBJECT(item), "user_data", GINT_TO_POINTER(value[i])); |
|
| 493 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toolbar_icon_pref_changed), toolbar); |
|
| 494 if (value[i] == (GtkToolbarStyle)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")) |
|
| 495 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
|
| 496 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
| 497 } |
|
| 498 |
|
| 499 gtk_widget_show_all(menu); |
|
| 500 |
|
| 501 gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); |
|
| 502 return FALSE; |
|
| 503 } |
|
| 504 |
|
| 505 static void |
|
| 506 pidgin_debug_window_class_init(PidginDebugWindowClass *klass) { |
464 pidgin_debug_window_class_init(PidginDebugWindowClass *klass) { |
| 507 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
465 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
| 508 |
466 |
| 509 gtk_widget_class_set_template_from_resource( |
467 gtk_widget_class_set_template_from_resource( |
| 510 widget_class, |
468 widget_class, |
| 549 widget_class, PidginDebugWindow, popover); |
507 widget_class, PidginDebugWindow, popover); |
| 550 gtk_widget_class_bind_template_child( |
508 gtk_widget_class_bind_template_child( |
| 551 widget_class, PidginDebugWindow, popover_invert); |
509 widget_class, PidginDebugWindow, popover_invert); |
| 552 gtk_widget_class_bind_template_child( |
510 gtk_widget_class_bind_template_child( |
| 553 widget_class, PidginDebugWindow, popover_highlight); |
511 widget_class, PidginDebugWindow, popover_highlight); |
| 554 gtk_widget_class_bind_template_callback(widget_class, toolbar_context); |
|
| 555 gtk_widget_class_bind_template_callback(widget_class, save_cb); |
512 gtk_widget_class_bind_template_callback(widget_class, save_cb); |
| 556 gtk_widget_class_bind_template_callback(widget_class, clear_cb); |
513 gtk_widget_class_bind_template_callback(widget_class, clear_cb); |
| 557 gtk_widget_class_bind_template_callback(widget_class, pause_cb); |
514 gtk_widget_class_bind_template_callback(widget_class, pause_cb); |
| 558 gtk_widget_class_bind_template_callback(widget_class, |
515 gtk_widget_class_bind_template_callback(widget_class, |
| 559 regex_filter_toggled_cb); |
516 regex_filter_toggled_cb); |
| 592 g_signal_connect(G_OBJECT(win), "configure_event", |
549 g_signal_connect(G_OBJECT(win), "configure_event", |
| 593 G_CALLBACK(configure_cb), NULL); |
550 G_CALLBACK(configure_cb), NULL); |
| 594 |
551 |
| 595 handle = pidgin_debug_get_handle(); |
552 handle = pidgin_debug_get_handle(); |
| 596 |
553 |
| |
554 /* Setup our top button bar thingie. */ |
| 597 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { |
555 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { |
| 598 /* Setup our top button bar thingie. */ |
|
| 599 gtk_toolbar_set_style(GTK_TOOLBAR(win->toolbar), |
|
| 600 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")); |
|
| 601 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/style", |
|
| 602 toolbar_style_pref_changed_cb, win->toolbar); |
|
| 603 |
|
| 604 /* we purposely disable the toggle button here in case |
556 /* we purposely disable the toggle button here in case |
| 605 * /purple/gtk/debug/expression has an empty string. If it does not have |
557 * /purple/gtk/debug/expression has an empty string. If it does not have |
| 606 * an empty string, the change signal will get called and make the |
558 * an empty string, the change signal will get called and make the |
| 607 * toggle button sensitive. |
559 * toggle button sensitive. |
| 608 */ |
560 */ |
| 891 |
843 |
| 892 /* Controls printing to the debug window */ |
844 /* Controls printing to the debug window */ |
| 893 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/enabled", FALSE); |
845 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/enabled", FALSE); |
| 894 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/filterlevel", |
846 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/filterlevel", |
| 895 PURPLE_DEBUG_ALL); |
847 PURPLE_DEBUG_ALL); |
| 896 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/style", |
|
| 897 GTK_TOOLBAR_BOTH_HORIZ); |
|
| 898 |
848 |
| 899 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/toolbar", TRUE); |
849 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/toolbar", TRUE); |
| 900 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/width", 450); |
850 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/width", 450); |
| 901 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/height", 250); |
851 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/height", 250); |
| 902 |
852 |