[glib/wip/settings-backend: 4/7] GSettings: change API of writable-change-event
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/settings-backend: 4/7] GSettings: change API of writable-change-event
- Date: Fri, 30 Dec 2011 00:29:19 +0000 (UTC)
commit c253de12acbd0590b886a23bb06bb180c0ff966d
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Dec 29 05:05:47 2011 -0500
GSettings: change API of writable-change-event
This is an API break. It modifies the writable-change-event signal and
vfunc to be more like the change-event signal.
I don't think anyone is implementing or connected to this.
Also, remove a lie from the documentation for the same signal.
gio/gsettings.c | 48 +++++++++++++++---------------------------------
gio/gsettings.h | 3 ++-
2 files changed, 17 insertions(+), 34 deletions(-)
---
diff --git a/gio/gsettings.c b/gio/gsettings.c
index 3912f47..1c5621c 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -277,14 +277,13 @@ g_settings_real_change_event (GSettings *settings,
}
static gboolean
-g_settings_real_writable_change_event (GSettings *settings,
- GQuark key)
+g_settings_real_writable_change_event (GSettings *settings,
+ const GQuark *keys,
+ gint n_keys)
{
- const GQuark *keys = &key;
- gint n_keys = 1;
gint i;
- if (key == 0)
+ if (keys == NULL)
keys = g_settings_schema_list (settings->priv->schema, &n_keys);
for (i = 0; i < n_keys; i++)
@@ -323,25 +322,8 @@ g_settings_emit_signal (gpointer user_data)
g_assert_not_reached ();
}
- /* this signal is presently emitted differently */
- if (signal_id == g_settings_signals[SIGNAL_WRITABLE_CHANGE_EVENT])
- {
- if (data->n_items > 0)
- {
- gint i;
-
- for (i = 0; i < data->n_items; i++)
- g_signal_emit (data->settings, signal_id, 0, data->quarks[i], &ignore_this);
- }
- else
- g_signal_emit (data->settings, signal_id, 0, (GQuark) 0, &ignore_this);
-
- goto out;
- }
-
g_signal_emit (data->settings, signal_id, 0, data->quarks, data->n_items, &ignore_this);
-out:
g_object_unref (data->settings);
g_free (data->quarks);
@@ -769,7 +751,9 @@ g_settings_class_init (GSettingsClass *class)
/**
* GSettings::writable-change-event:
* @settings: the object on which the signal was emitted
- * @key: the quark of the key, or 0
+ * @keys: (array length=n_keys) (element-type GQuark) (allow-none):
+ * an array of #GQuark<!-- -->s for the affected keys, or %NULL
+ * @n_keys: the length of the @keys array, or 0
*
* The "writable-change-event" signal is emitted once per writability
* change event that affects this settings object. You should connect
@@ -778,17 +762,15 @@ g_settings_class_init (GSettingsClass *class)
* "writable-changed" signal. For most use cases it is more
* appropriate to use the "writable-changed" signal.
*
- * In the event that the writability change applies only to a single
- * key, @key will be set to the #GQuark for that key. In the event
- * that the writability change affects the entire settings object,
- * @key will be 0.
+ * In the event that the change event applies to one or more specified
+ * keys, @keys will be an array of #GQuark of length @n_keys. In the
+ * event that the change event applies to the #GSettings object as a
+ * whole (ie: potentially every key has been changed) then @keys will
+ * be %NULL and @n_keys will be 0.
*
* The default handler for this signal invokes the "writable-changed"
- * and "changed" signals for each affected key. This is done because
- * changes in writability might also imply changes in value (if for
- * example, a new mandatory setting is introduced). If any other
- * connected handler returns %TRUE then this default functionality
- * will be suppressed.
+ * signal for each affected key. If any other connected handler
+ * returns %TRUE then this default functionality will be suppressed.
*
* Returns: %TRUE to stop other handlers from being invoked for the
* event. FALSE to propagate the event further.
@@ -798,7 +780,7 @@ g_settings_class_init (GSettingsClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSettingsClass, writable_change_event),
g_signal_accumulator_true_handled, NULL,
- NULL, G_TYPE_BOOLEAN, 1, G_TYPE_UINT);
+ NULL, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_INT);
/**
* GSettings:context:
diff --git a/gio/gsettings.h b/gio/gsettings.h
index 80b9990..abc0a24 100644
--- a/gio/gsettings.h
+++ b/gio/gsettings.h
@@ -54,7 +54,8 @@ struct _GSettingsClass
void (*changed) (GSettings *settings,
const gchar *key);
gboolean (*writable_change_event) (GSettings *settings,
- GQuark key);
+ const GQuark *keys,
+ gint n_keys);
gboolean (*change_event) (GSettings *settings,
const GQuark *keys,
gint n_keys);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]