diff options
Diffstat (limited to 'libpurple/theme.c')
-rw-r--r-- | libpurple/theme.c | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/libpurple/theme.c b/libpurple/theme.c index 73b981720f..4e59513c28 100644 --- a/libpurple/theme.c +++ b/libpurple/theme.c @@ -21,6 +21,7 @@ */ #include "internal.h" +#include "glibcompat.h" #include "theme.h" #include "util.h" @@ -43,12 +44,6 @@ typedef struct { } PurpleThemePrivate; /****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** * Enums *****************************************************************************/ @@ -59,10 +54,18 @@ enum { PROP_AUTHOR, PROP_TYPE, PROP_DIR, - PROP_IMAGE + PROP_IMAGE, + PROP_LAST }; /****************************************************************************** + * Globals + *****************************************************************************/ + +static GObjectClass *parent_class = NULL; +static GParamSpec *properties[PROP_LAST]; + +/****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -148,7 +151,6 @@ static void purple_theme_class_init(PurpleThemeClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; parent_class = g_type_class_peek_parent(klass); @@ -159,47 +161,53 @@ purple_theme_class_init(PurpleThemeClass *klass) obj_class->finalize = purple_theme_finalize; /* NAME */ - pspec = g_param_spec_string("name", "Name", + properties[PROP_NAME] = g_param_spec_string("name", "Name", "The name of the theme", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_NAME, pspec); + g_object_class_install_property(obj_class, PROP_NAME, + properties[PROP_NAME]); /* DESCRIPTION */ - pspec = g_param_spec_string("description", "Description", + properties[PROP_DESCRIPTION] = g_param_spec_string("description", + "Description", "The description of the theme", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec); + g_object_class_install_property(obj_class, PROP_DESCRIPTION, + properties[PROP_DESCRIPTION]); /* AUTHOR */ - pspec = g_param_spec_string("author", "Author", + properties[PROP_AUTHOR] = g_param_spec_string("author", "Author", "The author of the theme", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_AUTHOR, pspec); + g_object_class_install_property(obj_class, PROP_AUTHOR, + properties[PROP_AUTHOR]); /* TYPE STRING (read only) */ - pspec = g_param_spec_string("type", "Type", + properties[PROP_TYPE] = g_param_spec_string("type", "Type", "The string representing the type of the theme", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_TYPE, pspec); + g_object_class_install_property(obj_class, PROP_TYPE, + properties[PROP_TYPE]); /* DIRECTORY */ - pspec = g_param_spec_string("directory", "Directory", + properties[PROP_DIR] = g_param_spec_string("directory", "Directory", "The directory that contains the theme and all its files", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_DIR, pspec); + g_object_class_install_property(obj_class, PROP_DIR, properties[PROP_DIR]); /* PREVIEW IMAGE */ - pspec = g_param_spec_string("image", "Image", + properties[PROP_IMAGE] = g_param_spec_string("image", "Image", "A preview image of the theme", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property(obj_class, PROP_IMAGE, pspec); + g_object_class_install_property(obj_class, PROP_IMAGE, + properties[PROP_IMAGE]); } @@ -269,7 +277,7 @@ purple_theme_set_name(PurpleTheme *theme, const gchar *name) g_free(priv->name); priv->name = theme_clean_text(name); - g_object_notify(G_OBJECT(theme), "name"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_NAME]); } const gchar * @@ -295,7 +303,7 @@ purple_theme_set_description(PurpleTheme *theme, const gchar *description) g_free(priv->description); priv->description = theme_clean_text(description); - g_object_notify(G_OBJECT(theme), "description"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DESCRIPTION]); } const gchar * @@ -321,7 +329,7 @@ purple_theme_set_author(PurpleTheme *theme, const gchar *author) g_free(priv->author); priv->author = theme_clean_text(author); - g_object_notify(G_OBJECT(theme), "author"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_AUTHOR]); } const gchar * @@ -348,7 +356,7 @@ purple_theme_set_type_string(PurpleTheme *theme, const gchar *type) g_free(priv->type); priv->type = g_strdup(type); - g_object_notify(G_OBJECT(theme), "type"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_TYPE]); } const gchar * @@ -374,7 +382,7 @@ purple_theme_set_dir(PurpleTheme *theme, const gchar *dir) g_free(priv->dir); priv->dir = g_strdup(dir); - g_object_notify(G_OBJECT(theme), "directory"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DIR]); } const gchar * @@ -412,5 +420,5 @@ purple_theme_set_image(PurpleTheme *theme, const gchar *img) g_free(priv->img); priv->img = g_strdup(img); - g_object_notify(G_OBJECT(theme), "image"); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_IMAGE]); } |