application: Remove gcal_application_get_clock()
That moved to GcalContext, and now that all pieces who used it have access to the context, we can just use it.
This commit is contained in:
@@ -751,11 +751,3 @@ gcal_application_set_initial_date (GcalApplication *self,
|
||||
g_clear_pointer (&self->initial_date, g_free);
|
||||
self->initial_date = datetime_to_icaltime (initial_date);
|
||||
}
|
||||
|
||||
GcalClock*
|
||||
gcal_application_get_clock (GcalApplication *self)
|
||||
{
|
||||
g_return_val_if_fail (GCAL_IS_APPLICATION (self), NULL);
|
||||
|
||||
return gcal_context_get_clock (self->context);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ void gcal_application_set_uuid (GcalApplicatio
|
||||
void gcal_application_set_initial_date (GcalApplication *self,
|
||||
GDateTime *initial_date);
|
||||
|
||||
GcalClock* gcal_application_get_clock (GcalApplication *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GCAL_APPLICATION_H_ */
|
||||
|
||||
+6
-12
@@ -780,6 +780,12 @@ gcal_event_widget_set_property (GObject *object,
|
||||
case PROP_CONTEXT:
|
||||
g_assert (self->context == NULL);
|
||||
self->context = g_value_dup_object (value);
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (self->context),
|
||||
"minute-changed",
|
||||
G_CALLBACK (update_color),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
break;
|
||||
|
||||
case PROP_DATE_END:
|
||||
@@ -978,7 +984,6 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass)
|
||||
static void
|
||||
gcal_event_widget_init (GcalEventWidget *self)
|
||||
{
|
||||
GcalApplication *application;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_WIDGET (self);
|
||||
@@ -995,17 +1000,6 @@ gcal_event_widget_init (GcalEventWidget *self)
|
||||
/* Starts with horizontal */
|
||||
self->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "horizontal");
|
||||
|
||||
/* 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 (update_color),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
|
||||
+10
-16
@@ -447,8 +447,6 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass)
|
||||
static void
|
||||
gcal_month_cell_init (GcalMonthCell *self)
|
||||
{
|
||||
GcalApplication *application;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
/* Setup the month cell as a drag n' drop destination */
|
||||
@@ -457,18 +455,6 @@ gcal_month_cell_init (GcalMonthCell *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),
|
||||
"day-changed",
|
||||
G_CALLBACK (day_changed_cb),
|
||||
self,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
@@ -590,8 +576,16 @@ gcal_month_cell_set_context (GcalMonthCell *self,
|
||||
{
|
||||
g_return_if_fail (GCAL_IS_MONTH_CELL (self));
|
||||
|
||||
if (g_set_object (&self->context, context))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTEXT]);
|
||||
if (!g_set_object (&self->context, context))
|
||||
return;
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (context),
|
||||
"day-changed",
|
||||
G_CALLBACK (day_changed_cb),
|
||||
self,
|
||||
0);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTEXT]);
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -2094,6 +2094,12 @@ gcal_month_view_set_property (GObject *object,
|
||||
for (i = 0; i < 42; i++)
|
||||
gcal_month_cell_set_context (GCAL_MONTH_CELL (self->month_cell[i / 7][i % 7]), self->context);
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (self->context),
|
||||
"day-changed",
|
||||
G_CALLBACK (update_month_cells),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_object_notify (object, "context");
|
||||
break;
|
||||
|
||||
@@ -2219,8 +2225,6 @@ gcal_month_view_class_init (GcalMonthViewClass *klass)
|
||||
static void
|
||||
gcal_month_view_init (GcalMonthView *self)
|
||||
{
|
||||
GcalApplication *application;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
|
||||
@@ -2255,17 +2259,5 @@ gcal_month_view_init (GcalMonthView *self)
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
g_signal_connect (self->overflow_popover, "event-activated", G_CALLBACK (on_month_popover_event_activated_cb), self);
|
||||
|
||||
|
||||
/* 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),
|
||||
"day-changed",
|
||||
G_CALLBACK (update_month_cells),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
|
||||
@@ -1112,8 +1112,6 @@ 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;
|
||||
@@ -1128,17 +1126,6 @@ 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 */
|
||||
@@ -1149,6 +1136,12 @@ gcal_week_grid_set_context (GcalWeekGrid *self,
|
||||
g_return_if_fail (GCAL_IS_WEEK_GRID (self));
|
||||
|
||||
self->context = context;
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (context),
|
||||
"minute-changed",
|
||||
G_CALLBACK (gtk_widget_queue_draw),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1669,8 +1669,6 @@ gcal_week_header_class_init (GcalWeekHeaderClass *kclass)
|
||||
static void
|
||||
gcal_week_header_init (GcalWeekHeader *self)
|
||||
{
|
||||
GcalApplication *application;
|
||||
|
||||
self->expanded = FALSE;
|
||||
self->selection_start = -1;
|
||||
self->selection_end = -1;
|
||||
@@ -1690,17 +1688,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
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),
|
||||
"day-changed",
|
||||
G_CALLBACK (gtk_widget_queue_draw),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
/* Private API */
|
||||
@@ -1831,6 +1818,12 @@ gcal_week_header_set_context (GcalWeekHeader *self,
|
||||
g_return_if_fail (GCAL_IS_WEEK_HEADER (self));
|
||||
|
||||
self->context = context;
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (context),
|
||||
"day-changed",
|
||||
G_CALLBACK (gtk_widget_queue_draw),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1669,6 +1669,13 @@ gcal_year_view_set_property (GObject *object,
|
||||
|
||||
case PROP_CONTEXT:
|
||||
self->context = g_value_dup_object (value);
|
||||
|
||||
g_signal_connect_object (gcal_context_get_clock (self->context),
|
||||
"day-changed",
|
||||
G_CALLBACK (gtk_widget_queue_draw),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_object_notify (object, "context");
|
||||
break;
|
||||
|
||||
@@ -2012,7 +2019,6 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
|
||||
static void
|
||||
gcal_year_view_init (GcalYearView *self)
|
||||
{
|
||||
GcalApplication *application;
|
||||
guint i;
|
||||
|
||||
self->weather_service = NULL;
|
||||
@@ -2055,17 +2061,6 @@ gcal_year_view_init (GcalYearView *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),
|
||||
"day-changed",
|
||||
G_CALLBACK (gtk_widget_queue_draw),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user