[gnome-calendar] month-view: highlight current date properly
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: highlight current date properly
- Date: Wed, 28 Jan 2015 20:59:18 +0000 (UTC)
commit 88e95081c5ea39a62e4a3c07678ccf72483a6521
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Wed Jan 28 15:54:16 2015 -0500
month-view: highlight current date properly
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=703323
src/gcal-month-view.c | 15 ++++++++++++++-
src/gcal-month-view.h | 2 ++
src/gcal-window.c | 1 +
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index a090cbe..50e23c3 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -73,6 +73,8 @@ typedef struct
/* text direction factors */
gint k;
+ icaltimetype *current_date;
+
/* property */
icaltimetype *date;
} GcalMonthViewPrivate;
@@ -1214,7 +1216,8 @@ gcal_month_view_draw (GtkWidget *widget,
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;
PangoFontDescription *cfont_desc;
@@ -1704,6 +1707,16 @@ gcal_month_view_new (void)
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:
* @view: A #GcalMonthView instance
diff --git a/src/gcal-month-view.h b/src/gcal-month-view.h
index 2903d5f..9b615d7 100644
--- a/src/gcal-month-view.h
+++ b/src/gcal-month-view.h
@@ -47,6 +47,8 @@ struct _GcalMonthViewClass
GType gcal_month_view_get_type (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,
gint day_nr);
void gcal_month_view_set_use_24h_format (GcalMonthView *view,
diff --git a/src/gcal-window.c b/src/gcal-window.c
index f688ecb..8a922f7 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -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_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);
seconds = 24 * 60 * 60 - (icaltime_as_timet (*(priv->current_date)) % (24 * 60 * 60));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]