[simple-scan] Add a delete button to the actionbar



commit fd718e4e93a43f71c226f15625a6e1e96942f29b
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri May 19 16:02:49 2017 +1200

    Add a delete button to the actionbar

 src/app-window.ui   |   26 +++++++++++++++++++++++++-
 src/app-window.vala |    9 +++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index 9c9cfeb..ec84592 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -672,7 +672,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Crop the selected page</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for crop button">Crop 
the selected page</property>
                     <property name="use_underline">True</property>
                     <signal name="toggled" handler="crop_button_toggled_cb" swapped="no"/>
                     <child>
@@ -691,6 +691,30 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkButton" id="delete_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for delete 
button">Delete the selected page</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="delete_button_clicked_cb" swapped="no"/>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">edit-delete-symbolic</property>
+                        <property name="icon_size">1</property>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="image-button"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="position">0</property>
diff --git a/src/app-window.vala b/src/app-window.vala
index ca1369d..ccb0e57 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -90,6 +90,8 @@ public class AppWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.ToggleButton crop_button;
     [GtkChild]
+    private Gtk.Button delete_button;
+    [GtkChild]
     private Gtk.Button stop_button;
     [GtkChild]
     private Gtk.Button scan_button;
@@ -155,6 +157,7 @@ public class AppWindow : Gtk.ApplicationWindow
         {
             scanning_ = value;
             page_delete_menuitem.sensitive = !value;
+            delete_button.sensitive = !value;
             stop_scan_menuitem.sensitive = value;
             stop_toolbutton.sensitive = value;
             scan_button.visible = !value;
@@ -876,6 +879,12 @@ public class AppWindow : Gtk.ApplicationWindow
     }
 
     [GtkCallback]
+    private void delete_button_clicked_cb (Gtk.Button widget)
+    {
+        book_view.book.delete_page (book_view.selected_page);
+    }
+
+    [GtkCallback]
     private void four_by_six_menuitem_toggled_cb (Gtk.CheckMenuItem widget)
     {
         if (widget.active)


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