[gnome-photos/wip/rishi/share-point: 14/19] application: Enable Share action



commit 0ff5c8c7bfde8380e25ecfa6abbfb14c0e2ea0f5
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 8a6351b..bf6993e 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -385,6 +385,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 5a3ec1a..9e0d549 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"
@@ -2252,6 +2253,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]