[gnome-todo] edit-pane: Simplify code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] edit-pane: Simplify code
- Date: Mon, 17 Feb 2020 17:34:53 +0000 (UTC)
commit 69b746d8115664a8c7419496ab4f9b7762eeed02
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Feb 12 20:15:01 2020 -0300
edit-pane: Simplify code
src/task-list-view/gtd-edit-pane.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/src/task-list-view/gtd-edit-pane.c b/src/task-list-view/gtd-edit-pane.c
index ee2efa7..2f86ff2 100644
--- a/src/task-list-view/gtd-edit-pane.c
+++ b/src/task-list-view/gtd-edit-pane.c
@@ -71,31 +71,20 @@ static void on_date_selected_cb (GtkCalendar
static void
update_date_widgets (GtdEditPane *self)
{
- GDateTime *dt;
+ g_autoptr (GDateTime) dt = NULL;
gchar *text;
g_return_if_fail (GTD_IS_EDIT_PANE (self));
- dt = self->task ? gtd_task_get_due_date (self->task) : NULL;
+ dt = self->task ? g_date_time_ref (gtd_task_get_due_date (self->task)) : NULL;
text = dt ? g_date_time_format (dt, "%x") : NULL;
g_signal_handlers_block_by_func (self->calendar, on_date_selected_cb, self);
- if (dt)
- {
- gtk_calendar_select_day (self->calendar, dt);
-
- }
- else
- {
- GDateTime *today;
+ if (!dt)
+ dt = g_date_time_new_now_local ();
- today = g_date_time_new_now_local ();
-
- gtk_calendar_select_day (self->calendar, dt);
-
- g_clear_pointer (&today, g_date_time_unref);
- }
+ gtk_calendar_select_day (self->calendar, dt);
g_signal_handlers_unblock_by_func (self->calendar, on_date_selected_cb, self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]