[tepl] File loading: get FileContent object from FileContentLoader
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] File loading: get FileContent object from FileContentLoader
- Date: Fri, 20 Oct 2017 14:50:11 +0000 (UTC)
commit 616bfb545bc31e3b49b07c4295224eb6723f54f8
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Oct 20 15:20:23 2017 +0200
File loading: get FileContent object from FileContentLoader
tepl/tepl-file-content-loader.c | 8 ++++----
tepl/tepl-file-content-loader.h | 3 ++-
tepl/tepl-file-loader.c | 13 +++++++++----
3 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/tepl/tepl-file-content-loader.c b/tepl/tepl-file-content-loader.c
index 3266847..d475c1d 100644
--- a/tepl/tepl-file-content-loader.c
+++ b/tepl/tepl-file-content-loader.c
@@ -567,10 +567,10 @@ _tepl_file_content_loader_load_finish (TeplFileContentLoader *loader,
/*
* Should be called only after a successful load operation.
*
- * Returns: (transfer none) (element-type GBytes): the content that has been
- * loaded by the last load operation on @loader.
+ * Returns: (transfer none): the content that has been loaded by the last load
+ * operation on @loader.
*/
-GQueue *
+TeplFileContent *
_tepl_file_content_loader_get_content (TeplFileContentLoader *loader)
{
g_return_val_if_fail (TEPL_IS_FILE_CONTENT_LOADER (loader), NULL);
@@ -580,7 +580,7 @@ _tepl_file_content_loader_get_content (TeplFileContentLoader *loader)
loader->priv->content = _tepl_file_content_new ();
}
- return _tepl_file_content_get_chunks (loader->priv->content);
+ return loader->priv->content;
}
/* Should be called only after a successful load operation. */
diff --git a/tepl/tepl-file-content-loader.h b/tepl/tepl-file-content-loader.h
index 2ac214d..fbaa21a 100644
--- a/tepl/tepl-file-content-loader.h
+++ b/tepl/tepl-file-content-loader.h
@@ -21,6 +21,7 @@
#define TEPL_FILE_CONTENT_LOADER_H
#include <gio/gio.h>
+#include "tepl-file-content.h"
G_BEGIN_DECLS
@@ -83,7 +84,7 @@ gboolean _tepl_file_content_loader_load_finish
(TeplFileContentLoader *loader
GError **error);
G_GNUC_INTERNAL
-GQueue * _tepl_file_content_loader_get_content (TeplFileContentLoader *loader);
+TeplFileContent * _tepl_file_content_loader_get_content (TeplFileContentLoader *loader);
G_GNUC_INTERNAL
const gchar * _tepl_file_content_loader_get_etag (TeplFileContentLoader *loader);
diff --git a/tepl/tepl-file-loader.c b/tepl/tepl-file-loader.c
index c1ad356..435d609 100644
--- a/tepl/tepl-file-loader.c
+++ b/tepl/tepl-file-loader.c
@@ -23,6 +23,7 @@
#include <glib/gi18n-lib.h>
#include "tepl-buffer.h"
#include "tepl-file.h"
+#include "tepl-file-content.h"
#include "tepl-file-content-loader.h"
#include "tepl-encoding.h"
#include "tepl-encoding-converter.h"
@@ -794,7 +795,8 @@ convert_and_insert_content (GTask *task)
TeplFileLoaderPrivate *priv;
TaskData *task_data;
TeplEncodingConverter *converter = NULL;
- GQueue *content;
+ TeplFileContent *content;
+ GQueue *chunks;
GList *l;
GError *error = NULL;
@@ -827,8 +829,9 @@ convert_and_insert_content (GTask *task)
}
content = _tepl_file_content_loader_get_content (task_data->content_loader);
+ chunks = _tepl_file_content_get_chunks (content);
- for (l = content->head; l != NULL; l = l->next)
+ for (l = chunks->head; l != NULL; l = l->next)
{
GBytes *chunk = l->data;
@@ -922,7 +925,8 @@ determine_encoding (GTask *task)
TaskData *task_data;
uchardet_t ud;
const gchar *charset;
- GQueue *content;
+ TeplFileContent *content;
+ GQueue *chunks;
GList *l;
loader = g_task_get_source_object (task);
@@ -933,8 +937,9 @@ determine_encoding (GTask *task)
ud = uchardet_new ();
content = _tepl_file_content_loader_get_content (task_data->content_loader);
+ chunks = _tepl_file_content_get_chunks (content);
- for (l = content->head; l != NULL; l = l->next)
+ for (l = chunks->head; l != NULL; l = l->next)
{
GBytes *chunk = l->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]