lib/settings: make the WpSettings object a non-singleton
This doesn't need to be a singleton, since we have the core registration API available publicly nowadays. Makes things more clean for the API, following the pattern of WpPlugin and WpSiFactory and simplifies the built-in settings component in the internal component loader :)
This commit is contained in:
@@ -1810,8 +1810,7 @@ settings_get (lua_State *L)
|
||||
{
|
||||
const char *setting = luaL_checkstring (L, 1);
|
||||
|
||||
g_autoptr (WpSettings) s = wp_settings_get_instance (get_wp_core (L),
|
||||
"sm-settings");
|
||||
g_autoptr (WpSettings) s = wp_settings_find (get_wp_core (L), NULL);
|
||||
|
||||
if (s) {
|
||||
WpSpaJson *j = wp_settings_get (s, setting);
|
||||
@@ -1828,8 +1827,7 @@ static int
|
||||
settings_subscribe (lua_State *L)
|
||||
{
|
||||
const gchar *pattern = luaL_checkstring (L, 1);
|
||||
g_autoptr (WpSettings) s = wp_settings_get_instance (get_wp_core (L),
|
||||
"sm-settings");
|
||||
g_autoptr (WpSettings) s = wp_settings_find (get_wp_core (L), NULL);
|
||||
|
||||
guintptr sub_id = 0;
|
||||
|
||||
@@ -1847,8 +1845,7 @@ settings_unsubscribe (lua_State *L)
|
||||
{
|
||||
guintptr sub_id = luaL_checkinteger (L, 1);
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr (WpSettings) s = wp_settings_get_instance (get_wp_core (L),
|
||||
"sm-settings");
|
||||
g_autoptr (WpSettings) s = wp_settings_find (get_wp_core (L), NULL);
|
||||
|
||||
if (s)
|
||||
ret = wp_settings_unsubscribe (s, sub_id);
|
||||
|
Reference in New Issue
Block a user