summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Hallendal <micke@codefactory.se>2002-05-07 22:58:14 +0000
committerMikael Hallendal <hallski@src.gnome.org>2002-05-07 22:58:14 +0000
commit3f4a4cfd1e1fdb4ba449b2fa7cb1f0d4904d7634 (patch)
tree350acfea5681b8f1fca8cc98162468a19b7e90ae
parent32fee326786c85bb3f0d0962a5dc02c6cffd9501 (diff)
downloadyelp-3f4a4cfd1e1fdb4ba449b2fa7cb1f0d4904d7634.tar.gz
- added yelp-reader.[ch]
2002-05-08 Mikael Hallendal <micke@codefactory.se> * src/Makefile.am (yelp_SOURCES): - added yelp-reader.[ch] * src/yelp-uri.[ch]: - removed the YelpReader-stuff from here. * src/yelp-reader.[ch]: - starting on this class that will take care of reading any given YelpURI *uri and signalling when there is something to read.
-rw-r--r--ChangeLog12
-rw-r--r--src/Makefile.am1
-rw-r--r--src/yelp-reader.c88
-rw-r--r--src/yelp-reader.h69
-rw-r--r--src/yelp-uri.c33
-rw-r--r--src/yelp-uri.h29
6 files changed, 170 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e726e29..36fd14da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-05-08 Mikael Hallendal <micke@codefactory.se>
+
+ * src/Makefile.am (yelp_SOURCES):
+ - added yelp-reader.[ch]
+
+ * src/yelp-uri.[ch]:
+ - removed the YelpReader-stuff from here.
+
+ * src/yelp-reader.[ch]:
+ - starting on this class that will take care of reading any given
+ YelpURI *uri and signalling when there is something to read.
+
2002-05-07 Christophe Merlet <christophe@merlet.net>
* src/Makefile.am: Really add ??!! $(DESTDIR) variable.
diff --git a/src/Makefile.am b/src/Makefile.am
index 8a19c694..e5a7d309 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,6 +47,7 @@ yelp_SOURCES = \
yelp-info.c yelp-info.h \
yelp-main.c \
yelp-man.c yelp-man.h \
+ yelp-reader.c yelp-reader.h \
yelp-section.c yelp-section.h \
yelp-scrollkeeper.c yelp-scrollkeeper.h \
yelp-util.c yelp-util.h \
diff --git a/src/yelp-reader.c b/src/yelp-reader.c
new file mode 100644
index 00000000..d4e3a937
--- /dev/null
+++ b/src/yelp-reader.c
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2002 Mikael Hallendal <micke@codefactory.se>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Mikael Hallendal <micke@codefactory.se>
+ */
+
+#include "yelp-reader.h"
+
+struct _YelpReaderPriv {
+ YelpURI *current_uri;
+
+};
+
+
+static void reader_class_init (YelpReaderClass *klass);
+static void reader_init (YelpReader *reader);
+
+
+GType
+yelp_reader_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info =
+ {
+ sizeof (YelpReaderClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) reader_class_init,
+ NULL,
+ NULL,
+ sizeof (YelpReader),
+ 0,
+ (GInstanceInitFunc) reader_init,
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "YelpReader",
+ &info, 0);
+ }
+
+ return type;
+}
+
+static void
+reader_class_init (YelpReaderClass *klass)
+{
+}
+
+static void
+reader_init (YelpReader *reader)
+{
+}
+
+YelpReader *
+yelp_reader_new (gboolean async)
+{
+ YelpReader *reader;
+
+ reader = g_new0 (YelpReader, 1);
+
+ return reader;
+}
+
+gboolean
+yelp_reader_read (YelpURI *uri)
+{
+ return TRUE;
+}
+
+
diff --git a/src/yelp-reader.h b/src/yelp-reader.h
new file mode 100644
index 00000000..9ab790d4
--- /dev/null
+++ b/src/yelp-reader.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2002 Mikael Hallendal <micke@codefactory.se>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Mikael Hallendal <micke@codefactory.se>
+ */
+
+#ifndef __YELP_READER_H__
+#define __YELP_READER_H__
+
+#include <glib-object.h>
+
+#include "yelp-uri.h"
+
+#define YELP_TYPE_READER (yelp_reader_get_type ())
+#define YELP_READER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), YELP_TYPE_READER, YelpReader))
+#define YELP_READER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), YELP_TYPE_READER, YelpReaderClass))
+#define YELP_IS_READER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), YELP_TYPE_READER))
+#define YELP_IS_READER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), YELP_TYPE_READER))
+#define YELP_READER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), YELP_TYPE_READER, YelpReaderClass))
+
+typedef struct _YelpReader YelpReader;
+typedef struct _YelpReaderClass YelpReaderClass;
+typedef struct _YelpReaderPriv YelpReaderPriv;
+
+typedef enum {
+ YELP_READER_STATUS_OK,
+ YELP_READER_STATUS_ERROR
+} YelpReaderStatus;
+
+struct _YelpReader {
+ GObject parent;
+
+ YelpReaderPriv *priv;
+};
+
+struct _YelpReaderClass {
+ GObjectClass parent_class;
+
+ /* Signals */
+ gboolean (*open) (YelpReaderStatus status);
+ gboolean (*read) (YelpReaderStatus status,
+ gint len,
+ gchar *buffer);
+ gboolean (*close) (YelpReaderStatus status);
+ gboolean (*error) (GError *error);
+};
+
+GType yelp_reader_get_type (void);
+YelpReader * yelp_reader_new (gboolean async);
+
+gboolean yelp_reader_read (YelpURI *uri);
+
+#endif /* __YELP_READER_H__ */
diff --git a/src/yelp-uri.c b/src/yelp-uri.c
index 4327a4d5..8c43bcd1 100644
--- a/src/yelp-uri.c
+++ b/src/yelp-uri.c
@@ -384,20 +384,6 @@ yelp_uri_get_section (YelpURI *uri)
return uri->section;
}
-gboolean
-yelp_uri_read (YelpURI *uri, YelpURIReader *reader, GError **error)
-{
- /* Read directly */
- return TRUE;
-}
-
-gboolean
-yelp_uri_read_async (YelpURI *uri, YelpURIReader *reader, GError **error)
-{
- /* For now read in a g_idle and later in own thread/gnome-vfs-async */
- return TRUE;
-}
-
YelpURI *
yelp_uri_ref (YelpURI *uri)
{
@@ -584,22 +570,3 @@ yelp_uri_to_string (YelpURI *uri)
return ret_val;
}
-
-YelpURIReader *
-yelp_uri_reader_new (YelpURIReaderOpenCallback open_cb,
- YelpURIReaderReadCallback read_cb,
- YelpURIReaderCloseCallback close_cb,
- gpointer user_data)
-{
- YelpURIReader *reader;
-
- reader = g_new0 (YelpURIReader, 1);
-
- reader->open_callback = open_cb;
- reader->read_callback = read_cb;
- reader->close_callback = close_cb;
- reader->user_data = user_data;
-
- return reader;
-}
-
diff --git a/src/yelp-uri.h b/src/yelp-uri.h
index e9233c28..ac8de97d 100644
--- a/src/yelp-uri.h
+++ b/src/yelp-uri.h
@@ -42,21 +42,6 @@ typedef enum {
typedef struct _YelpURI YelpURI;
-typedef int (*YelpURIReaderOpenCallback) (gpointer user_data,
- GError *error);
-typedef int (*YelpURIReaderReadCallback) (gpointer user_data,
- const gchar *buffer,
- gint len,
- GError *error);
-typedef int (*YelpURIReaderCloseCallback) (gpointer user_data,
- GError *error);
-typedef struct {
- YelpURIReaderOpenCallback open_callback;
- YelpURIReaderReadCallback read_callback;
- YelpURIReaderCloseCallback close_callback;
- gpointer user_data;
-} YelpURIReader;
-
YelpURI * yelp_uri_new (const gchar *str_uri);
gboolean yelp_uri_exists (YelpURI *uri);
@@ -64,14 +49,6 @@ YelpURIType yelp_uri_get_type (YelpURI *uri);
const gchar * yelp_uri_get_path (YelpURI *uri);
const gchar * yelp_uri_get_section (YelpURI *uri);
-gboolean yelp_uri_read (YelpURI *uri,
- YelpURIReader *reader,
- GError **error);
-
-gboolean yelp_uri_read_async (YelpURI *uri,
- YelpURIReader *reader,
- GError **error);
-
YelpURI * yelp_uri_ref (YelpURI *uri);
void yelp_uri_unref (YelpURI *uri);
@@ -86,10 +63,4 @@ gboolean yelp_uri_equal_section (YelpURI *uri1,
YelpURI *uri2);
gchar * yelp_uri_to_string (YelpURI *uri);
-/* Convenience function for creating a Reader-struct. */
-YelpURIReader * yelp_uri_reader_new (YelpURIReaderOpenCallback open_cb,
- YelpURIReaderReadCallback read_cb,
- YelpURIReaderCloseCallback close_cb,
- gpointer user_data);
-
#endif /* __YELP_URI_H__ */