diff options
author | Justin Rodriguez <ffdragon@soc.pidgin.im> | 2008-06-22 03:07:07 +0000 |
---|---|---|
committer | Justin Rodriguez <ffdragon@soc.pidgin.im> | 2008-06-22 03:07:07 +0000 |
commit | 7573b402eeefbf6563db4958aff1f58a700151f7 (patch) | |
tree | b390c2b5fef00b26b4c2cc162e581b5d4bbfef29 | |
parent | fc42de072c7eb71237827546d7d29e2a2f37d14d (diff) | |
download | pidgin-7573b402eeefbf6563db4958aff1f58a700151f7.tar.gz |
more gobject fixed
-rw-r--r-- | libpurple/core.c | 2 | ||||
-rw-r--r-- | libpurple/sound-loader.c | 5 | ||||
-rw-r--r-- | libpurple/sound-theme.c | 5 | ||||
-rw-r--r-- | libpurple/theme-loader.c | 11 | ||||
-rw-r--r-- | libpurple/theme-manager.c | 8 | ||||
-rw-r--r-- | libpurple/theme.c | 30 |
6 files changed, 33 insertions, 28 deletions
diff --git a/libpurple/core.c b/libpurple/core.c index 21d3618bfd..fac2255b39 100644 --- a/libpurple/core.c +++ b/libpurple/core.c @@ -149,7 +149,7 @@ purple_core_init(const char *ui) /* Accounts use status, buddy icons and connection signals, so * initialize these before accounts */ - purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, NULL), NULL); + purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL), NULL); purple_status_init(); purple_buddy_icons_init(); purple_connections_init(); diff --git a/libpurple/sound-loader.c b/libpurple/sound-loader.c index 17b991fe03..7efb02446b 100644 --- a/libpurple/sound-loader.c +++ b/libpurple/sound-loader.c @@ -29,9 +29,6 @@ /****************************************************************************** * Globals *****************************************************************************/ - -static PurpleThemeLoaderClass *parent_class = NULL; - /***************************************************************************** * Sound Theme Builder *****************************************************************************/ @@ -126,7 +123,7 @@ purple_sound_theme_loader_get_type (void) NULL, /* instance_init */ NULL, /* value table */ }; - type = g_type_register_static (G_TYPE_OBJECT, + type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, "PurpleSoundThemeLoader", &info, 0); } diff --git a/libpurple/sound-theme.c b/libpurple/sound-theme.c index 093003ed77..1537ab7f7e 100644 --- a/libpurple/sound-theme.c +++ b/libpurple/sound-theme.c @@ -54,9 +54,10 @@ purple_sound_theme_init(GTypeInstance *instance, gpointer klass) { PurpleSoundThemePrivate *priv; - GObject *obj = (GObject *)instance; - priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj); + (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); + + priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); priv->sound_files = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/libpurple/theme-loader.c b/libpurple/theme-loader.c index 0c01515cca..85fa996683 100644 --- a/libpurple/theme-loader.c +++ b/libpurple/theme-loader.c @@ -85,6 +85,13 @@ purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *val } static void +purple_theme_loader_init(GTypeInstance *instance, + gpointer klass) +{ + (PURPLE_THEME_LOADER(instance))->priv = g_new0(PurpleThemeLoaderPrivate, 1); +} + +static void purple_theme_loader_finalize(GObject *obj) { PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); @@ -130,11 +137,11 @@ purple_theme_loader_get_type (void) NULL, /* class_data */ sizeof (PurpleThemeLoader), 0, /* n_preallocs */ - NULL, /* instance_init */ + purple_theme_loader_init, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (G_TYPE_OBJECT, - "PurpleThemeLoaderType", + "PurpleThemeLoader", &info, G_TYPE_FLAG_ABSTRACT); } return type; diff --git a/libpurple/theme-manager.c b/libpurple/theme-manager.c index 5504d91ef0..8e0e58ece1 100644 --- a/libpurple/theme-manager.c +++ b/libpurple/theme-manager.c @@ -65,9 +65,9 @@ purple_theme_manager_get_type (void) static gchar * purple_theme_manager_make_key(const gchar *name, const gchar *type) { - g_return_val_if_fail(name, NULL); + g_return_val_if_fail(name, NULL); g_return_val_if_fail(type, NULL); - return g_strconcat(type, '/', name, NULL); + return g_strconcat(type, "/", name, NULL); } /* returns TRUE if theme is of type "user_data" */ @@ -76,7 +76,7 @@ purple_theme_manager_is_theme_type(gchar *key, gpointer value, gchar *user_data) { - return g_str_has_prefix (key, g_strconcat(user_data, '/', NULL)); + return g_str_has_prefix (key, g_strconcat(user_data, "/", NULL)); } static gboolean @@ -244,7 +244,7 @@ purple_theme_manager_add_theme(PurpleTheme *theme) g_return_if_fail(key); /* if something is already there do nothing */ - if (! g_hash_table_lookup (theme_table, key)) + if (g_hash_table_lookup (theme_table, key) == NULL) g_hash_table_insert(theme_table, key, theme); g_free(key); diff --git a/libpurple/theme.c b/libpurple/theme.c index 48583c30ab..b13c846d71 100644 --- a/libpurple/theme.c +++ b/libpurple/theme.c @@ -49,12 +49,6 @@ static GObjectClass *parent_class = NULL; /****************************************************************************** * 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" -#define PROP_IMAGE_S "image" enum { PROP_ZERO = 0, @@ -66,7 +60,6 @@ enum { PROP_IMAGE }; - /****************************************************************************** * GObject Stuff * *****************************************************************************/ @@ -134,6 +127,13 @@ purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, } static void +purple_theme_init(GTypeInstance *instance, + gpointer klass) +{ + (PURPLE_THEME(instance))->priv = g_new0(PurpleThemePrivate, 1); +} + +static void purple_theme_finalize(GObject *obj) { PurpleTheme *theme = PURPLE_THEME(obj); @@ -162,37 +162,37 @@ purple_theme_class_init (PurpleThemeClass *klass) obj_class->finalize = purple_theme_finalize; /* NAME */ - pspec = g_param_spec_string(PROP_NAME_S, "Name", + pspec = g_param_spec_string("name", "Name", "The name of the theme", 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", + pspec = g_param_spec_string("description", "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", + pspec = g_param_spec_string("author", "Author", "The author of the theme", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_AUTHOR, pspec); /* TYPE STRING (read only) */ - pspec = g_param_spec_string(PROP_TYPE_S, "Type", + pspec = g_param_spec_string("type", "Type", "The string represtenting the type of the theme", NULL, - G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property(obj_class, PROP_TYPE, pspec); /* DIRECTORY */ - pspec = g_param_spec_string(PROP_DIR_S, "Directory", + pspec = g_param_spec_string("directory", "Directory", "The directory that contains the theme and all its files", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_DIR, pspec); /* PREVIEW IMAGE */ - pspec = g_param_spec_pointer(PROP_IMAGE_S, "Image", + pspec = g_param_spec_pointer("image", "Image", "A preview image of the theme", G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_IMAGE, pspec); @@ -213,7 +213,7 @@ purple_theme_get_type (void) NULL, /* class_data */ sizeof (PurpleTheme), 0, /* n_preallocs */ - NULL, /* instance_init */ + purple_theme_init, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (G_TYPE_OBJECT, |