[gtk/property-selection-getters] propertyselection: Add getters



commit 059c45a85b967ecbce623865aa4da0c86822bbd5
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jun 11 07:15:27 2020 -0400

    propertyselection: Add getters
    
    These were missing.

 docs/reference/gtk/gtk4-sections.txt |  2 ++
 gtk/gtkpropertyselection.c           | 53 +++++++++++++++++++++++++++++-------
 gtk/gtkpropertyselection.h           |  5 ++++
 3 files changed, 50 insertions(+), 10 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 3808932479..bc70b8bce1 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -409,6 +409,8 @@ gtk_multi_selection_get_type
 <TITLE>GtkPropertySelection</TITLE>
 GtkPropertySelection
 gtk_property_selection_new
+gtk_property_selection_get_model
+gtk_property_selection_get_property
 <SUBSECTION Private>
 gtk_property_selection_get_type
 </SECTION>
diff --git a/gtk/gtkpropertyselection.c b/gtk/gtkpropertyselection.c
index 3f4c192ba1..25fb94846d 100644
--- a/gtk/gtkpropertyselection.c
+++ b/gtk/gtkpropertyselection.c
@@ -355,10 +355,10 @@ gtk_property_selection_clear_model (GtkPropertySelection *self)
 }
 
 static void
-gtk_property_selection_set_property (GObject      *object,
-                                     guint         prop_id,
-                                     const GValue *value,
-                                     GParamSpec   *pspec)
+gtk_property_selection_real_set_property (GObject      *object,
+                                          guint         prop_id,
+                                          const GValue *value,
+                                          GParamSpec   *pspec)
 
 {
   GtkPropertySelection *self = GTK_PROPERTY_SELECTION (object);
@@ -399,10 +399,10 @@ gtk_property_selection_set_property (GObject      *object,
 }
 
 static void
-gtk_property_selection_get_property (GObject    *object,
-                                     guint       prop_id,
-                                     GValue     *value,
-                                     GParamSpec *pspec)
+gtk_property_selection_real_get_property (GObject    *object,
+                                          guint       prop_id,
+                                          GValue     *value,
+                                          GParamSpec *pspec)
 {
   GtkPropertySelection *self = GTK_PROPERTY_SELECTION (object);
 
@@ -439,8 +439,8 @@ gtk_property_selection_class_init (GtkPropertySelectionClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  gobject_class->get_property = gtk_property_selection_get_property;
-  gobject_class->set_property = gtk_property_selection_set_property;
+  gobject_class->get_property = gtk_property_selection_real_get_property;
+  gobject_class->set_property = gtk_property_selection_real_set_property;
   gobject_class->dispose = gtk_property_selection_dispose;
 
   /**
@@ -497,3 +497,36 @@ gtk_property_selection_new (GListModel *model,
                        "property", property,
                        NULL);
 }
+
+/**
+ * gtk_property_selection_get_model:
+ * @self: a #GtkPropertySelection
+ *
+ * Gets the underlying model.
+ *
+ * Returns: (transfer none): the underlying model
+ */
+GListModel *
+gtk_property_selection_get_model (GtkPropertySelection *self)
+{
+  g_return_val_if_fail (GTK_IS_PROPERTY_SELECTION (self), NULL);
+
+  return self->model;
+}
+
+/**
+ * gtk_property_selection_get_property:
+ * @self: a #GtkPropertySelection
+ *
+ * Gets the name of the item property that @self stores
+ * the selection in.
+ *
+ * Returns: the name of the property
+ */
+const char *
+gtk_property_selection_get_property (GtkPropertySelection *self)
+{
+  g_return_val_if_fail (GTK_IS_PROPERTY_SELECTION (self), NULL);
+
+  return self->property;
+}
diff --git a/gtk/gtkpropertyselection.h b/gtk/gtkpropertyselection.h
index 60378ae655..8a2440449f 100644
--- a/gtk/gtkpropertyselection.h
+++ b/gtk/gtkpropertyselection.h
@@ -34,6 +34,11 @@ GDK_AVAILABLE_IN_ALL
 GListModel *    gtk_property_selection_new      (GListModel     *model,
                                                  const char     *property);
 
+GDK_AVAILABLE_IN_ALL
+GListModel *    gtk_property_selection_get_model    (GtkPropertySelection *self);
+
+GDK_AVAILABLE_IN_ALL
+const char *    gtk_property_selection_get_property (GtkPropertySelection *self);
 
 G_END_DECLS
 


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