[gnome-todo] task-row: Modernize codebase
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] task-row: Modernize codebase
- Date: Mon, 5 Feb 2018 14:00:47 +0000 (UTC)
commit 964d3974594a842e4f7cb65e2d95a6ee78e62c17
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Feb 5 11:59:45 2018 -0200
task-row: Modernize codebase
This also fixes a crash introduced by the previous commit.
data/ui/task-row.ui | 30 ++--
src/gtd-task-row.c | 420 +++++++++++++++++++++++++++-------------------------
src/gtd-task-row.h | 3 -
3 files changed, 235 insertions(+), 218 deletions(-)
---
diff --git a/data/ui/task-row.ui b/data/ui/task-row.ui
index f9fbe1a..9dee5c9 100644
--- a/data/ui/task-row.ui
+++ b/data/ui/task-row.ui
@@ -42,12 +42,12 @@
<child>
<object class="GtkEventBox" id="dnd_event_box">
<property name="visible">True</property>
- <signal name="button-press-event" handler="button_press_event" object="GtdTaskRow"
swapped="no" />
- <signal name="drag-begin" handler="drag_begin_cb" object="GtdTaskRow" swapped="no" />
- <signal name="drag-end" handler="drag_end_cb" object="GtdTaskRow" swapped="no" />
- <signal name="drag-failed" handler="drag_failed_cb" object="GtdTaskRow" swapped="no" />
- <signal name="enter-notify-event" handler="mouse_over_dnd_event_cb" object="GtdTaskRow"
swapped="no" />
- <signal name="leave-notify-event" handler="mouse_out_dnd_event_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="button-press-event" handler="on_button_press_event_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="drag-begin" handler="on_drag_begin_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-end" handler="on_drag_end_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-failed" handler="on_drag_failed_cb" object="GtdTaskRow" swapped="no"
/>
+ <signal name="enter-notify-event" handler="on_mouse_over_dnd_event_cb"
object="GtdTaskRow" swapped="no" />
+ <signal name="leave-notify-event" handler="on_mouse_out_dnd_event_cb"
object="GtdTaskRow" swapped="no" />
<child>
<object class="GtkImage" id="dnd_icon">
<property name="visible">True</property>
@@ -72,19 +72,19 @@
<property name="vexpand">True</property>
<property name="draw_indicator">True</property>
<property name="margin-start">6</property>
- <signal name="toggled" handler="complete_check_toggled_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="toggled" handler="on_complete_check_toggled_cb" object="GtdTaskRow"
swapped="no" />
</object>
</child>
<child>
<object class="GtkEventBox" id="header_event_box">
<property name="visible">True</property>
- <signal name="button-press-event" handler="button_press_event" object="GtdTaskRow"
swapped="no" />
- <signal name="drag-begin" handler="drag_begin_cb" object="GtdTaskRow" swapped="no" />
- <signal name="drag-end" handler="drag_end_cb" object="GtdTaskRow" swapped="no" />
- <signal name="drag-failed" handler="drag_failed_cb" object="GtdTaskRow" swapped="no" />
- <signal name="enter-notify-event" handler="mouse_over_event_cb" object="GtdTaskRow"
swapped="no" />
- <signal name="leave-notify-event" handler="mouse_out_event_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="button-press-event" handler="on_button_press_event_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="drag-begin" handler="on_drag_begin_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-end" handler="on_drag_end_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-failed" handler="on_drag_failed_cb" object="GtdTaskRow" swapped="no"
/>
+ <signal name="enter-notify-event" handler="on_mouse_over_event_cb" object="GtdTaskRow"
swapped="no" />
+ <signal name="leave-notify-event" handler="on_mouse_out_event_cb" object="GtdTaskRow"
swapped="no" />
<child>
<object class="GtkBox">
<property name="visible">True</property>
@@ -140,7 +140,7 @@
<object class="GtkButton" id="toggle_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <signal name="clicked" handler="toggle_active_cb" object="GtdTaskRow" swapped="no"/>
+ <signal name="clicked" handler="on_toggle_active_cb" object="GtdTaskRow" swapped="no"/>
<style>
<class name="flat" />
<class name="close-button" />
@@ -169,7 +169,7 @@
<object class="GtdEditPane" id="edit_panel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="remove-task" handler="remove_task_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="remove-task" handler="on_remove_task_cb" object="GtdTaskRow" swapped="no"
/>
</object>
</child>
</object>
diff --git a/src/gtd-task-row.c b/src/gtd-task-row.c
index 9c8b0f8..1c43d80 100644
--- a/src/gtd-task-row.c
+++ b/src/gtd-task-row.c
@@ -18,6 +18,7 @@
#define G_LOG_DOMAIN "GtdTaskRow"
+#include "gtd-debug.h"
#include "gtd-edit-pane.h"
#include "gtd-expandable-entry.h"
#include "gtd-manager.h"
@@ -68,6 +69,26 @@ struct _GtdTaskRow
#define PRIORITY_ICON_SIZE 8
+static void on_complete_changed_cb (GtdTaskRow *self,
+ GParamSpec *pspec,
+ GtdTask *task);
+
+static void on_complete_check_toggled_cb (GtkToggleButton *button,
+ GtdTaskRow *self);
+
+static void on_depth_changed_cb (GtdTaskRow *self,
+ GParamSpec *pspec,
+ GtdTask *task);
+
+static void on_priority_changed_cb (GtdTaskRow *row,
+ GParamSpec *spec,
+ GObject *object);
+
+static void on_task_title_changed_cb (GtdTaskRow *self);
+
+static void on_toggle_active_cb (GtkWidget *button,
+ GtdTaskRow *self);
+
G_DEFINE_TYPE (GtdTaskRow, gtd_task_row, GTK_TYPE_LIST_BOX_ROW)
@@ -94,6 +115,63 @@ static guint signals[NUM_SIGNALS] = { 0, };
* Auxiliary methods
*/
+static gboolean
+date_to_label_binding_cb (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ g_autofree gchar *new_label = NULL;
+ GDateTime *dt;
+
+ g_return_val_if_fail (GTD_IS_TASK_ROW (user_data), FALSE);
+
+ dt = g_value_get_boxed (from_value);
+
+ if (dt)
+ {
+ g_autoptr (GDateTime) today = g_date_time_new_now_local ();
+
+ if (g_date_time_get_year (dt) == g_date_time_get_year (today) &&
+ g_date_time_get_month (dt) == g_date_time_get_month (today))
+ {
+ if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today))
+ {
+ new_label = g_strdup (_("Today"));
+ }
+ else if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today) + 1)
+ {
+ new_label = g_strdup (_("Tomorrow"));
+ }
+ else if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today) - 1)
+ {
+ new_label = g_strdup (_("Yesterday"));
+ }
+ else if (g_date_time_get_day_of_year (dt) > g_date_time_get_day_of_month (today) &&
+ g_date_time_get_day_of_year (dt) < g_date_time_get_day_of_month (today) + 7)
+ {
+ new_label = g_date_time_format (dt, "%A");
+ }
+ else
+ {
+ new_label = g_date_time_format (dt, "%x");
+ }
+ }
+ else
+ {
+ new_label = g_date_time_format (dt, "%x");
+ }
+ }
+ else
+ {
+ new_label = g_strdup ("");
+ }
+
+ g_value_set_string (to_value, new_label);
+
+ return TRUE;
+}
+
static GtkWidget*
create_transient_row (GtdTaskRow *self)
{
@@ -134,14 +212,84 @@ set_cursor (GtkWidget *widget,
g_clear_object (&cursor);
}
+static void
+gtd_task_row_set_task (GtdTaskRow *row,
+ GtdTask *task)
+{
+ g_return_if_fail (GTD_IS_TASK_ROW (row));
+
+ if (!g_set_object (&row->task, task))
+ return;
+
+ if (task)
+ {
+ gtk_label_set_label (row->task_list_label, gtd_task_list_get_name (gtd_task_get_list (task)));
+
+ g_signal_handlers_block_by_func (row->title_entry, on_task_title_changed_cb, row);
+ g_signal_handlers_block_by_func (row->done_check, on_complete_check_toggled_cb, row);
+
+ g_object_bind_property (task,
+ "title",
+ row->title_entry,
+ "text",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (task,
+ "complete",
+ row->done_check,
+ "active",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property_full (task,
+ "due-date",
+ row->task_date_label,
+ "label",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
+ date_to_label_binding_cb,
+ NULL,
+ row,
+ NULL);
+
+ /*
+ * Here we generate a false callback call just to reuse the method to
+ * sync the initial state of the priority icon.
+ */
+ on_priority_changed_cb (row, NULL, G_OBJECT (task));
+ g_signal_connect_swapped (task,
+ "notify::priority",
+ G_CALLBACK (on_priority_changed_cb),
+ row);
+
+ on_complete_changed_cb (row, NULL, task);
+ g_signal_connect_swapped (task,
+ "notify::complete",
+ G_CALLBACK (on_complete_changed_cb),
+ row);
+
+ on_depth_changed_cb (row, NULL, task);
+ g_signal_connect_swapped (task,
+ "notify::depth",
+ G_CALLBACK (on_depth_changed_cb),
+ row);
+
+ g_signal_handlers_unblock_by_func (row->done_check, on_complete_check_toggled_cb, row);
+ g_signal_handlers_block_by_func (row->title_entry, on_task_title_changed_cb, row);
+
+ gtd_edit_pane_set_task (GTD_EDIT_PANE (row->edit_panel), task);
+ }
+
+ g_object_notify (G_OBJECT (row), "task");
+}
+
+
/*
* Callbacks
*/
static void
-toggle_active_cb (GtkWidget *button,
- GtdTaskRow *self)
+on_toggle_active_cb (GtkWidget *button,
+ GtdTaskRow *self)
{
if (self->active)
gtd_manager_update_task (gtd_manager_get_default (), self->task);
@@ -150,17 +298,17 @@ toggle_active_cb (GtkWidget *button,
}
static void
-remove_task_cb (GtdEditPane *edit_panel,
- GtdTask *task,
- GtdTaskRow *self)
+on_remove_task_cb (GtdEditPane *edit_panel,
+ GtdTask *task,
+ GtdTaskRow *self)
{
g_signal_emit (self, signals[REMOVE_TASK], 0);
}
static gboolean
-mouse_out_event_cb (GtkWidget *widget,
- GdkEvent *event,
- GtdTaskRow *self)
+on_mouse_out_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ GtdTaskRow *self)
{
set_cursor (widget, NULL);
@@ -168,9 +316,9 @@ mouse_out_event_cb (GtkWidget *widget,
}
static gboolean
-mouse_over_event_cb (GtkWidget *widget,
- GdkEvent *event,
- GtdTaskRow *self)
+on_mouse_over_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ GtdTaskRow *self)
{
set_cursor (widget, "pointer");
@@ -179,9 +327,9 @@ mouse_over_event_cb (GtkWidget *widget,
static gboolean
-mouse_out_dnd_event_cb (GtkWidget *widget,
- GdkEvent *event,
- GtdTaskRow *self)
+on_mouse_out_dnd_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ GtdTaskRow *self)
{
set_cursor (widget, NULL);
@@ -189,9 +337,9 @@ mouse_out_dnd_event_cb (GtkWidget *widget,
}
static gboolean
-mouse_over_dnd_event_cb (GtkWidget *widget,
- GdkEvent *event,
- GtdTaskRow *self)
+on_mouse_over_dnd_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ GtdTaskRow *self)
{
set_cursor (widget, "grab");
@@ -199,9 +347,9 @@ mouse_over_dnd_event_cb (GtkWidget *widget,
}
static gboolean
-button_press_event (GtkWidget *widget,
- GdkEventButton *event,
- GtdTaskRow *self)
+on_button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ GtdTaskRow *self)
{
gint real_x;
gint real_y;
@@ -220,9 +368,9 @@ button_press_event (GtkWidget *widget,
}
static void
-drag_begin_cb (GtkWidget *event_box,
- GdkDragContext *context,
- GtdTaskRow *self)
+on_drag_begin_cb (GtkWidget *event_box,
+ GdkDragContext *context,
+ GtdTaskRow *self)
{
GtkWidget *widget, *new_row;
gint x_offset;
@@ -251,19 +399,19 @@ drag_begin_cb (GtkWidget *event_box,
}
static void
-drag_end_cb (GtkWidget *event_box,
- GdkDragContext *context,
- GtdTaskRow *self)
+on_drag_end_cb (GtkWidget *event_box,
+ GdkDragContext *context,
+ GtdTaskRow *self)
{
set_cursor (GTK_WIDGET (self), NULL);
gtk_widget_show (GTK_WIDGET (self));
}
static gboolean
-drag_failed_cb (GtkWidget *widget,
- GdkDragContext *context,
- GtkDragResult result,
- GtdTaskRow *self)
+on_drag_failed_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkDragResult result,
+ GtdTaskRow *self)
{
set_cursor (GTK_WIDGET (self), NULL);
gtk_widget_show (GTK_WIDGET (self));
@@ -272,9 +420,9 @@ drag_failed_cb (GtkWidget *widget,
}
static void
-priority_changed_cb (GtdTaskRow *row,
- GParamSpec *spec,
- GObject *object)
+on_priority_changed_cb (GtdTaskRow *row,
+ GParamSpec *spec,
+ GObject *object)
{
GtkStyleContext *context;
gint priority;
@@ -310,9 +458,9 @@ priority_changed_cb (GtdTaskRow *row,
}
static void
-complete_changed_cb (GtdTaskRow *self,
- GParamSpec *pspec,
- GtdTask *task)
+on_complete_changed_cb (GtdTaskRow *self,
+ GParamSpec *pspec,
+ GtdTask *task)
{
GtkStyleContext *context;
@@ -325,23 +473,22 @@ complete_changed_cb (GtdTaskRow *self,
}
static void
-toggle_complete_cb (GtkRevealer *revealer,
- GParamSpec *pspec,
- GtdTaskRow *self)
+on_toggle_complete_cb (GtkRevealer *revealer,
+ GParamSpec *pspec,
+ GtdTaskRow *self)
{
- g_signal_handlers_disconnect_by_func (revealer, toggle_complete_cb, self);
+ g_signal_handlers_disconnect_by_func (revealer, on_toggle_complete_cb, self);
gtd_task_set_complete (self->task, !gtd_task_get_complete (self->task));
}
static void
-complete_check_toggled_cb (GtkToggleButton *button,
- GtdTaskRow *self)
+on_complete_check_toggled_cb (GtkToggleButton *button,
+ GtdTaskRow *self)
{
GtdTaskListView *listview;
- listview = GTD_TASK_LIST_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (self),
- GTD_TYPE_TASK_LIST_VIEW));
+ listview = GTD_TASK_LIST_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (self), GTD_TYPE_TASK_LIST_VIEW));
/*
* If the parent list view is showing completed tasks, we
@@ -359,78 +506,21 @@ complete_check_toggled_cb (GtkToggleButton *button,
g_signal_connect (self->revealer,
"notify::child-revealed",
- G_CALLBACK (toggle_complete_cb),
+ G_CALLBACK (on_toggle_complete_cb),
self);
}
static void
-depth_changed_cb (GtdTaskRow *self,
- GParamSpec *pspec,
- GtdTask *task)
+on_depth_changed_cb (GtdTaskRow *self,
+ GParamSpec *pspec,
+ GtdTask *task)
{
gtk_widget_set_margin_start (GTK_WIDGET (self),
self->handle_subtasks ? 32 * gtd_task_get_depth (task) + 3: 3);
}
static gboolean
-gtd_task_row__date_changed_binding (GBinding *binding,
- const GValue *from_value,
- GValue *to_value,
- gpointer user_data)
-{
- g_autofree gchar *new_label = NULL;
- GDateTime *dt;
-
- g_return_val_if_fail (GTD_IS_TASK_ROW (user_data), FALSE);
-
- dt = g_value_get_boxed (from_value);
-
- if (dt)
- {
- g_autoptr (GDateTime) today = g_date_time_new_now_local ();
-
- if (g_date_time_get_year (dt) == g_date_time_get_year (today) &&
- g_date_time_get_month (dt) == g_date_time_get_month (today))
- {
- if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today))
- {
- new_label = g_strdup (_("Today"));
- }
- else if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today) + 1)
- {
- new_label = g_strdup (_("Tomorrow"));
- }
- else if (g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today) - 1)
- {
- new_label = g_strdup (_("Yesterday"));
- }
- else if (g_date_time_get_day_of_year (dt) > g_date_time_get_day_of_month (today) &&
- g_date_time_get_day_of_year (dt) < g_date_time_get_day_of_month (today) + 7)
- {
- new_label = g_date_time_format (dt, "%A");
- }
- else
- {
- new_label = g_date_time_format (dt, "%x");
- }
- }
- else
- {
- new_label = g_date_time_format (dt, "%x");
- }
- }
- else
- {
- new_label = g_strdup ("");
- }
-
- g_value_set_string (to_value, new_label);
-
- return TRUE;
-}
-
-static gboolean
-gtd_task_row__destroy_cb (GtkWidget *row)
+on_destroy_cb (GtkWidget *row)
{
gtk_widget_destroy (row);
@@ -442,19 +532,25 @@ on_update_title_timeout_cb (gpointer data)
{
GtdTaskRow *self = data;
+ GTD_ENTRY;
+
gtd_manager_update_task (gtd_manager_get_default (), self->task);
self->update_title_timeout_id = 0;
- return G_SOURCE_REMOVE;
+ GTD_RETURN (G_SOURCE_REMOVE);
}
static void
on_task_title_changed_cb (GtdTaskRow *self)
{
+ GTD_ENTRY;
+
if (self->update_title_timeout_id > 0)
g_source_remove (self->update_title_timeout_id);
self->update_title_timeout_id = g_timeout_add_seconds (2, on_update_title_timeout_cb, self);
+
+ GTD_EXIT;
}
@@ -511,10 +607,9 @@ gtd_task_row_dispose (GObject *object)
if (task)
{
- g_signal_handlers_disconnect_by_func (task, depth_changed_cb, self);
- g_signal_handlers_disconnect_by_func (task, complete_changed_cb, self);
-
- g_signal_handlers_disconnect_by_func (task, priority_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (task, on_depth_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (task, on_complete_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (task, on_priority_changed_cb, self);
}
G_OBJECT_CLASS (gtd_task_row_parent_class)->dispose (object);
@@ -608,7 +703,7 @@ gtd_task_row_class_init (GtdTaskRowClass *klass)
"Task of the row",
"The task that this row represents",
GTD_TYPE_TASK,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GtdTaskRow::enter:
@@ -670,18 +765,18 @@ gtd_task_row_class_init (GtdTaskRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, title_entry);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, toggle_button);
- gtk_widget_class_bind_template_callback (widget_class, button_press_event);
- gtk_widget_class_bind_template_callback (widget_class, complete_check_toggled_cb);
- gtk_widget_class_bind_template_callback (widget_class, drag_begin_cb);
- gtk_widget_class_bind_template_callback (widget_class, drag_end_cb);
- gtk_widget_class_bind_template_callback (widget_class, drag_failed_cb);
- gtk_widget_class_bind_template_callback (widget_class, mouse_out_event_cb);
- gtk_widget_class_bind_template_callback (widget_class, mouse_out_dnd_event_cb);
- gtk_widget_class_bind_template_callback (widget_class, mouse_over_event_cb);
- gtk_widget_class_bind_template_callback (widget_class, mouse_over_dnd_event_cb);
- gtk_widget_class_bind_template_callback (widget_class, remove_task_cb);
- gtk_widget_class_bind_template_callback (widget_class, toggle_active_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_button_press_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_complete_check_toggled_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_drag_begin_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_drag_end_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_drag_failed_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_mouse_out_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_mouse_out_dnd_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_mouse_over_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_mouse_over_dnd_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_remove_task_cb);
gtk_widget_class_bind_template_callback (widget_class, on_task_title_changed_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_toggle_active_cb);
gtk_widget_class_set_css_name (widget_class, "taskrow");
}
@@ -734,81 +829,6 @@ gtd_task_row_get_task (GtdTaskRow *row)
return row->task;
}
-/**
- * gtd_task_row_set_task:
- * @row: a #GtdTaskRow
- * @task: a #GtdTask
- *
- * Sets the internal #GtdTask of @row. The task must be set to %NULL
- * before setting GtdObject::new-task-mode to %TRUE.
- */
-void
-gtd_task_row_set_task (GtdTaskRow *row,
- GtdTask *task)
-{
- g_return_if_fail (GTD_IS_TASK_ROW (row));
-
- if (!g_set_object (&row->task, task))
- return;
-
- if (task)
- {
- gtk_label_set_label (row->task_list_label, gtd_task_list_get_name (gtd_task_get_list (task)));
-
- g_signal_handlers_block_by_func (row->done_check, complete_check_toggled_cb, row);
-
- g_object_bind_property (task,
- "title",
- row->title_entry,
- "text",
- G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (task,
- "complete",
- row->done_check,
- "active",
- G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
-
- g_object_bind_property_full (task,
- "due-date",
- row->task_date_label,
- "label",
- G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
- gtd_task_row__date_changed_binding,
- NULL,
- row,
- NULL);
-
- /*
- * Here we generate a false callback call just to reuse the method to
- * sync the initial state of the priority icon.
- */
- priority_changed_cb (row, NULL, G_OBJECT (task));
- g_signal_connect_swapped (task,
- "notify::priority",
- G_CALLBACK (priority_changed_cb),
- row);
-
- complete_changed_cb (row, NULL, task);
- g_signal_connect_swapped (task,
- "notify::complete",
- G_CALLBACK (complete_changed_cb),
- row);
-
- depth_changed_cb (row, NULL, task);
- g_signal_connect_swapped (task,
- "notify::depth",
- G_CALLBACK (depth_changed_cb),
- row);
-
- g_signal_handlers_unblock_by_func (row->done_check, complete_check_toggled_cb, row);
-
- gtd_edit_pane_set_task (GTD_EDIT_PANE (row->edit_panel), task);
- }
-
- g_object_notify (G_OBJECT (row), "task");
-}
-
/**
* gtd_task_row_set_list_name_visible:
* @row: a #GtdTaskRow
@@ -878,7 +898,7 @@ gtd_task_row_destroy (GtdTaskRow *self)
gtk_revealer_set_reveal_child (self->revealer, FALSE);
self->destroy_row_timeout_id = g_timeout_add (duration,
- (GSourceFunc) gtd_task_row__destroy_cb,
+ (GSourceFunc) on_destroy_cb,
self);
}
}
@@ -904,7 +924,7 @@ gtd_task_row_set_handle_subtasks (GtdTaskRow *self,
gtk_widget_set_visible (self->dnd_box, handle_subtasks);
gtk_widget_set_visible (self->dnd_event_box, handle_subtasks);
- depth_changed_cb (self, NULL, self->task);
+ on_depth_changed_cb (self, NULL, self->task);
if (handle_subtasks)
{
diff --git a/src/gtd-task-row.h b/src/gtd-task-row.h
index 40e850d..e8fe1e8 100644
--- a/src/gtd-task-row.h
+++ b/src/gtd-task-row.h
@@ -34,9 +34,6 @@ GtkWidget* gtd_task_row_new (GtdTask
GtdTask* gtd_task_row_get_task (GtdTaskRow *row);
-void gtd_task_row_set_task (GtdTaskRow *row,
- GtdTask *task);
-
void gtd_task_row_set_list_name_visible (GtdTaskRow *row,
gboolean show_list_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]