[gnome-photos/wip/rishi/share-point: 16/18] application: Enable Share action



commit 7231882738ff645809afed33a795a697b8f3d548
Author: Umang Jain <mailumangjain gmail com>
Date:   Fri Jul 15 23:35:49 2016 +0530

    application: Enable Share action
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751181

 src/photos-application.c |    4 ++++
 src/photos-base-item.c   |   13 +++++++++++++
 src/photos-base-item.h   |    2 ++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 789d656..4b043f6 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -386,6 +386,10 @@ photos_application_actions_update (PhotosApplication *self)
         can_open = TRUE;
     }
 
+  enable = (((load_state == PHOTOS_LOAD_STATE_FINISHED && mode == PHOTOS_WINDOW_MODE_PREVIEW)
+            || (selection_mode && item != NULL)) && photos_base_item_can_share (item));
+  g_simple_action_set_enabled (self->share_action, enable);
+
   enable = ((load_state == PHOTOS_LOAD_STATE_FINISHED
              && mode == PHOTOS_WINDOW_MODE_PREVIEW
              && photos_base_item_can_trash (item))
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index a5e4a11..5a0ff1c 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -46,6 +46,7 @@
 #include "photos-debug.h"
 #include "photos-delete-item-job.h"
 #include "photos-filterable.h"
+#include "photos-google-item.h"
 #include "photos-icons.h"
 #include "photos-local-item.h"
 #include "photos-pipeline.h"
@@ -2292,6 +2293,18 @@ photos_base_item_filterable_iface_init (PhotosFilterableInterface *iface)
 
 
 gboolean
+photos_base_item_can_share (PhotosBaseItem *self)
+{
+  g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
+
+  if (PHOTOS_IS_GOOGLE_ITEM (self))
+    return FALSE;
+  else
+    return TRUE;
+}
+
+
+gboolean
 photos_base_item_can_edit (PhotosBaseItem *self)
 {
   PhotosBaseItemPrivate *priv;
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 7e766fc..c16e033 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -103,6 +103,8 @@ GType               photos_base_item_get_type                (void) G_GNUC_CONST
 
 gboolean            photos_base_item_can_edit                (PhotosBaseItem *self);
 
+gboolean            photos_base_item_can_share               (PhotosBaseItem *self);
+
 gboolean            photos_base_item_can_trash               (PhotosBaseItem *self);
 
 cairo_surface_t    *photos_base_item_create_preview          (PhotosBaseItem *self,


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