[sushi] Use G_DECLARE_FINAL_TYPE for private lib types
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] Use G_DECLARE_FINAL_TYPE for private lib types
- Date: Mon, 17 Jun 2019 22:53:31 +0000 (UTC)
commit 44846026499dd917294dbd486aa4e789f3dd91d1
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Jun 17 14:57:29 2019 -0700
Use G_DECLARE_FINAL_TYPE for private lib types
Get up to date with the new GLib macros to simplify the boilerplate.
meson.build | 4 +-
src/libsushi/sushi-cover-art.c | 102 ++++++-------
src/libsushi/sushi-cover-art.h | 25 +---
src/libsushi/sushi-file-loader.c | 172 ++++++++++------------
src/libsushi/sushi-file-loader.h | 26 +---
src/libsushi/sushi-pdf-loader.c | 82 +++++------
src/libsushi/sushi-pdf-loader.h | 26 +---
src/libsushi/sushi-sound-player.c | 298 +++++++++++++++-----------------------
src/libsushi/sushi-sound-player.h | 26 +---
src/libsushi/sushi-text-loader.c | 54 +++----
src/libsushi/sushi-text-loader.h | 26 +---
11 files changed, 316 insertions(+), 525 deletions(-)
---
diff --git a/meson.build b/meson.build
index bdccf35..7e84632 100644
--- a/meson.build
+++ b/meson.build
@@ -10,9 +10,9 @@ evince_document_dep = dependency('evince-document-3.0')
evince_view_dep = dependency('evince-view-3.0')
freetype_dep = dependency('freetype2')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>=2.23.0')
-gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.29.14')
+gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.44.0')
gjs_dep = dependency('gjs-1.0', version: '>=1.38.0')
-glib_dep = dependency('glib-2.0', version: '>=2.29.14')
+glib_dep = dependency('glib-2.0', version: '>=2.44.0')
gstreamer_dep = dependency('gstreamer-1.0')
gstreamer_audio_dep = dependency('gstreamer-audio-1.0')
gstreamer_base_dep = dependency('gstreamer-base-1.0')
diff --git a/src/libsushi/sushi-cover-art.c b/src/libsushi/sushi-cover-art.c
index 0785176..0b0ff63 100644
--- a/src/libsushi/sushi-cover-art.c
+++ b/src/libsushi/sushi-cover-art.c
@@ -28,17 +28,7 @@
#include <musicbrainz5/mb5_c.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-G_DEFINE_TYPE (SushiCoverArtFetcher, sushi_cover_art_fetcher, G_TYPE_OBJECT);
-
-#define SUSHI_COVER_ART_FETCHER_GET_PRIVATE(obj)\
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SUSHI_TYPE_COVER_ART_FETCHER, SushiCoverArtFetcherPrivate))
-
-enum {
- PROP_COVER = 1,
- PROP_TAGLIST,
-};
-
-struct _SushiCoverArtFetcherPrivate {
+struct _SushiCoverArtFetcher {
GdkPixbuf *cover;
GstTagList *taglist;
@@ -47,6 +37,13 @@ struct _SushiCoverArtFetcherPrivate {
GInputStream *input_stream;
};
+G_DEFINE_TYPE (SushiCoverArtFetcher, sushi_cover_art_fetcher, G_TYPE_OBJECT)
+
+enum {
+ PROP_COVER = 1,
+ PROP_TAGLIST,
+};
+
#define AMAZON_IMAGE_FORMAT "http://images.amazon.com/images/P/%s.01.LZZZZZZZ.jpg"
static void sushi_cover_art_fetcher_set_taglist (SushiCoverArtFetcher *self,
@@ -62,18 +59,18 @@ static void try_read_from_file (SushiCoverArtFetcher *self,
static void
sushi_cover_art_fetcher_dispose (GObject *object)
{
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (object);
+ SushiCoverArtFetcher *self = SUSHI_COVER_ART_FETCHER (object);
- g_clear_object (&priv->cover);
- g_clear_object (&priv->input_stream);
+ g_clear_object (&self->cover);
+ g_clear_object (&self->input_stream);
- if (priv->taglist != NULL) {
- gst_tag_list_free (priv->taglist);
- priv->taglist = NULL;
+ if (self->taglist != NULL) {
+ gst_tag_list_free (self->taglist);
+ self->taglist = NULL;
}
- g_free (priv->asin);
- priv->asin = NULL;
+ g_free (self->asin);
+ self->asin = NULL;
G_OBJECT_CLASS (sushi_cover_art_fetcher_parent_class)->dispose (object);
}
@@ -85,14 +82,13 @@ sushi_cover_art_fetcher_get_property (GObject *gobject,
GParamSpec *pspec)
{
SushiCoverArtFetcher *self = SUSHI_COVER_ART_FETCHER (gobject);
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
switch (prop_id) {
case PROP_COVER:
- g_value_set_object (value, priv->cover);
+ g_value_set_object (value, self->cover);
break;
case PROP_TAGLIST:
- g_value_set_boxed (value, priv->taglist);
+ g_value_set_boxed (value, self->taglist);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
@@ -121,7 +117,6 @@ sushi_cover_art_fetcher_set_property (GObject *gobject,
static void
sushi_cover_art_fetcher_init (SushiCoverArtFetcher *self)
{
- self->priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
}
static void
@@ -150,8 +145,6 @@ sushi_cover_art_fetcher_class_init (SushiCoverArtFetcherClass *klass)
"Current file tags",
GST_TYPE_TAG_LIST,
G_PARAM_READWRITE));
-
- g_type_class_add_private (klass, sizeof (SushiCoverArtFetcherPrivate));
}
typedef struct {
@@ -279,7 +272,7 @@ get_gfile_for_amazon (SushiCoverArtFetcher *self)
GFile *retval;
gchar *uri;
- uri = g_strdup_printf (AMAZON_IMAGE_FORMAT, self->priv->asin);
+ uri = g_strdup_printf (AMAZON_IMAGE_FORMAT, self->asin);
retval = g_file_new_for_uri (uri);
g_free (uri);
@@ -297,7 +290,7 @@ get_gfile_for_cache (SushiCoverArtFetcher *self)
"sushi", NULL);
g_mkdir_with_parents (cache_path, 0700);
- filename = g_strdup_printf ("%s.jpg", self->priv->asin);
+ filename = g_strdup_printf ("%s.jpg", self->asin);
path = g_build_filename (cache_path, filename, NULL);
retval = g_file_new_for_path (path);
@@ -345,11 +338,11 @@ cache_replace_ready_cb (GObject *source,
return;
}
- g_seekable_seek (G_SEEKABLE (self->priv->input_stream), 0, G_SEEK_SET,
+ g_seekable_seek (G_SEEKABLE (self->input_stream), 0, G_SEEK_SET,
NULL, NULL);
g_output_stream_splice_async (G_OUTPUT_STREAM (cache_stream),
- self->priv->input_stream,
+ self->input_stream,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
G_PRIORITY_DEFAULT,
@@ -365,7 +358,6 @@ pixbuf_from_stream_async_cb (GObject *source,
gpointer user_data)
{
SushiCoverArtFetcher *self = user_data;
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
GError *error = NULL;
GdkPixbuf *pix;
GFile *file, *cache_file;
@@ -373,8 +365,8 @@ pixbuf_from_stream_async_cb (GObject *source,
pix = gdk_pixbuf_new_from_stream_finish (res, &error);
if (error != NULL) {
- if (!self->priv->tried_cache) {
- self->priv->tried_cache = TRUE;
+ if (!self->tried_cache) {
+ self->tried_cache = TRUE;
file = get_gfile_for_amazon (self);
try_read_from_file (self, file);
@@ -388,10 +380,10 @@ pixbuf_from_stream_async_cb (GObject *source,
return;
}
- priv->cover = pix;
+ self->cover = pix;
g_object_notify (G_OBJECT (self), "cover");
- if (self->priv->tried_cache) {
+ if (self->tried_cache) {
/* the pixbuf has been loaded. if we didn't hit the cache,
* save it now.
*/
@@ -414,7 +406,6 @@ read_async_ready_cb (GObject *source,
gpointer user_data)
{
SushiCoverArtFetcher *self = user_data;
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
GFileInputStream *stream;
GError *error = NULL;
GFile *file;
@@ -423,8 +414,8 @@ read_async_ready_cb (GObject *source,
res, &error);
if (error != NULL) {
- if (!self->priv->tried_cache) {
- self->priv->tried_cache = TRUE;
+ if (!self->tried_cache) {
+ self->tried_cache = TRUE;
file = get_gfile_for_amazon (self);
try_read_from_file (self, file);
@@ -438,8 +429,8 @@ read_async_ready_cb (GObject *source,
return;
}
- priv->input_stream = G_INPUT_STREAM (stream);
- gdk_pixbuf_new_from_stream_async (priv->input_stream, NULL,
+ self->input_stream = G_INPUT_STREAM (stream);
+ gdk_pixbuf_new_from_stream_async (self->input_stream, NULL,
pixbuf_from_stream_async_cb, self);
}
@@ -466,7 +457,7 @@ cache_file_query_info_cb (GObject *source,
res, &error);
if (error != NULL) {
- self->priv->tried_cache = TRUE;
+ self->tried_cache = TRUE;
file = get_gfile_for_amazon (self);
g_error_free (error);
} else {
@@ -488,7 +479,7 @@ amazon_cover_uri_async_ready_cb (GObject *source,
GError *error = NULL;
GFile *file;
- self->priv->asin = sushi_cover_art_fetcher_get_uri_for_track_finish
+ self->asin = sushi_cover_art_fetcher_get_uri_for_track_finish
(self, res, &error);
if (error != NULL) {
@@ -512,13 +503,12 @@ amazon_cover_uri_async_ready_cb (GObject *source,
static void
try_fetch_from_amazon (SushiCoverArtFetcher *self)
{
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
gchar *artist = NULL;
gchar *album = NULL;
- gst_tag_list_get_string (priv->taglist,
+ gst_tag_list_get_string (self->taglist,
GST_TAG_ARTIST, &artist);
- gst_tag_list_get_string (priv->taglist,
+ gst_tag_list_get_string (self->taglist,
GST_TAG_ALBUM, &album);
if (artist == NULL &&
@@ -646,17 +636,15 @@ totem_gst_tag_list_get_cover (GstTagList *tag_list)
static void
try_fetch_from_tags (SushiCoverArtFetcher *self)
{
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
-
- if (priv->taglist == NULL)
+ if (self->taglist == NULL)
return;
- if (priv->cover != NULL)
- g_clear_object (&priv->cover);
+ if (self->cover != NULL)
+ g_clear_object (&self->cover);
- priv->cover = totem_gst_tag_list_get_cover (priv->taglist);
+ self->cover = totem_gst_tag_list_get_cover (self->taglist);
- if (priv->cover != NULL)
+ if (self->cover != NULL)
g_object_notify (G_OBJECT (self), "cover");
else
try_fetch_from_amazon (self);
@@ -666,16 +654,14 @@ static void
sushi_cover_art_fetcher_set_taglist (SushiCoverArtFetcher *self,
GstTagList *taglist)
{
- SushiCoverArtFetcherPrivate *priv = SUSHI_COVER_ART_FETCHER_GET_PRIVATE (self);
-
- g_clear_object (&priv->cover);
+ g_clear_object (&self->cover);
- if (priv->taglist != NULL) {
- gst_tag_list_free (priv->taglist);
- priv->taglist = NULL;
+ if (self->taglist != NULL) {
+ gst_tag_list_free (self->taglist);
+ self->taglist = NULL;
}
- priv->taglist = gst_tag_list_copy (taglist);
+ self->taglist = gst_tag_list_copy (taglist);
try_fetch_from_tags (self);
}
diff --git a/src/libsushi/sushi-cover-art.h b/src/libsushi/sushi-cover-art.h
index 07c7205..2fd7394 100644
--- a/src/libsushi/sushi-cover-art.h
+++ b/src/libsushi/sushi-cover-art.h
@@ -31,30 +31,9 @@
G_BEGIN_DECLS
-#define SUSHI_TYPE_COVER_ART_FETCHER (sushi_cover_art_fetcher_get_type ())
-#define SUSHI_COVER_ART_FETCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
SUSHI_TYPE_COVER_ART_FETCHER, SushiCoverArtFetcher))
-#define SUSHI_IS_COVER_ART_FETCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
SUSHI_TYPE_COVER_ART_FETCHER))
-#define SUSHI_COVER_ART_FETCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
SUSHI_TYPE_COVER_ART_FETCHER, SushiCoverArtFetcherClass))
-#define SUSHI_IS_COVER_ART_FETCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
SUSHI_TYPE_COVER_ART_FETCHER))
-#define SUSHI_COVER_ART_FETCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
SUSHI_TYPE_COVER_ART_FETCHER, SushiCoverArtFetcherClass))
+#define SUSHI_TYPE_COVER_ART_FETCHER sushi_cover_art_fetcher_get_type ()
+G_DECLARE_FINAL_TYPE (SushiCoverArtFetcher, sushi_cover_art_fetcher, SUSHI, COVER_ART_FETCHER, GObject)
-typedef struct _SushiCoverArtFetcher SushiCoverArtFetcher;
-typedef struct _SushiCoverArtFetcherPrivate SushiCoverArtFetcherPrivate;
-typedef struct _SushiCoverArtFetcherClass SushiCoverArtFetcherClass;
-
-struct _SushiCoverArtFetcher
-{
- GObject parent_instance;
-
- SushiCoverArtFetcherPrivate *priv;
-};
-
-struct _SushiCoverArtFetcherClass
-{
- GObjectClass parent_class;
-};
-
-GType sushi_cover_art_fetcher_get_type (void) G_GNUC_CONST;
SushiCoverArtFetcher* sushi_cover_art_fetcher_new (GstTagList *taglist);
G_END_DECLS
diff --git a/src/libsushi/sushi-file-loader.c b/src/libsushi/sushi-file-loader.c
index 5602384..e6fcbbd 100644
--- a/src/libsushi/sushi-file-loader.c
+++ b/src/libsushi/sushi-file-loader.c
@@ -46,7 +46,24 @@
#define NOTIFICATION_TIMEOUT 300
-G_DEFINE_TYPE (SushiFileLoader, sushi_file_loader, G_TYPE_OBJECT);
+struct _SushiFileLoader {
+ GFile *file;
+ GFileInfo *info;
+
+ GCancellable *cancellable;
+
+ gint file_items;
+ gint directory_items;
+ gint unreadable_items;
+
+ goffset total_size;
+
+ gboolean loading;
+
+ guint size_notify_timeout_id;
+};
+
+G_DEFINE_TYPE (SushiFileLoader, sushi_file_loader, G_TYPE_OBJECT)
enum {
PROP_NAME = 1,
@@ -71,23 +88,6 @@ typedef struct {
} DeepCountState;
-struct _SushiFileLoaderPrivate {
- GFile *file;
- GFileInfo *info;
-
- GCancellable *cancellable;
-
- gint file_items;
- gint directory_items;
- gint unreadable_items;
-
- goffset total_size;
-
- gboolean loading;
-
- guint size_notify_timeout_id;
-};
-
#define DIRECTORY_LOAD_ITEMS_PER_CALLBACK 100
static void deep_count_load (DeepCountState *state,
@@ -98,7 +98,7 @@ size_notify_timeout_cb (gpointer user_data)
{
SushiFileLoader *self = user_data;
- self->priv->size_notify_timeout_id = 0;
+ self->size_notify_timeout_id = 0;
g_object_notify (G_OBJECT (self), "size");
@@ -108,12 +108,11 @@ size_notify_timeout_cb (gpointer user_data)
static void
queue_size_notify (SushiFileLoader *self)
{
- if (self->priv->size_notify_timeout_id != 0)
+ if (self->size_notify_timeout_id != 0)
return;
- self->priv->size_notify_timeout_id =
- g_timeout_add (NOTIFICATION_TIMEOUT,
- size_notify_timeout_cb, self);
+ self->size_notify_timeout_id = g_timeout_add (NOTIFICATION_TIMEOUT,
+ size_notify_timeout_cb, self);
}
/* adapted from nautilus/libnautilus-private/nautilus-directory-async.c */
@@ -159,7 +158,7 @@ deep_count_one (DeepCountState *state,
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
/* count the directory */
- state->self->priv->directory_items += 1;
+ state->self->directory_items += 1;
/* record the fact that we have to descend into this directory */
subdir = g_file_get_child (state->file, g_file_info_get_name (info));
@@ -167,19 +166,19 @@ deep_count_one (DeepCountState *state,
g_list_prepend (state->deep_count_subdirectories, subdir);
} else {
/* even non-regular files count as files */
- state->self->priv->file_items += 1;
+ state->self->file_items += 1;
}
/* count the size */
if (!is_seen_inode &&
g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE))
- state->self->priv->total_size += g_file_info_get_size (info);
+ state->self->total_size += g_file_info_get_size (info);
}
static void
deep_count_state_free (DeepCountState *state)
{
- state->self->priv->loading = FALSE;
+ state->self->loading = FALSE;
if (state->enumerator) {
if (!g_file_enumerator_is_closed (state->enumerator))
@@ -189,7 +188,7 @@ deep_count_state_free (DeepCountState *state)
g_object_unref (state->enumerator);
}
- g_cancellable_reset (state->self->priv->cancellable);
+ g_cancellable_reset (state->self->cancellable);
g_clear_object (&state->file);
g_list_free_full (state->deep_count_subdirectories, g_object_unref);
@@ -228,13 +227,11 @@ deep_count_more_files_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- DeepCountState *state;
+ DeepCountState *state = user_data;
GList *files, *l;
GFileInfo *info;
- state = user_data;
-
- if (g_cancellable_is_cancelled (state->self->priv->cancellable)) {
+ if (g_cancellable_is_cancelled (state->self->cancellable)) {
deep_count_state_free (state);
return;
}
@@ -258,7 +255,7 @@ deep_count_more_files_callback (GObject *source_object,
g_file_enumerator_next_files_async (state->enumerator,
DIRECTORY_LOAD_ITEMS_PER_CALLBACK,
G_PRIORITY_DEFAULT,
- state->self->priv->cancellable,
+ state->self->cancellable,
deep_count_more_files_callback,
state);
}
@@ -271,12 +268,10 @@ deep_count_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- DeepCountState *state;
+ DeepCountState *state = user_data;
GFileEnumerator *enumerator;
- state = user_data;
-
- if (g_cancellable_is_cancelled (state->self->priv->cancellable)) {
+ if (g_cancellable_is_cancelled (state->self->cancellable)) {
deep_count_state_free (state);
return;
}
@@ -285,14 +280,14 @@ deep_count_callback (GObject *source_object,
res, NULL);
if (enumerator == NULL) {
- state->self->priv->unreadable_items += 1;
+ state->self->unreadable_items += 1;
deep_count_next_dir (state);
} else {
state->enumerator = enumerator;
g_file_enumerator_next_files_async (state->enumerator,
DIRECTORY_LOAD_ITEMS_PER_CALLBACK,
G_PRIORITY_LOW,
- state->self->priv->cancellable,
+ state->self->cancellable,
deep_count_more_files_callback,
state);
}
@@ -302,13 +297,12 @@ static void
deep_count_load (DeepCountState *state,
GFile *file)
{
- state->file = g_object_ref (file);
-
+ state->self->file = g_object_ref (file);
g_file_enumerate_children_async (state->file,
DEEP_COUNT_ATTRS,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, /* flags */
G_PRIORITY_LOW, /* prio */
- state->self->priv->cancellable,
+ state->self->cancellable,
deep_count_callback,
state);
}
@@ -323,7 +317,7 @@ deep_count_start (SushiFileLoader *self)
state->seen_deep_count_inodes = g_hash_table_new (g_int64_hash,
g_int64_equal);
- deep_count_load (state, self->priv->file);
+ deep_count_load (state, state->self->file);
}
static void
@@ -340,10 +334,10 @@ query_info_async_ready_cb (GObject *source,
if (error != NULL) {
- if (!g_cancellable_is_cancelled (self->priv->cancellable)) {
+ if (!g_cancellable_is_cancelled (self->cancellable)) {
gchar *uri;
- uri = g_file_get_uri (self->priv->file);
+ uri = g_file_get_uri (self->file);
g_warning ("Unable to query info for file %s: %s", uri, error->message);
g_free (uri);
@@ -354,7 +348,7 @@ query_info_async_ready_cb (GObject *source,
return;
}
- self->priv->info = info;
+ self->info = info;
g_object_notify (G_OBJECT (self), "icon");
g_object_notify (G_OBJECT (self), "name");
@@ -363,7 +357,7 @@ query_info_async_ready_cb (GObject *source,
g_object_notify (G_OBJECT (self), "file-type");
if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) {
- self->priv->loading = FALSE;
+ self->loading = FALSE;
g_object_notify (G_OBJECT (self), "size");
} else {
deep_count_start (self);
@@ -373,13 +367,12 @@ query_info_async_ready_cb (GObject *source,
static void
start_loading_file (SushiFileLoader *self)
{
- self->priv->loading = TRUE;
-
- g_file_query_info_async (self->priv->file,
+ self->loading = TRUE;
+ g_file_query_info_async (self->file,
LOADER_ATTRS,
G_FILE_QUERY_INFO_NONE,
G_PRIORITY_DEFAULT,
- self->priv->cancellable,
+ self->cancellable,
query_info_async_ready_cb,
self);
}
@@ -388,10 +381,10 @@ static void
sushi_file_loader_set_file (SushiFileLoader *self,
GFile *file)
{
- g_clear_object (&self->priv->file);
- g_clear_object (&self->priv->info);
+ g_clear_object (&self->file);
+ g_clear_object (&self->info);
- self->priv->file = g_object_ref (file);
+ self->file = g_object_ref (file);
start_loading_file (self);
}
@@ -400,17 +393,17 @@ sushi_file_loader_dispose (GObject *object)
{
SushiFileLoader *self = SUSHI_FILE_LOADER (object);
- g_clear_object (&self->priv->file);
- g_clear_object (&self->priv->info);
+ g_clear_object (&self->file);
+ g_clear_object (&self->info);
- if (self->priv->cancellable != NULL) {
- g_cancellable_cancel (self->priv->cancellable);
- g_clear_object (&self->priv->cancellable);
+ if (self->cancellable != NULL) {
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
}
- if (self->priv->size_notify_timeout_id != 0) {
- g_source_remove (self->priv->size_notify_timeout_id);
- self->priv->size_notify_timeout_id = 0;
+ if (self->size_notify_timeout_id != 0) {
+ g_source_remove (self->size_notify_timeout_id);
+ self->size_notify_timeout_id = 0;
}
G_OBJECT_CLASS (sushi_file_loader_parent_class)->dispose (object);
@@ -438,7 +431,7 @@ sushi_file_loader_get_property (GObject *object,
g_value_set_object (value, sushi_file_loader_get_icon (self));
break;
case PROP_FILE:
- g_value_set_object (value, self->priv->file);
+ g_value_set_object (value, self->file);
break;
case PROP_CONTENT_TYPE:
g_value_take_string (value, sushi_file_loader_get_content_type_string (self));
@@ -524,20 +517,14 @@ sushi_file_loader_class_init (SushiFileLoaderClass *klass)
G_TYPE_ICON,
G_PARAM_READABLE);
- g_type_class_add_private (klass, sizeof (SushiFileLoaderPrivate));
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
static void
sushi_file_loader_init (SushiFileLoader *self)
{
- self->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (self,
- SUSHI_TYPE_FILE_LOADER,
- SushiFileLoaderPrivate);
-
- self->priv->cancellable = g_cancellable_new ();
- self->priv->total_size = -1;
+ self->cancellable = g_cancellable_new ();
+ self->total_size = -1;
}
SushiFileLoader *
@@ -557,10 +544,10 @@ sushi_file_loader_new (GFile *file)
gchar *
sushi_file_loader_get_display_name (SushiFileLoader *self)
{
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return NULL;
- return g_strdup (g_file_info_get_display_name (self->priv->info));
+ return g_strdup (g_file_info_get_display_name (self->info));
}
/**
@@ -572,10 +559,10 @@ sushi_file_loader_get_display_name (SushiFileLoader *self)
GIcon *
sushi_file_loader_get_icon (SushiFileLoader *self)
{
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return NULL;
- return g_file_info_get_icon (self->priv->info);
+ return g_file_info_get_icon (self->info);
}
/**
@@ -589,19 +576,19 @@ sushi_file_loader_get_size_string (SushiFileLoader *self)
{
goffset size;
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return NULL;
- if (g_file_info_get_file_type (self->priv->info) != G_FILE_TYPE_DIRECTORY) {
- size = g_file_info_get_size (self->priv->info);
+ if (g_file_info_get_file_type (self->info) != G_FILE_TYPE_DIRECTORY) {
+ size = g_file_info_get_size (self->info);
return g_format_size (size);
}
- if (self->priv->total_size != -1) {
+ if (self->total_size != -1) {
gchar *str, *size_str, *retval;
const gchar *items_str;
- size = self->priv->total_size;
+ size = self->total_size;
/* FIXME: we prolly could also use directory_items and unreadable_items
* somehow.
@@ -609,8 +596,8 @@ sushi_file_loader_get_size_string (SushiFileLoader *self)
items_str = g_dngettext (GETTEXT_PACKAGE,
"%d item",
"%d items",
- self->priv->file_items + self->priv->directory_items);
- str = g_strdup_printf (items_str, self->priv->file_items + self->priv->directory_items);
+ self->file_items + self->directory_items);
+ str = g_strdup_printf (items_str, self->file_items + self->directory_items);
size_str = g_format_size (size);
retval = g_strconcat (size_str, ", ", str, NULL);
@@ -618,7 +605,7 @@ sushi_file_loader_get_size_string (SushiFileLoader *self)
g_free (size_str);
return retval;
- } else if (!self->priv->loading) {
+ } else if (!self->loading) {
return g_strdup (_("Empty Folder"));
}
@@ -628,7 +615,7 @@ sushi_file_loader_get_size_string (SushiFileLoader *self)
gboolean
sushi_file_loader_get_loading (SushiFileLoader *self)
{
- return self->priv->loading;
+ return self->loading;
}
/**
@@ -644,10 +631,10 @@ sushi_file_loader_get_date_string (SushiFileLoader *self)
GDateTime *date;
gchar *retval;
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return NULL;
- g_file_info_get_modification_time (self->priv->info,
+ g_file_info_get_modification_time (self->info,
&timeval);
date = g_date_time_new_from_timeval_local (&timeval);
@@ -667,10 +654,10 @@ sushi_file_loader_get_date_string (SushiFileLoader *self)
gchar *
sushi_file_loader_get_content_type_string (SushiFileLoader *self)
{
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return NULL;
- return g_content_type_get_description (g_file_info_get_content_type (self->priv->info));
+ return g_content_type_get_description (g_file_info_get_content_type (self->info));
}
/**
@@ -682,17 +669,14 @@ sushi_file_loader_get_content_type_string (SushiFileLoader *self)
GFileType
sushi_file_loader_get_file_type (SushiFileLoader *self)
{
- if (self->priv->info == NULL)
+ if (self->info == NULL)
return G_FILE_TYPE_UNKNOWN;
- return g_file_info_get_file_type (self->priv->info);
+ return g_file_info_get_file_type (self->info);
}
void
sushi_file_loader_stop (SushiFileLoader *self)
{
- if (self->priv->cancellable == NULL)
- return;
-
- g_cancellable_cancel (self->priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
}
diff --git a/src/libsushi/sushi-file-loader.h b/src/libsushi/sushi-file-loader.h
index b883a5c..71a381c 100644
--- a/src/libsushi/sushi-file-loader.h
+++ b/src/libsushi/sushi-file-loader.h
@@ -31,30 +31,8 @@
G_BEGIN_DECLS
-#define SUSHI_TYPE_FILE_LOADER (sushi_file_loader_get_type ())
-#define SUSHI_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUSHI_TYPE_FILE_LOADER,
SushiFileLoader))
-#define SUSHI_IS_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUSHI_TYPE_FILE_LOADER))
-#define SUSHI_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUSHI_TYPE_FILE_LOADER,
SushiFileLoaderClass))
-#define SUSHI_IS_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUSHI_TYPE_FILE_LOADER))
-#define SUSHI_FILE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUSHI_TYPE_FILE_LOADER,
SushiFileLoaderClass))
-
-typedef struct _SushiFileLoader SushiFileLoader;
-typedef struct _SushiFileLoaderPrivate SushiFileLoaderPrivate;
-typedef struct _SushiFileLoaderClass SushiFileLoaderClass;
-
-struct _SushiFileLoader
-{
- GObject parent_instance;
-
- SushiFileLoaderPrivate *priv;
-};
-
-struct _SushiFileLoaderClass
-{
- GObjectClass parent_class;
-};
-
-GType sushi_file_loader_get_type (void) G_GNUC_CONST;
+#define SUSHI_TYPE_FILE_LOADER sushi_file_loader_get_type ()
+G_DECLARE_FINAL_TYPE (SushiFileLoader, sushi_file_loader, SUSHI, FILE_LOADER, GObject)
SushiFileLoader *sushi_file_loader_new (GFile *file);
diff --git a/src/libsushi/sushi-pdf-loader.c b/src/libsushi/sushi-pdf-loader.c
index 508f63d..c80ba49 100644
--- a/src/libsushi/sushi-pdf-loader.c
+++ b/src/libsushi/sushi-pdf-loader.c
@@ -31,16 +31,7 @@
#include <glib/gstdio.h>
#include <gdk/gdkx.h>
-G_DEFINE_TYPE (SushiPdfLoader, sushi_pdf_loader, G_TYPE_OBJECT);
-
-enum {
- PROP_DOCUMENT = 1,
- PROP_URI
-};
-
-static void load_libreoffice (SushiPdfLoader *self);
-
-struct _SushiPdfLoaderPrivate {
+struct _SushiPdfLoader {
EvDocument *document;
gchar *uri;
gchar *pdf_path;
@@ -50,6 +41,15 @@ struct _SushiPdfLoaderPrivate {
GPid libreoffice_pid;
};
+G_DEFINE_TYPE (SushiPdfLoader, sushi_pdf_loader, G_TYPE_OBJECT)
+
+enum {
+ PROP_DOCUMENT = 1,
+ PROP_URI
+};
+
+static void load_libreoffice (SushiPdfLoader *self);
+
static void
load_job_done (EvJob *job,
gpointer user_data)
@@ -63,7 +63,7 @@ load_job_done (EvJob *job,
return;
}
- self->priv->document = g_object_ref (job->document);
+ self->document = g_object_ref (job->document);
g_object_unref (job);
g_object_notify (G_OBJECT (self), "document");
@@ -145,9 +145,9 @@ libreoffice_child_watch_cb (GPid pid,
gchar *uri;
g_spawn_close_pid (pid);
- self->priv->libreoffice_pid = -1;
+ self->libreoffice_pid = -1;
- file = g_file_new_for_path (self->priv->pdf_path);
+ file = g_file_new_for_path (self->pdf_path);
uri = g_file_get_uri (file);
load_pdf (self, uri);
@@ -166,10 +166,10 @@ check_libreoffice_flatpak (SushiPdfLoader *self,
gint exit_status = -1;
GError *error = NULL;
- if (self->priv->checked_libreoffice_flatpak)
- return self->priv->have_libreoffice_flatpak;
+ if (self->checked_libreoffice_flatpak)
+ return self->have_libreoffice_flatpak;
- self->priv->checked_libreoffice_flatpak = TRUE;
+ self->checked_libreoffice_flatpak = TRUE;
ret = g_spawn_sync (NULL, (gchar **) check_argv, NULL,
G_SPAWN_DEFAULT |
@@ -183,7 +183,7 @@ check_libreoffice_flatpak (SushiPdfLoader *self,
GError *child_error = NULL;
if (g_spawn_check_exit_status (exit_status, &child_error)) {
g_debug ("Found LibreOffice flatpak!");
- self->priv->have_libreoffice_flatpak = TRUE;
+ self->have_libreoffice_flatpak = TRUE;
} else {
g_debug ("LibreOffice flatpak not found, flatpak info returned %i (%s)",
exit_status, child_error->message);
@@ -195,7 +195,7 @@ check_libreoffice_flatpak (SushiPdfLoader *self,
g_clear_error (&error);
}
- return self->priv->have_libreoffice_flatpak;
+ return self->have_libreoffice_flatpak;
}
static void
@@ -224,7 +224,7 @@ load_libreoffice (SushiPdfLoader *self)
}
}
- file = g_file_new_for_uri (self->priv->uri);
+ file = g_file_new_for_uri (self->uri);
doc_path = g_file_get_path (file);
doc_name = g_file_get_basename (file);
g_object_unref (file);
@@ -237,7 +237,7 @@ load_libreoffice (SushiPdfLoader *self)
g_free (doc_name);
pdf_dir = g_build_filename (g_get_user_cache_dir (), "sushi", NULL);
- self->priv->pdf_path = g_build_filename (pdf_dir, tmp_name, NULL);
+ self->pdf_path = g_build_filename (pdf_dir, tmp_name, NULL);
g_mkdir_with_parents (pdf_dir, 0700);
g_free (tmp_name);
@@ -308,7 +308,7 @@ load_libreoffice (SushiPdfLoader *self)
}
g_child_watch_add (pid, libreoffice_child_watch_cb, self);
- self->priv->libreoffice_pid = pid;
+ self->libreoffice_pid = pid;
}
static gboolean
@@ -346,7 +346,7 @@ query_info_ready_cb (GObject *obj,
if (error != NULL) {
g_warning ("Unable to query the mimetype of %s: %s",
- self->priv->uri, error->message);
+ self->uri, error->message);
g_error_free (error);
return;
@@ -355,7 +355,7 @@ query_info_ready_cb (GObject *obj,
content_type = g_file_info_get_content_type (info);
if (content_type_is_native (content_type))
- load_pdf (self, self->priv->uri);
+ load_pdf (self, self->uri);
else
load_libreoffice (self);
@@ -367,7 +367,7 @@ start_loading_document (SushiPdfLoader *self)
{
GFile *file;
- file = g_file_new_for_uri (self->priv->uri);
+ file = g_file_new_for_uri (self->uri);
g_file_query_info_async (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
@@ -383,10 +383,10 @@ static void
sushi_pdf_loader_set_uri (SushiPdfLoader *self,
const gchar *uri)
{
- g_clear_object (&self->priv->document);
- g_free (self->priv->uri);
+ g_clear_object (&self->document);
+ g_free (self->uri);
- self->priv->uri = g_strdup (uri);
+ self->uri = g_strdup (uri);
start_loading_document (self);
}
@@ -395,18 +395,18 @@ sushi_pdf_loader_dispose (GObject *object)
{
SushiPdfLoader *self = SUSHI_PDF_LOADER (object);
- if (self->priv->pdf_path) {
- g_unlink (self->priv->pdf_path);
- g_free (self->priv->pdf_path);
+ if (self->pdf_path) {
+ g_unlink (self->pdf_path);
+ g_free (self->pdf_path);
}
- if (self->priv->libreoffice_pid != -1) {
- kill (self->priv->libreoffice_pid, SIGKILL);
- self->priv->libreoffice_pid = -1;
+ if (self->libreoffice_pid != -1) {
+ kill (self->libreoffice_pid, SIGKILL);
+ self->libreoffice_pid = -1;
}
- g_clear_object (&self->priv->document);
- g_free (self->priv->uri);
+ g_clear_object (&self->document);
+ g_free (self->uri);
G_OBJECT_CLASS (sushi_pdf_loader_parent_class)->dispose (object);
}
@@ -421,10 +421,10 @@ sushi_pdf_loader_get_property (GObject *object,
switch (prop_id) {
case PROP_DOCUMENT:
- g_value_set_object (value, self->priv->document);
+ g_value_set_object (value, self->document);
break;
case PROP_URI:
- g_value_set_string (value, self->priv->uri);
+ g_value_set_string (value, self->uri);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -477,18 +477,12 @@ sushi_pdf_loader_class_init (SushiPdfLoaderClass *klass)
"The URI to load",
NULL,
G_PARAM_READWRITE));
-
- g_type_class_add_private (klass, sizeof (SushiPdfLoaderPrivate));
}
static void
sushi_pdf_loader_init (SushiPdfLoader *self)
{
- self->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (self,
- SUSHI_TYPE_PDF_LOADER,
- SushiPdfLoaderPrivate);
- self->priv->libreoffice_pid = -1;
+ self->libreoffice_pid = -1;
}
SushiPdfLoader *
diff --git a/src/libsushi/sushi-pdf-loader.h b/src/libsushi/sushi-pdf-loader.h
index 3a5fc70..b484df6 100644
--- a/src/libsushi/sushi-pdf-loader.h
+++ b/src/libsushi/sushi-pdf-loader.h
@@ -30,30 +30,8 @@
G_BEGIN_DECLS
-#define SUSHI_TYPE_PDF_LOADER (sushi_pdf_loader_get_type ())
-#define SUSHI_PDF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUSHI_TYPE_PDF_LOADER,
SushiPdfLoader))
-#define SUSHI_IS_PDF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUSHI_TYPE_PDF_LOADER))
-#define SUSHI_PDF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUSHI_TYPE_PDF_LOADER,
SushiPdfLoaderClass))
-#define SUSHI_IS_PDF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUSHI_TYPE_PDF_LOADER))
-#define SUSHI_PDF_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUSHI_TYPE_PDF_LOADER,
SushiPdfLoaderClass))
-
-typedef struct _SushiPdfLoader SushiPdfLoader;
-typedef struct _SushiPdfLoaderPrivate SushiPdfLoaderPrivate;
-typedef struct _SushiPdfLoaderClass SushiPdfLoaderClass;
-
-struct _SushiPdfLoader
-{
- GObject parent_instance;
-
- SushiPdfLoaderPrivate *priv;
-};
-
-struct _SushiPdfLoaderClass
-{
- GObjectClass parent_class;
-};
-
-GType sushi_pdf_loader_get_type (void) G_GNUC_CONST;
+#define SUSHI_TYPE_PDF_LOADER sushi_pdf_loader_get_type ()
+G_DECLARE_FINAL_TYPE (SushiPdfLoader, sushi_pdf_loader, SUSHI, PDF_LOADER, GObject)
SushiPdfLoader *sushi_pdf_loader_new (const gchar *uri);
diff --git a/src/libsushi/sushi-sound-player.c b/src/libsushi/sushi-sound-player.c
index 18db6a2..af9e251 100644
--- a/src/libsushi/sushi-sound-player.c
+++ b/src/libsushi/sushi-sound-player.c
@@ -32,27 +32,7 @@
#include "sushi-enum-types.h"
#include "sushi-sound-player.h"
-G_DEFINE_TYPE (SushiSoundPlayer, sushi_sound_player, G_TYPE_OBJECT);
-
-#define SUSHI_SOUND_PLAYER_GET_PRIVATE(obj) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((obj), SUSHI_TYPE_SOUND_PLAYER, SushiSoundPlayerPrivate))
-
-#define TICK_TIMEOUT 0.5
-
-enum
-{
- PROP_0,
-
- PROP_PLAYING,
- PROP_STATE,
- PROP_PROGRESS,
- PROP_DURATION,
- PROP_URI,
- PROP_TAGLIST
-};
-
-struct _SushiSoundPlayerPrivate
-{
+struct _SushiSoundPlayer {
GstElement *pipeline;
GstBus *bus;
SushiSoundPlayerState state;
@@ -70,6 +50,22 @@ struct _SushiSoundPlayerPrivate
guint in_seek : 1;
};
+G_DEFINE_TYPE (SushiSoundPlayer, sushi_sound_player, G_TYPE_OBJECT)
+
+#define TICK_TIMEOUT 0.5
+
+enum
+{
+ PROP_0,
+
+ PROP_PLAYING,
+ PROP_STATE,
+ PROP_PROGRESS,
+ PROP_DURATION,
+ PROP_URI,
+ PROP_TAGLIST
+};
+
static void sushi_sound_player_destroy_pipeline (SushiSoundPlayer *player);
static gboolean sushi_sound_player_ensure_pipeline (SushiSoundPlayer *player);
@@ -77,16 +73,12 @@ static void
sushi_sound_player_set_state (SushiSoundPlayer *player,
SushiSoundPlayerState state)
{
- SushiSoundPlayerPrivate *priv;
-
g_return_if_fail (SUSHI_IS_SOUND_PLAYER (player));
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->state == state)
+ if (player->state == state)
return;
- priv->state = state;
+ player->state = state;
g_object_notify (G_OBJECT (player), "state");
}
@@ -95,23 +87,21 @@ sushi_sound_player_set_state (SushiSoundPlayer *player,
static void
sushi_sound_player_destroy_discoverer (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->discoverer == NULL)
+ if (player->discoverer == NULL)
return;
- if (priv->taglist != NULL) {
- gst_tag_list_free (priv->taglist);
- priv->taglist = NULL;
+ if (player->taglist != NULL) {
+ gst_tag_list_free (player->taglist);
+ player->taglist = NULL;
}
- gst_discoverer_stop (priv->discoverer);
- gst_object_unref (priv->discoverer);
- priv->discoverer = NULL;
+ gst_discoverer_stop (player->discoverer);
+ gst_object_unref (player->discoverer);
+ player->discoverer = NULL;
g_object_notify (G_OBJECT (player), "taglist");
- g_clear_object (&priv->taglist);
+ g_clear_object (&player->taglist);
}
static void
@@ -121,11 +111,8 @@ discoverer_discovered_cb (GstDiscoverer *disco,
gpointer user_data)
{
SushiSoundPlayer *player = user_data;
- SushiSoundPlayerPrivate *priv;
const GstTagList *taglist;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
if (error != NULL)
return;
@@ -133,7 +120,7 @@ discoverer_discovered_cb (GstDiscoverer *disco,
if (taglist)
{
- priv->taglist = gst_tag_list_copy (taglist);
+ player->taglist = gst_tag_list_copy (taglist);
g_object_notify (G_OBJECT (player), "taglist");
}
}
@@ -141,22 +128,19 @@ discoverer_discovered_cb (GstDiscoverer *disco,
static gboolean
sushi_sound_player_ensure_discoverer (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->discoverer)
+ if (player->discoverer)
return TRUE;
- priv->discoverer = gst_discoverer_new (GST_SECOND * 60,
+ player->discoverer = gst_discoverer_new (GST_SECOND * 60,
NULL);
- if (priv->discoverer == NULL)
+ if (player->discoverer == NULL)
return FALSE;
- g_signal_connect (priv->discoverer, "discovered",
+ g_signal_connect (player->discoverer, "discovered",
G_CALLBACK (discoverer_discovered_cb), player);
- gst_discoverer_start (priv->discoverer);
- gst_discoverer_discover_uri_async (priv->discoverer, priv->uri);
+ gst_discoverer_start (player->discoverer);
+ gst_discoverer_discover_uri_async (player->discoverer, player->uri);
return TRUE;
}
@@ -165,22 +149,18 @@ static void
sushi_sound_player_set_uri (SushiSoundPlayer *player,
const char *uri)
{
- SushiSoundPlayerPrivate *priv;
-
g_return_if_fail (SUSHI_IS_SOUND_PLAYER (player));
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!g_strcmp0 (priv->uri, uri))
+ if (!g_strcmp0 (player->uri, uri))
return;
- g_free (priv->uri);
- priv->uri = g_strdup (uri);
+ g_free (player->uri);
+ player->uri = g_strdup (uri);
- if (priv->pipeline)
+ if (player->pipeline)
sushi_sound_player_destroy_pipeline (player);
- if (priv->discoverer)
+ if (player->discoverer)
sushi_sound_player_destroy_discoverer (player);
sushi_sound_player_ensure_pipeline (player);
@@ -193,34 +173,31 @@ static void
sushi_sound_player_set_progress (SushiSoundPlayer *player,
gdouble progress)
{
- SushiSoundPlayerPrivate *priv;
GstState pending;
GstQuery *duration_q;
gint64 position;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!priv->pipeline)
+ if (!player->pipeline)
return;
- priv->target_progress = progress;
+ player->target_progress = progress;
- if (priv->in_seek)
+ if (player->in_seek)
{
- priv->stacked_progress = progress;
+ player->stacked_progress = progress;
return;
}
- gst_element_get_state (priv->pipeline, &priv->stacked_state, &pending, 0);
+ gst_element_get_state (player->pipeline, &player->stacked_state, &pending, 0);
if (pending)
- priv->stacked_state = pending;
+ player->stacked_state = pending;
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ gst_element_set_state (player->pipeline, GST_STATE_PAUSED);
duration_q = gst_query_new_duration (GST_FORMAT_TIME);
- if (gst_element_query (priv->pipeline, duration_q))
+ if (gst_element_query (player->pipeline, duration_q))
{
gint64 duration = 0;
@@ -233,7 +210,7 @@ sushi_sound_player_set_progress (SushiSoundPlayer *player,
gst_query_unref (duration_q);
- gst_element_seek (priv->pipeline,
+ gst_element_seek (player->pipeline,
1.0,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
@@ -241,32 +218,29 @@ sushi_sound_player_set_progress (SushiSoundPlayer *player,
position,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- priv->in_seek = TRUE;
- priv->stacked_progress = 0.0;
+ player->in_seek = TRUE;
+ player->stacked_progress = 0.0;
}
static gdouble
sushi_sound_player_get_progress (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
GstQuery *position_q, *duration_q;
gdouble progress;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!priv->pipeline)
+ if (!player->pipeline)
return 0.0;
- if (priv->in_seek)
+ if (player->in_seek)
{
- return priv->target_progress;
+ return player->target_progress;
}
position_q = gst_query_new_position (GST_FORMAT_TIME);
duration_q = gst_query_new_duration (GST_FORMAT_TIME);
- if (gst_element_query (priv->pipeline, position_q) &&
- gst_element_query (priv->pipeline, duration_q))
+ if (gst_element_query (player->pipeline, position_q) &&
+ gst_element_query (player->pipeline, duration_q))
{
gint64 position, duration;
@@ -289,22 +263,19 @@ sushi_sound_player_get_progress (SushiSoundPlayer *player)
static void
sushi_sound_player_query_duration (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
gdouble new_duration, difference;
gint64 duration;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!gst_element_query_duration (priv->pipeline, GST_FORMAT_TIME, &duration))
+ if (!gst_element_query_duration (player->pipeline, GST_FORMAT_TIME, &duration))
return;
new_duration = (gdouble) duration / GST_SECOND;
- difference = ABS (priv->duration - new_duration);
+ difference = ABS (player->duration - new_duration);
if (difference > 1e-3)
{
- priv->duration = new_duration;
+ player->duration = new_duration;
if (difference > 1.0)
g_object_notify (G_OBJECT (player), "duration");
@@ -314,16 +285,13 @@ sushi_sound_player_query_duration (SushiSoundPlayer *player)
static void
sushi_sound_player_reset_pipeline (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
GstState state, pending;
GstMessage *msg;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!priv->pipeline)
+ if (!player->pipeline)
return;
- gst_element_get_state (priv->pipeline, &state, &pending, 0);
+ gst_element_get_state (player->pipeline, &state, &pending, 0);
if (state == GST_STATE_NULL && pending == GST_STATE_VOID_PENDING)
{
@@ -331,17 +299,17 @@ sushi_sound_player_reset_pipeline (SushiSoundPlayer *player)
}
else if (state == GST_STATE_NULL && pending != GST_STATE_VOID_PENDING)
{
- gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+ gst_element_set_state (player->pipeline, GST_STATE_NULL);
return;
}
- gst_element_set_state (priv->pipeline, GST_STATE_READY);
- gst_element_get_state (priv->pipeline, NULL, NULL, -1);
+ gst_element_set_state (player->pipeline, GST_STATE_READY);
+ gst_element_get_state (player->pipeline, NULL, NULL, -1);
- while ((msg = gst_bus_pop (priv->bus)))
- gst_bus_async_signal_func (priv->bus, msg, NULL);
+ while ((msg = gst_bus_pop (player->bus)))
+ gst_bus_async_signal_func (player->bus, msg, NULL);
- gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+ gst_element_set_state (player->pipeline, GST_STATE_NULL);
g_object_notify (G_OBJECT (player), "duration");
g_object_notify (G_OBJECT (player), "progress");
@@ -350,31 +318,27 @@ sushi_sound_player_reset_pipeline (SushiSoundPlayer *player)
static void
sushi_sound_player_destroy_pipeline (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
-
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->bus)
+ if (player->bus)
{
- gst_bus_set_flushing (priv->bus, TRUE);
- gst_bus_remove_signal_watch (priv->bus);
+ gst_bus_set_flushing (player->bus, TRUE);
+ gst_bus_remove_signal_watch (player->bus);
- gst_object_unref (priv->bus);
- priv->bus = NULL;
+ gst_object_unref (player->bus);
+ player->bus = NULL;
}
- if (priv->pipeline)
+ if (player->pipeline)
{
- gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+ gst_element_set_state (player->pipeline, GST_STATE_NULL);
- gst_object_unref (priv->pipeline);
- priv->pipeline = NULL;
+ gst_object_unref (player->pipeline);
+ player->pipeline = NULL;
}
- if (priv->tick_timeout_id != 0)
+ if (player->tick_timeout_id != 0)
{
- g_source_remove (priv->tick_timeout_id);
- priv->tick_timeout_id = 0;
+ g_source_remove (player->tick_timeout_id);
+ player->tick_timeout_id = 0;
}
g_object_notify (G_OBJECT (player), "duration");
@@ -396,14 +360,11 @@ sushi_sound_player_on_state_changed (GstBus *bus,
GstMessage *msg,
SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
GstState state, old_state;
g_return_if_fail (SUSHI_IS_SOUND_PLAYER (player));
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (msg->src != GST_OBJECT (priv->pipeline))
+ if (msg->src != GST_OBJECT (player->pipeline))
return;
gst_message_parse_state_changed (msg, &old_state, &state, NULL);
@@ -416,9 +377,9 @@ sushi_sound_player_on_state_changed (GstBus *bus,
case GST_STATE_PLAYING:
sushi_sound_player_set_state (player, SUSHI_SOUND_PLAYER_STATE_PLAYING);
- if (priv->tick_timeout_id == 0)
+ if (player->tick_timeout_id == 0)
{
- priv->tick_timeout_id =
+ player->tick_timeout_id =
g_timeout_add (TICK_TIMEOUT * 1000,
sushi_sound_player_tick_timeout,
player);
@@ -429,10 +390,10 @@ sushi_sound_player_on_state_changed (GstBus *bus,
case GST_STATE_PAUSED:
sushi_sound_player_set_state (player, SUSHI_SOUND_PLAYER_STATE_IDLE);
- if (priv->tick_timeout_id != 0)
+ if (player->tick_timeout_id != 0)
{
- g_source_remove (priv->tick_timeout_id);
- priv->tick_timeout_id = 0;
+ g_source_remove (player->tick_timeout_id);
+ player->tick_timeout_id = 0;
}
break;
@@ -467,20 +428,16 @@ sushi_sound_player_on_async_done (GstBus *bus,
GstMessage *msg,
SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
-
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->in_seek)
+ if (player->in_seek)
{
g_object_notify (G_OBJECT (player), "progress");
- priv->in_seek = FALSE;
- gst_element_set_state (priv->pipeline, priv->stacked_state);
+ player->in_seek = FALSE;
+ gst_element_set_state (player->pipeline, player->stacked_state);
- if (priv->stacked_progress)
+ if (player->stacked_progress)
{
- sushi_sound_player_set_progress (player, priv->stacked_progress);
+ sushi_sound_player_set_progress (player, player->stacked_progress);
}
}
}
@@ -503,16 +460,13 @@ sushi_sound_player_on_duration (GstBus *bus,
static gboolean
sushi_sound_player_ensure_pipeline (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
GError *error;
gchar *pipeline_desc;
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (priv->pipeline)
+ if (player->pipeline)
return TRUE;
- if (priv->uri == NULL)
+ if (player->uri == NULL)
{
sushi_sound_player_set_state (player, SUSHI_SOUND_PLAYER_STATE_ERROR);
return FALSE;
@@ -521,62 +475,62 @@ sushi_sound_player_ensure_pipeline (SushiSoundPlayer *player)
error = NULL;
pipeline_desc = g_strdup_printf("playbin uri=\"%s\"",
- priv->uri);
+ player->uri);
- priv->pipeline = gst_parse_launch (pipeline_desc, &error);
+ player->pipeline = gst_parse_launch (pipeline_desc, &error);
g_free (pipeline_desc);
if (error)
{
g_error_free (error);
- priv->pipeline = NULL;
+ player->pipeline = NULL;
sushi_sound_player_set_state (player, SUSHI_SOUND_PLAYER_STATE_ERROR);
return FALSE;
}
- if (!gst_element_set_state (priv->pipeline, GST_STATE_READY))
+ if (!gst_element_set_state (player->pipeline, GST_STATE_READY))
{
- g_object_unref (priv->pipeline);
- priv->pipeline = NULL;
+ g_object_unref (player->pipeline);
+ player->pipeline = NULL;
sushi_sound_player_set_state (player, SUSHI_SOUND_PLAYER_STATE_ERROR);
return FALSE;
}
- priv->bus = gst_element_get_bus (priv->pipeline);
+ player->bus = gst_element_get_bus (player->pipeline);
- gst_bus_add_signal_watch (priv->bus);
+ gst_bus_add_signal_watch (player->bus);
- g_signal_connect (priv->bus,
+ g_signal_connect (player->bus,
"message::state-changed",
G_CALLBACK (sushi_sound_player_on_state_changed),
player);
- g_signal_connect (priv->bus,
+ g_signal_connect (player->bus,
"message::error",
G_CALLBACK (sushi_sound_player_on_error),
player);
- g_signal_connect (priv->bus,
+ g_signal_connect (player->bus,
"message::eos",
G_CALLBACK (sushi_sound_player_on_eos),
player);
- g_signal_connect (priv->bus,
+ g_signal_connect (player->bus,
"message::async-done",
G_CALLBACK (sushi_sound_player_on_async_done),
player);
- g_signal_connect (priv->bus,
+ g_signal_connect (player->bus,
"message::duration",
G_CALLBACK (sushi_sound_player_on_duration),
player);
/* Pause pipeline so that the file duration becomes
* available as soon as possible */
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ gst_element_set_state (player->pipeline, GST_STATE_PAUSED);
return TRUE;
}
@@ -585,20 +539,17 @@ void
sushi_sound_player_set_playing (SushiSoundPlayer *player,
gboolean playing)
{
- SushiSoundPlayerPrivate *priv;
GstState state;
g_return_if_fail (SUSHI_IS_SOUND_PLAYER (player));
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
if (playing)
state = GST_STATE_PLAYING;
else
state = GST_STATE_PAUSED;
if (sushi_sound_player_ensure_pipeline (player))
- gst_element_set_state (priv->pipeline, state);
+ gst_element_set_state (player->pipeline, state);
g_object_notify (G_OBJECT (player), "playing");
g_object_notify (G_OBJECT (player), "progress");
@@ -607,18 +558,15 @@ sushi_sound_player_set_playing (SushiSoundPlayer *player,
static gboolean
sushi_sound_player_get_playing (SushiSoundPlayer *player)
{
- SushiSoundPlayerPrivate *priv;
GstState state, pending;
gboolean playing;
g_return_val_if_fail (SUSHI_IS_SOUND_PLAYER (player), FALSE);
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- if (!priv->pipeline)
+ if (!player->pipeline)
return FALSE;
- gst_element_get_state (priv->pipeline, &state, &pending, 0);
+ gst_element_get_state (player->pipeline, &state, &pending, 0);
if (pending)
playing = (pending == GST_STATE_PLAYING);
@@ -650,10 +598,8 @@ sushi_sound_player_get_property (GObject *gobject,
GParamSpec *pspec)
{
SushiSoundPlayer *player;
- SushiSoundPlayerPrivate *priv;
player = SUSHI_SOUND_PLAYER (gobject);
- priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
switch (prop_id)
{
@@ -663,7 +609,7 @@ sushi_sound_player_get_property (GObject *gobject,
break;
case PROP_STATE:
- g_value_set_enum (value, priv->state);
+ g_value_set_enum (value, player->state);
break;
case PROP_PROGRESS:
@@ -672,15 +618,15 @@ sushi_sound_player_get_property (GObject *gobject,
break;
case PROP_DURATION:
- g_value_set_double (value, priv->duration);
+ g_value_set_double (value, player->duration);
break;
case PROP_URI:
- g_value_set_string (value, priv->uri);
+ g_value_set_string (value, player->uri);
break;
case PROP_TAGLIST:
- g_value_set_boxed (value, priv->taglist);
+ g_value_set_boxed (value, player->taglist);
break;
default:
@@ -725,8 +671,6 @@ sushi_sound_player_class_init (SushiSoundPlayerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (SushiSoundPlayerPrivate));
-
gobject_class->get_property = sushi_sound_player_get_property;
gobject_class->set_property = sushi_sound_player_set_property;
gobject_class->dispose = sushi_sound_player_dispose;
@@ -796,14 +740,12 @@ sushi_sound_player_class_init (SushiSoundPlayerClass *klass)
static void
sushi_sound_player_init (SushiSoundPlayer *player)
{
- player->priv = SUSHI_SOUND_PLAYER_GET_PRIVATE (player);
-
- player->priv->state = SUSHI_SOUND_PLAYER_STATE_UNKNOWN;
- player->priv->playing = FALSE;
- player->priv->uri = NULL;
- player->priv->pipeline = NULL;
- player->priv->bus = NULL;
- player->priv->stacked_progress = 0.0;
- player->priv->duration = 0.0;
- player->priv->tick_timeout_id = 0;
+ player->state = SUSHI_SOUND_PLAYER_STATE_UNKNOWN;
+ player->playing = FALSE;
+ player->uri = NULL;
+ player->pipeline = NULL;
+ player->bus = NULL;
+ player->stacked_progress = 0.0;
+ player->duration = 0.0;
+ player->tick_timeout_id = 0;
}
diff --git a/src/libsushi/sushi-sound-player.h b/src/libsushi/sushi-sound-player.h
index 12d578d..88de628 100644
--- a/src/libsushi/sushi-sound-player.h
+++ b/src/libsushi/sushi-sound-player.h
@@ -30,16 +30,8 @@
G_BEGIN_DECLS
-#define SUSHI_TYPE_SOUND_PLAYER (sushi_sound_player_get_type ())
-#define SUSHI_SOUND_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUSHI_TYPE_SOUND_PLAYER,
SushiSoundPlayer))
-#define SUSHI_IS_SOUND_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUSHI_TYPE_SOUND_PLAYER))
-#define SUSHI_SOUND_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUSHI_TYPE_SOUND_PLAYER,
SushiSoundPlayerClass))
-#define SUSHI_IS_SOUND_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUSHI_TYPE_SOUND_PLAYER))
-#define SUSHI_SOUND_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUSHI_TYPE_SOUND_PLAYER,
SushiSoundPlayerClass))
-
-typedef struct _SushiSoundPlayer SushiSoundPlayer;
-typedef struct _SushiSoundPlayerPrivate SushiSoundPlayerPrivate;
-typedef struct _SushiSoundPlayerClass SushiSoundPlayerClass;
+#define SUSHI_TYPE_SOUND_PLAYER sushi_sound_player_get_type ()
+G_DECLARE_FINAL_TYPE (SushiSoundPlayer, sushi_sound_player, SUSHI, SOUND_PLAYER, GObject)
typedef enum
{
@@ -50,20 +42,6 @@ typedef enum
SUSHI_SOUND_PLAYER_STATE_ERROR = 4
} SushiSoundPlayerState;
-struct _SushiSoundPlayer
-{
- GObject parent_instance;
-
- SushiSoundPlayerPrivate *priv;
-};
-
-struct _SushiSoundPlayerClass
-{
- GObjectClass parent_class;
-};
-
-GType sushi_sound_player_get_type (void) G_GNUC_CONST;
-
G_END_DECLS
#endif /* __SUSHI_SOUND_PLAYER_H__ */
diff --git a/src/libsushi/sushi-text-loader.c b/src/libsushi/sushi-text-loader.c
index afcae0c..0b6341c 100644
--- a/src/libsushi/sushi-text-loader.c
+++ b/src/libsushi/sushi-text-loader.c
@@ -31,7 +31,13 @@
#include "sushi-utils.h"
-G_DEFINE_TYPE (SushiTextLoader, sushi_text_loader, G_TYPE_OBJECT);
+struct _SushiTextLoader {
+ gchar *uri;
+ GtkSourceFile *source_file;
+ GtkSourceBuffer *buffer;
+};
+
+G_DEFINE_TYPE (SushiTextLoader, sushi_text_loader, G_TYPE_OBJECT)
enum {
PROP_URI = 1,
@@ -46,12 +52,6 @@ enum {
static GParamSpec* properties[NUM_PROPERTIES] = { NULL, };
static guint signals[NUM_SIGNALS] = { 0, };
-struct _SushiTextLoaderPrivate {
- gchar *uri;
- GtkSourceFile *source_file;
- GtkSourceBuffer *buffer;
-};
-
/* code adapted from gtksourceview:tests/test-widget.c
* License: LGPL v2.1+
* Copyright (C) 2001 - Mikael Hermansson <tyan linux se>
@@ -110,7 +110,7 @@ static GtkSourceLanguage *
text_loader_get_buffer_language (SushiTextLoader *self,
GFile *file)
{
- GtkSourceBuffer *buffer = self->priv->buffer;
+ GtkSourceBuffer *buffer = self->buffer;
GtkSourceLanguage *language = NULL;
GtkTextIter start, end;
gchar *text;
@@ -173,9 +173,9 @@ load_contents_async_ready_cb (GObject *source,
}
language = text_loader_get_buffer_language (self, gtk_source_file_loader_get_location (loader));
- gtk_source_buffer_set_language (self->priv->buffer, language);
+ gtk_source_buffer_set_language (self->buffer, language);
- g_signal_emit (self, signals[LOADED], 0, self->priv->buffer);
+ g_signal_emit (self, signals[LOADED], 0, self->buffer);
}
static void
@@ -184,16 +184,16 @@ start_loading_buffer (SushiTextLoader *self)
GFile *file;
GtkSourceFileLoader *loader;
- if (self->priv->source_file == NULL)
- self->priv->source_file = gtk_source_file_new ();
+ if (self->source_file == NULL)
+ self->source_file = gtk_source_file_new ();
- file = g_file_new_for_uri (self->priv->uri);
- gtk_source_file_set_location (self->priv->source_file, file);
+ file = g_file_new_for_uri (self->uri);
+ gtk_source_file_set_location (self->source_file, file);
g_object_unref (file);
- self->priv->buffer = gtk_source_buffer_new (NULL);
- loader = gtk_source_file_loader_new (self->priv->buffer,
- self->priv->source_file);
+ self->buffer = gtk_source_buffer_new (NULL);
+ loader = gtk_source_file_loader_new (self->buffer,
+ self->source_file);
gtk_source_file_loader_load_async (loader, G_PRIORITY_DEFAULT,
NULL, NULL, NULL, NULL,
@@ -205,11 +205,11 @@ static void
sushi_text_loader_set_uri (SushiTextLoader *self,
const gchar *uri)
{
- if (g_strcmp0 (uri, self->priv->uri) != 0) {
- g_free (self->priv->uri);
+ if (g_strcmp0 (uri, self->uri) != 0) {
+ g_free (self->uri);
- self->priv->uri = g_strdup (uri);
- g_clear_object (&self->priv->buffer);
+ self->uri = g_strdup (uri);
+ g_clear_object (&self->buffer);
start_loading_buffer (self);
@@ -222,8 +222,8 @@ sushi_text_loader_dispose (GObject *object)
{
SushiTextLoader *self = SUSHI_TEXT_LOADER (object);
- g_free (self->priv->uri);
- g_clear_object (&self->priv->source_file);
+ g_free (self->uri);
+ g_clear_object (&self->source_file);
G_OBJECT_CLASS (sushi_text_loader_parent_class)->dispose (object);
}
@@ -238,7 +238,7 @@ sushi_text_loader_get_property (GObject *object,
switch (prop_id) {
case PROP_URI:
- g_value_set_string (value, self->priv->uri);
+ g_value_set_string (value, self->uri);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -291,17 +291,11 @@ sushi_text_loader_class_init (SushiTextLoaderClass *klass)
1, GTK_SOURCE_TYPE_BUFFER);
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
-
- g_type_class_add_private (klass, sizeof (SushiTextLoaderPrivate));
}
static void
sushi_text_loader_init (SushiTextLoader *self)
{
- self->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (self,
- SUSHI_TYPE_TEXT_LOADER,
- SushiTextLoaderPrivate);
}
SushiTextLoader *
diff --git a/src/libsushi/sushi-text-loader.h b/src/libsushi/sushi-text-loader.h
index 10dccbe..9f82680 100644
--- a/src/libsushi/sushi-text-loader.h
+++ b/src/libsushi/sushi-text-loader.h
@@ -30,30 +30,8 @@
G_BEGIN_DECLS
-#define SUSHI_TYPE_TEXT_LOADER (sushi_text_loader_get_type ())
-#define SUSHI_TEXT_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUSHI_TYPE_TEXT_LOADER,
SushiTextLoader))
-#define SUSHI_IS_TEXT_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUSHI_TYPE_TEXT_LOADER))
-#define SUSHI_TEXT_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUSHI_TYPE_TEXT_LOADER,
SushiTextLoaderClass))
-#define SUSHI_IS_TEXT_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUSHI_TYPE_TEXT_LOADER))
-#define SUSHI_TEXT_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUSHI_TYPE_TEXT_LOADER,
SushiTextLoaderClass))
-
-typedef struct _SushiTextLoader SushiTextLoader;
-typedef struct _SushiTextLoaderPrivate SushiTextLoaderPrivate;
-typedef struct _SushiTextLoaderClass SushiTextLoaderClass;
-
-struct _SushiTextLoader
-{
- GObject parent_instance;
-
- SushiTextLoaderPrivate *priv;
-};
-
-struct _SushiTextLoaderClass
-{
- GObjectClass parent_class;
-};
-
-GType sushi_text_loader_get_type (void) G_GNUC_CONST;
+#define SUSHI_TYPE_TEXT_LOADER sushi_text_loader_get_type ()
+G_DECLARE_FINAL_TYPE (SushiTextLoader, sushi_text_loader, SUSHI, TEXT_LOADER, GObject)
SushiTextLoader *sushi_text_loader_new (const gchar *uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]