mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 11:12:11 +01:00
GSettingsBackend: add vfuncs 'apply' and 'revert'
Remove this API from GDelayedSettingsBackend.
This commit is contained in:
parent
6681e7bf9c
commit
fecac16dcf
@ -165,9 +165,11 @@ g_delayed_settings_backend_get_permission (GSettingsBackend *backend,
|
|||||||
|
|
||||||
|
|
||||||
/* method calls */
|
/* method calls */
|
||||||
void
|
static void
|
||||||
g_delayed_settings_backend_apply (GDelayedSettingsBackend *delayed)
|
g_delayed_settings_backend_apply (GSettingsBackend *backend)
|
||||||
{
|
{
|
||||||
|
GDelayedSettingsBackend *delayed = G_DELAYED_SETTINGS_BACKEND (backend);
|
||||||
|
|
||||||
if (g_tree_nnodes (delayed->priv->delayed) > 0)
|
if (g_tree_nnodes (delayed->priv->delayed) > 0)
|
||||||
{
|
{
|
||||||
gboolean success;
|
gboolean success;
|
||||||
@ -190,9 +192,11 @@ g_delayed_settings_backend_apply (GDelayedSettingsBackend *delayed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
g_delayed_settings_backend_revert (GDelayedSettingsBackend *delayed)
|
g_delayed_settings_backend_revert (GSettingsBackend *backend)
|
||||||
{
|
{
|
||||||
|
GDelayedSettingsBackend *delayed = G_DELAYED_SETTINGS_BACKEND (backend);
|
||||||
|
|
||||||
if (g_tree_nnodes (delayed->priv->delayed) > 0)
|
if (g_tree_nnodes (delayed->priv->delayed) > 0)
|
||||||
{
|
{
|
||||||
GTree *tmp;
|
GTree *tmp;
|
||||||
@ -249,6 +253,8 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
|
|||||||
backend_class->subscribe = g_delayed_settings_backend_subscribe;
|
backend_class->subscribe = g_delayed_settings_backend_subscribe;
|
||||||
backend_class->unsubscribe = g_delayed_settings_backend_unsubscribe;
|
backend_class->unsubscribe = g_delayed_settings_backend_unsubscribe;
|
||||||
backend_class->get_permission = g_delayed_settings_backend_get_permission;
|
backend_class->get_permission = g_delayed_settings_backend_get_permission;
|
||||||
|
backend_class->apply = g_delayed_settings_backend_apply;
|
||||||
|
backend_class->revert = g_delayed_settings_backend_revert;
|
||||||
|
|
||||||
object_class->finalize = g_delayed_settings_backend_finalize;
|
object_class->finalize = g_delayed_settings_backend_finalize;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,5 @@ G_GNUC_INTERNAL
|
|||||||
GType g_delayed_settings_backend_get_type (void);
|
GType g_delayed_settings_backend_get_type (void);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GDelayedSettingsBackend * g_delayed_settings_backend_new (GSettingsBackend *backend);
|
GDelayedSettingsBackend * g_delayed_settings_backend_new (GSettingsBackend *backend);
|
||||||
G_GNUC_INTERNAL
|
|
||||||
void g_delayed_settings_backend_revert (GDelayedSettingsBackend *delayed);
|
|
||||||
G_GNUC_INTERNAL
|
|
||||||
void g_delayed_settings_backend_apply (GDelayedSettingsBackend *delayed);
|
|
||||||
|
|
||||||
#endif /* __G_DELAYED_SETTINGS_BACKEND_H__ */
|
#endif /* __G_DELAYED_SETTINGS_BACKEND_H__ */
|
||||||
|
@ -240,7 +240,7 @@ struct _GSettingsPrivate
|
|||||||
GSettingsSchema *schema;
|
GSettingsSchema *schema;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
GDelayedSettingsBackend *delayed;
|
gboolean delayed_apply;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -618,7 +618,7 @@ g_settings_get_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DELAY_APPLY:
|
case PROP_DELAY_APPLY:
|
||||||
g_value_set_boolean (value, settings->priv->delayed != NULL);
|
g_value_set_boolean (value, settings->priv->delayed_apply);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1962,21 +1962,24 @@ g_settings_set_strv (GSettings *settings,
|
|||||||
void
|
void
|
||||||
g_settings_delay (GSettings *settings)
|
g_settings_delay (GSettings *settings)
|
||||||
{
|
{
|
||||||
|
GDelayedSettingsBackend *delayed;
|
||||||
|
|
||||||
g_return_if_fail (G_IS_SETTINGS (settings));
|
g_return_if_fail (G_IS_SETTINGS (settings));
|
||||||
|
|
||||||
if (settings->priv->delayed)
|
if (settings->priv->delayed_apply)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
settings->priv->delayed = g_delayed_settings_backend_new (settings->priv->backend);
|
delayed = g_delayed_settings_backend_new (settings->priv->backend);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (settings->priv->backend, g_settings_got_event, settings);
|
g_signal_handlers_disconnect_by_func (settings->priv->backend, g_settings_got_event, settings);
|
||||||
g_object_unref (settings->priv->backend);
|
g_object_unref (settings->priv->backend);
|
||||||
|
|
||||||
settings->priv->backend = G_SETTINGS_BACKEND (settings->priv->delayed);
|
settings->priv->backend = G_SETTINGS_BACKEND (delayed);
|
||||||
g_signal_connect_object (settings->priv->backend, "event", G_CALLBACK (g_settings_got_event), settings, 0);
|
g_signal_connect_object (delayed, "event", G_CALLBACK (g_settings_got_event), settings, 0);
|
||||||
|
g_signal_connect_object (delayed, "notify::has-unapplied",
|
||||||
g_signal_connect_object (settings->priv->delayed, "notify::has-unapplied",
|
|
||||||
G_CALLBACK (g_settings_got_has_unapplied_notify), settings, 0);
|
G_CALLBACK (g_settings_got_has_unapplied_notify), settings, 0);
|
||||||
g_object_notify (G_OBJECT (settings), "delay-apply");
|
|
||||||
|
settings->priv->delayed_apply = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1991,13 +1994,7 @@ g_settings_delay (GSettings *settings)
|
|||||||
void
|
void
|
||||||
g_settings_apply (GSettings *settings)
|
g_settings_apply (GSettings *settings)
|
||||||
{
|
{
|
||||||
if (settings->priv->delayed)
|
g_settings_backend_apply (settings->priv->backend);
|
||||||
{
|
|
||||||
GDelayedSettingsBackend *delayed;
|
|
||||||
|
|
||||||
delayed = G_DELAYED_SETTINGS_BACKEND (settings->priv->backend);
|
|
||||||
g_delayed_settings_backend_apply (delayed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2014,13 +2011,7 @@ g_settings_apply (GSettings *settings)
|
|||||||
void
|
void
|
||||||
g_settings_revert (GSettings *settings)
|
g_settings_revert (GSettings *settings)
|
||||||
{
|
{
|
||||||
if (settings->priv->delayed)
|
g_settings_backend_revert (settings->priv->backend);
|
||||||
{
|
|
||||||
GDelayedSettingsBackend *delayed;
|
|
||||||
|
|
||||||
delayed = G_DELAYED_SETTINGS_BACKEND (settings->priv->backend);
|
|
||||||
g_delayed_settings_backend_revert (delayed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -708,6 +708,11 @@ ignore_subscription (GSettingsBackend *backend,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ignore_apply (GSettingsBackend *backend)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_settings_backend_init (GSettingsBackend *backend)
|
g_settings_backend_init (GSettingsBackend *backend)
|
||||||
{
|
{
|
||||||
@ -723,6 +728,8 @@ g_settings_backend_class_init (GSettingsBackendClass *class)
|
|||||||
|
|
||||||
class->subscribe = ignore_subscription;
|
class->subscribe = ignore_subscription;
|
||||||
class->unsubscribe = ignore_subscription;
|
class->unsubscribe = ignore_subscription;
|
||||||
|
class->apply = ignore_apply;
|
||||||
|
class->revert = ignore_apply;
|
||||||
|
|
||||||
gobject_class->get_property = g_settings_backend_get_property;
|
gobject_class->get_property = g_settings_backend_get_property;
|
||||||
|
|
||||||
@ -864,3 +871,17 @@ g_settings_backend_set_has_unapplied (GSettingsBackend *backend,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (backend), g_settings_backend_pspecs[PROP_HAS_UNAPPLIED]);
|
g_object_notify_by_pspec (G_OBJECT (backend), g_settings_backend_pspecs[PROP_HAS_UNAPPLIED]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
g_settings_backend_apply (GSettingsBackend *backend)
|
||||||
|
{
|
||||||
|
G_SETTINGS_BACKEND_GET_CLASS (backend)
|
||||||
|
->apply (backend);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
g_settings_backend_revert (GSettingsBackend *backend)
|
||||||
|
{
|
||||||
|
G_SETTINGS_BACKEND_GET_CLASS (backend)
|
||||||
|
->revert (backend);
|
||||||
|
}
|
||||||
|
@ -93,7 +93,10 @@ struct _GSettingsBackendClass
|
|||||||
GPermission * (*get_permission) (GSettingsBackend *backend,
|
GPermission * (*get_permission) (GSettingsBackend *backend,
|
||||||
const gchar *path);
|
const gchar *path);
|
||||||
|
|
||||||
gpointer padding[24];
|
void (*apply) (GSettingsBackend *backend);
|
||||||
|
void (*revert) (GSettingsBackend *backend);
|
||||||
|
|
||||||
|
gpointer padding[22];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GSettingsBackend
|
struct _GSettingsBackend
|
||||||
|
@ -73,6 +73,10 @@ GPermission * g_settings_backend_get_permission (GSettin
|
|||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean g_settings_backend_get_has_unapplied (GSettingsBackend *backend);
|
gboolean g_settings_backend_get_has_unapplied (GSettingsBackend *backend);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
void g_settings_backend_apply (GSettingsBackend *backend);
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
void g_settings_backend_revert (GSettingsBackend *backend);
|
||||||
|
G_GNUC_INTERNAL
|
||||||
void g_settings_backend_sync_default (void);
|
void g_settings_backend_sync_default (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user