[gnome-todo] edit-panel: Trap textview clicks



commit ca69a2fbf71fa6666ecd0cc311f9ccc4b9a01142
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Oct 30 22:37:21 2017 -0200

    edit-panel: Trap textview clicks
    
    Otherwise, if they bubble up, GtkListBox interprets it
    as a row activation and screws everything up.

 data/ui/edit-pane.ui | 2 ++
 src/gtd-edit-pane.c  | 9 +++++++++
 2 files changed, 11 insertions(+)
---
diff --git a/data/ui/edit-pane.ui b/data/ui/edit-pane.ui
index 11766df..9cba8b1 100644
--- a/data/ui/edit-pane.ui
+++ b/data/ui/edit-pane.ui
@@ -67,6 +67,8 @@
                     <property name="right-margin">6</property>
                     <property name="pixels-above-lines">6</property>
                     <property name="wrap-mode">word-char</property>
+                    <signal name="button-press-event" handler="trap_textview_clicks_cb" swapped="no" 
after="yes" />
+                    <signal name="button-release-event" handler="trap_textview_clicks_cb" swapped="no" 
after="yes" />
                   </object>
                 </child>
               </object>
diff --git a/src/gtd-edit-pane.c b/src/gtd-edit-pane.c
index c1d1160..7400542 100644
--- a/src/gtd-edit-pane.c
+++ b/src/gtd-edit-pane.c
@@ -192,6 +192,14 @@ date_selected_cb (GtkCalendar *calendar,
   g_free (text);
 }
 
+static gboolean
+trap_textview_clicks_cb (GtkWidget   *textview,
+                         GdkEvent    *event,
+                         GtdEditPane *self)
+{
+  return GDK_EVENT_STOP;
+}
+
 static void
 gtd_edit_pane_finalize (GObject *object)
 {
@@ -301,6 +309,7 @@ gtd_edit_pane_class_init (GtdEditPaneClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, gtd_edit_pane__no_date_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, today_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, tomorrow_button_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, trap_textview_clicks_cb);
 
   gtk_widget_class_set_css_name (widget_class, "editpane");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]