[libgsf] GsfOutput: make container a property.



commit 656e6cc5c7a3a04aae10131252d2a3baef774f0f
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 8 08:51:35 2013 -0500

    GsfOutput: make container a property.

 gsf/gsf-output.c |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/gsf/gsf-output.c b/gsf/gsf-output.c
index 2569b7e..4d2b4a9 100644
--- a/gsf/gsf-output.c
+++ b/gsf/gsf-output.c
@@ -48,7 +48,8 @@ enum {
        PROP_SIZE,
        PROP_CLOSED,
        PROP_POS,
-       PROP_MODTIME
+       PROP_MODTIME,
+       PROP_CONTAINER
 };
 
 static void
@@ -67,6 +68,9 @@ gsf_output_set_property (GObject      *object,
                gsf_output_set_modtime (output, modtime);
                break;
        }
+       case PROP_CONTAINER:
+               gsf_output_set_container (output, g_value_get_object (value));
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                break;
@@ -99,6 +103,9 @@ gsf_output_get_property (GObject     *object,
        case PROP_MODTIME:
                g_value_set_boxed (value, gsf_output_get_modtime (output));
                break;
+       case PROP_CONTAINER:
+               g_value_set_object (value, output->container);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                break;
@@ -229,6 +236,20 @@ gsf_output_class_init (GObjectClass *gobject_class)
                  GSF_PARAM_STATIC |
                  G_PARAM_CONSTRUCT_ONLY |
                  G_PARAM_READWRITE));
+
+       /**
+        * GsfOutput:container:
+        *
+        * The container, optionally %NULL, in which this output lives.
+        */
+       g_object_class_install_property
+               (gobject_class, PROP_CONTAINER,
+                g_param_spec_object ("container",
+                                     _("Container"),
+                                     _("The parent GsfOutfile"),
+                                     GSF_OUTFILE_TYPE,
+                                     GSF_PARAM_STATIC |
+                                     G_PARAM_READWRITE));
 }
 
 GSF_CLASS_ABSTRACT (GsfOutput, gsf_output,
@@ -241,8 +262,7 @@ GSF_CLASS_ABSTRACT (GsfOutput, gsf_output,
  *
  * Give the name of @output.
  *
- * Returns: (transfer none): @output's name in utf8 form, DO NOT FREE
- * THIS STRING
+ * Returns: (transfer none): @output's name in utf8 form.
  **/
 char const *
 gsf_output_name (GsfOutput const *output)
@@ -255,8 +275,7 @@ gsf_output_name (GsfOutput const *output)
  * gsf_output_container:
  * @output:
  *
- * Returns: (transfer none): but does not add a reference to @output's container.
- *     Potentially %NULL
+ * Returns: (transfer none): @output's container, potentially %NULL.
  **/
 GsfOutfile *
 gsf_output_container (GsfOutput const *output)


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