[gnome-calendar] night-light-monitor: Receive a context
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] night-light-monitor: Receive a context
- Date: Thu, 25 Apr 2019 19:57:18 +0000 (UTC)
commit 14c6544b958cd96c074c5429a97d4e4c6b8c1f6d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Apr 24 13:05:56 2019 -0300
night-light-monitor: Receive a context
src/gcal-application.c | 2 +-
src/gcal-night-light-monitor.c | 32 +++++++++++++++++---------------
src/gcal-night-light-monitor.h | 4 ++--
3 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index cdee0dc7..d3f28752 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -296,7 +296,7 @@ gcal_application_activate (GApplication *application)
}
if (!self->night_light_monitor)
- self->night_light_monitor = gcal_night_light_monitor_new (manager);
+ self->night_light_monitor = gcal_night_light_monitor_new (self->context);
if (!self->window)
{
diff --git a/src/gcal-night-light-monitor.c b/src/gcal-night-light-monitor.c
index 4198ba08..09816640 100644
--- a/src/gcal-night-light-monitor.c
+++ b/src/gcal-night-light-monitor.c
@@ -25,7 +25,7 @@ struct _GcalNightLightMonitor
{
GObject parent;
- GcalManager *manager;
+ GcalContext *context;
GDBusProxy *night_light_proxy;
};
@@ -35,7 +35,7 @@ G_DEFINE_TYPE (GcalNightLightMonitor, gcal_night_light_monitor, G_TYPE_OBJECT)
enum
{
PROP_0,
- PROP_MANAGER,
+ PROP_CONTEXT,
N_PROPS
};
@@ -52,12 +52,14 @@ on_night_light_proxy_properties_changed_cb (GcalNightLightMonitor *self,
const gchar * const *invalidated,
GDBusProxy *proxy)
{
+ GcalManager *manager;
GSettings *settings;
g_assert (GCAL_IS_NIGHT_LIGHT_MONITOR (self));
g_assert (G_IS_DBUS_PROXY (proxy));
- settings = gcal_manager_get_settings (self->manager);
+ manager = gcal_context_get_manager (self->context);
+ settings = gcal_manager_get_settings (manager);
if (g_settings_get_boolean (settings, "follow-night-light"))
{
@@ -84,7 +86,7 @@ gcal_night_light_monitor_finalize (GObject *object)
{
GcalNightLightMonitor *self = (GcalNightLightMonitor *)object;
- g_clear_object (&self->manager);
+ g_clear_object (&self->context);
g_clear_object (&self->night_light_proxy);
G_OBJECT_CLASS (gcal_night_light_monitor_parent_class)->finalize (object);
@@ -143,8 +145,8 @@ gcal_night_light_monitor_get_property (GObject *object,
switch (prop_id)
{
- case PROP_MANAGER:
- g_value_set_object (value, self->manager);
+ case PROP_CONTEXT:
+ g_value_set_object (value, self->context);
break;
default:
@@ -162,9 +164,9 @@ gcal_night_light_monitor_set_property (GObject *object,
switch (prop_id)
{
- case PROP_MANAGER:
- g_assert (self->manager == NULL);
- self->manager = g_value_dup_object (value);
+ case PROP_CONTEXT:
+ g_assert (self->context == NULL);
+ self->context = g_value_dup_object (value);
g_object_notify_by_pspec (object, pspec);
break;
@@ -183,10 +185,10 @@ gcal_night_light_monitor_class_init (GcalNightLightMonitorClass *klass)
object_class->get_property = gcal_night_light_monitor_get_property;
object_class->set_property = gcal_night_light_monitor_set_property;
- properties[PROP_MANAGER] = g_param_spec_object ("manager",
- "Manager",
- "Manager",
- GCAL_TYPE_MANAGER,
+ properties[PROP_CONTEXT] = g_param_spec_object ("context",
+ "Context",
+ "Context",
+ GCAL_TYPE_CONTEXT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
@@ -198,9 +200,9 @@ gcal_night_light_monitor_init (GcalNightLightMonitor *self)
}
GcalNightLightMonitor*
-gcal_night_light_monitor_new (GcalManager *manager)
+gcal_night_light_monitor_new (GcalContext *context)
{
return g_object_new (GCAL_TYPE_NIGHT_LIGHT_MONITOR,
- "manager", manager,
+ "context", context,
NULL);
}
diff --git a/src/gcal-night-light-monitor.h b/src/gcal-night-light-monitor.h
index 3b9d98b3..cf54d211 100644
--- a/src/gcal-night-light-monitor.h
+++ b/src/gcal-night-light-monitor.h
@@ -20,7 +20,7 @@
#pragma once
-#include "gcal-manager.h"
+#include "gcal-context.h"
#include "gcal-window.h"
G_BEGIN_DECLS
@@ -29,6 +29,6 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GcalNightLightMonitor, gcal_night_light_monitor, GCAL, NIGHT_LIGHT_MONITOR, GObject)
-GcalNightLightMonitor* gcal_night_light_monitor_new (GcalManager *manager);
+GcalNightLightMonitor* gcal_night_light_monitor_new (GcalContext *context);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]