[gnome-online-accounts/gnome-3-8] alarm: Consolidate clear_scheduled_time*_wakeups into one function
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-8] alarm: Consolidate clear_scheduled_time*_wakeups into one function
- Date: Tue, 12 Nov 2013 17:13:31 +0000 (UTC)
commit c4f25c45758875a430af39663b3f8b81091320f1
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Nov 12 11:00:05 2013 +0100
alarm: Consolidate clear_scheduled_time*_wakeups into one function
Since we are using the same GSource pointer for TIMER and TIMEOUT
alarms, there is no reason to continue having separate functions.
Fixes: https://bugzilla.gnome.org/711696
src/goaidentity/goaalarm.c | 52 ++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 35 deletions(-)
---
diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
index 9e0ab64..ed805d7 100644
--- a/src/goaidentity/goaalarm.c
+++ b/src/goaidentity/goaalarm.c
@@ -90,49 +90,31 @@ clear_scheduled_immediate_wakeup (GoaAlarm *self)
}
static void
-clear_scheduled_timer_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
-{
- GError *error;
- gboolean is_closed;
-
- g_source_destroy (source);
-
- error = NULL;
- is_closed = g_input_stream_close (stream, NULL, &error);
-
- if (!is_closed)
- {
- goa_warning ("GoaAlarm: could not close timer stream: %s", error->message);
- g_error_free (error);
- }
-
- g_object_unref (stream);
-}
-
-static void
-clear_scheduled_timeout_wakeups (GoaAlarm *self, GSource *source)
-{
- g_source_destroy (source);
-}
-
-static void
clear_scheduled_wakeups (GoaAlarm *self, GSource *source, GInputStream *stream)
{
g_rec_mutex_lock (&self->priv->lock);
clear_scheduled_immediate_wakeup (self);
- switch (self->priv->type)
+ if (self->priv->type != GOA_ALARM_TYPE_UNSCHEDULED)
{
- case GOA_ALARM_TYPE_TIMER:
- clear_scheduled_timer_wakeups (self, source, stream);
- break;
+ g_source_destroy (source);
- case GOA_ALARM_TYPE_TIMEOUT:
- clear_scheduled_timeout_wakeups (self, source);
- break;
+ if (stream != NULL)
+ {
+ GError *error;
+ gboolean is_closed;
- default:
- break;
+ error = NULL;
+ is_closed = g_input_stream_close (stream, NULL, &error);
+
+ if (!is_closed)
+ {
+ goa_warning ("GoaAlarm: could not close timer stream: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (stream);
+ }
}
g_clear_pointer (&self->priv->previous_wakeup_time,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]