delayed: fix issues found by test

gsettings: remove dead code
test: don't leak in a way that causes test failures
This commit is contained in:
Ryan Lortie
2010-04-16 08:42:20 -04:00
parent 2af9caf953
commit b7db858c04
3 changed files with 23 additions and 26 deletions

View File

@@ -157,7 +157,8 @@ g_delayed_settings_backend_apply (GDelayedSettingsBackend *delayed)
tmp, delayed->priv);
g_tree_unref (tmp);
g_object_notify (G_OBJECT (delayed), "has-unapplied");
if (delayed->priv->owner)
g_object_notify (delayed->priv->owner, "has-unapplied");
}
}
@@ -173,7 +174,8 @@ g_delayed_settings_backend_revert (GDelayedSettingsBackend *delayed)
g_settings_backend_changed_tree (G_SETTINGS_BACKEND (delayed), tmp, NULL);
g_tree_destroy (tmp);
g_object_notify (G_OBJECT (delayed), "has-unapplied");
if (delayed->priv->owner)
g_object_notify (delayed->priv->owner, "has-unapplied");
}
}
@@ -269,7 +271,7 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
backend_class->reset_path = g_delayed_settings_backend_reset_path;
backend_class->get_writable = g_delayed_settings_backend_get_writable;
backend_class->subscribe = g_delayed_settings_backend_subscribe;
backend_class->unsubscribe = g_delayed_settings_backend_subscribe;
backend_class->unsubscribe = g_delayed_settings_backend_unsubscribe;
object_class->finalize = g_delayed_settings_backend_finalize;
}

View File

@@ -114,8 +114,7 @@ struct _GSettingsPrivate
gchar *context;
gchar *path;
guint unapplied_handler;
gboolean delayed;
GDelayedSettingsBackend *delayed;
};
enum
@@ -242,6 +241,7 @@ settings_backend_writable_changed (GSettingsBackend *backend,
const gchar *string;
GQuark quark;
quark = g_quark_from_string (key + i);
string = g_quark_to_string (quark);
quark = g_quark_from_string (key + i);
@@ -358,12 +358,6 @@ g_settings_init (GSettings *settings)
GSettingsPrivate);
}
static void
g_settings_notify_unapplied (GSettings *settings)
{
g_object_notify (G_OBJECT (settings), "has-unapplied");
}
/**
* g_settings_set_delay_apply:
* @settings: a #GSettings object
@@ -396,21 +390,6 @@ g_settings_delay (GSettings *settings)
settings);
}
/**
* g_settings_get_delay_apply:
* @settings: a #GSettings object
* @returns: %TRUE if changes in @settings are not applied immediately
*
* Returns whether the #GSettings object is in 'delay-apply' mode.
*
* Since: 2.26
*/
gboolean
g_settings_get_delay_apply (GSettings *settings)
{
return settings->priv->delayed;
}
/**
* g_settings_apply:
* @settings: a #GSettings instance

View File

@@ -36,6 +36,7 @@ test_basic (void)
str = NULL;
g_settings_set (settings, "greeting", "s", "this is the end");
g_object_unref (settings);
}
static void
@@ -205,6 +206,7 @@ test_basic_types (void)
g_settings_get (settings, "test-objectpath", "o", &str);
g_assert_cmpstr (str, ==, "/a/object/path");
g_object_unref (settings);
g_free (str);
str = NULL;
}
@@ -250,6 +252,8 @@ test_complex_types (void)
g_assert_cmpint (i1, ==, 5);
g_assert (!g_variant_iter_next (iter, "i", &i1));
g_variant_iter_free (iter);
g_object_unref (settings);
}
static gboolean changed_cb_called;
@@ -287,6 +291,8 @@ test_changes (void)
g_settings_set (settings2, "greeting", "s", "hi");
g_assert (changed_cb_called);
g_object_unref (settings2);
g_object_unref (settings);
}
static gboolean changed_cb_called2;
@@ -362,6 +368,9 @@ test_delay_apply (void)
g_assert (!g_settings_get_has_unapplied (settings));
g_assert (!g_settings_get_has_unapplied (settings2));
g_object_unref (settings2);
g_object_unref (settings);
}
static void
@@ -401,6 +410,9 @@ test_delay_revert (void)
g_assert_cmpstr (str, ==, "top o' the morning");
g_free (str);
str = NULL;
g_object_unref (settings2);
g_object_unref (settings);
}
static void
@@ -472,6 +484,9 @@ test_atomic (void)
g_assert_cmpstr (str, ==, "atomic bye-bye");
g_free (str);
str = NULL;
g_object_unref (settings2);
g_object_unref (settings);
}
static gboolean
@@ -522,6 +537,7 @@ test_l10n (void)
setlocale (LC_MESSAGES, locale);
g_assert_cmpstr (str, ==, "Unbenannt");
g_object_unref (settings);
g_free (str);
str = NULL;