manager: Move GcalClock to GcalApplication

GcalManager is basically an object that is shared
among classes that need to modify calendars, while
GcalClock is just a wall clock implementation.

Move it to GcalApplication, so that objects without
access to GcalManager can still access the clock.
This commit is contained in:
Georges Basile Stavracas Neto
2018-05-04 21:37:53 -03:00
parent d00a4bc7b7
commit cfa8794313
9 changed files with 103 additions and 66 deletions
+15 -5
View File
@@ -19,6 +19,8 @@
#define G_LOG_DOMAIN "GcalWeekGrid"
#include "gcal-application.h"
#include "gcal-clock.h"
#include "gcal-debug.h"
#include "gcal-week-grid.h"
#include "gcal-week-view.h"
@@ -1109,6 +1111,8 @@ gcal_week_grid_class_init (GcalWeekGridClass *klass)
static void
gcal_week_grid_init (GcalWeekGrid *self)
{
GcalApplication *application;
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
self->selection_start = -1;
@@ -1123,6 +1127,17 @@ gcal_week_grid_init (GcalWeekGrid *self)
NULL,
0,
GDK_ACTION_MOVE);
/* Connect to the wall clock */
application = GCAL_APPLICATION (g_application_get_default ());
g_assert (application != NULL);
g_signal_connect_object (gcal_application_get_clock (application),
"minute-changed",
G_CALLBACK (gtk_widget_queue_draw),
self,
G_CONNECT_SWAPPED);
}
/* Public API */
@@ -1133,11 +1148,6 @@ gcal_week_grid_set_manager (GcalWeekGrid *self,
g_return_if_fail (GCAL_IS_WEEK_GRID (self));
self->manager = manager;
g_signal_connect_swapped (gcal_manager_get_clock (manager),
"minute-changed",
G_CALLBACK (gtk_widget_queue_draw),
self);
}
void