manager: Don't load theme in constructor

Loading the theme can trigger calls to
fbd_feedback_manager_get_default() which then results in an endless look
as the object isn't fully initialized in constructed. Instead do
the setup in main() which has the advantage that the manager's life
cycle becomes more obvious too.
This commit is contained in:
Guido Günther
2022-12-11 17:34:38 +01:00
parent c3beac7d41
commit f5757045aa
2 changed files with 4 additions and 4 deletions
-2
View File
@@ -439,8 +439,6 @@ fbd_feedback_manager_constructed (GObject *object)
G_OBJECT_CLASS (fbd_feedback_manager_parent_class)->constructed (object);
fbd_feedback_manager_load_theme(self);
g_signal_connect (self, "notify::profile", (GCallback)on_profile_changed, NULL);
self->settings = g_settings_new (FEEDBACKD_SCHEMA_ID);
+4 -2
View File
@@ -92,6 +92,7 @@ int main(int argc, char *argv[])
{
g_autoptr(GError) err = NULL;
g_autoptr(GOptionContext) opt_context = NULL;
g_autoptr (FbdFeedbackManager) manager = NULL;
opt_context = g_option_context_new ("- A daemon to trigger event feedback");
if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
@@ -100,6 +101,9 @@ int main(int argc, char *argv[])
return 1;
}
manager = fbd_feedback_manager_get_default ();
fbd_feedback_manager_load_theme (manager);
g_unix_signal_add (SIGTERM, quit_cb, NULL);
g_unix_signal_add (SIGINT, quit_cb, NULL);
g_unix_signal_add (SIGHUP, reload_cb, NULL);
@@ -117,6 +121,4 @@ int main(int argc, char *argv[])
g_main_loop_run (loop);
g_main_loop_unref (loop);
g_object_unref (fbd_feedback_manager_get_default ());
}