[gnome-photos/wip/rishi/item-manager: 1/11] base-manager: Be more strict about what is acceptable
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/item-manager: 1/11] base-manager: Be more strict about what is acceptable
- Date: Mon, 15 Aug 2016 22:09:16 +0000 (UTC)
commit c693983dc6a9dd0619886fb7142dfd6438069140
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Aug 16 00:07:14 2016 +0200
base-manager: Be more strict about what is acceptable
src/photos-base-manager.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index b115579..5fea604 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -480,6 +480,9 @@ photos_base_manager_remove_object (PhotosBaseManager *self, GObject *object)
{
const gchar *id;
+ g_return_if_fail (PHOTOS_IS_BASE_MANAGER (self));
+ g_return_if_fail (PHOTOS_IS_FILTERABLE (object));
+
id = photos_filterable_get_id (PHOTOS_FILTERABLE (object));
photos_base_manager_remove_object_by_id (self, id);
}
@@ -488,6 +491,9 @@ photos_base_manager_remove_object (PhotosBaseManager *self, GObject *object)
void
photos_base_manager_remove_object_by_id (PhotosBaseManager *self, const gchar *id)
{
+ g_return_if_fail (PHOTOS_IS_BASE_MANAGER (self));
+ g_return_if_fail (id != NULL && id[0] != '\0');
+
PHOTOS_BASE_MANAGER_GET_CLASS (self)->remove_object_by_id (self, id);
}
@@ -495,6 +501,9 @@ photos_base_manager_remove_object_by_id (PhotosBaseManager *self, const gchar *i
gboolean
photos_base_manager_set_active_object (PhotosBaseManager *self, GObject *object)
{
+ g_return_val_if_fail (PHOTOS_IS_BASE_MANAGER (self), FALSE);
+ g_return_val_if_fail (PHOTOS_IS_FILTERABLE (object), FALSE);
+
return PHOTOS_BASE_MANAGER_GET_CLASS (self)->set_active_object (self, object);
}
@@ -504,6 +513,9 @@ photos_base_manager_set_active_object_by_id (PhotosBaseManager *self, const gcha
{
GObject *object;
+ g_return_val_if_fail (PHOTOS_IS_BASE_MANAGER (self), FALSE);
+ g_return_val_if_fail (id != NULL && id[0] != '\0', FALSE);
+
object = photos_base_manager_get_object_by_id (self, id);
return photos_base_manager_set_active_object (self, object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]