[gnome-photos/wip/rishi/zoom: 9/10] zoom-bar: ...



commit 72caa526f08277d45daab74fcb769bf7fc8fe67f
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 6 21:50:53 2017 +0200

    zoom-bar: ...

 src/photos-zoom-bar.c  |   13 ++++++++++---
 src/photos-zoom-bar.ui |    2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-zoom-bar.c b/src/photos-zoom-bar.c
index 7b9d495..e795d4d 100644
--- a/src/photos-zoom-bar.c
+++ b/src/photos-zoom-bar.c
@@ -57,7 +57,6 @@ photos_zoom_bar_update_buttons (PhotosZoomBar *self)
   GtkWidget *image;
   gboolean zoom_best_fit_enabled;
   gboolean zoom_out_enabled;
-  const gchar *action_name;
   const gchar *icon_name;
 
   zoom_best_fit_enabled = g_action_get_enabled (self->zoom_best_fit_action);
@@ -66,8 +65,16 @@ photos_zoom_bar_update_buttons (PhotosZoomBar *self)
 
   gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer), zoom_out_enabled);
 
-  action_name = zoom_out_enabled ? "app.zoom-best-fit" : "app.zoom-in";
-  gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), action_name);
+  if (zoom_out_enabled)
+    {
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), "app.zoom-best-fit");
+      gtk_actionable_set_action_target_value (GTK_ACTIONABLE (self->zoom_toggle_button), NULL);
+    }
+  else
+    {
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), "app.zoom-in");
+      gtk_actionable_set_action_target (GTK_ACTIONABLE (self->zoom_toggle_button), "d", 1.0);
+    }
 
   icon_name = zoom_out_enabled ? "zoom-fit-best-symbolic" : "zoom-in-symbolic";
   image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_INVALID);
diff --git a/src/photos-zoom-bar.ui b/src/photos-zoom-bar.ui
index 7fd90b7..38dc02f 100644
--- a/src/photos-zoom-bar.ui
+++ b/src/photos-zoom-bar.ui
@@ -39,6 +39,7 @@
                 <child>
                   <object class="GtkButton" id="zoom_in_button">
                     <property name="action_name">app.zoom-in</property>
+                    <property name="action_target">1.0</property>
                     <style>
                       <class name="image-button"/>
                       <class name="osd"/>
@@ -53,6 +54,7 @@
                 <child>
                   <object class="GtkButton" id="zoom_out_button">
                     <property name="action_name">app.zoom-out</property>
+                    <property name="action_target">1.0</property>
                     <style>
                       <class name="image-button"/>
                       <class name="osd"/>


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