[gnome-photos] embed, item-manager, main-toolbar: Don't expose the loader cancellable
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] embed, item-manager, main-toolbar: Don't expose the loader cancellable
- Date: Wed, 18 Nov 2015 14:53:56 +0000 (UTC)
commit e11ff665392f9cdde90f8bbe1ac839ccc4a79ea5
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Nov 16 14:02:20 2015 +0100
embed, item-manager, main-toolbar: Don't expose the loader cancellable
There is simply no need to pass ItemManager's loader cancellable to the
MainToolbar's back button to cancel ongoing loads. Going back to the
previous mode is enough to cancel it.
This keeps the code in sync with gnome-documents.
src/photos-embed.c | 6 +-----
src/photos-item-manager.c | 9 ++++-----
src/photos-main-toolbar.c | 26 +-------------------------
src/photos-main-toolbar.h | 3 ---
4 files changed, 6 insertions(+), 38 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index f5fe8c9..6e65f0b 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -333,7 +333,6 @@ photos_embed_load_finished (PhotosEmbed *self, PhotosBaseItem *item, GeglNode *n
{
PhotosEmbedPrivate *priv = self->priv;
- photos_main_toolbar_set_cancellable (PHOTOS_MAIN_TOOLBAR (priv->toolbar), NULL);
photos_embed_clear_load_timer (self);
photos_spinner_box_stop (PHOTOS_SPINNER_BOX (priv->spinner_box));
@@ -360,11 +359,8 @@ photos_embed_load_show_timeout (gpointer user_data)
static void
-photos_embed_load_started (PhotosEmbed *self, PhotosBaseItem *item, GCancellable *cancellable)
+photos_embed_load_started (PhotosEmbed *self, PhotosBaseItem *item)
{
- PhotosEmbedPrivate *priv = self->priv;
-
- photos_main_toolbar_set_cancellable (PHOTOS_MAIN_TOOLBAR (priv->toolbar), cancellable);
photos_embed_clear_load_timer (self);
self->priv->load_show_id = g_timeout_add (400, photos_embed_load_show_timeout, g_object_ref (self));
}
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index c000456..a3b0694 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -383,7 +383,7 @@ photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *obje
photos_item_manager_item_load,
g_object_ref (self));
- g_signal_emit (self, signals[LOAD_STARTED], 0, PHOTOS_BASE_ITEM (object), self->loader_cancellable);
+ g_signal_emit (self, signals[LOAD_STARTED], 0, PHOTOS_BASE_ITEM (object));
if (window_mode_changed)
g_signal_emit (self, signals[WINDOW_MODE_CHANGED], 0, PHOTOS_WINDOW_MODE_PREVIEW, old_mode);
@@ -515,11 +515,10 @@ photos_item_manager_class_init (PhotosItemManagerClass *class)
load_started),
NULL, /*accumulator */
NULL, /*accu_data */
- g_cclosure_marshal_generic,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
- 2,
- PHOTOS_TYPE_BASE_ITEM,
- G_TYPE_CANCELLABLE);
+ 1,
+ PHOTOS_TYPE_BASE_ITEM);
signals[WINDOW_MODE_CHANGED] = g_signal_new ("window-mode-changed",
G_TYPE_FROM_CLASS (class),
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index 2cac268..eac8eae 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -45,7 +45,6 @@
struct _PhotosMainToolbarPrivate
{
GAction *search;
- GCancellable *loader_cancellable;
GSimpleAction *gear_menu;
GtkWidget *coll_back_button;
GtkWidget *favorite_button;
@@ -335,12 +334,7 @@ photos_main_toolbar_add_selection_button (PhotosMainToolbar *self)
static void
photos_main_toolbar_back_button_clicked (PhotosMainToolbar *self)
{
- PhotosMainToolbarPrivate *priv = self->priv;
-
- if (priv->loader_cancellable != NULL)
- g_cancellable_cancel (priv->loader_cancellable);
-
- photos_mode_controller_go_back (priv->mode_cntrlr);
+ photos_mode_controller_go_back (self->priv->mode_cntrlr);
}
@@ -684,7 +678,6 @@ photos_main_toolbar_dispose (GObject *object)
photos_main_toolbar_clear_state_data (self);
- g_clear_object (&priv->loader_cancellable);
g_clear_object (&priv->searchbar);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->mode_cntrlr);
@@ -884,23 +877,6 @@ photos_main_toolbar_reset_toolbar_mode (PhotosMainToolbar *self)
void
-photos_main_toolbar_set_cancellable (PhotosMainToolbar *self, GCancellable *cancellable)
-{
- PhotosMainToolbarPrivate *priv = self->priv;
-
- if (cancellable == priv->loader_cancellable)
- return;
-
- g_clear_object (&priv->loader_cancellable);
-
- if (cancellable != NULL)
- g_object_ref (cancellable);
-
- priv->loader_cancellable = cancellable;
-}
-
-
-void
photos_main_toolbar_set_stack (PhotosMainToolbar *self, GtkStack *stack)
{
photos_header_bar_set_stack (PHOTOS_HEADER_BAR (self->priv->toolbar), stack);
diff --git a/src/photos-main-toolbar.h b/src/photos-main-toolbar.h
index 3ad4814..4e8f9b6 100644
--- a/src/photos-main-toolbar.h
+++ b/src/photos-main-toolbar.h
@@ -81,9 +81,6 @@ gboolean photos_main_toolbar_is_focus (PhotosMainToo
void photos_main_toolbar_reset_toolbar_mode (PhotosMainToolbar *self);
-void photos_main_toolbar_set_cancellable (PhotosMainToolbar *self,
- GCancellable *cancellable);
-
void photos_main_toolbar_set_stack (PhotosMainToolbar *self, GtkStack *stack);
void photos_main_toolbar_set_view_model (PhotosMainToolbar *self, PhotosViewModel
*model);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]