application: Delay context initialization
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "css-code.h"
|
#include "css-code.h"
|
||||||
#include "gcal-application.h"
|
#include "gcal-application.h"
|
||||||
|
#include "gcal-context-private.h"
|
||||||
#include "gcal-debug.h"
|
#include "gcal-debug.h"
|
||||||
#include "gcal-log.h"
|
#include "gcal-log.h"
|
||||||
#include "gcal-shell-search-provider.h"
|
#include "gcal-shell-search-provider.h"
|
||||||
@@ -311,7 +312,7 @@ gcal_application_startup (GApplication *app)
|
|||||||
self->colors_provider = gtk_css_provider_new ();
|
self->colors_provider = gtk_css_provider_new ();
|
||||||
|
|
||||||
/* Startup the manager */
|
/* Startup the manager */
|
||||||
gcal_manager_startup (gcal_context_get_manager (self->context));
|
gcal_context_startup (self->context);
|
||||||
|
|
||||||
/* We're assuming the application is called as a service only by the shell search system */
|
/* We're assuming the application is called as a service only by the shell search system */
|
||||||
if ((g_application_get_flags (app) & G_APPLICATION_IS_SERVICE) != 0)
|
if ((g_application_get_flags (app) & G_APPLICATION_IS_SERVICE) != 0)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* gcal-context-private.h
|
||||||
|
*
|
||||||
|
* Copyright 2019 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "gcal-context.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void gcal_context_startup (GcalContext *self);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
+11
-2
@@ -245,8 +245,6 @@ gcal_context_init (GcalContext *self)
|
|||||||
self->settings = g_settings_new ("org.gnome.calendar");
|
self->settings = g_settings_new ("org.gnome.calendar");
|
||||||
self->weather_service = gcal_weather_service_new ();
|
self->weather_service = gcal_weather_service_new ();
|
||||||
|
|
||||||
self->night_light_monitor = gcal_night_light_monitor_new (self);
|
|
||||||
|
|
||||||
self->timezone_monitor = gcal_time_zone_monitor_new ();
|
self->timezone_monitor = gcal_time_zone_monitor_new ();
|
||||||
g_signal_connect_object (self->timezone_monitor,
|
g_signal_connect_object (self->timezone_monitor,
|
||||||
"notify::timezone",
|
"notify::timezone",
|
||||||
@@ -382,3 +380,14 @@ gcal_context_get_weather_service (GcalContext *self)
|
|||||||
|
|
||||||
return self->weather_service;
|
return self->weather_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gcal_context_startup (GcalContext *self)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GCAL_IS_CONTEXT (self));
|
||||||
|
|
||||||
|
/* Night Light requires GTK to be initialized */
|
||||||
|
self->night_light_monitor = gcal_night_light_monitor_new (self);
|
||||||
|
|
||||||
|
gcal_manager_startup (self->manager);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user