month-view: highlight current date properly
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=703323
This commit is contained in:
+14
-1
@@ -73,6 +73,8 @@ typedef struct
|
|||||||
/* text direction factors */
|
/* text direction factors */
|
||||||
gint k;
|
gint k;
|
||||||
|
|
||||||
|
icaltimetype *current_date;
|
||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
icaltimetype *date;
|
icaltimetype *date;
|
||||||
} GcalMonthViewPrivate;
|
} GcalMonthViewPrivate;
|
||||||
@@ -1214,7 +1216,8 @@ gcal_month_view_draw (GtkWidget *widget,
|
|||||||
g_object_unref (overflow_layout);
|
g_object_unref (overflow_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->date->day == j)
|
if (priv->date->year == priv->current_date->year && priv->date->month == priv->current_date->month &&
|
||||||
|
j == priv->current_date->day)
|
||||||
{
|
{
|
||||||
PangoLayout *clayout;
|
PangoLayout *clayout;
|
||||||
PangoFontDescription *cfont_desc;
|
PangoFontDescription *cfont_desc;
|
||||||
@@ -1704,6 +1707,16 @@ gcal_month_view_new (void)
|
|||||||
return g_object_new (GCAL_TYPE_MONTH_VIEW, NULL);
|
return g_object_new (GCAL_TYPE_MONTH_VIEW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gcal_month_view_set_current_date (GcalMonthView *month_view,
|
||||||
|
icaltimetype *current_date)
|
||||||
|
{
|
||||||
|
GcalMonthViewPrivate *priv = gcal_month_view_get_instance_private (month_view);
|
||||||
|
|
||||||
|
priv->current_date = current_date;
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (month_view));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gcal_month_view_set_first_weekday:
|
* gcal_month_view_set_first_weekday:
|
||||||
* @view: A #GcalMonthView instance
|
* @view: A #GcalMonthView instance
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ struct _GcalMonthViewClass
|
|||||||
|
|
||||||
GType gcal_month_view_get_type (void);
|
GType gcal_month_view_get_type (void);
|
||||||
GtkWidget* gcal_month_view_new (void);
|
GtkWidget* gcal_month_view_new (void);
|
||||||
|
void gcal_month_view_set_current_date (GcalMonthView *month_view,
|
||||||
|
icaltimetype *current_date);
|
||||||
void gcal_month_view_set_first_weekday (GcalMonthView *view,
|
void gcal_month_view_set_first_weekday (GcalMonthView *view,
|
||||||
gint day_nr);
|
gint day_nr);
|
||||||
void gcal_month_view_set_use_24h_format (GcalMonthView *view,
|
void gcal_month_view_set_use_24h_format (GcalMonthView *view,
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ update_current_date (GcalWindow *window)
|
|||||||
*(priv->current_date) = icaltime_current_time_with_zone (gcal_manager_get_system_timezone (priv->manager));
|
*(priv->current_date) = icaltime_current_time_with_zone (gcal_manager_get_system_timezone (priv->manager));
|
||||||
*(priv->current_date) = icaltime_set_timezone (priv->current_date, gcal_manager_get_system_timezone (priv->manager));
|
*(priv->current_date) = icaltime_set_timezone (priv->current_date, gcal_manager_get_system_timezone (priv->manager));
|
||||||
|
|
||||||
|
gcal_month_view_set_current_date (GCAL_MONTH_VIEW (priv->month_view), priv->current_date);
|
||||||
gcal_year_view_set_current_date (GCAL_YEAR_VIEW (priv->year_view), priv->current_date);
|
gcal_year_view_set_current_date (GCAL_YEAR_VIEW (priv->year_view), priv->current_date);
|
||||||
|
|
||||||
seconds = 24 * 60 * 60 - (icaltime_as_timet (*(priv->current_date)) % (24 * 60 * 60));
|
seconds = 24 * 60 * 60 - (icaltime_as_timet (*(priv->current_date)) % (24 * 60 * 60));
|
||||||
|
|||||||
Reference in New Issue
Block a user