[recipes] shopping: Stop using selected state



commit 82d5aea0baaa6f0d729ed57ab59412e1914cb347
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 27 22:09:29 2017 -0400

    shopping: Stop using selected state
    
    We don't really have any selection here.

 src/gr-shopping-page.c  |   11 +++++------
 src/gr-shopping-page.ui |    4 +++-
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/gr-shopping-page.c b/src/gr-shopping-page.c
index e887890..7aa31b6 100644
--- a/src/gr-shopping-page.c
+++ b/src/gr-shopping-page.c
@@ -296,6 +296,7 @@ remove_ingredient (GtkButton *button, GrShoppingPage *page)
 
         add_removed_row (page, unit, name);
 
+        page->active_row = NULL;
         gtk_widget_destroy (row);
 
         recount_ingredients (page);
@@ -384,12 +385,10 @@ set_active_row (GrShoppingPage *page,
 }
 
 static void
-selected_rows_changed (GtkListBox     *list,
-                       GrShoppingPage *page)
+row_activated (GtkListBox     *list,
+               GtkListBoxRow  *row,
+               GrShoppingPage *page)
 {
-        GtkListBoxRow *row;
-
-        row = gtk_list_box_get_selected_row (list);
         set_active_row (page, GTK_WIDGET (row));
 }
 
@@ -852,7 +851,7 @@ gr_shopping_page_class_init (GrShoppingPageClass *klass)
         gtk_widget_class_bind_template_callback (widget_class, clear_list);
         gtk_widget_class_bind_template_callback (widget_class, print_list);
         gtk_widget_class_bind_template_callback (widget_class, share_list);
-        gtk_widget_class_bind_template_callback (widget_class, selected_rows_changed);
+        gtk_widget_class_bind_template_callback (widget_class, row_activated);
         gtk_widget_class_bind_template_callback (widget_class, removed_row_activated);
 }
 
diff --git a/src/gr-shopping-page.ui b/src/gr-shopping-page.ui
index 3c22e8a..6f1e5d7 100644
--- a/src/gr-shopping-page.ui
+++ b/src/gr-shopping-page.ui
@@ -77,7 +77,9 @@
               <object class="GtkListBox" id="ingredients_list">
                 <property name="visible">1</property>
                 <property name="margin-bottom">10</property>
-                <signal name="selected-rows-changed" handler="selected_rows_changed"/>
+                <property name="selection-mode">none</property>
+                <property name="activate-on-single-click">1</property>
+                <signal name="row-activated" handler="row_activated"/>
                 <style>
                   <class name="frame"/>
                 </style>


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