[gtk+/wip/baedert/gtkimageview: 87/135] demo: Add 'Reset View' button



commit be2f74176038016e413c32c8c7f3a03c0805bf30
Author: Timm Bäder <mail baedert org>
Date:   Wed Feb 3 17:42:52 2016 +0100

    demo: Add 'Reset View' button

 demos/gtk-demo/image_view.c  |    9 ++++++++-
 demos/gtk-demo/image_view.ui |   17 +++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/image_view.c b/demos/gtk-demo/image_view.c
index 811a203..5ee4205 100644
--- a/demos/gtk-demo/image_view.c
+++ b/demos/gtk-demo/image_view.c
@@ -5,6 +5,14 @@
 GtkWidget *image_view;
 GtkWidget *uri_entry;
 
+
+void
+reset_view_button_clicked_cb ()
+{
+  gtk_image_view_set_scale (GTK_IMAGE_VIEW (image_view), 1.0);
+  gtk_image_view_set_angle (GTK_IMAGE_VIEW (image_view), 0.0);
+}
+
 void
 generic_cb ()
 {
@@ -27,7 +35,6 @@ file_set_cb (GtkFileChooserButton *widget,
   g_free (filename);
 }
 
-
 static void
 image_loaded_cb (GObject      *source_object,
                  GAsyncResult *result,
diff --git a/demos/gtk-demo/image_view.ui b/demos/gtk-demo/image_view.ui
index 7be80a3..1b0701f 100644
--- a/demos/gtk-demo/image_view.ui
+++ b/demos/gtk-demo/image_view.ui
@@ -291,6 +291,23 @@
           </packing>
         </child>
 
+
+        <child>
+          <object class="GtkButton" id="reset_button">
+            <property name="visible">true</property>
+            <property name="label" translatable="true">Reset View</property>
+            <property name="valign">end</property>
+            <property name="vexpand">true</property>
+            <signal name="clicked" handler="reset_view_button_clicked_cb" />
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">16</property>
+            <property name="width">2</property>
+          </packing>
+        </child>
+
+
       </object>
 
     </child>


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