[kdbus] Do not set body message if signature field is empty
[platform/upstream/glib.git] / gio / gtlspassword.c
index d68cffe..57e60ac 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Stef Walter <stefw@collabora.co.uk>
  */
@@ -65,13 +63,12 @@ struct _GTlsPasswordPrivate
   gchar *warning;
 };
 
-G_DEFINE_TYPE (GTlsPassword, g_tls_password, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GTlsPassword, g_tls_password, G_TYPE_OBJECT)
 
 static void
 g_tls_password_init (GTlsPassword *password)
 {
-  password->priv = G_TYPE_INSTANCE_GET_PRIVATE (password, G_TYPE_TLS_PASSWORD,
-                                              GTlsPasswordPrivate);
+  password->priv = g_tls_password_get_instance_private (password);
 }
 
 static const guchar *
@@ -84,10 +81,10 @@ g_tls_password_real_get_value (GTlsPassword  *password,
 }
 
 static void
-g_tls_password_real_set_value (GTlsPassword  *password,
-                               guchar        *value,
-                               gssize         length,
-                               GDestroyNotify destroy)
+g_tls_password_real_set_value (GTlsPassword   *password,
+                               guchar         *value,
+                               gssize          length,
+                               GDestroyNotify  destroy)
 {
   if (password->priv->destroy)
       (password->priv->destroy) (password->priv->value);
@@ -146,10 +143,10 @@ g_tls_password_get_property (GObject    *object,
 }
 
 static void
-g_tls_password_set_property (GObject    *object,
-                             guint       prop_id,
-                             const GValue     *value,
-                             GParamSpec *pspec)
+g_tls_password_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
 {
   GTlsPassword *password = G_TLS_PASSWORD (object);
 
@@ -195,20 +192,30 @@ g_tls_password_class_init (GTlsPasswordClass *klass)
   gobject_class->set_property = g_tls_password_set_property;
   gobject_class->finalize = g_tls_password_finalize;
 
-  g_type_class_add_private (klass, sizeof (GTlsPasswordPrivate));
-
   g_object_class_install_property (gobject_class, PROP_FLAGS,
-             g_param_spec_flags ("flags", "Flags", "Flags about the password",
-                                 G_TYPE_TLS_PASSWORD_FLAGS, G_TLS_PASSWORD_NONE,
-                                 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+                                  g_param_spec_flags ("flags",
+                                                      P_("Flags"),
+                                                      P_("Flags about the password"),
+                                                      G_TYPE_TLS_PASSWORD_FLAGS,
+                                                      G_TLS_PASSWORD_NONE,
+                                                      G_PARAM_READWRITE |
+                                                      G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_DESCRIPTION,
-             g_param_spec_string ("description", "Description", "Description of what the password is for",
-                                  "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+                                  g_param_spec_string ("description",
+                                                       P_("Description"),
+                                                       P_("Description of what the password is for"),
+                                                       NULL,
+                                                       G_PARAM_READWRITE |
+                                                       G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_WARNING,
-             g_param_spec_string ("warning", "Warning", "Warning about the password",
-                                 "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+                                  g_param_spec_string ("warning",
+                                                       P_("Warning"),
+                                                       P_("Warning about the password"),
+                                                       NULL,
+                                                       G_PARAM_READWRITE |
+                                                       G_PARAM_STATIC_STRINGS));
 
 }
 
@@ -236,10 +243,13 @@ g_tls_password_new (GTlsPasswordFlags  flags,
  * @password: a #GTlsPassword object
  * @length: (allow-none): location to place the length of the password.
  *
- * Get the password value. If @length is not %NULL then it will be filled
- * in with the length of the password value.
+ * Get the password value. If @length is not %NULL then it will be
+ * filled in with the length of the password value. (Note that the
+ * password value is not nul-terminated, so you can only pass %NULL
+ * for @length in contexts where you know the password will have a
+ * certain fixed length.)
  *
- * Returns: The password value owned by the password object.
+ * Returns: The password value (owned by the password object).
  *
  * Since: 2.30
  */
@@ -260,9 +270,10 @@ g_tls_password_get_value (GTlsPassword  *password,
  * Set the value for this password. The @value will be copied by the password
  * object.
  *
- * Specify the @length, for a non-null-terminated password. Pass -1 as
- * @length if using a null-terminated password, and @length will be calculated
- * automatically.
+ * Specify the @length, for a non-nul-terminated password. Pass -1 as
+ * @length if using a nul-terminated password, and @length will be
+ * calculated automatically. (Note that the terminating nul is not
+ * considered part of the password in this case.)
  *
  * Since: 2.30
  */
@@ -291,18 +302,19 @@ g_tls_password_set_value (GTlsPassword  *password,
  * The @value will be owned by the password object, and later freed using
  * the @destroy function callback.
  *
- * Specify the @length, for a non-null-terminated password. Pass -1 as
- * @length if using a null-terminated password, and @length will be calculated
- * automatically.
+ * Specify the @length, for a non-nul-terminated password. Pass -1 as
+ * @length if using a nul-terminated password, and @length will be
+ * calculated automatically. (Note that the terminating nul is not
+ * considered part of the password in this case.)
  *
  * Virtual: set_value
  * Since: 2.30
  */
 void
-g_tls_password_set_value_full (GTlsPassword  *password,
-                               guchar        *value,
-                               gssize         length,
-                               GDestroyNotify destroy)
+g_tls_password_set_value_full (GTlsPassword   *password,
+                               guchar         *value,
+                               gssize          length,
+                               GDestroyNotify  destroy)
 {
   g_return_if_fail (G_IS_TLS_PASSWORD (password));
   G_TLS_PASSWORD_GET_CLASS (password)->set_value (password, value,
@@ -315,7 +327,7 @@ g_tls_password_set_value_full (GTlsPassword  *password,
  *
  * Get flags about the password.
  *
- * Return value: The flags about the password.
+ * Returns: The flags about the password.
  *
  * Since: 2.30
  */
@@ -352,7 +364,7 @@ g_tls_password_set_flags (GTlsPassword      *password,
  *
  * Get a description string about what the password will be used for.
  *
- * Return value: The description of the password.
+ * Returns: The description of the password.
  *
  * Since: 2.30
  */
@@ -395,7 +407,7 @@ g_tls_password_set_description (GTlsPassword      *password,
  * representation of the password flags returned from
  * g_tls_password_get_flags().
  *
- * Return value: The warning.
+ * Returns: The warning.
  *
  * Since: 2.30
  */