From f51a24d94d0140e6b68ef14563f8003fa0de3bdc Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Tue, 1 Nov 2022 00:27:44 -0500 Subject: Make PurpleUi.start return a gboolean and GError This allows the user interface to handle initialization errors in one place as purple_core_init calls purple_ui_start. Testing Done: Compiled and ran pidgin3 Reviewed at https://reviews.imfreedom.org/r/2008/ --- finch/finchui.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'finch') diff --git a/finch/finchui.c b/finch/finchui.c index f4af9330fd..4bd07b4fbf 100644 --- a/finch/finchui.c +++ b/finch/finchui.c @@ -92,10 +92,8 @@ finch_ui_prefs_init(G_GNUC_UNUSED PurpleUi *ui) { finch_prefs_init(); } -static void -finch_ui_start(G_GNUC_UNUSED PurpleUi *ui) { - GError *error = NULL; - +static gboolean +finch_ui_start(G_GNUC_UNUSED PurpleUi *ui, GError **error) { finch_debug_init(); #ifdef STANDALONE @@ -106,10 +104,16 @@ finch_ui_start(G_GNUC_UNUSED PurpleUi *ui) { gnt_init(); #endif /* STANDALONE */ - if(!finch_history_init(&error)) { - g_critical("failed to initialize the history api: %s", - error != NULL ? error->message : "unknown"); - g_clear_error(&error); + if(!finch_history_init(error)) { + const char *error_message = "unknown"; + + if(error != NULL && *error != NULL) { + error_message = (*error)->message; + } + + g_critical("failed to initialize the history api: %s", error_message); + + return FALSE; } purple_prefs_add_none("/purple/gnt"); @@ -158,6 +162,8 @@ finch_ui_start(G_GNUC_UNUSED PurpleUi *ui) { gnt_register_action(_("Preferences"), finch_prefs_show_all); gnt_register_action(_("Statuses"), finch_savedstatus_show_all); + return TRUE; + #ifdef STANDALONE } -- cgit v1.2.1