[gnome-photos/wip/abono/sidebar: 629/635] properties-sidebar: Add set_item



commit 35338584fe92787cf6ba489c5eb509514712ec50
Author: Alessandro Bono <abono gnome org>
Date:   Tue Dec 13 16:30:37 2016 +0100

    properties-sidebar: Add set_item

 src/photos-properties-sidebar.c |   19 +++++++++++++++++++
 src/photos-properties-sidebar.h |    5 +++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-properties-sidebar.c b/src/photos-properties-sidebar.c
index 28040d1..1bf10b5 100644
--- a/src/photos-properties-sidebar.c
+++ b/src/photos-properties-sidebar.c
@@ -62,3 +62,22 @@ photos_properties_sidebar_init (PhotosPropertiesSidebar *self)
 {
   gtk_widget_init_template (GTK_WIDGET (self));
 }
+
+static void
+photos_properties_sidebar_clear (PhotosPropertiesSidebar *self)
+{
+  /* FIXME: g_object_clear () gives problems */
+  if (self->item)
+    {
+      g_object_unref (self->item);
+      self->item = NULL;
+    }
+}
+
+void
+photos_properties_sidebar_set_item (PhotosPropertiesSidebar *self, PhotosBaseItem *item)
+{
+  photos_properties_sidebar_clear (self);
+
+  self->item = g_object_ref (item);
+}
diff --git a/src/photos-properties-sidebar.h b/src/photos-properties-sidebar.h
index 6bfa3e3..3b94fda 100644
--- a/src/photos-properties-sidebar.h
+++ b/src/photos-properties-sidebar.h
@@ -23,6 +23,8 @@
 
 #include <gtk/gtk.h>
 
+#include "photos-base-item.h"
+
 G_BEGIN_DECLS
 
 #define PHOTOS_TYPE_PROPERTIES_SIDEBAR (photos_properties_sidebar_get_type ())
@@ -30,6 +32,9 @@ G_DECLARE_FINAL_TYPE (PhotosPropertiesSidebar, photos_properties_sidebar, PHOTOS
 
 GtkWidget             *photos_properties_sidebar_new                    (void);
 
+void                   photos_properties_sidebar_set_item               (PhotosPropertiesSidebar *self,
+                                                                         PhotosBaseItem *item);
+
 G_END_DECLS
 
 #endif /* PHOTOS_PROPERTIES_SIDEBAR_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]