application: move GSettings object to GcalManager

The first outcome of the test suite. This separation does
not make much sense now, and GcalManager is basically a
holder for all data types.

This commit moves the GSettings to the GcalManager instance
of the application. Of course, in the future, the plan is to
split GcalManager nicely.
This commit is contained in:
Georges Basile Stavracas Neto
2017-09-07 12:52:49 -03:00
parent 1d29fd4944
commit a0b6bdb04a
6 changed files with 43 additions and 43 deletions
+13 -14
View File
@@ -43,7 +43,6 @@ struct _GcalApplication
GtkWidget *window;
GSettings *settings;
GcalManager *manager;
GtkCssProvider *provider;
@@ -168,7 +167,6 @@ gcal_application_finalize (GObject *object)
g_clear_object (&(self->provider));
g_clear_object (&self->colors_provider);
g_clear_object (&self->settings);
g_clear_object (&self->manager);
g_clear_object (&self->search_provider);
@@ -182,10 +180,12 @@ static void
gcal_application_activate (GApplication *application)
{
GcalApplication *self;
GSettings *settings;
GCAL_ENTRY;
self = GCAL_APPLICATION (application);
settings = gcal_manager_get_settings (self->manager);
if (!self->provider)
{
@@ -216,12 +216,12 @@ gcal_application_activate (GApplication *application)
}
self->window = gcal_window_new_with_view_and_date (GCAL_APPLICATION (application),
g_settings_get_enum (self->settings, "active-view"),
g_settings_get_enum (settings, "active-view"),
self->initial_date);
g_signal_connect (self->window, "destroy", G_CALLBACK (gtk_widget_destroyed), &(self->window));
g_settings_bind (self->settings,
g_settings_bind (settings,
"active-view",
self->window,
"active-view",
@@ -398,10 +398,9 @@ gcal_application_init (GcalApplication *self)
{
g_application_add_main_option_entries (G_APPLICATION (self), gcal_application_goptions);
self->settings = g_settings_new ("org.gnome.calendar");
self->colors_provider = gtk_css_provider_new ();
self->manager = gcal_manager_new_with_settings (self->settings);
self->manager = gcal_manager_new ();
g_signal_connect_swapped (self->manager, "source-added", G_CALLBACK (process_sources), self);
g_signal_connect_swapped (self->manager, "source-changed", G_CALLBACK (process_sources), self);
@@ -513,6 +512,14 @@ gcal_application_new (void)
NULL);
}
/**
* gcal_application_get_manager:
* @self: a #GcalApplication
*
* Retrieves the #GcalManager of the application.
*
* Returns: (transfer none): a #GcalManager
*/
GcalManager*
gcal_application_get_manager (GcalApplication *self)
{
@@ -521,14 +528,6 @@ gcal_application_get_manager (GcalApplication *self)
return self->manager;
}
GSettings*
gcal_application_get_settings (GcalApplication *self)
{
g_return_val_if_fail (GCAL_IS_APPLICATION (self), NULL);
return self->settings;
}
void
gcal_application_set_uuid (GcalApplication *self,
const gchar *app_uuid)