[gnome-calendar] application: Move night light monitor to GcalContext



commit 8366d22cf0f123cedce66ca7283faa47a6e21caa
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 24 14:30:24 2019 -0300

    application: Move night light monitor to GcalContext

 src/gcal-application.c | 6 ------
 src/gcal-context.c     | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index d3f28752..58b0c940 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -26,7 +26,6 @@
 #include "gcal-debug.h"
 #include "gcal-enums.h"
 #include "gcal-log.h"
-#include "gcal-night-light-monitor.h"
 #include "gcal-shell-search-provider.h"
 #include "gcal-weather-service.h"
 #include "gcal-window.h"
@@ -53,7 +52,6 @@ struct _GcalApplication
 
   GcalWeatherService *weather_service;
   GcalShellSearchProvider *search_provider;
-  GcalNightLightMonitor *night_light_monitor;
 
   GcalContext        *context;
 };
@@ -229,7 +227,6 @@ gcal_application_finalize (GObject *object)
   g_clear_object (&self->context);
   g_clear_object (&self->colors_provider);
   g_clear_object (&self->desktop_settings);
-  g_clear_object (&self->night_light_monitor);
   g_clear_object (&self->provider);
   g_clear_object (&self->search_provider);
   g_clear_object (&self->weather_service);
@@ -295,9 +292,6 @@ gcal_application_activate (GApplication *application)
                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 2);
     }
 
-  if (!self->night_light_monitor)
-    self->night_light_monitor = gcal_night_light_monitor_new (self->context);
-
   if (!self->window)
     {
       if (!self->initial_date)
diff --git a/src/gcal-context.c b/src/gcal-context.c
index 2685d01b..87e31ccc 100644
--- a/src/gcal-context.c
+++ b/src/gcal-context.c
@@ -21,6 +21,7 @@
 #define G_LOG_DOMAIN "GcalContext"
 
 #include "gcal-context.h"
+#include "gcal-night-light-monitor.h"
 
 struct _GcalContext
 {
@@ -31,6 +32,8 @@ struct _GcalContext
   GcalManager        *manager;
   GSettings          *settings;
   GcalWeatherService *weather_service;
+
+  GcalNightLightMonitor *night_light_monitor;
 };
 
 G_DEFINE_TYPE (GcalContext, gcal_context, G_TYPE_OBJECT)
@@ -61,6 +64,7 @@ gcal_context_finalize (GObject *object)
   g_clear_object (&self->clock);
   g_clear_object (&self->goa_client);
   g_clear_object (&self->manager);
+  g_clear_object (&self->night_light_monitor);
   g_clear_object (&self->weather_service);
 
   G_OBJECT_CLASS (gcal_context_parent_class)->finalize (object);
@@ -169,6 +173,8 @@ gcal_context_init (GcalContext *self)
   self->manager = gcal_manager_new ();
   self->settings = g_settings_new ("org.gnome.calendar");
   self->weather_service = gcal_weather_service_new ();
+
+  self->night_light_monitor = gcal_night_light_monitor_new (self);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]