[gnome-photos/wip/rishi/misc-fixes: 9/22] Save the pipeline on "Done", instead of exporting the image
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/misc-fixes: 9/22] Save the pipeline on "Done", instead of exporting the image
- Date: Fri, 25 Dec 2015 09:20:27 +0000 (UTC)
commit 8f9056760df6ba486957fa20ab036585d9e7dff7
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Dec 18 13:44:56 2015 +0100
Save the pipeline on "Done", instead of exporting the image
We are going to add explicit UI controls for exporting images and
albums.
https://bugzilla.gnome.org/show_bug.cgi?id=759363
src/photos-application.c | 46 +++++++++++++++++++++++++++++++++++++++++++++
src/photos-main-toolbar.c | 2 +-
2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 8cedb3e..7f70d95 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -72,6 +72,7 @@ struct _PhotosApplicationPrivate
GSimpleAction *crop_action;
GSimpleAction *denoise_action;
GSimpleAction *edit_cancel_action;
+ GSimpleAction *edit_done_action;
GSimpleAction *fs_action;
GSimpleAction *gear_action;
GSimpleAction *insta_action;
@@ -252,6 +253,7 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (priv->crop_action, enable);
g_simple_action_set_enabled (priv->denoise_action, enable);
g_simple_action_set_enabled (priv->edit_cancel_action, enable);
+ g_simple_action_set_enabled (priv->edit_done_action, enable);
g_simple_action_set_enabled (priv->insta_action, enable);
g_simple_action_set_enabled (priv->save_action, enable);
g_simple_action_set_enabled (priv->sharpen_action, enable);
@@ -618,6 +620,42 @@ photos_application_edit_cancel (PhotosApplication *self)
static void
+photos_application_edit_done_pipeline_save (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+ PhotosApplication *self = PHOTOS_APPLICATION (user_data);
+ PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object);
+ GError *error;
+
+ error = NULL;
+ if (!photos_base_item_pipeline_save_finish (item, res, &error))
+ {
+ g_warning ("Unable to save pipeline: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ photos_mode_controller_go_back (self->priv->state->mode_cntrlr);
+
+ out:
+ g_application_release (G_APPLICATION (self));
+}
+
+
+static void
+photos_application_edit_done (PhotosApplication *self)
+{
+ PhotosApplicationPrivate *priv = self->priv;
+ PhotosBaseItem *item;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (priv->state->item_mngr));
+ g_return_if_fail (item != NULL);
+
+ g_application_hold (G_APPLICATION (self));
+ photos_base_item_pipeline_save_async (item, NULL, photos_application_edit_done_pipeline_save, self);
+}
+
+
+static void
photos_application_edit_current (PhotosApplication *self)
{
PhotosApplicationPrivate *priv = self->priv;
@@ -1258,6 +1296,13 @@ photos_application_startup (GApplication *application)
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
g_object_unref (action);
+ priv->edit_done_action = g_simple_action_new ("edit-done", NULL);
+ g_signal_connect_swapped (priv->edit_done_action,
+ "activate",
+ G_CALLBACK (photos_application_edit_done),
+ self);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->edit_done_action));
+
priv->fs_action = g_simple_action_new ("fullscreen", NULL);
g_signal_connect_swapped (priv->fs_action, "activate", G_CALLBACK (photos_application_fullscreen), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->fs_action));
@@ -1436,6 +1481,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&priv->crop_action);
g_clear_object (&priv->denoise_action);
g_clear_object (&priv->edit_cancel_action);
+ g_clear_object (&priv->edit_done_action);
g_clear_object (&priv->fs_action);
g_clear_object (&priv->gear_action);
g_clear_object (&priv->insta_action);
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index eac8eae..b36f256 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -502,7 +502,7 @@ photos_main_toolbar_populate_for_edit (PhotosMainToolbar *self)
gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->toolbar), cancel_button);
done_button = gtk_button_new_with_label (_("Done"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (done_button), "app.save-current");
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (done_button), "app.edit-done");
gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->toolbar), done_button);
context = gtk_widget_get_style_context (done_button);
gtk_style_context_add_class (context, "suggested-action");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]