mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-04 20:07:36 +00:00
record-row: Prefer g_autoptr for GDateTime
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/755>
This commit is contained in:
parent
03a50260ec
commit
3b1cf7b5ee
1 changed files with 11 additions and 18 deletions
|
@ -132,7 +132,9 @@ static gboolean date_change_cb (CallsCallRecordRow *self);
|
||||||
static void
|
static void
|
||||||
setup_date_change_timeout (CallsCallRecordRow *self)
|
setup_date_change_timeout (CallsCallRecordRow *self)
|
||||||
{
|
{
|
||||||
GDateTime *gnow, *gnextday, *gtomorrow;
|
g_autoptr (GDateTime) gnow = NULL;
|
||||||
|
g_autoptr (GDateTime) gnextday = NULL;
|
||||||
|
g_autoptr (GDateTime) gtomorrow = NULL;
|
||||||
struct timeval now, tomorrow, delta;
|
struct timeval now, tomorrow, delta;
|
||||||
int err;
|
int err;
|
||||||
guint interval;
|
guint interval;
|
||||||
|
@ -142,7 +144,6 @@ setup_date_change_timeout (CallsCallRecordRow *self)
|
||||||
|
|
||||||
// Get the next day
|
// Get the next day
|
||||||
gnextday = g_date_time_add_days (gnow, 1);
|
gnextday = g_date_time_add_days (gnow, 1);
|
||||||
g_date_time_unref (gnow);
|
|
||||||
|
|
||||||
// Get the start of the next day
|
// Get the start of the next day
|
||||||
gtomorrow =
|
gtomorrow =
|
||||||
|
@ -153,12 +154,10 @@ setup_date_change_timeout (CallsCallRecordRow *self)
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0.0);
|
0.0);
|
||||||
g_date_time_unref (gnextday);
|
|
||||||
|
|
||||||
// Convert to a timeval
|
// Convert to a timeval
|
||||||
tomorrow.tv_sec = g_date_time_to_unix (gtomorrow);
|
tomorrow.tv_sec = g_date_time_to_unix (gtomorrow);
|
||||||
tomorrow.tv_usec = 0;
|
tomorrow.tv_usec = 0;
|
||||||
g_date_time_unref (gtomorrow);
|
|
||||||
|
|
||||||
// Get the precise time now
|
// Get the precise time now
|
||||||
err = gettimeofday (&now, NULL);
|
err = gettimeofday (&now, NULL);
|
||||||
|
@ -188,7 +187,7 @@ setup_date_change_timeout (CallsCallRecordRow *self)
|
||||||
static gboolean
|
static gboolean
|
||||||
date_change_cb (CallsCallRecordRow *self)
|
date_change_cb (CallsCallRecordRow *self)
|
||||||
{
|
{
|
||||||
GDateTime *end;
|
g_autoptr (GDateTime) end = NULL;
|
||||||
gboolean final;
|
gboolean final;
|
||||||
|
|
||||||
g_object_get (self->record,
|
g_object_get (self->record,
|
||||||
|
@ -197,7 +196,6 @@ date_change_cb (CallsCallRecordRow *self)
|
||||||
g_assert (end != NULL);
|
g_assert (end != NULL);
|
||||||
|
|
||||||
update_time_text (self, end, &final);
|
update_time_text (self, end, &final);
|
||||||
g_date_time_unref (end);
|
|
||||||
|
|
||||||
if (final)
|
if (final)
|
||||||
self->date_change_timeout = 0;
|
self->date_change_timeout = 0;
|
||||||
|
@ -233,9 +231,9 @@ notify_time_cb (CallsCallRecordRow *self,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
CallsCallRecord *record)
|
CallsCallRecord *record)
|
||||||
{
|
{
|
||||||
|
g_autoptr (GDateTime) answered = NULL;
|
||||||
|
g_autoptr (GDateTime) end = NULL;
|
||||||
gboolean inbound;
|
gboolean inbound;
|
||||||
GDateTime *answered;
|
|
||||||
GDateTime *end;
|
|
||||||
|
|
||||||
g_object_get (G_OBJECT (self->record),
|
g_object_get (G_OBJECT (self->record),
|
||||||
"inbound", &inbound,
|
"inbound", &inbound,
|
||||||
|
@ -245,14 +243,11 @@ notify_time_cb (CallsCallRecordRow *self,
|
||||||
|
|
||||||
update_time (self, inbound, answered, end);
|
update_time (self, inbound, answered, end);
|
||||||
|
|
||||||
if (answered) {
|
if (answered)
|
||||||
g_date_time_unref (answered);
|
|
||||||
calls_clear_signal (record, &self->answered_notify_handler_id);
|
calls_clear_signal (record, &self->answered_notify_handler_id);
|
||||||
}
|
|
||||||
if (end) {
|
if (end)
|
||||||
g_date_time_unref (end);
|
|
||||||
calls_clear_signal (record, &self->end_notify_handler_id);
|
calls_clear_signal (record, &self->end_notify_handler_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,8 +429,8 @@ constructed (GObject *object)
|
||||||
{
|
{
|
||||||
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
||||||
gboolean inbound;
|
gboolean inbound;
|
||||||
GDateTime *answered;
|
g_autoptr (GDateTime) answered = NULL;
|
||||||
GDateTime *end;
|
g_autoptr (GDateTime) end = NULL;
|
||||||
g_autofree char *protocol = NULL;
|
g_autofree char *protocol = NULL;
|
||||||
g_autofree char *action_name = NULL;
|
g_autofree char *action_name = NULL;
|
||||||
g_autofree char *target = NULL;
|
g_autofree char *target = NULL;
|
||||||
|
@ -466,8 +461,6 @@ constructed (GObject *object)
|
||||||
"(ss)", target, "");
|
"(ss)", target, "");
|
||||||
|
|
||||||
setup_time (self, inbound, answered, end);
|
setup_time (self, inbound, answered, end);
|
||||||
calls_date_time_unref (answered);
|
|
||||||
calls_date_time_unref (end);
|
|
||||||
|
|
||||||
setup_contact (self);
|
setup_contact (self);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue