Mercurial > pidgin
changeset 11256:bb0d7b719af2
[gaim-migrate @ 13430]
I give you regex filtering in the debug window.
We keep a buffer of all the text, so when unpausing all the messages that were output when paused will be displayed, as well as when you change the filter.
This _should_ be alright on systems that don't have regex.h but I haven't gotten anyone to test it recently, if it's busted, just #ifdef HAVE_REGEX_H it.
committer: Tailor Script <tailor@pidgin.im>
line wrap: on
line diff
--- a/configure.ac Sat Aug 13 18:40:40 2005 +0000 +++ b/configure.ac Sat Aug 13 22:09:34 2005 +0000 @@ -43,7 +43,7 @@ dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h) +AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h regex.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST
--- a/plugins/autorecon.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/autorecon.c Sat Aug 13 22:09:34 2005 +0000 @@ -227,8 +227,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("autorecon"); - /* this was the suggested way to override a single function of the real ui ops. However, there's a mild concern of having more than one bit of code making a new ui op call-through copy. If plugins A and B @@ -280,8 +278,6 @@ g_free(new_ops); old_ops = new_ops = NULL; - gaim_debug_unregister_category("autorecon"); - return TRUE; }
--- a/plugins/ciphertest.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/ciphertest.c Sat Aug 13 22:09:34 2005 +0000 @@ -179,8 +179,6 @@ **************************************************************************/ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("cipher-test"); - cipher_test_md5(); cipher_test_sha1(); @@ -189,8 +187,6 @@ static gboolean plugin_unload(GaimPlugin *plugin) { - gaim_debug_unregister_category("cipher-test"); - return TRUE; }
--- a/plugins/docklet/docklet.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/docklet/docklet.c Sat Aug 13 22:09:34 2005 +0000 @@ -471,8 +471,6 @@ void *accounts_handle = gaim_accounts_get_handle(); void *core_handle = gaim_get_core(); - gaim_debug_register_category("tray icon"); - gaim_debug(GAIM_DEBUG_INFO, "tray icon", "plugin loaded\n"); handle = plugin; @@ -514,8 +512,6 @@ gaim_debug(GAIM_DEBUG_INFO, "tray icon", "plugin unloaded\n"); - gaim_debug_register_category("tray icon"); - return TRUE; }
--- a/plugins/filectl.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/filectl.c Sat Aug 13 22:09:34 2005 +0000 @@ -216,8 +216,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("filectl"); - init_file(); check = gaim_timeout_add(5000, (GSourceFunc)check_file, NULL); @@ -229,8 +227,6 @@ { gaim_timeout_remove(check); - gaim_debug_unregister_category("filectl"); - return TRUE; }
--- a/plugins/gaim-remote/remote.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/gaim-remote/remote.c Sat Aug 13 22:09:34 2005 +0000 @@ -770,9 +770,6 @@ GIOChannel *channel; char *buf = NULL; - gaim_debug_register_category("cui"); - gaim_debug_register_category("gaim_remote_handle_uri"); - if ((UI_fd = open_socket(&buf)) < 0) { gaim_notify_error(NULL, NULL, _("Unable to open socket"), buf); g_free(buf); @@ -806,9 +803,6 @@ gaim_debug_misc("core", "Removed core\n"); - gaim_debug_unregister_category("cui"); - gaim_debug_unregister_category("gaim_remote_handle_uri"); - return TRUE; #else return FALSE;
--- a/plugins/gestures/gestures.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/gestures/gestures.c Sat Aug 13 22:09:34 2005 +0000 @@ -185,8 +185,6 @@ GaimConversation *conv; GList *l; - gaim_debug_register_category("gestures"); - for (l = gaim_get_conversations(); l != NULL; l = l->next) { conv = (GaimConversation *)l->data; @@ -221,8 +219,6 @@ gstroke_cleanup(gtkconv->imhtml); } - gaim_debug_register_category("gestures"); - return TRUE; }
--- a/plugins/gevolution/gevolution.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/gevolution/gevolution.c Sat Aug 13 22:09:34 2005 +0000 @@ -321,8 +321,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("evolution"); - bonobo_activate(); backup_blist_ui_ops = gaim_blist_get_ui_ops(); @@ -363,8 +361,6 @@ book = NULL; } - gaim_debug_unregister_category("evolution"); - return TRUE; }
--- a/plugins/gtk-signals-test.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/gtk-signals-test.c Sat Aug 13 22:09:34 2005 +0000 @@ -70,8 +70,6 @@ void *blist_handle = gaim_gtk_blist_get_handle(); void *conv_handle = gaim_gtk_conversations_get_handle(); - gaim_debug_register_category("gtk-signal-test"); - /* Accounts subsystem signals */ gaim_signal_connect(accounts_handle, "account-modified", plugin, GAIM_CALLBACK(account_modified_cb), NULL); @@ -90,9 +88,8 @@ } static gboolean -plugin_unload(GaimPlugin *plugin) -{ - gaim_debug_unregister_category("gtk-signal-test"); +plugin_unload(GaimPlugin *plugin) { + return TRUE; } static GaimPluginInfo info =
--- a/plugins/idle.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/idle.c Sat Aug 13 22:09:34 2005 +0000 @@ -83,22 +83,6 @@ return l; } -static gboolean -plugin_load(GaimPlugin *plugin) -{ - gaim_debug_register_category("idle"); - - return TRUE; -} - -static gboolean -plugin_unload(GaimPlugin *plugin) -{ - gaim_debug_unregister_category("idle"); - - return TRUE; -} - static GaimPluginInfo info = { GAIM_PLUGIN_MAGIC, @@ -116,8 +100,8 @@ N_("Allows you to hand-configure how long you've been idle for"), "Eric Warmenhoven <eric@warmenhoven.org>", GAIM_WEBSITE, - plugin_load, - plugin_unload, + NULL, + NULL, NULL, NULL, NULL,
--- a/plugins/ipc-test-client.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/ipc-test-client.c Sat Aug 13 22:09:34 2005 +0000 @@ -32,8 +32,6 @@ gboolean ok; int result; - gaim_debug_register_category("ipc-test-client"); - server_plugin = gaim_plugins_find_with_id("core-ipc-test-server"); if (server_plugin == NULL) @@ -74,12 +72,6 @@ return TRUE; } -static gboolean -plugin_unload(GaimPlugin *plugin) -{ - gaim_debug_unregister_category("ipc-test-client"); -} - static GaimPluginInfo info = { GAIM_PLUGIN_MAGIC, @@ -103,7 +95,7 @@ GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ - plugin_unload, /**< unload */ + NULL, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */
--- a/plugins/ipc-test-server.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/ipc-test-server.c Sat Aug 13 22:09:34 2005 +0000 @@ -44,8 +44,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("ipc-test-server"); - gaim_plugin_ipc_register(plugin, "add", GAIM_CALLBACK(add_func), gaim_marshal_INT__INT_INT, gaim_value_new(GAIM_TYPE_INT), 2, @@ -61,12 +59,6 @@ return TRUE; } -static gboolean -plugin_unload(GaimPlugin *plugin) -{ - gaim_debug_unregister_category("ipc-test-server"); -} - static GaimPluginInfo info = { GAIM_PLUGIN_MAGIC, @@ -90,7 +82,7 @@ GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ - plugin_unload, /**< unload */ + NULL, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */
--- a/plugins/mailchk.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/mailchk.c Sat Aug 13 22:09:34 2005 +0000 @@ -117,8 +117,6 @@ GaimBuddyList *list = gaim_get_blist(); void *conn_handle = gaim_connections_get_handle(); - gaim_debug_register_category("mailchk"); - if (!check_timeout(NULL)) { gaim_debug_warning("mailchk", "Could not read $MAIL or /var/spool/mail/$USER"); return FALSE; @@ -145,8 +143,6 @@ gtk_widget_destroy(mail); mail = NULL; - gaim_debug_unregister_category("mailchk"); - return TRUE; }
--- a/plugins/perl/perl.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/perl/perl.c Sat Aug 13 22:09:34 2005 +0000 @@ -532,8 +532,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("perl"); - return TRUE; } @@ -542,8 +540,6 @@ { perl_end(); - gaim_debug_unregister_category("perl"); - return TRUE; }
--- a/plugins/raw.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/raw.c Sat Aug 13 22:09:34 2005 +0000 @@ -94,8 +94,6 @@ GtkWidget *entry; GtkWidget *dropdown; - gaim_debug_register_category("raw"); - /* Setup the window. */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width(GTK_CONTAINER(window), 6); @@ -136,8 +134,6 @@ window = NULL; - gaim_debug_register_category("raw"); - return TRUE; }
--- a/plugins/signals-test.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/signals-test.c Sat Aug 13 22:09:34 2005 +0000 @@ -490,8 +490,6 @@ void *ciphers_handle = gaim_ciphers_get_handle(); void *buddy_icons_handle = gaim_buddy_icons_get_handle(); - gaim_debug_register_category("signals-test"); - /* Accounts subsystem signals */ gaim_signal_connect(accounts_handle, "account-connecting", plugin, GAIM_CALLBACK(account_connecting_cb), NULL); @@ -613,12 +611,6 @@ return TRUE; } -static gboolean -plugin_unload(GaimPlugin *plugin) -{ - gaim_debug_unregister_category("signals-test"); -} - static GaimPluginInfo info = { GAIM_PLUGIN_MAGIC, @@ -641,7 +633,7 @@ GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ - plugin_unload, /**< unload */ + NULL, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */
--- a/plugins/simple.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/simple.c Sat Aug 13 22:09:34 2005 +0000 @@ -6,8 +6,6 @@ static gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("simple"); - gaim_debug(GAIM_DEBUG_INFO, "simple", "simple plugin loaded.\n"); return TRUE; @@ -18,8 +16,6 @@ { gaim_debug(GAIM_DEBUG_INFO, "simple", "simple plugin unloaded.\n"); - gaim_debug_unregister_category("simple"); - return TRUE; }
--- a/plugins/ssl/ssl-gnutls.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/ssl/ssl-gnutls.c Sat Aug 13 22:09:34 2005 +0000 @@ -187,8 +187,6 @@ plugin_load(GaimPlugin *plugin) { #ifdef HAVE_GNUTLS - gaim_debug_register_category("gnutls"); - if (!gaim_ssl_get_ops()) { gaim_ssl_set_ops(&ssl_ops); } @@ -211,8 +209,6 @@ } #endif - gaim_debug_unregister_category("gnutls"); - return TRUE; }
--- a/plugins/ssl/ssl-nss.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/ssl/ssl-nss.c Sat Aug 13 22:09:34 2005 +0000 @@ -279,8 +279,6 @@ plugin_load(GaimPlugin *plugin) { #ifdef HAVE_NSS - gaim_debug_register_category("nss"); - if (!gaim_ssl_get_ops()) { gaim_ssl_set_ops(&ssl_ops); } @@ -303,8 +301,6 @@ } #endif - gaim_debug_unregister_category("nss"); - return TRUE; }
--- a/plugins/tcl/tcl.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/tcl/tcl.c Sat Aug 13 22:09:34 2005 +0000 @@ -319,8 +319,6 @@ static gboolean tcl_load(GaimPlugin *plugin) { - gaim_debug_register_category("tcl"); - if(!tcl_loaded) return FALSE; tcl_glib_init(); @@ -339,8 +337,6 @@ g_hash_table_destroy(tcl_plugins); tcl_plugins = NULL; - gaim_debug_unregister_category("tcl"); - return TRUE; }
--- a/plugins/timestamp.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/timestamp.c Sat Aug 13 22:09:34 2005 +0000 @@ -233,8 +233,6 @@ { void *conv_handle = gaim_conversations_get_handle(); - gaim_debug_register_category("timestamp"); - init_timer_list(); gaim_signal_connect(conv_handle, "conversation-created", @@ -266,8 +264,6 @@ gtk_imhtml_show_comments(GTK_IMHTML(conv->imhtml), TRUE); } - gaim_debug_unregister_category("timestamp"); - return TRUE; }
--- a/plugins/win32/transparency/win2ktrans.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/win32/transparency/win2ktrans.c Sat Aug 13 22:09:34 2005 +0000 @@ -340,8 +340,6 @@ * EXPORTED FUNCTIONS */ gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category(WINTRANS_PLUGIN_ID); - imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA); blalpha = gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA); @@ -378,8 +376,6 @@ if(blist) set_wintrans_off(blist); - gaim_debug_unregister_category(WINTRANS_PLUGIN_ID); - return TRUE; }
--- a/plugins/win32/winprefs/winprefs.c Sat Aug 13 18:40:40 2005 +0000 +++ b/plugins/win32/winprefs/winprefs.c Sat Aug 13 22:09:34 2005 +0000 @@ -329,9 +329,6 @@ */ gboolean plugin_load(GaimPlugin *plugin) { - gaim_debug_register_category("gtkappbar"); - gaim_debug_register_category(WINPREFS_PLUGIN_ID); - /* Find out how to go blinky */ load_winver_specific_procs(); @@ -362,9 +359,6 @@ blist_set_dockable(FALSE); blist_set_ontop(FALSE); - gaim_debug_unregister_category("gtkappbar"); - gaim_debug_unregister_category(WINPREFS_PLUGIN_ID); - return TRUE; }
--- a/src/account.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/account.c Sat Aug 13 22:09:34 2005 +0000 @@ -2046,8 +2046,6 @@ { void *handle = gaim_accounts_get_handle(); - gaim_debug_register_category("account"); - gaim_signal_register(handle, "account-connecting", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, @@ -2102,6 +2100,4 @@ } gaim_signals_unregister_by_instance(gaim_accounts_get_handle()); - - gaim_debug_unregister_category("account"); }
--- a/src/blist.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/blist.c Sat Aug 13 22:09:34 2005 +0000 @@ -2564,8 +2564,6 @@ { void *handle = gaim_blist_get_handle(); - gaim_debug_register_category("blist"); - gaim_signal_register(handle, "buddy-away", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, @@ -2619,6 +2617,4 @@ } gaim_signals_unregister_by_instance(gaim_blist_get_handle()); - - gaim_debug_unregister_category("blist"); }
--- a/src/buddyicon.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/buddyicon.c Sat Aug 13 22:09:34 2005 +0000 @@ -505,8 +505,6 @@ void gaim_buddy_icons_init() { - gaim_debug_register_category("buddy icons"); - account_cache = g_hash_table_new_full( g_direct_hash, g_direct_equal, NULL, (GFreeFunc)g_hash_table_destroy); @@ -527,8 +525,6 @@ gaim_buddy_icons_uninit() { g_hash_table_destroy(account_cache); - - gaim_debug_unregister_category("buddy icons"); } void gaim_buddy_icon_get_scale_size(GaimBuddyIconSpec *spec, int *width, int *height)
--- a/src/connection.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/connection.c Sat Aug 13 22:09:34 2005 +0000 @@ -506,8 +506,6 @@ { void *handle = gaim_connections_get_handle(); - gaim_debug_register_category("connection"); - gaim_signal_register(handle, "signing-on", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, @@ -533,8 +531,6 @@ gaim_connections_uninit(void) { gaim_signals_unregister_by_instance(gaim_connections_get_handle()); - - gaim_debug_unregister_category("connection"); } void *
--- a/src/conversation.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/conversation.c Sat Aug 13 22:09:34 2005 +0000 @@ -2721,8 +2721,6 @@ { void *handle = gaim_conversations_get_handle(); - gaim_debug_register_category("conversation"); - /********************************************************************** * Register preferences **********************************************************************/ @@ -3014,6 +3012,4 @@ while (conversations) gaim_conversation_destroy((GaimConversation*)conversations->data); gaim_signals_unregister_by_instance(gaim_conversations_get_handle()); - - gaim_debug_unregister_category("conversation"); }
--- a/src/core.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/core.c Sat Aug 13 22:09:34 2005 +0000 @@ -92,8 +92,6 @@ ops->debug_ui_init(); } - gaim_debug_register_category("main"); - #ifdef HAVE_DBUS gaim_dbus_init(); #endif @@ -172,9 +170,6 @@ core->ui = NULL; } - /* I think this is where this should go */ - gaim_debug_unregister_category("main"); - g_free(core); _core = NULL;
--- a/src/debug.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/debug.c Sat Aug 13 22:09:34 2005 +0000 @@ -158,32 +158,6 @@ } void -gaim_debug_register_category(const char *category) -{ - GaimDebugUiOps *ops; - - g_return_if_fail(category != NULL); - - ops = gaim_debug_get_ui_ops(); - - if (ops != NULL && ops->register_category != NULL) - ops->register_category(category); -} - -void -gaim_debug_unregister_category(const char *category) -{ - GaimDebugUiOps *ops; - - g_return_if_fail(category != NULL); - - ops = gaim_debug_get_ui_ops(); - - if (ops != NULL && ops->unregister_category != NULL) - ops->unregister_category(category); -} - -void gaim_debug_set_enabled(gboolean enabled) { debug_enabled = enabled;
--- a/src/debug.h Sat Aug 13 18:40:40 2005 +0000 +++ b/src/debug.h Sat Aug 13 22:09:34 2005 +0000 @@ -49,8 +49,6 @@ { void (*print)(GaimDebugLevel level, const char *category, const char *format, va_list args); - void (*register_category)(const char *category); - void (*unregister_category)(const char *category); } GaimDebugUiOps; #ifdef __cplusplus @@ -151,20 +149,6 @@ void gaim_debug_fatal(const char *category, const char *format, ...); /** - * Registers a debug category so that it can be filtered on. - * - * @param category The category to register. - */ -void gaim_debug_register_category(const char *category); - -/** - * Remove a registered category. - * - * @param category The category to unregister. - */ -void gaim_debug_unregister_category(const char *category); - -/** * Enable or disable printing debug output to the console. * * @param enabled TRUE to enable debug output or FALSE to disable it.
--- a/src/gtkaccount.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkaccount.c Sat Aug 13 22:09:34 2005 +0000 @@ -2516,8 +2516,6 @@ void gaim_gtk_account_init(void) { - gaim_debug_register_category("buddyicon"); - gaim_prefs_add_none("/gaim/gtk/accounts"); gaim_prefs_add_none("/gaim/gtk/accounts/dialog"); gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 550); @@ -2533,6 +2531,4 @@ gaim_gtk_account_uninit(void) { gaim_signals_unregister_by_instance(gaim_gtk_account_get_handle()); - - gaim_debug_unregister_category("buddyicon"); }
--- a/src/gtkblist.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkblist.c Sat Aug 13 22:09:34 2005 +0000 @@ -4979,8 +4979,6 @@ { void *gtk_blist_handle = gaim_gtk_blist_get_handle(); - gaim_debug_register_category("gtkblist"); - gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gtk_blist_handle, GAIM_CALLBACK(account_signon_cb), NULL); @@ -5013,8 +5011,6 @@ void gaim_gtk_blist_uninit(void) { gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle()); - - gaim_debug_unregister_category("gtkblist"); } /*********************************************************************
--- a/src/gtkconv.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkconv.c Sat Aug 13 22:09:34 2005 +0000 @@ -6218,8 +6218,6 @@ { void *handle = gaim_gtk_conversations_get_handle(); - gaim_debug_register_category("gtkconv"); - /* Conversations */ gaim_prefs_add_none("/gaim/gtk/conversations"); gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); @@ -6320,6 +6318,4 @@ { gaim_prefs_disconnect_by_handle(gaim_gtk_conversations_get_handle()); gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); - - gaim_debug_unregister_category("gtkconv"); }
--- a/src/gtkdebug.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkdebug.c Sat Aug 13 22:09:34 2005 +0000 @@ -36,18 +36,33 @@ #include "gtkutils.h" #include "gtkstock.h" +#ifdef HAVE_REGEX_H +# include <regex.h> +#endif /* HAVE_REGEX_H */ + typedef struct { GtkWidget *window; GtkWidget *text; - GtkWidget *find; - /* The category filter tree view. */ - GtkWidget *treeview; + GtkListStore *store; gboolean timestamps; gboolean paused; +#ifdef HAVE_REGEX_H + GtkWidget *filter; + GtkWidget *expression; + + gboolean invert; + gboolean highlight; + + guint timer; + + regex_t regex; +#else + GtkWidget *find; +#endif /* HAVE_REGEX_H */ } DebugWindow; static char debug_fg_colors[][8] = { @@ -61,19 +76,29 @@ static DebugWindow *debug_win = NULL; -static GHashTable *debug_categories = NULL; -static gboolean filter_enabled = FALSE; - -struct _find { - DebugWindow *window; - GtkWidget *entry; -}; +#ifdef HAVE_REGEX_H +static void regex_filter_all(DebugWindow *win); +static void regex_show_all(DebugWindow *win); +#endif /* HAVE_REGEX_H */ static gint debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) { gaim_prefs_disconnect_by_handle(gaim_gtk_debug_get_handle()); +#ifdef HAVE_REGEX_H + if(debug_win->timer != 0) { + const gchar *text; + + g_source_remove(debug_win->timer); + + text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression)); + gaim_prefs_set_string("/gaim/gtk/debug/regex", text); + } + + regfree(&debug_win->regex); +#endif + /* If the "Save Log" dialog is open then close it */ gaim_request_close_with_handle(debug_win); @@ -96,12 +121,18 @@ return FALSE; } +#ifndef HAVE_REGEX_H +struct _find { + DebugWindow *window; + GtkWidget *entry; +}; + static void do_find_cb(GtkWidget *widget, gint response, struct _find *f) { switch (response) { case GTK_RESPONSE_OK: - gtk_imhtml_search_find(GTK_IMHTML(f->window->text), + gtk_imhtml_search_find(GTK_IMHTML(f->window->text), gtk_entry_get_text(GTK_ENTRY(f->entry))); break; @@ -171,6 +202,7 @@ gtk_widget_show_all(win->find); gtk_widget_grab_focus(f->entry); } +#endif /* HAVE_REGEX_H */ static void save_writefile_cb(void *user_data, const char *filename) @@ -203,12 +235,25 @@ clear_cb(GtkWidget *w, DebugWindow *win) { gtk_imhtml_clear(GTK_IMHTML(win->text)); + +#ifdef HAVE_REGEX_H + gtk_list_store_clear(win->store); +#endif /* HAVE_REGEX_H */ } static void pause_cb(GtkWidget *w, DebugWindow *win) { win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); + +#ifdef HAVE_REGEX_H + if(!win->paused) { + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) + regex_filter_all(win); + else + regex_show_all(win); + } +#endif /* HAVE_REGEX_H */ } static void @@ -226,26 +271,330 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), GPOINTER_TO_INT(value)); } +/****************************************************************************** + * regex stuff + *****************************************************************************/ +#ifdef HAVE_REGEX_H static void -filter_cb(GtkToggleButton *button, DebugWindow *win) +regex_clear_color(GtkWidget *w) { + gtk_widget_modify_base(w, GTK_STATE_NORMAL, NULL); +} + +static void +regex_change_color(GtkWidget *w, guint16 r, guint16 g, guint16 b) { + GdkColor color; + + color.red = r; + color.green = g; + color.blue = b; + + gtk_widget_modify_base(w, GTK_STATE_NORMAL, &color); +} + +static void +regex_highlight_clear(DebugWindow *win) { + GtkIMHtml *imhtml = GTK_IMHTML(win->text); + GtkTextIter s, e; + + gtk_text_buffer_get_start_iter(imhtml->text_buffer, &s); + gtk_text_buffer_get_end_iter(imhtml->text_buffer, &e); + gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "regex", &s, &e); +} + +static void +regex_match(DebugWindow *win, const gchar *text) { + GtkIMHtml *imhtml = GTK_IMHTML(win->text); + regmatch_t matches[4]; /* adjust if necessary */ + size_t n_matches = sizeof(matches) / sizeof(matches[0]); + gchar *plaintext; + gint inverted; + + if(!text) + return; + + inverted = (win->invert) ? REG_NOMATCH : 0; + + /* I don't like having to do this, but we need it for highlighting. Plus + * it makes the ^ and $ operators work :) + */ + plaintext = gaim_markup_strip_html(text); + + /* we do a first pass to see if it matches at all. If it does we append + * it, and work out the offsets to highlight. + */ + if(regexec(&win->regex, plaintext, n_matches, matches, 0) == inverted) { + GtkTextIter ins; + gchar *p = plaintext; + gint i, offset = 0; + + gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &ins, + gtk_text_buffer_get_insert(imhtml->text_buffer)); + i = gtk_text_iter_get_offset(&ins); + + gtk_imhtml_append_text(imhtml, text, 0); + + if(!win->highlight) { + g_free(plaintext); + return; + } + + /* we use a do-while to highlight the first match, and then continue + * if necessary... + */ + do { + gint m; + + for(m = 0; m < n_matches; m++) { + GtkTextIter ms, me; + + if(matches[m].rm_eo == -1) + break; + + i += offset; + + gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &ms, + i + matches[m].rm_so); + gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &me, + i + matches[m].rm_eo); + gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "regex", + &ms, &me); + offset = matches[m].rm_eo; + } + + p += offset; + } while(regexec(&win->regex, p, n_matches, matches, REG_NOTBOL) == inverted); + } + + g_free(plaintext); +} + +static gboolean +regex_filter_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, + gpointer data) { - if (gtk_toggle_button_get_active(button)) { - filter_enabled = TRUE; - } else { - filter_enabled = FALSE; - } + DebugWindow *win = (DebugWindow *)data; + gchar *text; + + gtk_tree_model_get(m, iter, 0, &text, -1); + + regex_match(win, text); + + g_free(text); + + return FALSE; +} + +static void +regex_filter_all(DebugWindow *win) { + gtk_imhtml_clear(GTK_IMHTML(win->text)); + + if(win->highlight) + regex_highlight_clear(win); + + gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_filter_all_cb, + win); +} + +static gboolean +regex_show_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, + gpointer data) +{ + DebugWindow *win = (DebugWindow *)data; + gchar *text; + + gtk_tree_model_get(m, iter, 0, &text, -1); + gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); + g_free(text); + + return FALSE; +} + +static void +regex_show_all(DebugWindow *win) { + gtk_imhtml_clear(GTK_IMHTML(win->text)); + + if(win->highlight) + regex_highlight_clear(win); + + gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_show_all_cb, + win); } static void -debug_liststore_append(gpointer key, gpointer value, gpointer user_data) +regex_compile(DebugWindow *win) { + const gchar *text; + + text = gtk_entry_get_text(GTK_ENTRY(win->expression)); + + if(text == NULL || *text == '\0') { + regex_clear_color(win->expression); + gtk_widget_set_sensitive(win->filter, FALSE); + return; + } + + regfree(&win->regex); + + if(regcomp(&win->regex, text, REG_EXTENDED | REG_ICASE) != 0) { + /* failed to compile */ + regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); + gtk_widget_set_sensitive(win->filter, FALSE); + } else { + /* compiled successfully */ + regex_change_color(win->expression, 0xAFFF, 0xFFFF, 0xAFFF); + gtk_widget_set_sensitive(win->filter, TRUE); + } + + /* we check if the filter is on in case it was only of the options that + * got changed, and not the expression. + */ + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) + regex_filter_all(win); +} + +static void +regex_pref_filter_cb(const gchar *name, GaimPrefType type, + gpointer val, gpointer data) +{ + DebugWindow *win = (DebugWindow *)data; + gboolean active = GPOINTER_TO_INT(val), current; + + if(!win || !win->window) + return; + + current = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)); + if(active != current) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), active); +} + +static void +regex_pref_expression_cb(const gchar *name, GaimPrefType type, + gpointer val, gpointer data) +{ + DebugWindow *win = (DebugWindow *)data; + const gchar *exp = (const gchar *)val; + + gtk_entry_set_text(GTK_ENTRY(win->expression), exp); +} + +static void +regex_pref_invert_cb(const gchar *name, GaimPrefType type, + gpointer val, gpointer data) +{ + DebugWindow *win = (DebugWindow *)data; + gboolean active = GPOINTER_TO_INT(val); + + win->invert = active; + + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) + regex_filter_all(win); +} + +static void +regex_pref_highlight_cb(const gchar *name, GaimPrefType type, + gpointer val, gpointer data) +{ + DebugWindow *win = (DebugWindow *)data; + gboolean active = GPOINTER_TO_INT(val); + + win->highlight = active; + + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) + regex_filter_all(win); +} + +static void +regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path, + GtkTreeIter *iter, DebugWindow *win) { - GtkTreeIter iter; - GtkListStore **liststore = (GtkListStore **)user_data; + gchar *text; + + if(!win || !win->window) + return; + + /* If the debug window is paused, we just return since it's in the store. + * We don't call regex_match because it doesn't make sense to check the + * string if it's paused. When we unpause we clear the imhtml and + * reiterate over the store to handle matches that were outputted when + * we were paused. + */ + if(win->paused) + return; + + gtk_tree_model_get(model, iter, 0, &text, -1); + + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { + regex_match(win, text); + } else { + gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); + } + + g_free(text); +} + +static gboolean +regex_timer_cb(DebugWindow *win) { + const gchar *text; + + text = gtk_entry_get_text(GTK_ENTRY(win->expression)); + gaim_prefs_set_string("/gaim/gtk/debug/regex", text); + + win->timer = 0; + + return FALSE; +} + +static void +regex_changed_cb(GtkWidget *w, DebugWindow *win) { + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), + FALSE); + } - gtk_list_store_append(*liststore, &iter); - gtk_list_store_set(*liststore, &iter, 0, key, -1); + if(win->timer == 0) + win->timer = gaim_timeout_add(5000, (GSourceFunc)regex_timer_cb, win); + + regex_compile(win); +} + +static void +regex_menu_cb(GtkWidget *item, const gchar *pref) { + gboolean active; + + active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)); + + gaim_prefs_set_bool(pref, active); } +static void +regex_popup_cb(GtkEntry *entry, GtkWidget *menu, DebugWindow *win) { + gaim_separator(menu); + gaim_new_check_item(menu, _("Invert"), + G_CALLBACK(regex_menu_cb), + "/gaim/gtk/debug/invert", win->invert); + gaim_new_check_item(menu, _("Highlight matches"), + G_CALLBACK(regex_menu_cb), + "/gaim/gtk/debug/highlight", win->highlight); +} + +static void +regex_filter_toggled_cb(GtkToggleButton *button, DebugWindow *win) { + gboolean active; + + active = gtk_toggle_button_get_active(button); + + gaim_prefs_set_bool("/gaim/gtk/debug/filter", active); + + if(!GTK_IS_IMHTML(win->text)) + return; + + if(active) + regex_filter_all(win); + else + regex_show_all(win); +} + +#endif /* HAVE_REGEX_H */ + static DebugWindow * debug_window_new(void) { @@ -255,11 +604,8 @@ GtkWidget *frame; GtkWidget *button; GtkWidget *image; - GtkListStore *liststore = NULL; - GtkCellRenderer *renderer = NULL; - GtkTreeSelection *selection = NULL; - GtkTreeViewColumn *column = NULL; - int width, height; + gint width, height; + void *handle; win = g_new0(DebugWindow, 1); @@ -268,7 +614,7 @@ GAIM_DIALOG(win->window); gaim_debug_info("gtkdebug", "Setting dimensions to %d, %d\n", - width, height); + width, height); gtk_window_set_default_size(GTK_WINDOW(win->window), width, height); gtk_window_set_role(GTK_WINDOW(win->window), "debug"); @@ -279,6 +625,22 @@ g_signal_connect(G_OBJECT(win->window), "configure_event", G_CALLBACK(configure_cb), win); + handle = gaim_gtk_debug_get_handle(); + +#ifdef HAVE_REGEX_H + /* the list store for all the messages */ + win->store = gtk_list_store_new(1, G_TYPE_STRING); + + /* row-changed gets called when we do gtk_list_store_set, and row-inserted + * gets called with gtk_list_store_append, which is a + * completely empty row. So we just ignore row-inserted, and deal with row + * changed. -Gary + */ + g_signal_connect(G_OBJECT(win->store), "row-changed", + G_CALLBACK(regex_row_changed_cb), win); + +#endif /* HAVE_REGEX_H */ + /* Setup the vbox */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(win->window), vbox); @@ -286,6 +648,8 @@ if (gaim_prefs_get_bool("/gaim/gtk/debug/toolbar")) { /* Setup our top button bar thingie. */ toolbar = gtk_toolbar_new(); + gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), @@ -293,19 +657,21 @@ gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); +#ifndef HAVE_REGEX_H /* Find button */ gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, - NULL, NULL, G_CALLBACK(find_cb), + _("Find"), NULL, G_CALLBACK(find_cb), win, -1); +#endif /* HAVE_REGEX_H */ /* Save */ gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, - NULL, NULL, G_CALLBACK(save_cb), + _("Save"), NULL, G_CALLBACK(save_cb), win, -1); /* Clear button */ gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, - NULL, NULL, G_CALLBACK(clear_cb), + _("Clear"), NULL, G_CALLBACK(clear_cb), win, -1); gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); @@ -314,7 +680,7 @@ image = gtk_image_new_from_stock(GAIM_STOCK_PAUSE, GTK_ICON_SIZE_MENU); button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, - NULL, _("Pause"), NULL, + NULL, _("Pause"), _("Pause"), NULL, image, G_CALLBACK(pause_cb), win); @@ -322,48 +688,61 @@ button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Timestamps"), - NULL, NULL, NULL, + _("Timestamps"), NULL, NULL, G_CALLBACK(timestamps_cb), win); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), gaim_prefs_get_bool("/core/debug/timestamps")); - gaim_prefs_connect_callback(gaim_gtk_debug_get_handle(), - "/core/debug/timestamps", + gaim_prefs_connect_callback(handle, "/core/debug/timestamps", timestamps_pref_cb, button); - button = gtk_check_button_new_with_label(_("Filter")); - g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(filter_cb), win); - button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), - GTK_TOOLBAR_CHILD_WIDGET, - button, NULL, NULL, NULL, - NULL, NULL, NULL); +#ifdef HAVE_REGEX_H + /* regex stuff */ + gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); - button = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(button), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); + /* regex toggle button */ + win->filter = + gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), + GTK_TOOLBAR_CHILD_TOGGLEBUTTON, + NULL, _("Filter"), _("Filter"), + NULL, NULL, + G_CALLBACK(regex_filter_toggled_cb), + win); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), + gaim_prefs_get_bool("/gaim/gtk/debug/filter")); + gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/filter", + regex_pref_filter_cb, win); - liststore = gtk_list_store_new(1, G_TYPE_STRING); - win->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(liststore)); - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Filter"), renderer, "text", 0, NULL); - - gtk_tree_view_append_column(GTK_TREE_VIEW(win->treeview), column); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(win->treeview), FALSE); - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(liststore), 0, GTK_SORT_ASCENDING); + /* regex entry */ + win->expression = gtk_entry_new(); + gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), + GTK_TOOLBAR_CHILD_WIDGET, win->expression, + NULL, _("Right click for more options."), + NULL, NULL, NULL, NULL); + /* this needs to be before the text is set from the pref if we want it + * to colorize a stored expression. + */ + g_signal_connect(G_OBJECT(win->expression), "changed", + G_CALLBACK(regex_changed_cb), win); + gtk_entry_set_text(GTK_ENTRY(win->expression), + gaim_prefs_get_string("/gaim/gtk/debug/regex")); + g_signal_connect(G_OBJECT(win->expression), "populate-popup", + G_CALLBACK(regex_popup_cb), win); + gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/regex", + regex_pref_expression_cb, win); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(win->treeview)); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); - - g_hash_table_foreach(debug_categories, (GHFunc)debug_liststore_append, &liststore); + /* connect the rest of our pref callbacks */ + win->invert = gaim_prefs_get_bool("/gaim/gtk/debug/invert"); + gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/invert", + regex_pref_invert_cb, win); - gtk_container_add(GTK_CONTAINER(button), win->treeview); - button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), - GTK_TOOLBAR_CHILD_WIDGET, - button, NULL, NULL, - NULL, NULL, NULL, NULL); + win->highlight = gaim_prefs_get_bool("/gaim/gtk/debug/highlight"); + gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/highlight", + regex_pref_highlight_cb, win); + +#endif /* HAVE_REGEX_H */ } /* Add the gtkimhtml */ @@ -373,6 +752,14 @@ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); +#ifdef HAVE_REGEX_H + /* add the tag for regex highlighting */ + gtk_text_buffer_create_tag(GTK_IMHTML(win->text)->text_buffer, "regex", + "background", "#FFAFAF", + "weight", "bold", + NULL); +#endif /* HAVE_REGEX_H */ + gtk_widget_show_all(win->window); return win; @@ -444,8 +831,6 @@ void gaim_gtk_debug_init(void) { - gaim_debug_register_category("gtkdebug"); - /* Debug window preferences. */ /* * NOTE: This must be set before prefs are loaded, and the callbacks @@ -463,6 +848,14 @@ gaim_prefs_add_int("/gaim/gtk/debug/width", 450); gaim_prefs_add_int("/gaim/gtk/debug/height", 250); +#ifdef HAVE_REGEX_H + gaim_prefs_add_string("/gaim/gtk/debug/regex", ""); + gaim_prefs_add_bool("/gaim/gtk/debug/filter", FALSE); + gaim_prefs_add_bool("/gaim/gtk/debug/invert", FALSE); + gaim_prefs_add_bool("/gaim/gtk/debug/case_insensitive", FALSE); + gaim_prefs_add_bool("/gaim/gtk/debug/highlight", FALSE); +#endif /* HAVE_REGEX_H */ + gaim_prefs_connect_callback(NULL, "/gaim/gtk/debug/enabled", debug_enabled_cb, NULL); @@ -490,8 +883,6 @@ void gaim_gtk_debug_uninit(void) { - gaim_debug_unregister_category("gtkdebug"); - gaim_debug_set_ui_ops(NULL); } @@ -516,57 +907,17 @@ } static void -create_debug_selected_categories(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, gpointer data) -{ - GHashTable **hashtable = (GHashTable **)data; - char *text = NULL; - - gtk_tree_model_get(model, iter, 0, &text, -1); - - g_hash_table_insert(*hashtable, text, NULL); -} - -static gboolean -debug_is_filtered_out(const char *category) -{ - GtkTreeSelection *selection = NULL; - GHashTable *hashtable = NULL; - gboolean found = FALSE; - - if (category == NULL) - return FALSE; - - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(debug_win->treeview)); - hashtable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - NULL); - - gtk_tree_selection_selected_foreach(selection, - create_debug_selected_categories, - &hashtable); - - if (filter_enabled) { - if (g_hash_table_lookup_extended(hashtable, category, NULL, NULL)) - found = FALSE; - else - found = TRUE; - } - - g_hash_table_destroy(hashtable); - return found; -} - -static void gaim_gtk_debug_print(GaimDebugLevel level, const char *category, const char *format, va_list args) { + GtkTreeIter iter; gboolean timestamps; gchar *arg_s, *ts_s; gchar *esc_s, *cat_s, *tmp, *s; if (!gaim_prefs_get_bool("/gaim/gtk/debug/enabled") || - (debug_win == NULL) || debug_win->paused || - debug_is_filtered_out(category)) { + (debug_win == NULL)) + { return; } @@ -614,78 +965,21 @@ s = tmp; } - gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, 0); +#ifdef HAVE_REGEX_H + /* add the text to the list store */ + gtk_list_store_append(debug_win->store, &iter); + gtk_list_store_set(debug_win->store, &iter, 0, s, -1); +#else /* HAVE_REGEX_H */ + if(!debug_win->paused) + gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, 0); +#endif /* !HAVE_REGEX_H */ g_free(s); } -static void -gaim_gtk_debug_register_category(const char *category) -{ - /* XXX I'd like to be able to put this creation in _init, but that - * would require that this be init:ed before anything that wants to - * register a category, and I'm not sure I can count on this coming - * first */ - if (debug_categories == NULL) - debug_categories = g_hash_table_new_full(g_str_hash, - g_str_equal, - g_free, NULL); - - if (!g_hash_table_lookup_extended(debug_categories, category, NULL, NULL)) { - g_hash_table_insert(debug_categories, g_strdup(category), NULL); - - if (debug_win != NULL && debug_win->treeview != NULL) { - GtkTreeModel *model = NULL; - GtkTreeIter iter; - - model = gtk_tree_view_get_model(GTK_TREE_VIEW(debug_win->treeview)); - - gtk_list_store_append(GTK_LIST_STORE(model), &iter); - gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, - category, -1); - } - } -} - -static gboolean -find_and_remove_category(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, gpointer data) -{ - GValue value = {0}; - - gtk_tree_model_get_value(model, iter, 0, &value); - - if (strcmp(g_value_get_string(&value), data) == 0) { - gtk_list_store_remove(GTK_LIST_STORE(model), iter); - - return TRUE; - } - - return FALSE; -} - -static void -gaim_gtk_debug_unregister_category(const char *category) -{ - GtkTreeModel *model = NULL; - - if (debug_win == NULL) - return; - - model = gtk_tree_view_get_model(GTK_TREE_VIEW(debug_win->treeview)); - - gtk_tree_model_foreach(model, - (GtkTreeModelForeachFunc)find_and_remove_category, - (char *)category); - - g_hash_table_remove(debug_categories, category); -} - static GaimDebugUiOps ops = { gaim_gtk_debug_print, - gaim_gtk_debug_register_category, - gaim_gtk_debug_unregister_category }; GaimDebugUiOps *
--- a/src/gtkft.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkft.c Sat Aug 13 22:09:34 2005 +0000 @@ -1135,8 +1135,6 @@ gaim_prefs_add_none("/gaim/gtk/filetransfer"); gaim_prefs_add_bool("/gaim/gtk/filetransfer/clear_finished", TRUE); gaim_prefs_add_bool("/gaim/gtk/filetransfer/keep_open", FALSE); - - gaim_debug_register_category("ft"); } void
--- a/src/gtkmain.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkmain.c Sat Aug 13 22:09:34 2005 +0000 @@ -685,39 +685,9 @@ startup_notification_complete(); #endif - gaim_debug_register_category("sighandler"); - gaim_debug_register_category("ui_main"); - - /* XXX These don't really belong here, but I don't have a better place for - * them right now */ - gaim_debug_register_category("gtkimhtml"); - gaim_debug_register_category("gtk_imhtml_tip"); - gaim_debug_register_category("html clipboard"); - /* #if 0'ed out for Windows stuff - gaim_debug_register_category("imhtml clipboard"); - */ - gaim_debug_register_category("imgstore"); - gaim_debug_register_category("pluginpref"); - gaim_debug_register_category("request"); - gaim_debug_register_category("roomlist"); - /* gtkutils.c */ - gaim_debug_register_category("accels"); - gaim_debug_register_category("gtkspell"); - /* These are from util.c */ - gaim_debug_register_category("build_dir"); - gaim_debug_register_category("gaim_mkstemp"); - gaim_debug_register_category("gaim_str_add_cr"); - gaim_debug_register_category("gaim_url_fetch"); - gaim_debug_register_category("gaim_utf8_strcasecmp"); - gaim_debug_register_category("parse_content_len"); - gaim_debug_register_category("program_is_valid"); - gaim_debug_register_category("util"); - /* These only show up once */ - gaim_debug_register_category("gtknotify"); - gaim_debug_register_category("gtksound"); - gaim_debug_register_category("prpl"); - gaim_debug_register_category("server"); - gaim_debug_register_category("stringref"); +#ifdef HAVE_DBUS + gaim_dbus_connect(gaim_dbus_object); +#endif gtk_main();
--- a/src/gtkprefs.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtkprefs.c Sat Aug 13 22:09:34 2005 +0000 @@ -2229,8 +2229,6 @@ void gaim_gtk_prefs_init(void) { - gaim_debug_register_category("theme dnd"); - gaim_prefs_add_none("/gaim"); gaim_prefs_add_none("/gaim/gtk"); gaim_prefs_add_none("/plugins/gtk");
--- a/src/gtksound.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/gtksound.c Sat Aug 13 22:09:34 2005 +0000 @@ -156,8 +156,6 @@ { void *gtk_sound_handle = gaim_gtk_sound_get_handle(); - gaim_debug_register_category("sound"); - gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gtk_sound_handle, GAIM_CALLBACK(account_signon_cb), NULL); @@ -208,8 +206,6 @@ ao_shutdown(); #endif sound_initialized = FALSE; - - gaim_debug_unregister_category("sound"); } #if defined(USE_AO)
--- a/src/log.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/log.c Sat Aug 13 22:09:34 2005 +0000 @@ -430,8 +430,6 @@ void gaim_log_init(void) { - gaim_debug_register_category("log"); - gaim_prefs_add_none("/core/logging"); gaim_prefs_add_bool("/core/logging/log_ims", FALSE); gaim_prefs_add_bool("/core/logging/log_chats", FALSE);
--- a/src/network.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/network.c Sat Aug 13 22:09:34 2005 +0000 @@ -298,8 +298,6 @@ void gaim_network_init(void) { - gaim_debug_register_category("network"); - gaim_prefs_add_none ("/core/network"); gaim_prefs_add_bool ("/core/network/auto_ip", TRUE); gaim_prefs_add_string("/core/network/public_ip", "");
--- a/src/plugin.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/plugin.c Sat Aug 13 22:09:34 2005 +0000 @@ -815,8 +815,6 @@ gaim_plugins_init(void) { void *handle = gaim_plugins_get_handle(); - gaim_debug_register_category("plugins"); - gaim_signal_register(handle, "plugin-load", gaim_marshal_VOID__POINTER, NULL, 1, @@ -832,8 +830,6 @@ void gaim_plugins_uninit(void) { gaim_signals_disconnect_by_handle(gaim_plugins_get_handle()); - - gaim_debug_unregister_category("plugins"); } /**************************************************************************
--- a/src/pounce.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/pounce.c Sat Aug 13 22:09:34 2005 +0000 @@ -980,8 +980,6 @@ void *blist_handle = gaim_blist_get_handle(); void *conv_handle = gaim_conversations_get_handle(); - gaim_debug_register_category("pounce"); - pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_pounce_handler); @@ -1021,6 +1019,4 @@ } gaim_signals_disconnect_by_handle(gaim_pounces_get_handle()); - - gaim_debug_unregister_category("pounce"); }
--- a/src/prefs.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/prefs.c Sat Aug 13 22:09:34 2005 +0000 @@ -1075,8 +1075,6 @@ { void *handle = gaim_prefs_get_handle(); - gaim_debug_register_category("prefs"); - prefs_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); gaim_prefs_connect_callback(handle, "/", prefs_save_cb, NULL); @@ -1133,6 +1131,4 @@ } gaim_prefs_disconnect_by_handle(gaim_prefs_get_handle()); - - gaim_debug_unregister_category("prefs"); }
--- a/src/protocols/gg/gg.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/gg/gg.c Sat Aug 13 22:09:34 2005 +0000 @@ -1831,8 +1831,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("gg"); - option = gaim_account_option_string_new(_("Nick"), "nick", "Gadu-Gadu User"); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
--- a/src/protocols/irc/irc.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/irc/irc.c Sat Aug 13 22:09:34 2005 +0000 @@ -846,8 +846,6 @@ GaimAccountUserSplit *split; GaimAccountOption *option; - gaim_debug_register_category("irc"); - split = gaim_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
--- a/src/protocols/jabber/jabber.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/jabber/jabber.c Sat Aug 13 22:09:34 2005 +0000 @@ -1610,8 +1610,6 @@ GaimAccountUserSplit *split; GaimAccountOption *option; - gaim_debug_register_category("jabber"); - split = gaim_account_user_split_new(_("Server"), "jabber.org", '@'); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
--- a/src/protocols/msn/msn.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/msn/msn.c Sat Aug 13 22:09:34 2005 +0000 @@ -1804,8 +1804,6 @@ static gboolean msn_load(GaimPlugin *plugin) { - gaim_debug_register_category("msn"); - msn_notification_init(); msn_switchboard_init(); msn_sync_init(); @@ -1819,8 +1817,6 @@ msn_switchboard_end(); msn_sync_end(); - gaim_debug_unregister_category("msn"); - return TRUE; }
--- a/src/protocols/napster/napster.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/napster/napster.c Sat Aug 13 22:09:34 2005 +0000 @@ -706,8 +706,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("napster"); - option = gaim_account_option_string_new(_("Server"), "server", NAP_SERVER); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
--- a/src/protocols/novell/novell.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/novell/novell.c Sat Aug 13 22:09:34 2005 +0000 @@ -3557,8 +3557,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("novell"); - option = gaim_account_option_string_new(_("Server address"), "server", NULL); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/protocols/oscar/oscar.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/oscar/oscar.c Sat Aug 13 22:09:34 2005 +0000 @@ -7779,8 +7779,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("oscar"); - option = gaim_account_option_string_new(_("Auth host"), "server", FAIM_LOGIN_SERVER); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/protocols/silc/silc.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/silc/silc.c Sat Aug 13 22:09:34 2005 +0000 @@ -1594,8 +1594,6 @@ GaimAccountUserSplit *split; char tmp[256]; - gaim_debug_register_category("silc"); - silc_plugin = plugin; split = gaim_account_user_split_new(_("Network"), "silcnet.org", '@');
--- a/src/protocols/toc/toc.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/toc/toc.c Sat Aug 13 22:09:34 2005 +0000 @@ -2335,8 +2335,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("toc"); - option = gaim_account_option_string_new(_("TOC host"), "server", TOC_HOST); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/protocols/trepia/trepia.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/trepia/trepia.c Sat Aug 13 22:09:34 2005 +0000 @@ -1297,8 +1297,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("trepia"); - option = gaim_account_option_string_new(_("Login server"), "server", TREPIA_SERVER); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
--- a/src/protocols/yahoo/yahoo.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/yahoo/yahoo.c Sat Aug 13 22:09:34 2005 +0000 @@ -3380,9 +3380,6 @@ { yahoo_dest_colorht(); - gaim_debug_unregister_category("yahoo"); - gaim_debug_unregister_category("yahoo_filexfer"); - return TRUE; } @@ -3610,9 +3607,6 @@ { GaimAccountOption *option; - gaim_debug_register_category("yahoo"); - gaim_debug_register_category("yahoo_filexfer"); - option = gaim_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/protocols/zephyr/zephyr.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/protocols/zephyr/zephyr.c Sat Aug 13 22:09:34 2005 +0000 @@ -2866,8 +2866,6 @@ GaimAccountOption *option; char *tmp = get_exposure_level(); - gaim_debug_register_category("zepyhr"); - option = gaim_account_option_bool_new("Use tzc", "use_tzc", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/proxy.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/proxy.c Sat Aug 13 22:09:34 2005 +0000 @@ -1959,12 +1959,6 @@ { void *handle; - gaim_debug_register_category("dns"); - gaim_debug_register_category("proxy"); - gaim_debug_register_category("http proxy"); - gaim_debug_register_category("socks5 proxy"); - gaim_debug_register_category("socks4 proxy"); - /* Initialize a default proxy info struct. */ global_proxy_info = gaim_proxy_info_new();
--- a/src/session.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/session.c Sat Aug 13 22:09:34 2005 +0000 @@ -284,8 +284,6 @@ gchar *tmp = NULL; gchar **cmd = NULL; - gaim_debug_register_category("Session Management"); - if (session != NULL) { /* session is already established, what the hell is going on? */ gaim_debug(GAIM_DEBUG_WARNING, "Session Management", @@ -392,7 +390,5 @@ gaim_debug(GAIM_DEBUG_INFO, "Session Management", "Connection closed.\n"); - - gaim_debug_unregister_category("Session Management"); #endif /* USE_SM */ }
--- a/src/signals.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/signals.c Sat Aug 13 22:09:34 2005 +0000 @@ -577,8 +577,6 @@ { g_return_if_fail(instance_table == NULL); - gaim_debug_register_category("signals"); - instance_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)destroy_instance_data); @@ -591,8 +589,6 @@ g_hash_table_destroy(instance_table); instance_table = NULL; - - gaim_debug_unregister_category("signals"); } /**************************************************************************
--- a/src/status.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/status.c Sat Aug 13 22:09:34 2005 +0000 @@ -1723,8 +1723,6 @@ { void *handle = gaim_status_get_handle; - gaim_debug_register_category("status"); - gaim_prefs_add_none("/core/status"); gaim_prefs_add_none("/core/status/scores"); @@ -1774,6 +1772,4 @@ buddy_presences = NULL; } - - gaim_debug_unregister_category("status"); }
--- a/src/win32/win32dep.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/win32/win32dep.c Sat Aug 13 22:09:34 2005 +0000 @@ -376,9 +376,6 @@ char *newenv; gaim_debug_set_ui_ops(&ops); - gaim_debug_register_category("wgaim"); - gaim_debug_register_category("wgaim_gz_decompress"); - gaim_debug_register_category("wgaim_gz_untar"); gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init start\n"); gaimexe_hInstance = hint; @@ -442,10 +439,6 @@ wgaim_remove_idlehooks(); g_free(app_data_dir); - - gaim_debug_unregister_category("wgaim"); - gaim_debug_unregister_category("wgaim_gz_decompress"); - gaim_debug_unregister_category("wgaim_gz_untar"); } /* DLL initializer */
--- a/src/win32/wspell.c Sat Aug 13 18:40:40 2005 +0000 +++ b/src/win32/wspell.c Sat Aug 13 22:09:34 2005 +0000 @@ -135,8 +135,6 @@ void wgaim_gtkspell_init() { char *aspell_path = lookup_aspell_path(); - gaim_debug_register_category("wspell"); - if (aspell_path != NULL) { char *tmp = g_strconcat(aspell_path, "\\aspell-15.dll", NULL); if (g_file_test(tmp, G_FILE_TEST_EXISTS)) {