[yelp/yelp-3-0] [libyelp] Adding yelp-io-channel to libyelp
- From: Shaun McCance <shaunm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [yelp/yelp-3-0] [libyelp] Adding yelp-io-channel to libyelp
- Date: Wed, 18 Nov 2009 18:34:13 +0000 (UTC)
commit 6c21a73a4c884d4869a367e75eb570850aa475f1
Author: Shaun McCance <shaunm gnome org>
Date: Mon Nov 16 21:44:48 2009 -0600
[libyelp] Adding yelp-io-channel to libyelp
This is only an internal implementation detail. I want to switch over
to GIO. I'll need to create a GInputStream that automatically decodes
to replace YelpIOChannel.
libyelp/Makefile.am | 1 +
{src => libyelp}/yelp-io-channel.c | 10 +++---
{src => libyelp}/yelp-io-channel.h | 0
tests/Makefile.am | 7 ++++
src/yelp-io-channel.h => tests/test-io-channel.c | 35 +++++++++++++++++-----
tests/test-uri.c | 4 +-
6 files changed, 42 insertions(+), 15 deletions(-)
---
diff --git a/libyelp/Makefile.am b/libyelp/Makefile.am
index ed79d0c..f636918 100644
--- a/libyelp/Makefile.am
+++ b/libyelp/Makefile.am
@@ -5,6 +5,7 @@ libyelp_la_SOURCES = \
yelp-error.c \
yelp-docbook-document.c \
yelp-document.c \
+ yelp-io-channel.c \
yelp-location-entry.c \
yelp-mallard-document.c \
yelp-settings.c \
diff --git a/src/yelp-io-channel.c b/libyelp/yelp-io-channel.c
similarity index 95%
rename from src/yelp-io-channel.c
rename to libyelp/yelp-io-channel.c
index b41a205..47934d1 100644
--- a/src/yelp-io-channel.c
+++ b/libyelp/yelp-io-channel.c
@@ -121,11 +121,11 @@ yelp_io_channel_new_file (gchar *file,
if (!channel) {
if (error) {
- g_set_error (error, YELP_GERROR, YELP_GERROR_IO,
- _("The file â??%sâ?? could not be read and decoded. "
- "The file may be compressed in an unsupported "
- "format."),
- file);
+ g_set_error (error, YELP_ERROR, YELP_ERROR_PROCESSING,
+ _("The file â??%sâ?? could not be read and decoded. "
+ "The file may be compressed in an unsupported "
+ "format."),
+ file);
}
return NULL;
}
diff --git a/src/yelp-io-channel.h b/libyelp/yelp-io-channel.h
similarity index 100%
copy from src/yelp-io-channel.h
copy to libyelp/yelp-io-channel.h
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d305e34..02f1d98 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,15 +6,22 @@ YELP_COMMON_CFLAGS = \
-I$(top_srcdir)/libyelp
YELP_COMMON_LDADD = \
$(YELP_LIBS) \
+ $(Z_LIBS) \
+ $(BZ_LIBS) \
+ $(LZMADEC_LIBS) \
$(top_builddir)/libyelp/libyelp.la
check_PROGRAMS = \
+ test-io-channel \
test-location-entry \
test-settings \
test-transform \
test-uri \
test-view
+test_io_channel_CFLAGS = $(YELP_COMMON_CFLAGS)
+test_io_channel_LDADD = $(YELP_COMMON_LDADD)
+
test_location_entry_CFLAGS = $(YELP_COMMON_CFLAGS)
test_location_entry_LDADD = $(YELP_COMMON_LDADD)
diff --git a/src/yelp-io-channel.h b/tests/test-io-channel.c
similarity index 52%
rename from src/yelp-io-channel.h
rename to tests/test-io-channel.c
index ad2e0bf..f2e1dbc 100644
--- a/src/yelp-io-channel.h
+++ b/tests/test-io-channel.c
@@ -1,6 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2003 Shaun McCance <shaunm gnome org>
+ * Copyright (C) 2009 Shaun McCance <shaunm gnome org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -17,15 +17,34 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Author: Shaun McCance <shaunm gnome org>
+ * Author: Shaun McCance <shaunm gnome org
*/
-#ifndef __YELP_IO_CHANNEL_H__
-#define __YELP_IO_CHANNEL_H__
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
#include <glib.h>
-GIOChannel * yelp_io_channel_new_file (gchar *file,
- GError **error);
+#include "yelp-io-channel.h"
-#endif /* __YELP_IO_CHANNEL_H__ */
+int
+main (int argc, char **argv)
+{
+ GIOChannel *channel;
+ gchar *str;
+ gint len;
+
+ g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
+
+ if (argc < 2) {
+ g_printerr ("Usage: test-io-channel FILE\n");
+ return 1;
+ }
+
+ channel = yelp_io_channel_new_file (argv[1], NULL);
+ g_io_channel_read_to_end (channel, &str, &len, NULL);
+ printf ("%s\n", str);
+
+ return 0;
+}
diff --git a/tests/test-uri.c b/tests/test-uri.c
index bf295f0..869d9b1 100644
--- a/tests/test-uri.c
+++ b/tests/test-uri.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2002 Mikael Hallendal <micke imendio com>
+ * Copyright (C) 2009 Shaun McCance <shaunm gnome org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Author: Mikael Hallendal <micke imendio com>
+ * Author: Shaun McCance <shaunm gnome org>
*/
#include <config.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]