changeset 25080:8f397c8e728a

Added description to theme abstract class
author Justin Rodriguez <ffdragon@soc.pidgin.im>
date Wed, 11 Jun 2008 18:32:12 +0000
parents d5c5512adc69
children 8793058bc318
files libpurple/theme.c libpurple/theme.h
diffstat 2 files changed, 57 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/theme.c	Wed Jun 11 03:51:47 2008 +0000
+++ b/libpurple/theme.c	Wed Jun 11 18:32:12 2008 +0000
@@ -32,6 +32,7 @@
  *****************************************************************************/
 typedef struct {
 	gchar *name;
+	gchar *description;
 	gchar *author;
 	gchar *type;
 	gchar *dir;
@@ -46,6 +47,7 @@
  * Enums
  *****************************************************************************/
 #define PROP_NAME_S "name"
+#define PROP_DESCRIPION_S "description"
 #define PROP_AUTHOR_S "author"
 #define PROP_TYPE_S "type"
 #define PROP_DIR_S "dir"
@@ -54,6 +56,7 @@
 enum {
 	PROP_ZERO = 0,
 	PROP_NAME,
+	PROP_DESCRIPION,
 	PROP_AUTHOR,
 	PROP_TYPE,
 	PROP_DIR,
@@ -75,6 +78,9 @@
 		case PROP_NAME:
 			g_value_set_string(value, purple_theme_get_name(theme));
 			break;
+		case PROP_DESCRIPION:
+			g_value_set_string(value, purple_theme_get_description(theme));
+			break;
 		case PROP_AUTHOR:
 			g_value_set_string(value, purple_theme_get_author(theme));
 			break;
@@ -103,6 +109,9 @@
 		case PROP_NAME:
 			purple_theme_set_name(theme, g_value_get_string(value));
 			break;
+		case PROP_DESCRIPION:
+			purple_theme_set_description(theme, g_value_get_string(value));
+			break;
 		case PROP_AUTHOR:
 			purple_theme_set_author(theme, g_value_get_string(value));
 			break;
@@ -136,6 +145,12 @@
 				    NULL,
 				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
 	g_object_class_install_property(obj_class, PROP_NAME, pspec);
+	/* DESCRIPION */
+	pspec = g_param_spec_string(PROP_DESCRIPION_S, "Description",
+				    "The description of the theme",
+				    NULL,
+				    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+	g_object_class_install_property(obj_class, PROP_DESCRIPION, pspec);
 	/* AUTHOR */
 	pspec = g_param_spec_string(PROP_AUTHOR_S, "Author",
 				    "The author of the theme",
@@ -216,6 +231,30 @@
 }
 
 gchar *
+purple_theme_get_description(PurpleTheme *theme)
+{
+	PurpleThemePrivate *priv = NULL;
+
+	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
+	priv = PURPLE_THEME_GET_PRIVATE(theme);
+	return priv->description;
+}
+
+void
+purple_theme_set_description(PurpleTheme *theme, const gchar *description)
+{
+	PurpleThemePrivate *priv = NULL;
+
+	g_return_if_fail(PURPLE_IS_THEME(theme));
+
+	priv = PURPLE_THEME_GET_PRIVATE(theme);
+
+	g_free(priv->description);
+	priv->description = g_strdup (description);
+}
+
+gchar *
 purple_theme_get_author(PurpleTheme *theme)
 {
 	PurpleThemePrivate *priv = NULL;
--- a/libpurple/theme.h	Wed Jun 11 03:51:47 2008 +0000
+++ b/libpurple/theme.h	Wed Jun 11 18:32:12 2008 +0000
@@ -1,5 +1,5 @@
 /**
- * @file purpletheme.h  Purple Theme Abstact Class API
+ * @file theme.h  Purple Theme Abstact Class API
  */
 
 /* purple
@@ -86,6 +86,23 @@
 void purple_theme_set_name(PurpleTheme *theme, const gchar *name);
 
 /**
+ * Returns the description of the PurpleTheme object
+ * 
+ * @param theme 	the purple theme
+ *
+ * @return A short description of the theme
+ */
+gchar *purple_theme_get_description(PurpleTheme *theme);
+
+/**
+ * Sets the description of the PurpleTheme object
+ * 
+ * @param theme 	the purple theme
+ * @param description	the description of the PurpleTheme object
+ */
+void purple_theme_set_description(PurpleTheme *theme, const gchar *description);
+
+/**
  * Returns the author of the PurpleTheme object
  * 
  * @param theme 	the purple theme