[gnome-control-center] background: Add function for debugging
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Add function for debugging
- Date: Fri, 11 Feb 2011 03:54:02 +0000 (UTC)
commit f2cfedd98b22fd349423c9b7ca26036d1c2512da
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 11 03:35:50 2011 +0000
background: Add function for debugging
Prints out the contents of a CcBackgroundItem in details.
panels/background/cc-background-item.c | 56 ++++++++++++++++++++++++++++++++
panels/background/cc-background-item.h | 2 +
2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index 034d667..7042f6f 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -746,3 +746,59 @@ cc_background_item_new (const char *filename)
return CC_BACKGROUND_ITEM (object);
}
+
+static const char *
+flags_to_str (CcBackgroundItemFlags flag)
+{
+ GFlagsClass *fclass;
+ GFlagsValue *value;
+
+ fclass = G_FLAGS_CLASS (g_type_class_peek (G_DESKTOP_TYPE_BACKGROUND_ITEM_FLAGS));
+ value = g_flags_get_first_value (fclass, flag);
+
+ g_assert (value);
+
+ return value->value_nick;
+}
+
+void
+cc_background_item_dump (CcBackgroundItem *item)
+{
+ CcBackgroundItemPrivate *priv;
+ GString *flags;
+ int i;
+
+ g_return_if_fail (CC_IS_BACKGROUND_ITEM (item));
+
+ priv = item->priv;
+
+ g_debug ("name:\t\t\t%s", priv->name);
+ g_debug ("filename:\t\t%s", priv->filename ? priv->filename : "NULL");
+ if (priv->size)
+ g_debug ("size:\t\t\t'%s'", priv->size);
+ flags = g_string_new (NULL);
+ for (i = 0; i < 5; i++) {
+ if (priv->flags & (1 << i)) {
+ g_string_append (flags, flags_to_str (1 << i));
+ g_string_append_c (flags, ' ');
+ }
+ }
+ if (flags->len == 0)
+ g_string_append (flags, "-none-");
+ g_debug ("flags:\t\t\t%s", flags->str);
+ g_string_free (flags, TRUE);
+ if (priv->primary_color)
+ g_debug ("pcolor:\t\t%s", priv->primary_color);
+ if (priv->secondary_color)
+ g_debug ("scolor:\t\t%s", priv->secondary_color);
+ if (priv->source_url)
+ g_debug ("source URL:\t\t%s", priv->source_url);
+ if (priv->source_xml)
+ g_debug ("source XML:\t\t%s", priv->source_xml);
+ g_debug ("deleted:\t\t%s", priv->is_deleted ? "yes" : "no");
+ if (priv->mime_type)
+ g_debug ("mime-type:\t\t%s", priv->mime_type);
+ g_debug ("dimensions:\t\t%d x %d", priv->width, priv->height);
+ g_debug (" ");
+}
+
diff --git a/panels/background/cc-background-item.h b/panels/background/cc-background-item.h
index 25ffed3..31515e6 100644
--- a/panels/background/cc-background-item.h
+++ b/panels/background/cc-background-item.h
@@ -92,6 +92,8 @@ const char * cc_background_item_get_scolor (CcBackgroundItem *i
const char * cc_background_item_get_name (CcBackgroundItem *item);
const char * cc_background_item_get_size (CcBackgroundItem *item);
+void cc_background_item_dump (CcBackgroundItem *item);
+
G_END_DECLS
#endif /* __CC_BACKGROUND_ITEM_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]