[gnome-todo/wip/gbsneto/row-header-improvements: 3/4] task-row: Toggle row when activating it
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/row-header-improvements: 3/4] task-row: Toggle row when activating it
- Date: Sun, 29 Oct 2017 19:06:04 +0000 (UTC)
commit 4021e7ea05d79dbdfe4e8f1d209df9ea42405561
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Oct 29 17:02:16 2017 -0200
task-row: Toggle row when activating it
This commit implements the behavior of toggling the
expanded/collapsed state of the rows when the row is
activated, and also remove the hack of expanding the
row when it gets focused.
src/gtd-task-list-view.c | 6 +++++-
src/gtd-task-row.c | 14 +-------------
2 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index bcfb2c9..6d18209 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -829,7 +829,11 @@ listbox_row_activated (GtkListBox *listbox,
if (!GTD_IS_TASK_ROW (row))
return;
- set_active_row (self, GTK_WIDGET (row));
+ /* Toggle the row */
+ if (gtd_task_row_get_active (GTD_TASK_ROW (row)))
+ set_active_row (self, NULL);
+ else
+ set_active_row (self, GTK_WIDGET (row));
}
static void
diff --git a/src/gtd-task-row.c b/src/gtd-task-row.c
index 090fd36..64c2869 100644
--- a/src/gtd-task-row.c
+++ b/src/gtd-task-row.c
@@ -437,15 +437,6 @@ gtd_task_row__key_press_event (GtkWidget *row,
return FALSE;
}
-static gboolean
-gtd_task_row_focus_in_event (GtkWidget *widget,
- GdkEventFocus *event)
-{
- gtd_task_row_set_active (GTD_TASK_ROW (widget), TRUE);
-
- return GDK_EVENT_PROPAGATE;
-}
-
/*
* GObject overrides
@@ -538,7 +529,6 @@ gtd_task_row_class_init (GtdTaskRowClass *klass)
object_class->get_property = gtd_task_row_get_property;
object_class->set_property = gtd_task_row_set_property;
- widget_class->focus_in_event = gtd_task_row_focus_in_event;
widget_class->key_press_event = gtd_task_row__key_press_event;
widget_class->get_preferred_width = gtd_row_get_preferred_width_with_max;
@@ -649,6 +639,7 @@ static void
gtd_task_row_init (GtdTaskRow *self)
{
self->handle_subtasks = TRUE;
+ self->active = FALSE;
gtk_widget_init_template (GTK_WIDGET (self));
@@ -896,9 +887,6 @@ gtd_task_row_set_active (GtdTaskRow *self,
gtk_style_context_remove_class (context, "active");
/* And the listbox */
- gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (self), !active);
- gtk_widget_set_can_focus (GTK_WIDGET (self), !active);
-
gtk_revealer_set_reveal_child (GTK_REVEALER (self->edit_panel_revealer), active);
if (active)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]