[gnome-calendar] event-widget: bring back alarm icon
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: bring back alarm icon
- Date: Tue, 1 Mar 2016 01:23:12 +0000 (UTC)
commit d84be66d70f14047cab6d6bb80f2933c9ae2db0c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Feb 29 22:20:52 2016 -0300
event-widget: bring back alarm icon
src/gcal-event-widget.c | 49 ++--------------------------------------------
src/gcal-event.c | 16 +++++++++++++++
src/gcal-event.h | 2 +
3 files changed, 21 insertions(+), 46 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index be1ca5b..7948b92 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -31,7 +31,6 @@ struct _GcalEventWidget
GDateTime *dt_end;
/* internal data */
- gboolean has_reminders : 1;
gboolean read_only : 1;
gchar *css_class;
@@ -47,7 +46,7 @@ enum
PROP_DATE_END,
PROP_DATE_START,
PROP_EVENT,
- PROP_HAS_REMINDERS
+ NUM_PROPS
};
enum
@@ -202,14 +201,6 @@ gcal_event_widget_set_property (GObject *object,
gcal_event_widget_set_event_internal (self, g_value_get_object (value));
break;
- case PROP_HAS_REMINDERS:
- if (self->has_reminders != g_value_get_boolean (value))
- {
- self->has_reminders = g_value_get_boolean (value);
- g_object_notify (object, "has-reminders");
- }
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -237,10 +228,6 @@ gcal_event_widget_get_property (GObject *object,
g_value_set_object (value, self->event);
break;
- case PROP_HAS_REMINDERS:
- g_value_set_boolean (value, self->has_reminders);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -462,7 +449,7 @@ gcal_event_widget_draw (GtkWidget *widget,
icon_size = 4 * (layout_height / 4);
left_gap = 0;
- if (self->has_reminders)
+ if (gcal_event_has_alarms (self->event))
{
left_gap = icon_size + padding.left;
pango_layout_set_width (layout, (width - (left_gap + padding.left + padding.right) ) * PANGO_SCALE);
@@ -478,7 +465,7 @@ gcal_event_widget_draw (GtkWidget *widget,
gtk_render_layout (context, cr, padding.left + left_gap, padding.top, layout);
/* render reminder icon */
- if (self->has_reminders)
+ if (gcal_event_has_alarms (self->event))
{
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
@@ -628,19 +615,6 @@ gcal_event_widget_class_init(GcalEventWidgetClass *klass)
GCAL_TYPE_EVENT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- /**
- * GcalEventWidget::has-reminders:
- *
- * Whether the event has reminders or not.
- */
- g_object_class_install_property (object_class,
- PROP_HAS_REMINDERS,
- g_param_spec_boolean ("has-reminders",
- "Event has reminders",
- "Wheter the event has reminders set or not",
- FALSE,
- G_PARAM_READWRITE));
-
signals[ACTIVATE] = g_signal_new ("activate",
GCAL_TYPE_EVENT_WIDGET,
G_SIGNAL_RUN_LAST,
@@ -677,23 +651,6 @@ gcal_event_widget_get_read_only (GcalEventWidget *event)
return event->read_only;
}
-void
-gcal_event_widget_set_has_reminders (GcalEventWidget *event,
- gboolean has_reminders)
-{
- g_return_if_fail (GCAL_IS_EVENT_WIDGET (event));
-
- g_object_set (event, "has-reminders", has_reminders, NULL);
-}
-
-gboolean
-gcal_event_widget_get_has_reminders (GcalEventWidget *event)
-{
- g_return_val_if_fail (GCAL_IS_EVENT_WIDGET (event), FALSE);
-
- return event->has_reminders;
-}
-
/**
* gcal_event_widget_get_date_end:
* @self: a #GcalEventWidget
diff --git a/src/gcal-event.c b/src/gcal-event.c
index 4260394..45dd9fa 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -813,6 +813,22 @@ gcal_event_set_description (GcalEvent *self,
}
/**
+ * gcal_event_has_alarms:
+ * @self: a #GcalEvent
+ *
+ * Retrieves whether the event has alarms or not.
+ *
+ * Returns: %TRUE if @event has alarms, %FALSE otherwise.
+ */
+gboolean
+gcal_event_has_alarms (GcalEvent *self)
+{
+ g_return_val_if_fail (GCAL_IS_EVENT (self), FALSE);
+
+ return e_cal_component_has_alarms (self->component);
+}
+
+/**
* gcal_event_get_location:
* @self: a #GcalEvent
*
diff --git a/src/gcal-event.h b/src/gcal-event.h
index e5bb0cd..f3eca91 100644
--- a/src/gcal-event.h
+++ b/src/gcal-event.h
@@ -60,6 +60,8 @@ const gchar* gcal_event_get_description (GcalEvent
void gcal_event_set_description (GcalEvent *self,
const gchar *description);
+gboolean gcal_event_has_alarms (GcalEvent *self);
+
const gchar* gcal_event_get_location (GcalEvent *self);
void gcal_event_set_location (GcalEvent *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]