Commit ffdef971 authored by Niels De Graef's avatar Niels De Graef

settings: use G_DECLARE_FINAL_TYPE

Note that we need to remove the signal vfunc in GdmSettingsClass, so
make sure to change the `g_signal_new("value-changed", ...)`, to cope
with that.

It also immediately gets rid of the deprecated
`g_type_class_add_private()`.
parent 7753d33d
......@@ -39,11 +39,11 @@
#include "gdm-settings-desktop-backend.h"
#define GDM_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SETTINGS, GdmSettingsPrivate))
struct GdmSettingsPrivate
struct _GdmSettings
{
GList *backends;
GObject parent;
GList *backends;
};
enum {
......@@ -87,7 +87,7 @@ gdm_settings_get_value (GdmSettings *settings,
local_error = NULL;
for (l = settings->priv->backends; l; l = g_list_next (l)) {
for (l = settings->backends; l; l = g_list_next (l)) {
GdmSettingsBackend *backend = l->data;
if (local_error) {
......@@ -126,7 +126,7 @@ gdm_settings_set_value (GdmSettings *settings,
local_error = NULL;
for (l = settings->priv->backends; l; l = g_list_next (l)) {
for (l = settings->backends; l; l = g_list_next (l)) {
GdmSettingsBackend *backend = l->data;
if (local_error) {
......@@ -160,7 +160,7 @@ gdm_settings_class_init (GdmSettingsClass *klass)
g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdmSettingsClass, value_changed),
0,
NULL,
NULL,
g_cclosure_marshal_generic,
......@@ -169,8 +169,6 @@ gdm_settings_class_init (GdmSettingsClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
g_type_class_add_private (klass, sizeof (GdmSettingsPrivate));
}
static void
......@@ -192,17 +190,15 @@ gdm_settings_init (GdmSettings *settings)
GList *l;
GdmSettingsBackend *backend;
settings->priv = GDM_SETTINGS_GET_PRIVATE (settings);
backend = gdm_settings_desktop_backend_new (GDM_CUSTOM_CONF);
if (backend)
settings->priv->backends = g_list_prepend (NULL, backend);
settings->backends = g_list_prepend (NULL, backend);
backend = gdm_settings_desktop_backend_new (GDM_RUNTIME_CONF);
if (backend)
settings->priv->backends = g_list_prepend (settings->priv->backends, backend);
settings->backends = g_list_prepend (settings->backends, backend);
for (l = settings->priv->backends; l; l = g_list_next (l)) {
for (l = settings->backends; l; l = g_list_next (l)) {
backend = l->data;
g_signal_connect (backend,
......@@ -222,11 +218,11 @@ gdm_settings_finalize (GObject *object)
settings = GDM_SETTINGS (object);
g_return_if_fail (settings->priv != NULL);
g_return_if_fail (settings != NULL);
g_list_foreach (settings->priv->backends, (GFunc) g_object_unref, NULL);
g_list_free (settings->priv->backends);
settings->priv->backends = NULL;
g_list_foreach (settings->backends, (GFunc) g_object_unref, NULL);
g_list_free (settings->backends);
settings->backends = NULL;
settings_object = NULL;
......
......@@ -26,30 +26,8 @@
G_BEGIN_DECLS
#define GDM_TYPE_SETTINGS (gdm_settings_get_type ())
#define GDM_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SETTINGS, GdmSettings))
#define GDM_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SETTINGS, GdmSettingsClass))
#define GDM_IS_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SETTINGS))
#define GDM_IS_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SETTINGS))
#define GDM_SETTINGS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SETTINGS, GdmSettingsClass))
typedef struct GdmSettingsPrivate GdmSettingsPrivate;
typedef struct
{
GObject parent;
GdmSettingsPrivate *priv;
} GdmSettings;
typedef struct
{
GObjectClass parent_class;
void (* value_changed) (GdmSettings *settings,
const char *key,
const char *old_value,
const char **new_value);
} GdmSettingsClass;
#define GDM_TYPE_SETTINGS (gdm_settings_get_type ())
G_DECLARE_FINAL_TYPE (GdmSettings, gdm_settings, GDM, SETTINGS, GObject)
typedef enum
{
......@@ -60,7 +38,6 @@ typedef enum
#define GDM_SETTINGS_ERROR gdm_settings_error_quark ()
GQuark gdm_settings_error_quark (void);
GType gdm_settings_get_type (void);
GdmSettings * gdm_settings_new (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment