diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-11-01 00:27:44 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-11-01 00:27:44 -0500 |
commit | f51a24d94d0140e6b68ef14563f8003fa0de3bdc (patch) | |
tree | 0db58603c6b71ff7a21ebee731f884248bc5f9b0 /finch | |
parent | 92e1ad8c52ae5c70f561b2739f44a24196de94aa (diff) | |
download | pidgin-f51a24d94d0140e6b68ef14563f8003fa0de3bdc.tar.gz |
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/
Diffstat (limited to 'finch')
-rw-r--r-- | finch/finchui.c | 22 |
1 files changed, 14 insertions, 8 deletions
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 } |