[gnome-photos/wip/rishi/invariant: 5/6] item-manager: Short-circuit the failure case
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/invariant: 5/6] item-manager: Short-circuit the failure case
- Date: Fri, 9 Oct 2015 16:54:24 +0000 (UTC)
commit 98e245ac9034552da61134842c26f7f845e75469
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Oct 9 18:01:48 2015 +0200
item-manager: Short-circuit the failure case
https://bugzilla.gnome.org/show_bug.cgi?id=737071
src/photos-item-manager.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 85b2b4b..e2978a4 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -272,6 +272,8 @@ photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *obje
g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (object) || object == NULL, FALSE);
active_item = photos_base_manager_get_active_object (manager);
+ if (object == active_item)
+ goto out;
/* Passing NULL is a way to go back to the current collection or
* overview from the preview. However, you can't do that when you
@@ -311,11 +313,13 @@ photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *obje
end:
ret_val = PHOTOS_BASE_MANAGER_CLASS (photos_item_manager_parent_class)->set_active_object (manager,
object);
+ /* We have already eliminated the possibility of failure. */
+ g_assert (ret_val == TRUE);
- if (ret_val && active_collection_changed)
+ if (active_collection_changed)
g_signal_emit (self, signals[ACTIVE_COLLECTION_CHANGED], 0, self->active_collection);
- if (ret_val && start_loading)
+ if (start_loading)
{
GtkRecentManager *recent;
const gchar *uri;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]