diff options
author | Mikael Hallendal <micke@codefactory.se> | 2001-12-08 23:14:36 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2001-12-08 23:14:36 +0000 |
commit | c1c0e3406fd830106e10987ccccb93f68d8a3428 (patch) | |
tree | 789b07ab33769f7ba44980e122df258d40973fb7 | |
parent | 58b806b7a866025f2f0e88308dfdd0126a23c643 (diff) | |
download | yelp-c1c0e3406fd830106e10987ccccb93f68d8a3428.tar.gz |
added, will be the Home-view.
22001-12-09 Mikael Hallendal <micke@codefactory.se>
* src/yelp-view-home.c: added, will be the Home-view.
* src/yelp-doc-view.[ch]: moved to yelp-view-doc.[ch]
* src/Makefile.am (yelp_SOURCES): use yelp-view* instead of
yelp-*-view.
Almost done with the cleaning up, yay!
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | po/ChangeLog | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | src/Makefile.am | 13 | ||||
-rw-r--r-- | src/yelp-index.c | 2 | ||||
-rw-r--r-- | src/yelp-main.c | 1 | ||||
-rw-r--r-- | src/yelp-view-doc.c (renamed from src/yelp-doc-view.c) | 148 | ||||
-rw-r--r-- | src/yelp-view-doc.h (renamed from src/yelp-doc-view.h) | 46 | ||||
-rw-r--r-- | src/yelp-view-home.c | 79 | ||||
-rw-r--r-- | src/yelp-view-home.h | 59 | ||||
-rw-r--r-- | src/yelp-window.c | 136 |
12 files changed, 305 insertions, 196 deletions
@@ -1,3 +1,12 @@ +2001-12-09 Mikael Hallendal <micke@codefactory.se> + + * src/yelp-view-home.c: added, will be the Home-view. + + * src/yelp-doc-view.[ch]: moved to yelp-view-doc.[ch] + + * src/Makefile.am (yelp_SOURCES): use yelp-view* instead of + yelp-*-view. + 2001-12-08 Mikael Hallendal <micke@codefactory.se> * src/yelp-main.c (main): cast the window to YELP_WINDOW. @@ -27,6 +27,7 @@ FEATURES: * Recently viewed +* Start with factory, if already activated and running, open new window. INTERNALS: ---------- diff --git a/po/ChangeLog b/po/ChangeLog index 8224efab..74111170 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2001-12-09 Mikael Hallendal <micke@codefactory.se> + + * POTFILES.in: updated + 2001-12-08 Christian Rose <menthos@menthos.com> * sv.po: Updated Swedish translation. diff --git a/po/POTFILES.in b/po/POTFILES.in index fdb8dc40..7e0bda92 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,12 +2,13 @@ # Please keep this file sorted alphabetically. src/yelp-base.c -src/yelp-doc-view.c src/yelp-history.c src/yelp-index.c src/yelp-main.c src/yelp-scrollkeeper.c src/yelp-section.c src/yelp-toc.c +src/yelp-view-doc.c +src/yelp-view-home.c src/yelp-window.c yelp.desktop.in diff --git a/src/Makefile.am b/src/Makefile.am index f7a6e2c0..5e382047 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,16 +12,17 @@ INCLUDES = \ bin_PROGRAMS = yelp yelp_SOURCES = \ - yelp-main.c \ yelp-base.c yelp-base.h \ - yelp-window.c yelp-window.h \ - yelp-toc.c yelp-toc.h \ - yelp-doc-view.c yelp-doc-view.h \ - yelp-index.c yelp-index.h \ yelp-history.c yelp-history.h \ + yelp-index.c yelp-index.h \ + yelp-main.c \ yelp-section.c yelp-section.h \ yelp-scrollkeeper.c yelp-scrollkeeper.h \ - yelp-util.c yelp-util.h + yelp-toc.c yelp-toc.h \ + yelp-util.c yelp-util.h \ + yelp-view-doc.c yelp-view-doc.h \ + yelp-view-home.c yelp-view-home.h \ + yelp-window.c yelp-window.h yelp_LDADD = \ $(YELP_LIBS) diff --git a/src/yelp-index.c b/src/yelp-index.c index 889c3b34..09e08e72 100644 --- a/src/yelp-index.c +++ b/src/yelp-index.c @@ -114,8 +114,6 @@ yelp_index_entry_active_cb (GtkEntry *entry, gpointer data) text = gtk_entry_get_text (entry); g_print ("Index searching isn't supported yet\n"); - -/* g_print ("Hits: %d\n", g_slist_length (hit_list)); */ } YelpIndex * diff --git a/src/yelp-main.c b/src/yelp-main.c index 97277e77..7d87d242 100644 --- a/src/yelp-main.c +++ b/src/yelp-main.c @@ -42,6 +42,7 @@ main (int argc, char **argv) #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif diff --git a/src/yelp-doc-view.c b/src/yelp-view-doc.c index e38414ee..34c9ced6 100644 --- a/src/yelp-doc-view.c +++ b/src/yelp-view-doc.c @@ -27,38 +27,38 @@ #include <libgnomevfs/gnome-vfs.h> #include <libgnome/gnome-i18n.h> #include <stdio.h> -#include "yelp-doc-view.h" +#include "yelp-view-doc.h" #define d(x) x typedef struct _StreamData StreamData; -static void ydv_init (YelpDocView *html); -static void ydv_class_init (YelpDocViewClass *klass); -static void ydv_async_open_cb (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer callback_data); -static void ydv_async_read_cb (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer buffer, - GnomeVFSFileSize bytes_requested, - GnomeVFSFileSize bytes_read, - gpointer callback_data); -static void ydv_async_close_cb (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer callback_data); -static void ydv_link_clicked_cb (HtmlDocument *doc, - const gchar *url, - gpointer data); -static void ydv_free_stream_data (StreamData *sdata, - gboolean remove); -static void ydv_stream_cancel (HtmlStream *stream, - gpointer user_data, - gpointer cancel_data); -static void ydv_url_requested_cb (HtmlDocument *doc, - const gchar *uri, - HtmlStream *stream, - gpointer data); +static void yvd_init (YelpViewDoc *html); +static void yvd_class_init (YelpViewDocClass *klass); +static void yvd_async_open_cb (GnomeVFSAsyncHandle *handle, + GnomeVFSResult result, + gpointer callback_data); +static void yvd_async_read_cb (GnomeVFSAsyncHandle *handle, + GnomeVFSResult result, + gpointer buffer, + GnomeVFSFileSize bytes_requested, + GnomeVFSFileSize bytes_read, + gpointer callback_data); +static void yvd_async_close_cb (GnomeVFSAsyncHandle *handle, + GnomeVFSResult result, + gpointer callback_data); +static void yvd_link_clicked_cb (HtmlDocument *doc, + const gchar *url, + gpointer data); +static void yvd_free_stream_data (StreamData *sdata, + gboolean remove); +static void yvd_stream_cancel (HtmlStream *stream, + gpointer user_data, + gpointer cancel_data); +static void yvd_url_requested_cb (HtmlDocument *doc, + const gchar *uri, + HtmlStream *stream, + gpointer data); #define BUFFER_SIZE 8192 @@ -69,21 +69,21 @@ enum { static gint signals[LAST_SIGNAL] = { 0 }; -struct _YelpDocViewPriv { +struct _YelpViewDocPriv { HtmlDocument *doc; GSList *connections; gchar *base_uri; }; struct _StreamData { - YelpDocView *view; + YelpViewDoc *view; HtmlStream *stream; GnomeVFSAsyncHandle *handle; gchar *anchor; }; GType -yelp_doc_view_get_type (void) +yelp_view_doc_get_type (void) { static GType view_type = 0; @@ -91,19 +91,19 @@ yelp_doc_view_get_type (void) { static const GTypeInfo view_info = { - sizeof (YelpDocViewClass), + sizeof (YelpViewDocClass), NULL, NULL, - (GClassInitFunc) ydv_class_init, + (GClassInitFunc) yvd_class_init, NULL, NULL, - sizeof (YelpDocView), + sizeof (YelpViewDoc), 0, - (GInstanceInitFunc) ydv_init, + (GInstanceInitFunc) yvd_init, }; view_type = g_type_register_static (HTML_TYPE_VIEW, - "YelpDocView", + "YelpViewDoc", &view_info, 0); } @@ -111,11 +111,11 @@ yelp_doc_view_get_type (void) } static void -ydv_init (YelpDocView *view) +yvd_init (YelpViewDoc *view) { - YelpDocViewPriv *priv; + YelpViewDocPriv *priv; - priv = g_new0 (YelpDocViewPriv, 1); + priv = g_new0 (YelpViewDocPriv, 1); priv->doc = html_document_new (); priv->connections = NULL; @@ -124,22 +124,22 @@ ydv_init (YelpDocView *view) html_view_set_document (HTML_VIEW (view), priv->doc); g_signal_connect (G_OBJECT (priv->doc), "link_clicked", - G_CALLBACK (ydv_link_clicked_cb), view); + G_CALLBACK (yvd_link_clicked_cb), view); g_signal_connect (G_OBJECT (priv->doc), "request_url", - G_CALLBACK (ydv_url_requested_cb), view); + G_CALLBACK (yvd_url_requested_cb), view); view->priv = priv; } static void -ydv_class_init (YelpDocViewClass *klass) +yvd_class_init (YelpViewDocClass *klass) { signals[URI_SELECTED] = g_signal_new ("uri_selected", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YelpDocViewClass, uri_selected), + G_STRUCT_OFFSET (YelpViewDocClass, uri_selected), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, @@ -148,7 +148,7 @@ ydv_class_init (YelpDocViewClass *klass) static void -ydv_async_close_cb (GnomeVFSAsyncHandle *handle, +yvd_async_close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer callback_data) { @@ -163,11 +163,11 @@ ydv_async_close_cb (GnomeVFSAsyncHandle *handle, sdata->anchor); } - ydv_free_stream_data (sdata, TRUE); + yvd_free_stream_data (sdata, TRUE); } static void -ydv_async_read_cb (GnomeVFSAsyncHandle *handle, +yvd_async_read_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer buffer, GnomeVFSFileSize bytes_requested, @@ -182,10 +182,10 @@ ydv_async_read_cb (GnomeVFSAsyncHandle *handle, if (result != GNOME_VFS_OK) { gnome_vfs_async_close (handle, - ydv_async_close_cb, + yvd_async_close_cb, sdata); -/* ydv_free_stream_data (sdata, TRUE); */ +/* yvd_free_stream_data (sdata, TRUE); */ g_free (buffer); } else { g_print ("Writing to html stream... "); @@ -193,12 +193,12 @@ ydv_async_read_cb (GnomeVFSAsyncHandle *handle, g_print ("done\n"); gnome_vfs_async_read (handle, buffer, bytes_requested, - ydv_async_read_cb, sdata); + yvd_async_read_cb, sdata); } } static void -ydv_async_open_cb (GnomeVFSAsyncHandle *handle, +yvd_async_open_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer callback_data) { @@ -212,7 +212,7 @@ ydv_async_open_cb (GnomeVFSAsyncHandle *handle, g_warning ("Open failed: %s.\n", gnome_vfs_result_to_string (result)); - ydv_free_stream_data (sdata, TRUE); + yvd_free_stream_data (sdata, TRUE); } else { gchar *buffer; @@ -220,24 +220,24 @@ ydv_async_open_cb (GnomeVFSAsyncHandle *handle, gnome_vfs_async_read (handle, buffer, BUFFER_SIZE, - ydv_async_read_cb, sdata); + yvd_async_read_cb, sdata); } } static void -ydv_url_requested_cb (HtmlDocument *doc, +yvd_url_requested_cb (HtmlDocument *doc, const gchar *uri, HtmlStream *stream, gpointer data) { - YelpDocView *view; - YelpDocViewPriv *priv; + YelpViewDoc *view; + YelpViewDocPriv *priv; GnomeVFSURI *vfs_uri; StreamData *sdata; d(puts(__FUNCTION__)); - view = YELP_DOC_VIEW (data); + view = YELP_VIEW_DOC (data); priv = view->priv; /* if (priv->base_uri) { */ @@ -261,12 +261,12 @@ ydv_url_requested_cb (HtmlDocument *doc, vfs_uri, GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT, - ydv_async_open_cb, + yvd_async_open_cb, sdata); gnome_vfs_uri_unref (vfs_uri); - html_stream_set_cancel_func (stream, ydv_stream_cancel, sdata); + html_stream_set_cancel_func (stream, yvd_stream_cancel, sdata); } /* static void */ @@ -289,7 +289,7 @@ ydv_url_requested_cb (HtmlDocument *doc, /* } */ static void -ydv_stream_cancel (HtmlStream *stream, +yvd_stream_cancel (HtmlStream *stream, gpointer user_data, gpointer cancel_data) { @@ -299,13 +299,13 @@ ydv_stream_cancel (HtmlStream *stream, gnome_vfs_async_cancel (sdata->handle); - ydv_free_stream_data (sdata, TRUE); + yvd_free_stream_data (sdata, TRUE); } static void -ydv_free_stream_data (StreamData *sdata, gboolean remove) +yvd_free_stream_data (StreamData *sdata, gboolean remove) { - YelpDocViewPriv *priv; + YelpViewDocPriv *priv; d(puts(__FUNCTION__)); @@ -328,12 +328,12 @@ ydv_free_stream_data (StreamData *sdata, gboolean remove) } static void -ydv_link_clicked_cb (HtmlDocument *doc, const gchar *url, gpointer data) +yvd_link_clicked_cb (HtmlDocument *doc, const gchar *url, gpointer data) { - YelpDocView *view; - YelpDocViewPriv *priv; + YelpViewDoc *view; + YelpViewDocPriv *priv; - view = YELP_DOC_VIEW (data); + view = YELP_VIEW_DOC (data); priv = view->priv; if (priv->base_uri) { @@ -347,14 +347,14 @@ ydv_link_clicked_cb (HtmlDocument *doc, const gchar *url, gpointer data) } GtkWidget * -yelp_doc_view_new (void) +yelp_view_doc_new (void) { - YelpDocView *view; - YelpDocViewPriv *priv; + YelpViewDoc *view; + YelpViewDocPriv *priv; d(puts(__FUNCTION__)); - view = g_object_new (YELP_TYPE_DOC_VIEW, NULL); + view = g_object_new (YELP_TYPE_VIEW_DOC, NULL); priv = view->priv; html_document_open_stream (priv->doc, "text/html"); @@ -372,15 +372,15 @@ yelp_doc_view_new (void) } void -yelp_doc_view_open_section (YelpDocView *view, const YelpSection *section) +yelp_view_doc_open_section (YelpViewDoc *view, const YelpSection *section) { - YelpDocViewPriv *priv; + YelpViewDocPriv *priv; StreamData *sdata; GnomeVFSURI *uri; d(puts(__FUNCTION__)); - g_return_if_fail (YELP_IS_DOC_VIEW (view)); + g_return_if_fail (YELP_IS_VIEW_DOC (view)); g_return_if_fail (section != NULL); priv = view->priv; @@ -422,12 +422,12 @@ yelp_doc_view_open_section (YelpDocView *view, const YelpSection *section) uri, GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT, - ydv_async_open_cb, + yvd_async_open_cb, sdata); gnome_vfs_uri_unref (uri); html_stream_set_cancel_func (sdata->stream, - ydv_stream_cancel, + yvd_stream_cancel, sdata); } diff --git a/src/yelp-doc-view.h b/src/yelp-view-doc.h index c1b0e868..f8b44efc 100644 --- a/src/yelp-doc-view.h +++ b/src/yelp-view-doc.h @@ -20,8 +20,8 @@ * Author: Mikael Hallendal <micke@codefactory.se> */ -#ifndef __YELP_DOC_VIEW_H__ -#define __YELP_DOC_VIEW_H__ +#ifndef __YELP_VIEW_DOC_H__ +#define __YELP_VIEW_DOC_H__ #include <gtk/gtkobject.h> #include <gtk/gtktypeutils.h> @@ -29,42 +29,36 @@ #include <libgtkhtml/gtkhtml.h> #include "yelp-section.h" -#define YELP_TYPE_DOC_VIEW (yelp_doc_view_get_type ()) -#define YELP_DOC_VIEW(o) (GTK_CHECK_CAST ((o), YELP_TYPE_DOC_VIEW, YelpDocView)) -#define YELP_DOC_VIEW_CLASS(k)(GTK_CHECK_FOR_CAST((k), YELP_TYPE_DOC_VIEW, YelpDocViewClass)) -#define YELP_IS_DOC_VIEW(o) (GTK_CHECK_TYPE ((o), YELP_TYPE_DOC_VIEW)) -#define YELP_IS_DOC_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), YELP_TYPE_DOC_VIEW)) +#define YELP_TYPE_VIEW_DOC (yelp_view_doc_get_type ()) +#define YELP_VIEW_DOC(o) (GTK_CHECK_CAST ((o), YELP_TYPE_VIEW_DOC, YelpViewDoc)) +#define YELP_VIEW_DOC_CLASS(k)(GTK_CHECK_FOR_CAST((k), YELP_TYPE_VIEW_DOC, YelpViewDocClass)) +#define YELP_IS_VIEW_DOC(o) (GTK_CHECK_TYPE ((o), YELP_TYPE_VIEW_DOC)) +#define YELP_IS_VIEW_DOC_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), YELP_TYPE_VIEW_DOC)) -typedef struct _YelpDocView YelpDocView; -typedef struct _YelpDocViewClass YelpDocViewClass; -typedef struct _YelpDocViewPriv YelpDocViewPriv; +typedef struct _YelpViewDoc YelpViewDoc; +typedef struct _YelpViewDocClass YelpViewDocClass; +typedef struct _YelpViewDocPriv YelpViewDocPriv; -struct _YelpDocView { +struct _YelpViewDoc { HtmlView parent; - YelpDocViewPriv *priv; + YelpViewDocPriv *priv; }; -struct _YelpDocViewClass { +struct _YelpViewDocClass { HtmlViewClass parent_class; /* Signals */ - void (*uri_selected) (YelpDocView *view, - const gchar *uri, - const gchar *anchor); + void (*uri_selected) (YelpViewDoc *view, + const gchar *uri, + const gchar *anchor); }; -GType yelp_doc_view_get_type (void); -GtkWidget *yelp_doc_view_new (void); +GType yelp_view_doc_get_type (void); +GtkWidget *yelp_view_doc_new (void); -#if 0 -void yelp_doc_view_open_uri (YelpDocView *view, - const gchar *uri); -#endif - -void yelp_doc_view_open_section (YelpDocView *view, +void yelp_view_doc_open_section (YelpViewDoc *view, const YelpSection *section); - -#endif /* __YELP_DOC_VIEW_H__ */ +#endif /* __YELP_VIEW_DOC_H__ */ diff --git a/src/yelp-view-home.c b/src/yelp-view-home.c new file mode 100644 index 00000000..a054cf14 --- /dev/null +++ b/src/yelp-view-home.c @@ -0,0 +1,79 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2001 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> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <libgnomevfs/gnome-vfs.h> +#include <libgnome/gnome-i18n.h> +#include <stdio.h> +#include "yelp-view-home.h" + +#define d(x) x + +static void yvh_init (YelpViewHome *html); +static void yvh_class_init (YelpViewHomeClass *klass); + +struct _YelpViewHomePriv { + HtmlDocument *doc; + +}; + +GType +yelp_view_home_get_type (void) +{ + static GType view_type = 0; + + if (!view_type) + { + static const GTypeInfo view_info = + { + sizeof (YelpViewHomeClass), + NULL, + NULL, + (GClassInitFunc) yvh_class_init, + NULL, + NULL, + sizeof (YelpViewHome), + 0, + (GInstanceInitFunc) yvh_init, + }; + + view_type = g_type_register_static (HTML_TYPE_VIEW, + "YelpViewHome", + &view_info, 0); + } + + return view_type; +} + +static void +yvh_init (YelpViewHome *view) +{ +} + +static void +yvh_class_init (YelpViewHomeClass *klass) +{ +} + diff --git a/src/yelp-view-home.h b/src/yelp-view-home.h new file mode 100644 index 00000000..707f62e7 --- /dev/null +++ b/src/yelp-view-home.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2001 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_VIEW_HOME_H__ +#define __YELP_VIEW_HOME_H__ + +#include <gtk/gtkobject.h> +#include <gtk/gtktypeutils.h> +#include <gtk/gtkmarshal.h> +#include <libgtkhtml/gtkhtml.h> +#include "yelp-section.h" + +#define YELP_TYPE_VIEW_HOME (yelp_view_home_get_type ()) +#define YELP_VIEW_HOME(o) (GTK_CHECK_CAST ((o), YELP_TYPE_VIEW_HOME, YelpViewHome)) +#define YELP_VIEW_HOME_CLASS(k)(GTK_CHECK_FOR_CAST((k), YELP_TYPE_VIEW_HOME, YelpViewHomeClass)) +#define YELP_IS_VIEW_HOME(o) (GTK_CHECK_TYPE ((o), YELP_TYPE_VIEW_HOME)) +#define YELP_IS_VIEW_HOME_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), YELP_TYPE_VIEW_HOME)) + +typedef struct _YelpViewHome YelpViewHome; +typedef struct _YelpViewHomeClass YelpViewHomeClass; +typedef struct _YelpViewHomePriv YelpViewHomePriv; + +struct _YelpViewHome { + HtmlView parent; + + YelpViewHomePriv *priv; +}; + +struct _YelpViewHomeClass { + HtmlViewClass parent_class; + + /* Signals */ + + /* Signal when icon is clicked. */ +}; + +GType yelp_view_home_get_type (void); +GtkWidget *yelp_view_home_new (GtkTreeStore *store); + +#endif /* __YELP_VIEW_HOME__ */ diff --git a/src/yelp-window.c b/src/yelp-window.c index 362311d9..0d8c60e7 100644 --- a/src/yelp-window.c +++ b/src/yelp-window.c @@ -29,12 +29,11 @@ #include <libgtkhtml/gtkhtml.h> #include <libgnomevfs/gnome-vfs.h> #include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-about.h> #include <libgnome/gnome-i18n.h> #include <string.h> #include "yelp-index.h" #include "yelp-toc.h" -#include "yelp-doc-view.h" +#include "yelp-view-doc.h" #include "yelp-window.h" #include "yelp-section.h" #include "yelp-history.h" @@ -44,17 +43,12 @@ static void yelp_window_class_init (YelpWindowClass *klass); static void yelp_window_populate (YelpWindow *window); -static void yelp_window_exit (gpointer data, - guint section, - GtkWidget *widget); -static void yelp_window_new_window (gpointer data, +static void yelp_window_close_cb (gpointer data, guint section, GtkWidget *widget); + static void yelp_window_section_selected_cb (YelpWindow *window, YelpSection *section); -static void yelp_window_about (gpointer data, - guint section, - GtkWidget *widget); static void yelp_window_toggle_history_buttons (GtkWidget *button, gboolean sensitive, YelpHistory *history); @@ -64,19 +58,14 @@ static void yelp_window_history_button_pressed (GtkWidget *button, struct _YelpWindowPriv { YelpBase *base; - GtkWidget *hpaned; - - GtkWidget *yelp_doc_view; + GtkWidget *yelp_view_doc; GtkWidget *yelp_toc; YelpIndex *index; - YelpHistory *history; GtkWidget *forward_button; GtkWidget *back_button; - - GtkItemFactory *item_factory; }; GType @@ -146,19 +135,18 @@ yelp_window_populate (YelpWindow *window) GtkWidget *frame; GtkWidget *main_box; GtkWidget *toolbar; + GtkWidget *button; + GtkWidget *hpaned; priv = window->priv; - main_box = gtk_vbox_new (FALSE, 0); - html_sw = gtk_scrolled_window_new (NULL, NULL); - tree_sw = gtk_scrolled_window_new (NULL, NULL); - search_list_sw = gtk_scrolled_window_new (NULL, NULL); - search_box = gtk_vbox_new (FALSE, 0); - - priv->hpaned = gtk_hpaned_new (); - - priv->item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, - "<main>", NULL); + main_box = gtk_vbox_new (FALSE, 0); + html_sw = gtk_scrolled_window_new (NULL, NULL); + tree_sw = gtk_scrolled_window_new (NULL, NULL); + search_list_sw = gtk_scrolled_window_new (NULL, NULL); + search_box = gtk_vbox_new (FALSE, 0); + hpaned = gtk_hpaned_new (); + gtk_container_add (GTK_CONTAINER (window), main_box); toolbar = gtk_toolbar_new (); @@ -183,24 +171,28 @@ yelp_window_populate (YelpWindow *window) "", "", NULL, NULL, -1); - gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), - "gtk-home", - "", "", - NULL, NULL, -1); + button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + "gtk-home", + "", "", + NULL, NULL, -1); + + /* Connect to Home-button */ gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); - gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), - "gtk-index", - "", "", - NULL, NULL, -1); + button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + "gtk-index", + "", "", + NULL, NULL, -1); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); - gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), - "gtk-find", - "", "", - NULL, NULL, -1); + button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + "gtk-find", + "", "", + NULL, NULL, -1); + + /* Connect to find-button */ gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), gtk_label_new (_("Help on ")), @@ -220,27 +212,33 @@ yelp_window_populate (YelpWindow *window) G_CALLBACK (yelp_window_history_button_pressed), G_OBJECT (window)); + button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + "gtk-close", + "", "", + NULL, NULL, -1); + + g_signal_connect (button, "clicked", + G_CALLBACK (yelp_window_close_cb), + G_OBJECT (window)); gtk_box_pack_start (GTK_BOX (main_box), toolbar, FALSE, FALSE, 0); /* Doc View */ - priv->yelp_doc_view = yelp_doc_view_new (); + priv->yelp_view_doc = yelp_view_doc_new (); - g_signal_connect_swapped (priv->yelp_doc_view, "section_selected", + g_signal_connect_swapped (priv->yelp_view_doc, "section_selected", G_CALLBACK (yelp_window_section_selected_cb), G_OBJECT (window)); - gtk_container_add (GTK_CONTAINER (html_sw), priv->yelp_doc_view); + gtk_container_add (GTK_CONTAINER (html_sw), priv->yelp_view_doc); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (html_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - frame = gtk_frame_new (NULL); gtk_container_add (GTK_CONTAINER (frame), html_sw); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); - gtk_paned_add2 (GTK_PANED (priv->hpaned), frame); + gtk_paned_add2 (GTK_PANED (hpaned), frame); /* Tree */ priv->yelp_toc = yelp_toc_new (yelp_base_get_bookshelf (priv->base)); @@ -266,6 +264,7 @@ yelp_window_populate (YelpWindow *window) gtk_box_pack_start (GTK_BOX (search_box), yelp_index_get_entry (priv->index), FALSE, FALSE, 0); + gtk_box_pack_end_defaults (GTK_BOX (search_box), search_list_sw); frame = gtk_frame_new (NULL); @@ -273,36 +272,20 @@ yelp_window_populate (YelpWindow *window) gtk_container_add (GTK_CONTAINER (frame), tree_sw); - gtk_paned_add1 (GTK_PANED (priv->hpaned), frame); + gtk_paned_add1 (GTK_PANED (hpaned), frame); - gtk_paned_set_position (GTK_PANED (priv->hpaned), 250); + gtk_paned_set_position (GTK_PANED (hpaned), 250); - gtk_box_pack_start (GTK_BOX (main_box), priv->hpaned, - TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (main_box), hpaned, TRUE, TRUE, 0); } static void -yelp_window_exit (gpointer data, guint section, GtkWidget *widget) +yelp_window_close_cb (gpointer data, guint section, GtkWidget *widget) { gtk_main_quit (); } static void -yelp_window_new_window (gpointer data, guint section, GtkWidget *widget) -{ - YelpWindow *window; - GtkWidget *new_window; - - g_return_if_fail (YELP_IS_WINDOW (data)); - - window = YELP_WINDOW (data); - - new_window = yelp_base_new_window (window->priv->base); - - gtk_widget_show_all (new_window); -} - -static void yelp_window_section_selected_cb (YelpWindow *window, YelpSection *section) { @@ -316,29 +299,8 @@ yelp_window_section_selected_cb (YelpWindow *window, yelp_history_goto (priv->history, section); - yelp_doc_view_open_section (YELP_DOC_VIEW (window->priv->yelp_doc_view), section); - -} + yelp_view_doc_open_section (YELP_VIEW_DOC (window->priv->yelp_view_doc), section); -static void -yelp_window_about (gpointer data, guint section, GtkWidget *widget) -{ - GtkWidget *about; - const gchar *authors[] = { - "Mikael Hallendal <micke@codefactory.se>", - NULL - }; - - about = gnome_about_new (PACKAGE, VERSION, - "(C) 2001 Mikael Hallendal <micke@codefactory.se>", - _("Help Browser for GNOME 2.0"), - authors, - NULL, - NULL, - NULL); - - gtk_widget_show (about); - g_print ("Show about\n"); } static void @@ -372,7 +334,7 @@ yelp_window_history_button_pressed (GtkWidget *button, YelpWindow *window) } if (section) { - yelp_doc_view_open_section (YELP_DOC_VIEW (priv->yelp_doc_view), section); + yelp_view_doc_open_section (YELP_VIEW_DOC (priv->yelp_view_doc), section); } } @@ -400,7 +362,7 @@ yelp_window_open_uri (YelpWindow *window, priv = window->priv; - yelp_doc_view_open_section (YELP_DOC_VIEW (priv->yelp_doc_view), + yelp_view_doc_open_section (YELP_VIEW_DOC (priv->yelp_view_doc), yelp_section_new (NULL, str_uri, NULL, NULL)); } |