Remove AgSettings’ priv property

This commit is contained in:
Gergely Polonkai 2014-07-03 18:15:48 +02:00
parent 4542f52980
commit 26fb959a48
2 changed files with 14 additions and 12 deletions

View File

@ -15,18 +15,19 @@ G_DEFINE_TYPE_WITH_PRIVATE(AgSettings, ag_settings, G_TYPE_OBJECT);
static void static void
ag_settings_init(AgSettings *settings) ag_settings_init(AgSettings *settings)
{ {
settings->priv = ag_settings_get_instance_private(settings); AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
settings->priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW);
settings->priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART); priv->settings_window = g_settings_new(SETTINGS_SCHEMA_ID_WINDOW);
priv->settings_chart = g_settings_new(SETTINGS_SCHEMA_ID_CHART);
} }
static void static void
ag_settings_dispose(GObject *object) ag_settings_dispose(GObject *object)
{ {
AgSettings *settings = AG_SETTINGS(object); AgSettingsPrivate *priv = ag_settings_get_instance_private(AG_SETTINGS(object));
g_clear_object(&settings->priv->settings_window); g_clear_object(&priv->settings_window);
g_clear_object(&settings->priv->settings_chart); g_clear_object(&priv->settings_chart);
G_OBJECT_CLASS(ag_settings_parent_class)->dispose(object); G_OBJECT_CLASS(ag_settings_parent_class)->dispose(object);
} }
@ -35,6 +36,7 @@ static void
ag_settings_finalize(GObject *object) ag_settings_finalize(GObject *object)
{ {
singleton = NULL; singleton = NULL;
G_OBJECT_CLASS(ag_settings_parent_class)->finalize(object); G_OBJECT_CLASS(ag_settings_parent_class)->finalize(object);
} }
@ -64,12 +66,15 @@ ag_settings_get(void)
GSettings * GSettings *
ag_settings_peek_window_settings(AgSettings *settings) ag_settings_peek_window_settings(AgSettings *settings)
{ {
return settings->priv->settings_window; AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
return priv->settings_window;
} }
GSettings * GSettings *
ag_settings_peek_chart_settings(AgSettings *settings) ag_settings_peek_chart_settings(AgSettings *settings)
{ {
return settings->priv->settings_chart; AgSettingsPrivate *priv = ag_settings_get_instance_private(settings);
}
return priv->settings_chart;
}

View File

@ -19,9 +19,6 @@ typedef struct _AgSettingsPrivate AgSettingsPrivate;
struct _AgSettings { struct _AgSettings {
GObject parent_instance; GObject parent_instance;
/*< private >*/
AgSettingsPrivate *priv;
}; };
struct _AgSettingsClass { struct _AgSettingsClass {