soc.2008.themes: 7d83d9a2: fixed formatting and get/set properties

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Fri Jun 6 22:00:45 EDT 2008


-----------------------------------------------------------------
Revision: 7d83d9a275566219883c2c7a13d5645c04853f07
Ancestor: baa43b3402724c644435f1ba89addfb7738b7487
Author: ffdragon at soc.pidgin.im
Date: 2008-06-07T01:55:23
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/7d83d9a275566219883c2c7a13d5645c04853f07

Modified files:
        libpurple/theme.c

ChangeLog: 

fixed formatting and get/set properties

-------------- next part --------------
============================================================
--- libpurple/theme.c	e875fd9ef65e383b8c51a00773245ffa1172b4c2
+++ libpurple/theme.c	c9b2b6ccd268a6b2fef41a4a01c04078794396a1
@@ -69,23 +69,23 @@ purple_theme_get_property(GObject *obj, 
 purple_theme_get_property(GObject *obj, guint param_id, GValue *value,
 						 GParamSpec *psec)
 {
-	PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(PURPLE_THEME(obj));
+	PurpleTheme *theme = PURPLE_THEME(obj);
 
 	switch(param_id) {
 		case PROP_NAME:
-			g_value_set_string(value, priv->name);
+			g_value_set_string(value, purple_theme_get_name(theme));
 			break;
 		case PROP_AUTHOR:
-			g_value_set_string(value, priv->author);
+			g_value_set_string(value, purple_theme_get_author(theme));
 			break;
 		case PROP_TYPE:
-			g_value_set_string(value, priv->type);
+			g_value_set_string(value, purple_theme_get_type_string(theme));
 			break;
 		case PROP_DIR:
-			g_value_set_string(value, priv->dir);
+			g_value_set_string(value, purple_theme_get_dir(theme));
 			break;
 		case PROP_IMAGE:
-			g_value_set_pointer(value, priv->img);
+			g_value_set_pointer(value, purple_theme_get_image(theme));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
@@ -97,31 +97,20 @@ purple_theme_set_property(GObject *obj, 
 purple_theme_set_property(GObject *obj, guint param_id, const GValue *value,
 						 GParamSpec *psec)
 {
-	PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(PURPLE_THEME(obj));
-	PurpleStoredImage *img;
+	PurpleTheme *theme = PURPLE_THEME(obj);
 
 	switch(param_id) {
 		case PROP_NAME:
-			if(priv->name)
-				g_free(priv->name);
-			priv->name = g_value_dup_string(value);
+			purple_theme_set_name(theme, g_value_get_string(value));
 			break;
 		case PROP_AUTHOR:
-			if(priv->author)
-				g_free(priv->author);
-			priv->author = g_value_dup_string(value);
+			purple_theme_set_author(theme, g_value_get_string(value));
 			break;
 		case PROP_DIR:
-			if(priv->dir)
-				g_free(priv->dir);
-			priv->dir = g_value_dup_string(value);
+			purple_theme_set_dir(theme, g_value_get_string(value));
 			break;
 		case PROP_IMAGE:
-			img = g_value_get_pointer(value);
-
-			purple_imgstore_unref(priv->img);
-			if (img) 
-				priv->img = img;
+			purple_theme_set_image(theme, g_value_get_pointer(value));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
@@ -206,7 +195,9 @@ purple_theme_get_name(PurpleTheme *theme
 purple_theme_get_name(PurpleTheme *theme)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
 	return priv->name;
 }
@@ -215,10 +206,12 @@ purple_theme_set_name(PurpleTheme *theme
 purple_theme_set_name(PurpleTheme *theme, const gchar *name)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_if_fail(PURPLE_IS_THEME(theme));
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
-	if(priv->name)
-		g_free(priv->name);
+
+	g_free(priv->name);
 	priv->name = g_strdup (name);
 }
 
@@ -226,7 +219,9 @@ purple_theme_get_author(PurpleTheme *the
 purple_theme_get_author(PurpleTheme *theme)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
 	return priv->author;
 }
@@ -235,10 +230,12 @@ purple_theme_set_author(PurpleTheme *the
 purple_theme_set_author(PurpleTheme *theme, const gchar *author)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_if_fail(PURPLE_IS_THEME(theme));
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
-	if(priv->author)
-		g_free(priv->author);
+
+	g_free(priv->author);
 	priv->author = g_strdup (author);
 }
 
@@ -246,7 +243,9 @@ purple_theme_get_type_string(PurpleTheme
 purple_theme_get_type_string(PurpleTheme *theme)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
 	return priv->type;
 }
@@ -255,7 +254,9 @@ purple_theme_get_dir(PurpleTheme *theme)
 purple_theme_get_dir(PurpleTheme *theme) 
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
 	return priv->dir;
 }
@@ -264,10 +265,12 @@ purple_theme_set_dir(PurpleTheme *theme,
 purple_theme_set_dir(PurpleTheme *theme, const gchar *dir)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_if_fail(PURPLE_IS_THEME(theme));
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
-	if(priv->dir)
-		g_free(priv->dir);
+
+	g_free(priv->dir);
 	priv->dir = g_strdup (dir);
 }
 
@@ -275,8 +278,11 @@ purple_theme_get_image(PurpleTheme *them
 purple_theme_get_image(PurpleTheme *theme)
 {
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
+
 	return purple_imgstore_ref(priv->img);
 }
 
@@ -284,8 +290,11 @@ purple_theme_set_image(PurpleTheme *them
 purple_theme_set_image(PurpleTheme *theme, PurpleStoredImage *img)
 {	
 	PurpleThemePrivate *priv = NULL;
+
 	g_return_if_fail(PURPLE_IS_THEME(theme));
+
 	priv = PURPLE_THEME_GET_PRIVATE(theme);
+
 	purple_imgstore_unref(priv->img);
 	priv->img = img;
 }


More information about the Commits mailing list