[Xfce4-commits] <midori:master> Introduce katze_item_get_meta_boolean convenience

Christian Dywan noreply at xfce.org
Thu Jul 1 20:58:04 CEST 2010


Updating branch refs/heads/master
         to 6822969aacd1a65941913764a75366729cb82d95 (commit)
       from fb634e19b9cb30721e4d918198ba2097c206881a (commit)

commit 6822969aacd1a65941913764a75366729cb82d95
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Jul 1 20:42:42 2010 +0200

    Introduce katze_item_get_meta_boolean convenience

 katze/katze-item.c |   26 ++++++++++++++++++++++++++
 katze/katze-item.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/katze/katze-item.c b/katze/katze-item.c
index 9ea98bd..e56bc47 100644
--- a/katze/katze-item.c
+++ b/katze/katze-item.c
@@ -596,6 +596,32 @@ katze_item_get_meta_integer (KatzeItem*   item,
 }
 
 /**
+ * katze_item_get_meta_boolean:
+ * @item: a #KatzeItem
+ * @key: the name of a boolean value
+ *
+ * The Value should be set with katze_item_set_meta_integer().
+ * If the value is set and not 0, %TRUE will be returned.
+ *
+ * Since: 0.2.7
+ **/
+gboolean
+katze_item_get_meta_boolean  (KatzeItem*   item,
+                              const gchar* key)
+{
+    const gchar* value;
+
+    g_return_val_if_fail (KATZE_IS_ITEM (item), FALSE);
+    g_return_val_if_fail (key != NULL, FALSE);
+
+    value = katze_item_get_meta_string (item, key);
+    if (value == NULL || value[0] == '0')
+        return FALSE;
+    else
+        return TRUE;
+}
+
+/**
  * katze_item_set_meta_integer:
  * @item: a #KatzeItem
  * @key: the name of an integer value
diff --git a/katze/katze-item.h b/katze/katze-item.h
index 387a7a2..23b61fd 100644
--- a/katze/katze-item.h
+++ b/katze/katze-item.h
@@ -118,6 +118,10 @@ gint64
 katze_item_get_meta_integer       (KatzeItem*      item,
                                    const gchar*    key);
 
+gboolean
+katze_item_get_meta_boolean       (KatzeItem*      item,
+                                   const gchar*    key);
+
 void
 katze_item_set_meta_integer       (KatzeItem*      item,
                                    const gchar*    key,



More information about the Xfce4-commits mailing list