[yelp/yelp-3-0: 25/27] Starting libyelp



commit 83fc28c0069485be4db9426a3ab8f8c05ee91a1f
Author: Shaun McCance <shaunm gnome org>
Date:   Sun Sep 6 15:12:17 2009 -0500

    Starting libyelp

 configure.in                   |    1 +
 libyelp/Makefile.am            |   12 ++++
 {src => libyelp}/yelp-debug.c  |    0
 {src => libyelp}/yelp-debug.h  |    0
 {src => libyelp}/yelp-uri.c    |    0
 {src => libyelp}/yelp-uri.h    |    0
 libyelp/yelp-view.c            |  122 ++++++++++++++++++++++++++++++++++++++++
 libyelp/yelp-view.h            |   60 ++++++++++++++++++++
 tests/Makefile.am              |    8 +-
 tests/uri/ghelp-docbook-1.test |    4 +
 10 files changed, 203 insertions(+), 4 deletions(-)
---
diff --git a/configure.in b/configure.in
index 362c390..fd81adf 100644
--- a/configure.in
+++ b/configure.in
@@ -294,6 +294,7 @@ AC_SUBST([AM_LDFLAGS])
 
 AC_CONFIG_FILES([
 Makefile
+libyelp/Makefile
 src/Makefile
 stylesheets/Makefile
 stylesheets/db2html.xsl
diff --git a/libyelp/Makefile.am b/libyelp/Makefile.am
new file mode 100644
index 0000000..f452fd2
--- /dev/null
+++ b/libyelp/Makefile.am
@@ -0,0 +1,12 @@
+lib_LIBRARIES = libyelp.a
+
+libyelp_a_SOURCES =		\
+	yelp-debug.c		\
+	yelp-uri.c		\
+	yelp-view.c
+
+libyelp_a_CFLAGS =		\
+	$(YELP_CFLAGS)
+
+libyelp_a_LIBADD =		\
+	$(YELP_LIBS)
diff --git a/src/yelp-debug.c b/libyelp/yelp-debug.c
similarity index 100%
rename from src/yelp-debug.c
rename to libyelp/yelp-debug.c
diff --git a/src/yelp-debug.h b/libyelp/yelp-debug.h
similarity index 100%
rename from src/yelp-debug.h
rename to libyelp/yelp-debug.h
diff --git a/src/yelp-uri.c b/libyelp/yelp-uri.c
similarity index 100%
rename from src/yelp-uri.c
rename to libyelp/yelp-uri.c
diff --git a/src/yelp-uri.h b/libyelp/yelp-uri.h
similarity index 100%
rename from src/yelp-uri.h
rename to libyelp/yelp-uri.h
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
new file mode 100644
index 0000000..ff0d43a
--- /dev/null
+++ b/libyelp/yelp-view.c
@@ -0,0 +1,122 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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
+ * 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: Shaun McCance <shaunm gnome org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+static void        view_init		          (YelpView        *view);
+static void        view_class_init	          (YelpViewClass   *klass);
+
+enum {
+    NEW_VIEW_REQUESTED,
+    LAST_SIGNAL
+};
+static gint signals[LAST_SIGNAL] = { 0 };
+static GObjectClass *parent_class = NULL;
+
+#define YELP_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), YELP_TYPE_VIEW, YelpWindowView))
+
+struct _YelpWindowPriv {
+    WebKitWebView  *webview;
+};
+
+#define TARGET_TYPE_URI_LIST     "text/uri-list"
+enum {
+    TARGET_URI_LIST
+};
+
+GType
+yelp_view_get_type (void)
+{
+    static GType view_type = 0;
+
+    if (!window_type) {
+	static const GTypeInfo view_info = {
+	    sizeof (YelpViewClass),
+	    NULL,
+	    NULL,
+	    (GClassInitFunc) view_class_init,
+	    NULL,
+	    NULL,
+	    sizeof (YelpView),
+	    0,
+	    (GInstanceInitFunc) view_init,
+	};
+	view_type = g_type_register_static (GTK_TYPE_VIEW,
+                                            "YelpView",
+                                            &view_info, 0);
+    }
+    return view_type;
+}
+
+static void
+view_init (YelpView *view)
+{
+    view->priv = YELP_VIEW_GET_PRIVATE (view);
+    view->priv->webview = (WebKitWebView *) webkit_web_view_new ();
+    gtk_container_add (GTK_CONTAINER (view), (GtkWidget *) webview);
+}
+
+static void
+view_dispose (GObject *object)
+{
+    parent_class->dispose (object);
+}
+
+static void
+view_finalize (GObject *object)
+{
+    YelpView *view = YELP_VIEW (object);
+    YelpViewPriv *priv = view->priv;
+
+    /* FIXME Free stuff */
+
+    parent_class->finalize (object);
+}
+
+static void
+view_class_init (YelpViewClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
+
+    object_class->dispose = view_dispose;
+    object_class->finalize = view_finalize;
+
+    signals[NEW_VIEW_REQUESTED] =
+	g_signal_new ("new_view_requested",
+		      G_TYPE_FROM_CLASS (klass),
+		      G_SIGNAL_RUN_LAST,
+		      G_STRUCT_OFFSET (YelpViewClass,
+				       new_view_requested),
+		      NULL, NULL,
+		      g_cclosure_marshal_VOID__STRING,
+		      G_TYPE_NONE, 1, G_TYPE_STRING);
+
+    g_type_class_add_private (klass, sizeof (YelpViewPriv));
+}
diff --git a/libyelp/yelp-view.h b/libyelp/yelp-view.h
new file mode 100644
index 0000000..052eb11
--- /dev/null
+++ b/libyelp/yelp-view.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2001-2002 Mikael Hallendal <micke imendio com>
+ *
+ * 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 imendio com>
+ */
+
+#ifndef __YELP_VIEW_H__
+#define __YELP_VIEW_H__
+
+#include <gtk/gtk.h>
+
+#define YELP_TYPE_VIEW            (yelp_view_get_type ())
+#define YELP_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), YELP_TYPE_VIEW, YelpView))
+#define YELP_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), YELP_TYPE_VIEW, YelpViewClass))
+#define YELP_IS_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YELP_TYPE_VIEW))
+#define YELP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), YELP_TYPE_VIEW))
+
+typedef struct _YelpView       YelpView;
+typedef struct _YelpViewClass  YelpViewClass;
+typedef struct _YelpViewPriv   YelpViewPriv;
+
+struct _YelpView
+{
+    GtkContainer  parent;
+    YelpViewPriv *priv;
+};
+
+struct _YelpViewClass
+{
+    GtkContainerClass  parent_class;
+
+    /* Signals */
+    void (*new_window_requested) (YelpWindow *window);
+    void (*new_window_requested_uri) (YelpWindow *window,
+				      const gchar *uri);
+};
+
+GType            yelp_view_get_type        (void);
+GtkWidget *      yelp_view_new             (GNode         *doc_tree,
+					    GList         *index);
+void             yelp_view_load            (YelpWindow    *window,
+					    const gchar   *uri);
+
+#endif /* __YELP_WINDOW_H__ */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c122e1d..2975199 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,10 +1,10 @@
 check_PROGRAMS = test-uri
 
-test_uri_SOURCES =			\
-	$(top_srcdir)/src/yelp-uri.c	\
-	$(top_srcdir)/src/yelp-uri.h	\
+test_uri_SOURCES =				\
+	$(top_srcdir)/libyelp/yelp-uri.c	\
+	$(top_srcdir)/libyelp/yelp-uri.h	\
 	test-uri.c
 
-test_uri_CFLAGS = $(YELP_CFLAGS) $(AM_CFLAGS) $(YELP_DEFINES) -I$(top_srcdir)/src `pkg-config --cflags gio-unix-2.0`
+test_uri_CFLAGS = $(YELP_CFLAGS) $(AM_CFLAGS) $(YELP_DEFINES) -I$(top_srcdir)/libyelp `pkg-config --cflags gio-unix-2.0`
 test_uri_LDADD = $(YELP_LIBS)
 test_uri_LDFLAGS = $(AM_LDFLAGS) `pkg-config --libs gio-unix-2.0`
diff --git a/tests/uri/ghelp-docbook-1.test b/tests/uri/ghelp-docbook-1.test
new file mode 100644
index 0000000..c52d19a
--- /dev/null
+++ b/tests/uri/ghelp-docbook-1.test
@@ -0,0 +1,4 @@
+ghelp:user-guide
+TYPE:  DOCBOOK
+URI:   file:///usr/share/gnome/help/user-guide/C/user-guide.xml
+PATH:  /usr/share/gnome/help/user-guide/C



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]