diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2021-10-19 00:41:44 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2021-10-19 00:41:44 -0500 |
commit | 805be51f98824ca6a5e31d6655007d0aa9b13407 (patch) | |
tree | 9be1e7e633106211922104e7f7b8769b41243740 /finch | |
parent | d499af1680862663a58e4257da247485e9dfec96 (diff) | |
download | pidgin-805be51f98824ca6a5e31d6655007d0aa9b13407.tar.gz |
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/
Diffstat (limited to 'finch')
-rw-r--r-- | finch/gntdebug.c | 88 | ||||
-rw-r--r-- | finch/gntdebug.h | 10 | ||||
-rw-r--r-- | finch/libfinch.c | 8 |
3 files changed, 0 insertions, 106 deletions
diff --git a/finch/gntdebug.c b/finch/gntdebug.c index d97331d4c8..dce2a6b7a1 100644 --- a/finch/gntdebug.c +++ b/finch/gntdebug.c @@ -44,12 +44,6 @@ struct _FinchDebugUi /* 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)); - static gboolean handle_fprintf_stderr_cb(GIOChannel *source, GIOCondition cond, gpointer null) { @@ -103,72 +97,6 @@ static struct gboolean paused; } debug; -static gboolean -match_string(const char *category, const char *args) -{ - const char *str = gnt_entry_get_text(GNT_ENTRY(debug.search)); - if (!str || !*str) - return TRUE; - if (g_strrstr(category, str) != NULL) - return TRUE; - if (g_strrstr(args, str) != NULL) - return TRUE; - return FALSE; -} - -static void -finch_debug_print(PurpleDebugUi *self, - PurpleDebugLevel level, const char *category, - const char *args) -{ - 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; - const char *mdate; - 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), - mdate, flag); - - 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); - - switch (level) - { - case PURPLE_DEBUG_WARNING: - flag |= GNT_TEXT_FLAG_UNDERLINE; - /* fall through */ - case PURPLE_DEBUG_ERROR: - case PURPLE_DEBUG_FATAL: - flag |= GNT_TEXT_FLAG_BOLD; - break; - default: - break; - } - - 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); - if (pos <= 1) - gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); - } -} - -static gboolean -finch_debug_is_enabled(PurpleDebugUi *self, PurpleDebugLevel level, const char *category) -{ - return debug.window && !debug.paused; -} - -static void -finch_debug_ui_interface_init(PurpleDebugUiInterface *iface) -{ - iface->print = finch_debug_print; - iface->is_enabled = finch_debug_is_enabled; -} - static void reset_debug_win(GntWidget *w, gpointer null) { @@ -396,22 +324,6 @@ start_with_debugwin(gpointer null) return FALSE; } -static void -finch_debug_ui_class_init(FinchDebugUiClass *klass) -{ -} - -static void -finch_debug_ui_init(FinchDebugUi *self) -{ -} - -FinchDebugUi * -finch_debug_ui_new(void) -{ - return g_object_new(FINCH_TYPE_DEBUG_UI, NULL); -} - void finch_debug_init_handler(void) { diff --git a/finch/gntdebug.h b/finch/gntdebug.h index 1ab90d9555..7f0e011767 100644 --- a/finch/gntdebug.h +++ b/finch/gntdebug.h @@ -42,16 +42,6 @@ G_BEGIN_DECLS * GNT Debug API **********************************************************************/ -#define FINCH_TYPE_DEBUG_UI (finch_debug_ui_get_type()) -G_DECLARE_FINAL_TYPE(FinchDebugUi, finch_debug_ui, FINCH, DEBUG_UI, GObject) - -/** - * finch_debug_ui_new: - * - * Perform necessary initializations. - */ -FinchDebugUi *finch_debug_ui_new(void); - /** * finch_debug_init_handler: * diff --git a/finch/libfinch.c b/finch/libfinch.c index 10225a854b..22c0eab87f 100644 --- a/finch/libfinch.c +++ b/finch/libfinch.c @@ -39,13 +39,6 @@ #include "config.h" #include "package_revision.h" -static void -debug_init(void) -{ - FinchDebugUi *ui = finch_debug_ui_new(); - purple_debug_set_ui(PURPLE_DEBUG_UI(ui)); -} - static PurpleUiInfo * finch_ui_get_info(void) { return purple_ui_info_new(_("Finch"), VERSION, "https://pidgin.im", @@ -61,7 +54,6 @@ finch_quit(void) static PurpleCoreUiOps core_ops = { finch_prefs_init, - debug_init, finch_ui_init, finch_quit, finch_ui_get_info, |