[gnome-photos/gnome-3-26] tool-crop: Hide orientation controls for square items & original ratio



commit 101dd56bdd50f9db2bae1c45cec05d615ede48a9
Author: Umang Jain <mailumangjain gmail com>
Date:   Sat Sep 16 07:47:47 2017 +0530

    tool-crop: Hide orientation controls for square items & original ratio
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785115

 src/photos-tool-crop.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-tool-crop.c b/src/photos-tool-crop.c
index 2d22be1..203f87e 100644
--- a/src/photos-tool-crop.c
+++ b/src/photos-tool-crop.c
@@ -1018,6 +1018,19 @@ photos_tool_crop_reset_clicked (PhotosToolCrop *self)
 
 
 static void
+photos_tool_crop_update_original_orientable (PhotosToolCrop *self)
+{
+  guint i;
+
+  for (i = 0; self->constraints[i].aspect_ratio_type != 0; i++)
+    {
+      if (self->constraints[i].aspect_ratio_type == PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL)
+        self->constraints[i].orientable = self->bbox_source.height != self->bbox_source.width;
+    }
+}
+
+
+static void
 photos_tool_crop_activate (PhotosTool *tool, PhotosBaseItem *item, PhotosImageView *view)
 {
   PhotosToolCrop *self = PHOTOS_TOOL_CROP (tool);
@@ -1032,6 +1045,7 @@ photos_tool_crop_activate (PhotosTool *tool, PhotosBaseItem *item, PhotosImageVi
 
   self->reset = FALSE;
   self->view = GTK_WIDGET (view);
+  photos_tool_crop_update_original_orientable (self);
 
   if (photos_base_item_operation_get (item,
                                       "gegl:crop",


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