diff --git a/src/main.c b/src/main.c index d97088712..1b96a255f 100644 --- a/src/main.c +++ b/src/main.c @@ -23,7 +23,7 @@ #include #include "shell-a11y.h" -#include "shell-global.h" +#include "shell-global-private.h" #include "shell-perf-log.h" #include "st.h" @@ -540,7 +540,7 @@ main (int argc, char **argv) g_log_set_default_handler (default_log_handler, sender); /* Initialize the global object */ - shell_global_get (); + _shell_global_init (NULL); ecode = meta_run (); diff --git a/src/shell-global-private.h b/src/shell-global-private.h index 2dd698f94..f10dfb8f4 100644 --- a/src/shell-global-private.h +++ b/src/shell-global-private.h @@ -6,6 +6,8 @@ #include +void _shell_global_init (const char *first_property_name, + ...); void _shell_global_set_plugin (ShellGlobal *global, MetaPlugin *plugin); diff --git a/src/shell-global.c b/src/shell-global.c index 07a51a21a..7160c2d5e 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -448,6 +449,37 @@ shell_global_class_init (ShellGlobalClass *klass) G_PARAM_READABLE)); } +/**• + * _shell_global_init: (skip)• + * @first_property_name: the name of the first property + * @...: the value of the first property, followed optionally by more + * name/value pairs, followed by %NULL + *• + * Initializes the shell global singleton with the construction-time + * properties. + * + * There are currently no such properties, so @first_property_name should + * always be %NULL. + * + * This call must be called before shell_global_get() and shouldn't be called + * more than once. + */ +void +_shell_global_init (const char *first_property_name, + ...) +{ + va_list argument_list; + + g_return_if_fail (the_object == NULL); + + va_start (argument_list, first_property_name); + the_object = SHELL_GLOBAL (g_object_new_valist (SHELL_TYPE_GLOBAL, + first_property_name, + argument_list)); + va_end (argument_list); + +} + /** * shell_global_get: * @@ -458,9 +490,6 @@ shell_global_class_init (ShellGlobalClass *klass) ShellGlobal * shell_global_get (void) { - if (!the_object) - the_object = g_object_new (SHELL_TYPE_GLOBAL, 0); - return the_object; }