Commit 019cb6a7 authored by Bastien Nocera's avatar Bastien Nocera

plparser: Remove g_type_class_add_private() usage

Obsoleted since glib 2.58
parent a6f21e78
......@@ -327,8 +327,6 @@ totem_pl_parser_class_init (TotemPlParserClass *klass)
totem_pl_parser_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (TotemPlParserPrivate));
object_class->finalize = totem_pl_parser_finalize;
object_class->set_property = totem_pl_parser_set_property;
object_class->get_property = totem_pl_parser_get_property;
......@@ -1278,7 +1276,7 @@ totem_pl_parser_read_ini_line_string (char **lines, const char *key)
static void
totem_pl_parser_init (TotemPlParser *parser)
{
parser->priv = G_TYPE_INSTANCE_GET_PRIVATE (parser, TOTEM_TYPE_PL_PARSER, TotemPlParserPrivate);
parser->priv = g_new0 (TotemPlParserPrivate, 1);
parser->priv->main_thread = g_thread_self ();
g_mutex_init (&parser->priv->ignore_mutex);
parser->priv->ignore_schemes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
......@@ -1289,16 +1287,14 @@ totem_pl_parser_init (TotemPlParser *parser)
static void
totem_pl_parser_finalize (GObject *object)
{
TotemPlParserPrivate *priv = TOTEM_PL_PARSER (object)->priv;
g_return_if_fail (object != NULL);
g_return_if_fail (priv != NULL);
TotemPlParser *parser = TOTEM_PL_PARSER (object);
TotemPlParserPrivate *priv = parser->priv;
g_clear_pointer (&priv->ignore_schemes, g_hash_table_destroy);
g_clear_pointer (&priv->ignore_mimetypes, g_hash_table_destroy);
g_clear_pointer (&priv->ignore_globs, g_hash_table_destroy);
g_mutex_clear (&priv->ignore_mutex);
g_clear_pointer (&parser->priv, g_free);
G_OBJECT_CLASS (totem_pl_parser_parent_class)->finalize (object);
}
......
......@@ -51,13 +51,10 @@ struct TotemPlPlaylistPrivate {
GList *items;
};
#define TOTEM_PL_PLAYLIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TOTEM_TYPE_PL_PLAYLIST, TotemPlPlaylistPrivate))
static void totem_pl_playlist_finalize (GObject *object);
G_DEFINE_TYPE (TotemPlPlaylist, totem_pl_playlist, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_CODE (TotemPlPlaylist, totem_pl_playlist, G_TYPE_OBJECT,
G_ADD_PRIVATE (TotemPlPlaylist))
static void
totem_pl_playlist_class_init (TotemPlPlaylistClass *klass)
......@@ -65,8 +62,6 @@ totem_pl_playlist_class_init (TotemPlPlaylistClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = totem_pl_playlist_finalize;
g_type_class_add_private (klass, sizeof (TotemPlPlaylistPrivate));
}
static void
......@@ -79,7 +74,7 @@ totem_pl_playlist_finalize (GObject *object)
{
TotemPlPlaylistPrivate *priv;
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (object);
priv = totem_pl_playlist_get_instance_private (TOTEM_PL_PLAYLIST (object));
g_list_foreach (priv->items, (GFunc) g_hash_table_destroy, NULL);
g_list_free (priv->items);
......@@ -115,7 +110,7 @@ totem_pl_playlist_size (TotemPlPlaylist *playlist)
g_return_val_if_fail (TOTEM_IS_PL_PLAYLIST (playlist), 0);
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
return g_list_length (priv->items);
}
......@@ -148,7 +143,7 @@ totem_pl_playlist_prepend (TotemPlPlaylist *playlist,
g_return_if_fail (TOTEM_IS_PL_PLAYLIST (playlist));
g_return_if_fail (iter != NULL);
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
item = create_playlist_item ();
priv->items = g_list_prepend (priv->items, item);
......@@ -177,7 +172,7 @@ totem_pl_playlist_append (TotemPlPlaylist *playlist,
g_return_if_fail (TOTEM_IS_PL_PLAYLIST (playlist));
g_return_if_fail (iter != NULL);
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
item = create_playlist_item ();
......@@ -214,7 +209,7 @@ totem_pl_playlist_insert (TotemPlPlaylist *playlist,
g_return_if_fail (TOTEM_IS_PL_PLAYLIST (playlist));
g_return_if_fail (iter != NULL);
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
item = create_playlist_item ();
priv->items = g_list_insert (priv->items, item, position);
......@@ -237,7 +232,7 @@ check_iter (TotemPlPlaylist *playlist,
return FALSE;
}
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
if (g_list_position (priv->items, iter->data2) == -1) {
return FALSE;
......@@ -264,7 +259,7 @@ totem_pl_playlist_iter_first (TotemPlPlaylist *playlist,
g_return_val_if_fail (TOTEM_IS_PL_PLAYLIST (playlist), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
priv = TOTEM_PL_PLAYLIST_GET_PRIVATE (playlist);
priv = totem_pl_playlist_get_instance_private (playlist);
if (!priv->items) {
/* Empty playlist */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment