Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Suspend wallclock notifies for the duration of the re-setting of
  said wallclock.
  • Loading branch information
mtwebster committed Jun 12, 2014
1 parent 6a92a32 commit e7d7094
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions panels/datetime/cc-datetime-panel.c
Expand Up @@ -78,6 +78,8 @@ struct _CcDateTimePanelPrivate

GDateTime *date;

gboolean clock_blocked;

GSettings *settings;
gboolean clock_use_24h;

Expand All @@ -93,6 +95,10 @@ struct _CcDateTimePanelPrivate

static void update_time (CcDateTimePanel *self);

static void on_clock_changed (GnomeWallClock *clock,
GParamSpec *pspec,
CcDateTimePanel *panel);

static void
cc_date_time_panel_get_property (GObject *object,
guint property_id,
Expand Down Expand Up @@ -328,6 +334,11 @@ set_date_time_cb (CcDateTimePanel *panel)
set_time_cb,
panel);

if (priv->clock_blocked) {
g_signal_handlers_unblock_by_func (priv->clock_tracker, on_clock_changed, panel);
priv->clock_blocked = FALSE;
}

priv->set_date_time_delay_id = 0;
return FALSE;
}
Expand All @@ -342,6 +353,11 @@ queue_set_datetime (CcDateTimePanel *self)
priv->set_date_time_delay_id = 0;
}

if (!priv->clock_blocked) {
g_signal_handlers_block_by_func (priv->clock_tracker, on_clock_changed, self);
priv->clock_blocked = TRUE;
}

priv->set_date_time_delay_id = g_timeout_add (1000, (GSourceFunc)set_date_time_cb, self);
}

Expand Down Expand Up @@ -872,6 +888,7 @@ cc_date_time_panel_init (CcDateTimePanel *self)
priv = self->priv = DATE_TIME_PANEL_PRIVATE (self);

priv->set_date_time_delay_id = 0;
priv->clock_blocked = FALSE;

priv->cancellable = g_cancellable_new ();
error = NULL;
Expand Down

0 comments on commit e7d7094

Please sign in to comment.