diff scid/scid.c @ 54:85c59fbf1407

scid: add commands to retrieve API key
author David Demelier <markand@malikania.fr>
date Wed, 17 Aug 2022 11:07:08 +0200
parents 576f4b1ec79f
children 5076be758687
line wrap: on
line diff
--- a/scid/scid.c	Wed Aug 17 09:52:00 2022 +0200
+++ b/scid/scid.c	Wed Aug 17 11:07:08 2022 +0200
@@ -28,13 +28,10 @@
 	.dbpath = VARDIR "/db/sci/sci.db"
 };
 
-static void
-init_misc(void)
+static inline void
+init_log(void)
 {
-	log_open("scid: version " VERSION);
-	log_info("scid: opening database %s", scid.dbpath);
-
-	theme_open(scid.themedir);
+	log_open("scid");
 }
 
 static void
@@ -60,16 +57,27 @@
 	}
 }
 
-void
-scid_init(void)
+static inline void
+init_theme(void)
 {
-	init_misc();
-	init_database();
+	theme_open(scid.themedir);
+}
+
+void
+scid_init(enum scid_init init)
+{
+	if (init & SCID_INIT_LOG)
+		init_log();
+	if (init & SCID_INIT_DATABASE)
+		init_database();
+	if (init & SCID_INIT_THEME)
+		init_theme();
 }
 
 void
 scid_finish(void)
 {
 	db_finish();
+	theme_finish();
 	log_finish();
 }