[gtk+/wip/baedert/gtkimageview: 194/228] demo: Add transitions-enabled switch



commit 8f4aebc6566843d02ec8e8d36df8c5515fd99fca
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 9 21:08:01 2016 +0100

    demo: Add transitions-enabled switch

 demos/gtk-demo/image_view.c          |   12 +++++++---
 demos/gtk-demo/image_view.ui         |   39 ++++++++++++++++++++++++++++-----
 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkimageview.c                   |    6 +++++
 4 files changed, 48 insertions(+), 10 deletions(-)
---
diff --git a/demos/gtk-demo/image_view.c b/demos/gtk-demo/image_view.c
index 4a74c9e..aac271f 100644
--- a/demos/gtk-demo/image_view.c
+++ b/demos/gtk-demo/image_view.c
@@ -218,6 +218,7 @@ do_image_view (GtkWidget *do_widget)
   GtkWidget *fit_allocation_switch = GTK_WIDGET (gtk_builder_get_object (builder, "fit_allocation_switch"));
   GtkWidget *rotate_gesture_switch = GTK_WIDGET (gtk_builder_get_object (builder, "rotate_gesture_switch"));
   GtkWidget *zoom_gesture_switch = GTK_WIDGET (gtk_builder_get_object (builder, "zoom_gesture_switch"));
+  GtkWidget *transitions_switch = GTK_WIDGET (gtk_builder_get_object (builder, "transitions_switch"));
 
   GtkAdjustment *scale_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "scale_adjustment"));
   GtkAdjustment *angle_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "angle_adjustment"));
@@ -225,15 +226,13 @@ do_image_view (GtkWidget *do_widget)
           uri_entry   = GTK_WIDGET (gtk_builder_get_object (builder, "uri_entry"));
 
 
-  /*gtk_window_set_title (GTK_WINDOW (window), "blue: current, green: anchor");*/
-
   g_object_bind_property (scale_adjustment, "value", image_view, "scale",
                           G_BINDING_BIDIRECTIONAL);
 
   g_object_bind_property (angle_adjustment, "value", image_view, "angle",
-                          /*G_BINDING_BIDIRECTIONAL | */G_BINDING_SYNC_CREATE);
+                          G_BINDING_SYNC_CREATE);
   g_object_bind_property (image_view, "angle", angle_adjustment, "value",
-                          /*G_BINDING_BIDIRECTIONAL | */G_BINDING_SYNC_CREATE);
+                          G_BINDING_SYNC_CREATE);
 
 
 
@@ -250,6 +249,11 @@ do_image_view (GtkWidget *do_widget)
                           zoom_gesture_switch, "active",
                           G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
 
+  g_object_bind_property (image_view, "transitions-enabled",
+                          transitions_switch, "active",
+                          G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
+
 
 
   gtk_container_add (GTK_CONTAINER (window), box);
diff --git a/demos/gtk-demo/image_view.ui b/demos/gtk-demo/image_view.ui
index 346bbd1..d34ddea 100644
--- a/demos/gtk-demo/image_view.ui
+++ b/demos/gtk-demo/image_view.ui
@@ -245,6 +245,30 @@
         </child>
 
 
+       <child>
+         <object class="GtkLabel">
+           <property name="visible">true</property>
+           <property name="label" translatable="yes">Transitions</property>
+           <property name="halign">start</property>
+         </object>
+         <packing>
+           <property name="left_attach">0</property>
+           <property name="top_attach">11</property>
+         </packing>
+       </child>
+
+        <child>
+          <object class="GtkSwitch" id="transitions_switch">
+            <property name="visible">true</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">11</property>
+          </packing>
+        </child>
+
+
+
         <child>
           <object class="GtkLabel">
             <property name="visible">true</property>
@@ -257,7 +281,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">11</property>
+            <property name="top_attach">12</property>
             <property name="width">2</property>
           </packing>
         </child>
@@ -273,7 +297,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">12</property>
+            <property name="top_attach">13</property>
             <property name="width">2</property>
           </packing>
         </child>
@@ -284,10 +308,13 @@
             <property name="label" translatable="yes">Scale</property>
             <property name="halign">start</property>
             <property name="xalign">0.0</property>
+            <attributes>
+              <attribute name="weight" value="bold" />
+            </attributes>
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">13</property>
+            <property name="top_attach">14</property>
             <property name="width">2</property>
           </packing>
         </child>
@@ -300,7 +327,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">14</property>
+            <property name="top_attach">15</property>
             <property name="width">2</property>
           </packing>
         </child>
@@ -344,7 +371,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">15</property>
+            <property name="top_attach">16</property>
             <property name="width">2</property>
           </packing>
         </child>
@@ -360,7 +387,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">16</property>
+            <property name="top_attach">17</property>
             <property name="width">2</property>
           </packing>
         </child>
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 3a60c26..96331b1 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -2023,6 +2023,7 @@ gtk_image_view_set_rotatable
 gtk_image_view_get_rotatable
 gtk_image_view_set_zoomable
 gtk_image_view_get_zoomable
+gtk_image_view_get_scale_set
 <SUBSECTION Standard>
 GTK_IMAGE_VIEW
 GTK_IS_IMAGE_VIEW
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 9d45166..098c34c 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1922,6 +1922,9 @@ gtk_image_view_set_property (GObject      *object,
       case PROP_ZOOMABLE:
         gtk_image_view_set_zoomable (image_view, g_value_get_boolean (value));
         break;
+      case PROP_TRANSITIONS_ENABLED:
+        gtk_image_view_set_transitions_enabled (image_view, g_value_get_boolean (value));
+        break;
       case PROP_HADJUSTMENT:
         gtk_image_view_set_hadjustment (image_view, g_value_get_object (value));
         break;
@@ -1971,6 +1974,9 @@ gtk_image_view_get_property (GObject    *object,
       case PROP_ZOOMABLE:
         g_value_set_boolean (value, priv->zoomable);
         break;
+      case PROP_TRANSITIONS_ENABLED:
+        g_value_set_boolean (value, priv->transitions_enabled);
+        break;
       case PROP_HADJUSTMENT:
         g_value_set_object (value, priv->hadjustment);
         break;


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