Remove entire PurpleDebugUiInterface and implementations
The `purple_debug*` functions are routed through GLib's logging interface, and the UIs capture logs from there, so there's no need for this interface any more.
Testing Done:
Opened Debug Window and saw logs appearing there.
Reviewed at https://reviews.imfreedom.org/r/1074/
--- a/ChangeLog.API Tue Oct 19 00:40:28 2021 -0500
+++ b/ChangeLog.API Tue Oct 19 00:41:44 2021 -0500
@@ -389,6 +389,7 @@
* Removed the general Purple DBus interface
* purple_date_format_long, use g_date_time_format instead.
* purple_date_format_short, use g_date_time_format instead.
* purple_dnsquery_a_account
* purple_event_loop_{get|set}_ui_ops. Manually drive the GLib
event loop yourself. See GLib Main Event Loop docs.
--- a/finch/gntdebug.c Tue Oct 19 00:40:28 2021 -0500
+++ b/finch/gntdebug.c Tue Oct 19 00:41:44 2021 -0500
@@ -44,12 +44,6 @@
/* Other members, including private data. */
-static void finch_debug_ui_interface_init(PurpleDebugUiInterface *iface);
-G_DEFINE_TYPE_WITH_CODE(FinchDebugUi, finch_debug_ui, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(PURPLE_TYPE_DEBUG_UI,
- finch_debug_ui_interface_init));
handle_fprintf_stderr_cb(GIOChannel *source, GIOCondition cond, gpointer null)
@@ -103,72 +97,6 @@
-match_string(const char *category, const char *args)
- const char *str = gnt_entry_get_text(GNT_ENTRY(debug.search));
- if (g_strrstr(category, str) != NULL)
- if (g_strrstr(args, str) != NULL)
-finch_debug_print(PurpleDebugUi *self,
- PurpleDebugLevel level, const char *category,
- if (debug.window && !debug.paused && match_string(category, args))
- int pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview));
- GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL;
- time_t mtime = time(NULL);
- mdate = purple_utf8_strftime("%H:%M:%S ", localtime(&mtime));
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
- category, GNT_TEXT_FLAG_BOLD);
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
- ": ", GNT_TEXT_FLAG_BOLD);
- case PURPLE_DEBUG_WARNING:
- flag |= GNT_TEXT_FLAG_UNDERLINE;
- case PURPLE_DEBUG_ERROR:
- case PURPLE_DEBUG_FATAL:
- flag |= GNT_TEXT_FLAG_BOLD;
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag);
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), "\n", GNT_TEXT_FLAG_NORMAL);
- gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0);
-finch_debug_is_enabled(PurpleDebugUi *self, PurpleDebugLevel level, const char *category)
- return debug.window && !debug.paused;
-finch_debug_ui_interface_init(PurpleDebugUiInterface *iface)
- iface->print = finch_debug_print;
- iface->is_enabled = finch_debug_is_enabled;
reset_debug_win(GntWidget *w, gpointer null)
@@ -396,22 +324,6 @@
-finch_debug_ui_class_init(FinchDebugUiClass *klass)
-finch_debug_ui_init(FinchDebugUi *self)
-finch_debug_ui_new(void)
- return g_object_new(FINCH_TYPE_DEBUG_UI, NULL);
finch_debug_init_handler(void)
--- a/finch/gntdebug.h Tue Oct 19 00:40:28 2021 -0500
+++ b/finch/gntdebug.h Tue Oct 19 00:41:44 2021 -0500
@@ -42,16 +42,6 @@
**********************************************************************/
-#define FINCH_TYPE_DEBUG_UI (finch_debug_ui_get_type())
-G_DECLARE_FINAL_TYPE(FinchDebugUi, finch_debug_ui, FINCH, DEBUG_UI, GObject)
- * Perform necessary initializations.
-FinchDebugUi *finch_debug_ui_new(void);
* finch_debug_init_handler:
--- a/finch/libfinch.c Tue Oct 19 00:40:28 2021 -0500
+++ b/finch/libfinch.c Tue Oct 19 00:41:44 2021 -0500
@@ -39,13 +39,6 @@
#include "package_revision.h"
- FinchDebugUi *ui = finch_debug_ui_new();
- purple_debug_set_ui(PURPLE_DEBUG_UI(ui));
finch_ui_get_info(void) {
return purple_ui_info_new(_("Finch"), VERSION, "https://pidgin.im",
@@ -61,7 +54,6 @@
static PurpleCoreUiOps core_ops =
--- a/libpurple/core.c Tue Oct 19 00:40:28 2021 -0500
+++ b/libpurple/core.c Tue Oct 19 00:41:44 2021 -0500
@@ -134,13 +134,10 @@
- if (ops->ui_prefs_init != NULL)
+ if (ops->ui_prefs_init != NULL) {
- if (ops->debug_ui_init != NULL)
--- a/libpurple/core.h Tue Oct 19 00:40:28 2021 -0500
+++ b/libpurple/core.h Tue Oct 19 00:41:44 2021 -0500
@@ -48,11 +48,6 @@
* @ui_prefs_init: Called just after the preferences subsystem is initialized;
* the UI could use this callback to add some preferences it
* needs to be in place when other subsystems are initialized.
- * @debug_ui_init: Called just after the debug subsystem is initialized, but
- * before just about every other component's initialization. The
- * UI should use this hook to call purple_debug_set_ui() so
- * that debugging information for other components can be logged
- * during their initialization.
* @ui_init: Called after all of libpurple has been initialized. The UI
* should use this hook to set all other necessary
* <link linkend="chapter-ui-ops"><literal>UiOps structures</literal></link>.
@@ -67,7 +62,6 @@
void (*ui_prefs_init)(void);
- void (*debug_ui_init)(void);
--- a/libpurple/debug.c Tue Oct 19 00:40:28 2021 -0500
+++ b/libpurple/debug.c Tue Oct 19 00:41:44 2021 -0500
@@ -23,8 +23,6 @@
-static PurpleDebugUi *debug_ui = NULL;
* This determines whether debug info should be written to the
@@ -165,11 +163,6 @@
-purple_debug_set_ui(PurpleDebugUi *ui) {
- g_set_object(&debug_ui, ui);
purple_debug_is_verbose() {
@@ -195,11 +188,6 @@
-purple_debug_get_ui(void) {
purple_debug_init(void) {
/* Read environment variables once per init */
--- a/libpurple/debug.h Tue Oct 19 00:40:28 2021 -0500
+++ b/libpurple/debug.h Tue Oct 19 00:41:44 2021 -0500
@@ -218,32 +218,6 @@
void purple_debug_set_colored(gboolean colored);
/******************************************************************************
- * UI Registration Functions
- *****************************************************************************/
- * @ui: The UI operations structure.
- * Sets the UI operations structure to be used when outputting debug
-void purple_debug_set_ui(PurpleDebugUi *ui);
- * Get the #PurpleDebugUi instance used for outputting debug information.
- * Returns: (transfer none): The #PurpleDebugUi instance in use.
-PurpleDebugUi *purple_debug_get_ui(void);
-/******************************************************************************
*****************************************************************************/
--- a/pidgin/libpidgin.c Tue Oct 19 00:40:28 2021 -0500
+++ b/pidgin/libpidgin.c Tue Oct 19 00:41:44 2021 -0500
@@ -183,13 +183,6 @@
purple_ui_add_protocol_theme_paths(protocol);
- PidginDebugUi *ui = pidgin_debug_ui_new();
- purple_debug_set_ui(PURPLE_DEBUG_UI(ui));
pidgin_history_init(GError **error) {
PurpleHistoryManager *manager = NULL;
@@ -289,7 +282,6 @@
/* Be sure to close all windows that are not attached to anything
* (e.g., the debug window), or they may access things after they are
@@ -304,9 +296,6 @@
pidgin_accounts_uninit();
pidgin_debug_window_hide();
- ui = purple_debug_get_ui();
- purple_debug_set_ui(NULL);
@@ -322,7 +311,6 @@
static PurpleCoreUiOps core_ops =
--- a/pidgin/pidgindebug.c Tue Oct 19 00:40:28 2021 -0500
+++ b/pidgin/pidgindebug.c Tue Oct 19 00:41:44 2021 -0500
@@ -72,19 +72,6 @@
static PidginDebugWindow *debug_win = NULL;
static guint debug_enabled_timer = 0;
- /* Other members, including private data. */
- guint debug_enabled_timer;
-static void pidgin_debug_ui_interface_init(PurpleDebugUiInterface *iface);
-G_DEFINE_TYPE_WITH_CODE(PidginDebugUi, pidgin_debug_ui, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(PURPLE_TYPE_DEBUG_UI,
- pidgin_debug_ui_interface_init));
G_DEFINE_TYPE(PidginDebugWindow, pidgin_debug_window, GTK_TYPE_WINDOW);
@@ -811,11 +798,6 @@
return G_LOG_WRITER_HANDLED;
-pidgin_debug_ui_init(PidginDebugUi *self)
pidgin_debug_window_show(void)
@@ -838,121 +820,6 @@
-pidgin_debug_print(PurpleDebugUi *self,
- PurpleDebugLevel level, const char *category,
- if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"))
- scroll = view_near_bottom(debug_win);
- gtk_text_buffer_get_end_iter(debug_win->buffer, &end);
- gtk_text_buffer_move_mark(debug_win->buffer, debug_win->start_mark,
- level_tag = debug_win->tags.level[level];
- mdate = purple_utf8_strftime("(%H:%M:%S) ", localtime(&mtime));
- gtk_text_buffer_insert_with_tags(
- debug_win->paused ? debug_win->tags.paused : NULL,
- if (category && *category) {
- gtk_text_buffer_insert_with_tags(
- debug_win->tags.category,
- debug_win->paused ? debug_win->tags.paused : NULL,
- gtk_text_buffer_insert_with_tags(
- debug_win->tags.category,
- debug_win->paused ? debug_win->tags.paused : NULL,
- gtk_text_buffer_insert_with_tags(
- debug_win->paused ? debug_win->tags.paused : NULL,
- gtk_text_buffer_insert_with_tags(
- debug_win->paused ? debug_win->tags.paused : NULL,
- if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter") && debug_win->regex) {
- /* Filter out any new messages. */
- gtk_text_buffer_get_iter_at_mark(debug_win->buffer, &start,
- debug_win->start_mark);
- gtk_text_buffer_get_iter_at_mark(debug_win->buffer, &end,
- do_regex(debug_win, &start, &end);
- gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(debug_win->textview),
- debug_win->end_mark, 0, TRUE, 0, 1);
-pidgin_debug_is_enabled(PurpleDebugUi *self, PurpleDebugLevel level, const char *category)
- return (debug_win != NULL &&
- purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"));
-pidgin_debug_ui_interface_init(PurpleDebugUiInterface *iface)
- iface->print = pidgin_debug_print;
- iface->is_enabled = pidgin_debug_is_enabled;
-pidgin_debug_ui_class_init(PidginDebugUiClass *klass)
-pidgin_debug_ui_new(void)
- return g_object_new(PIDGIN_TYPE_DEBUG_UI, NULL);
pidgin_debug_init_handler(void)
--- a/pidgin/pidgindebug.h Tue Oct 19 00:40:28 2021 -0500
+++ b/pidgin/pidgindebug.h Tue Oct 19 00:41:44 2021 -0500
@@ -36,9 +36,7 @@
-#define PIDGIN_TYPE_DEBUG_UI (pidgin_debug_ui_get_type())
#define PIDGIN_TYPE_DEBUG_WINDOW (pidgin_debug_window_get_type())
-G_DECLARE_FINAL_TYPE(PidginDebugUi, pidgin_debug_ui, PIDGIN, DEBUG_UI, GObject)
G_DECLARE_FINAL_TYPE(PidginDebugWindow, pidgin_debug_window, PIDGIN, DEBUG_WINDOW, GtkWindow)
@@ -72,13 +70,6 @@
void pidgin_debug_uninit(void);
- * Initializes the GTK debug system.
-PidginDebugUi *pidgin_debug_ui_new(void);
* pidgin_debug_get_handle:
* Get the handle for the GTK debug system.