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



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

    zoom-bar: ...

 src/photos-zoom-bar.c  |   15 ++++++++++++---
 src/photos-zoom-bar.ui |    2 ++
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-zoom-bar.c b/src/photos-zoom-bar.c
index 7b9d495..b08e051 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,18 @@ 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);
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), NULL);
+  gtk_actionable_set_action_target_value (GTK_ACTIONABLE (self->zoom_toggle_button), NULL);
+
+  if (zoom_out_enabled)
+    {
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), "app.zoom-best-fit");
+    }
+  else
+    {
+      gtk_actionable_set_action_target (GTK_ACTIONABLE (self->zoom_toggle_button), "d", 1.0);
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (self->zoom_toggle_button), "app.zoom-in");
+    }
 
   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]