diff options
-rw-r--r-- | data/Makefile.am | 2 | ||||
-rw-r--r-- | data/starthere/.cvsignore | 4 | ||||
-rw-r--r-- | data/starthere/Makefile.am | 14 | ||||
-rw-r--r-- | data/starthere/index.xml.in | 31 | ||||
-rw-r--r-- | data/starthere/section.xsl | 113 | ||||
-rw-r--r-- | data/starthere/smartbookmarks.xml.in | 31 | ||||
-rw-r--r-- | embed/mozilla/StartHereProtocolHandler.cpp | 187 | ||||
-rw-r--r-- | embed/mozilla/StartHereProtocolHandler.h | 49 | ||||
-rw-r--r-- | lib/ephy-start-here.c | 413 | ||||
-rw-r--r-- | lib/ephy-start-here.h | 61 |
10 files changed, 1 insertions, 904 deletions
diff --git a/data/Makefile.am b/data/Makefile.am index 7554501ea..4687d7cbf 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = ui art glade starthere +SUBDIRS = ui art glade @INTLTOOL_SERVER_RULE@ @INTLTOOL_DESKTOP_RULE@ diff --git a/data/starthere/.cvsignore b/data/starthere/.cvsignore deleted file mode 100644 index 5ef9a001c..000000000 --- a/data/starthere/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -index.xml -smartbookmarks.xml diff --git a/data/starthere/Makefile.am b/data/starthere/Makefile.am deleted file mode 100644 index 8aadf129d..000000000 --- a/data/starthere/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -@INTLTOOL_XML_RULE@ - -xmldir = $(pkgdatadir)/starthere -xml_in_files = index.xml.in smartbookmarks.xml.in -xml_DATA = $(xml_in_files:.xml.in=.xml) - -pagedir = $(pkgdatadir)/starthere -page_DATA = section.xsl - -EXTRA_DIST = $(xml_DATA) \ - $(xml_in_files) \ - $(page_DATA) - -DISTCLEANFILES = $(xml_DATA) diff --git a/data/starthere/index.xml.in b/data/starthere/index.xml.in deleted file mode 100644 index f35909862..000000000 --- a/data/starthere/index.xml.in +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet type="text/xsl" href="section.xsl"?> -<section name="Home"> -<_pagetitle>Home</_pagetitle> -<bar> -<item section="home:"><_translate>Home</_translate></item> -<item section="home:smartbookmarks"><_translate>Smart Bookmarks</_translate></item> -</bar> -<_title>The web browser</_title> -<_paragraph> -You can start browsing web pages either by typing a web address (example: www.google.com) -or a search phrase (example: best computer shop) in the address entry and then pressing -the Enter key. You can remember important visited pages using bookmarks or browse all of -them with the history dialog. -</_paragraph> -<_title>Getting started</_title> -<_paragraph> -To import bookmarks from another browser installed on your system just -click on one of the links below: -</_paragraph> -<paragraph> -<content id="bookmarks-import"/> -</paragraph> -<_paragraph> -If your internet connection requires it, make sure to setup your proxy in the -desktop wide configuration dialog. -</_paragraph> -<paragraph> -<action id="configure-network" param=""><_translate>Proxy configuration</_translate></action> -</paragraph> -</section> diff --git a/data/starthere/section.xsl b/data/starthere/section.xsl deleted file mode 100644 index a734ce708..000000000 --- a/data/starthere/section.xsl +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0"?> -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - -<xsl:template match="/"> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="section"> -<html> - <head> - <xsl:apply-templates/> - <style type="text/css"> - body { - margin-left: 150; - margin-right: 150; - background: <xsl:value-of select="@bg"/>; - color: <xsl:value-of select="@text"/>; - font-family: Verdana, Helvetica, Arial, sans-serif; - font-size: 1.0em; - } - - div.topbar { - height: 25px; - padding: 7px; - color: <xsl:value-of select="@title"/>; - background-color: <xsl:value-of select="@title-bg"/>; - font-weight: bold; - margin-bottom: 50; - } - - div.topbar a { - margin-right: 15; - font-size: 1.4em; - font-weight: bold; - color: <xsl:value-of select="@title"/>; - } - - h2 { - color: <xsl:value-of select="@headings"/>; - font-size: 1.2em; - } - - a { - color: <xsl:value-of select="@link"/> - } - - a.visited { - color: <xsl:value-of select="@link"/> - } - </style> - </head> - <body> - <xsl:apply-templates/> - </body> -</html> -</xsl:template> - -<xsl:template match="pagetitle"> - <title><xsl:apply-templates/></title> -</xsl:template> - -<xsl:template match="content"> -<div class="body"> - <xsl:apply-templates/> -</div> -</xsl:template> - -<xsl:template match="bar"> -<div class="topbar"> - <xsl:apply-templates/> -</div> -</xsl:template> - -<xsl:template match="item"> -<a href="{@section}"> - <xsl:apply-templates/> -</a> -</xsl:template> - -<xsl:template match="title"> -<h2> - <xsl:apply-templates/> -</h2> -</xsl:template> - -<xsl:template match="paragraph"> -<p> - <xsl:apply-templates/> -</p> -</xsl:template> - -<xsl:template match="buildcontent"> -<p> - <xsl:apply-templates/> -</p> -</xsl:template> - -<xsl:template match="action"> -<a href="home:{@id}?{@param}"> - <xsl:apply-templates/> -</a><br/> -</xsl:template> - -<xsl:template match="smartbookmark"> -<a type="text/smartbookmark" href="{@normal}" rel="{@smart}" title="{@title}"> - <xsl:apply-templates/> -</a><br/> -</xsl:template> - -</xsl:stylesheet> - diff --git a/data/starthere/smartbookmarks.xml.in b/data/starthere/smartbookmarks.xml.in deleted file mode 100644 index 34ba168c1..000000000 --- a/data/starthere/smartbookmarks.xml.in +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet type="text/xsl" href="section.xsl"?> -<section name="Smart Bookmarks"> -<_pagetitle>Smart Bookmarks</_pagetitle> -<bar> -<item section="home:"><_translate>Home</_translate></item> -<item section="home:smartbookmarks"><_translate>Smart Bookmarks</_translate></item> -</bar> -<content> -<_title>Smart Bookmarks</_title> -<_paragraph> -Smart bookmarks allows to perform searches and similar actions directly from -the address entry. -</_paragraph> -<_paragraph> -Right click the links and choose "Bookmark Link..." from the menu list. -When you will type a word in the address entry, a list of your smart -bookmarks will be displayed. Just choose one of them to perform the search. -The next time you type a word, just pressing the Enter key will be enough to -perform the same action. -</_paragraph> -<smartbookmark normal="http://www.google.com/" -smart="http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8" title="Search the web - Google"> -<_translate>Search the web - Google</_translate> -</smartbookmark> -<smartbookmark normal="http://images.google.com/" -smart="http://images.google.com/images?q=%s&ie=UTF-8&oe=UTF-8" title="Search images - Google"> -<_translate>Search images - Google</_translate> -</smartbookmark> -</content> -</section> diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp deleted file mode 100644 index 4d2c52c7d..000000000 --- a/embed/mozilla/StartHereProtocolHandler.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2001 Matt Aubury, Philip Langdale - * - * 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, 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. - */ - -#include "ephy-file-helpers.h" -#include "ephy-start-here.h" -#include "ephy-embed-shell.h" - -#include <string.h> - -#include "StartHereProtocolHandler.h" -#include "nsIIOService.h" -#include "nsIServiceManager.h" -#include "nsIURI.h" -#include "nsNetCID.h" -#include "nsNetUtil.h" -#include "nsIStorageStream.h" - -static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID); - -/* Implementation file */ -NS_IMPL_ISUPPORTS1 (GStartHereProtocolHandler, nsIProtocolHandler) - -GStartHereProtocolHandler::GStartHereProtocolHandler (void) -{ - NS_INIT_ISUPPORTS(); - -} - -GStartHereProtocolHandler::~GStartHereProtocolHandler() -{ - /* destructor code */ -} - -/* readonly attribute string scheme; */ -NS_IMETHODIMP GStartHereProtocolHandler::GetScheme(nsACString &aScheme) -{ - aScheme = NS_LITERAL_CSTRING("home"); - return NS_OK; -} - -/* readonly attribute long defaultPort; */ -NS_IMETHODIMP GStartHereProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort) -{ - nsresult rv = NS_OK; - if (aDefaultPort) - *aDefaultPort = -1; - else - rv = NS_ERROR_NULL_POINTER; - return rv; -} - -/* readonly attribute short protocolFlags; */ -NS_IMETHODIMP GStartHereProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags) -{ - if (aProtocolFlags) - *aProtocolFlags = nsIProtocolHandler::URI_STD; - else - return NS_ERROR_NULL_POINTER; - return NS_OK; -} - -/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */ -NS_IMETHODIMP GStartHereProtocolHandler::NewURI(const nsACString &aSpec, - const char *aOriginCharset, - nsIURI *aBaseURI, - nsIURI **_retval) -{ - nsresult rv = NS_OK; - nsCOMPtr <nsIURI> newUri; - - rv = nsComponentManager::CreateInstance(kSimpleURICID, NULL, - NS_GET_IID(nsIURI), - getter_AddRefs(newUri)); - - if (NS_SUCCEEDED(rv)) - { - newUri->SetSpec(aSpec); - rv = newUri->QueryInterface(NS_GET_IID(nsIURI), - (void **) _retval); - } - return rv; -} - -/* nsIChannel newChannel (in nsIURI aURI); */ -NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI, - nsIChannel **_retval) -{ - nsresult rv; - EphyStartHere *sh; - char *buf; - const char *aBaseURI; - PRUint32 bytesWritten; - - nsCAutoString path; - rv = aURI->GetPath(path); - if (NS_FAILED(rv)) return rv; - - if (g_str_has_prefix (path.get(), "import-mozilla-bookmarks")) - { - g_signal_emit_by_name (embed_shell, "command", "import-mozilla-bookmarks", - path.get() + strlen ("import-mozilla-bookmarks?")); - return NS_ERROR_FAILURE; - } - else if (g_str_has_prefix (path.get(), "import-galeon-bookmarks")) - { - g_signal_emit_by_name (embed_shell, "command", - "import-galeon-bookmarks", - path.get() + strlen ("import-galeon-bookmarks?")); - return NS_ERROR_FAILURE; - } - else if (g_str_has_prefix (path.get(), "import-konqueror-bookmarks")) - { - g_signal_emit_by_name (embed_shell, "command", - "import-konqueror-bookmarks", - path.get() + strlen ("import-konqueror-bookmarks?")); - return NS_ERROR_FAILURE; - } - else if (g_str_has_prefix (path.get(), "configure-network")) - { - g_signal_emit_by_name (embed_shell, "command", "configure-network", - NULL); - return NS_ERROR_FAILURE; - } - - nsCOMPtr<nsIStorageStream> sStream; - nsCOMPtr<nsIOutputStream> stream; - - rv = NS_NewStorageStream(16384, (PRUint32)-1, getter_AddRefs(sStream)); - if (NS_FAILED(rv)) return rv; - - rv = sStream->GetOutputStream(0, getter_AddRefs(stream)); - if (NS_FAILED(rv)) return rv; - - sh = ephy_start_here_new (); - buf = ephy_start_here_get_page - (sh, path.IsEmpty() ? "index" : path.get ()); - if (buf == NULL) return NS_ERROR_FAILURE; - aBaseURI = ephy_start_here_get_base_uri (sh); - - rv = stream->Write (buf, strlen (buf), &bytesWritten); - if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURI> uri; - nsCAutoString spec(aBaseURI); - rv = NS_NewURI(getter_AddRefs(uri), spec.get()); - if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIInputStream> iStream; - - rv = sStream->NewInputStream(0, getter_AddRefs(iStream)); - if (NS_FAILED(rv)) return rv; - - rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri, - iStream, NS_LITERAL_CSTRING("text/xml"), - NS_LITERAL_CSTRING("utf-8")); - - g_free (buf); - g_object_unref (sh); - - NS_IF_ADDREF (*_retval = mChannel); - - return rv; -} - -/* boolean allowPort (in long port, in string scheme); */ -NS_IMETHODIMP GStartHereProtocolHandler::AllowPort(PRInt32 port, const char *scheme, - PRBool *_retval) -{ - *_retval = PR_FALSE; - return NS_OK; -} - diff --git a/embed/mozilla/StartHereProtocolHandler.h b/embed/mozilla/StartHereProtocolHandler.h deleted file mode 100644 index ab8744523..000000000 --- a/embed/mozilla/StartHereProtocolHandler.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2001 Philip Langdale - * - * 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, 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. - */ - -#ifndef StartHereProtocolHandler_h__ -#define StartHereProtocolHandler_h__ - -#include "nsError.h" -#include "nsIProtocolHandler.h" -#include "nsCOMPtr.h" -#include "nsIChannel.h" - -#define G_START_HERE_PROTOCOLHANDLER_CID \ -{ /* a3a7b6e5-7a92-431d-87e6-3bef8e7ada51*/ \ - 0xa3a7b6e5, \ - 0x7a92, \ - 0x431d, \ - {0x87, 0xe6, 0x3b, 0xef, 0x8e, 0x7a, 0xda, 0x51} \ -} -#define G_START_HERE_PROTOCOLHANDLER_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "home" -#define G_START_HERE_PROTOCOLHANDLER_CLASSNAME "Epiphany's start here protocol handler" - -class GStartHereProtocolHandler : public nsIProtocolHandler -{ - public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROTOCOLHANDLER - - GStartHereProtocolHandler (void); - virtual ~GStartHereProtocolHandler(); - - nsCOMPtr<nsIChannel> mChannel; -}; - -#endif // StarthereProtocolHandler_h__ diff --git a/lib/ephy-start-here.c b/lib/ephy-start-here.c deleted file mode 100644 index f51314b99..000000000 --- a/lib/ephy-start-here.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (C) 2002 Marco Pesenti Gritti - * - * 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, 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtk.h> -#include <libxml/tree.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -#include "ephy-start-here.h" -#include "ephy-file-helpers.h" - -struct EphyStartHerePrivate -{ - const GList *langs; - char *base_uri; - xmlDocPtr doc; -}; - -static void -ephy_start_here_class_init (EphyStartHereClass *klass); -static void -ephy_start_here_init (EphyStartHere *tab); -static void -ephy_start_here_finalize (GObject *object); - -static GObjectClass *parent_class = NULL; - -GType -ephy_start_here_get_type (void) -{ - static GType ephy_start_here_type = 0; - - if (ephy_start_here_type == 0) - { - static const GTypeInfo our_info = - { - sizeof (EphyStartHereClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) ephy_start_here_class_init, - NULL, - NULL, /* class_data */ - sizeof (EphyStartHere), - 0, /* n_preallocs */ - (GInstanceInitFunc) ephy_start_here_init - }; - - ephy_start_here_type = g_type_register_static (G_TYPE_OBJECT, - "EphyStartHere", - &our_info, 0); - } - - return ephy_start_here_type; -} - -static void -ephy_start_here_class_init (EphyStartHereClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = ephy_start_here_finalize; -} - -static void -ephy_start_here_init (EphyStartHere *eb) -{ - eb->priv = g_new0 (EphyStartHerePrivate, 1); - - eb->priv->langs = gnome_i18n_get_language_list ("LC_MESSAGES"); - eb->priv->base_uri = g_strconcat ("file://", - ephy_file ("starthere/"), - NULL); -} - -static void -ephy_start_here_finalize (GObject *object) -{ - EphyStartHere *eb; - - g_return_if_fail (IS_EPHY_START_HERE (object)); - - eb = EPHY_START_HERE (object); - - g_return_if_fail (eb->priv != NULL); - - g_free (eb->priv->base_uri); - - g_free (eb->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -EphyStartHere * -ephy_start_here_new () -{ - EphyStartHere *tab; - - tab = EPHY_START_HERE (g_object_new (EPHY_START_HERE_TYPE, NULL)); - - return tab; -} - -static gboolean -is_my_lang (EphyStartHere *sh, char *my_lang) -{ - const GList *l; - - for (l = sh->priv->langs; l != NULL; l = l->next) - { - char *lang = (char *)l->data; - - if (strcmp (lang, my_lang) == 0) - return TRUE; - } - - return FALSE; -} - -static xmlNodePtr -drop_other_languages (EphyStartHere *sh, - const char *node_name, - xmlNodePtr node) -{ - xmlNodePtr default_node; - xmlNodePtr res = NULL; - gboolean use_default = TRUE; - - default_node = node->prev; - while (default_node && !xmlStrEqual (default_node->name, node_name)) - { - default_node = default_node->prev; - } - g_return_val_if_fail (default_node != NULL, NULL); - - while (node != NULL) - { - xmlChar *lang; - - res = node->next; - - lang = xmlNodeGetLang (node); - if (!is_my_lang (sh, lang)) - { - xmlUnlinkNode (node); - xmlFreeNode (node); - } - else - { - use_default = FALSE; - } - xmlFree (lang); - - node = (res && xmlStrEqual (res->name, node_name)) ? - res : NULL; - } - - if (!use_default) - { - xmlUnlinkNode (default_node); - xmlFreeNode (default_node); - } - - return res; -} - -static void -select_language (EphyStartHere *sh, xmlNodePtr node) -{ - while (node) - { - xmlChar *lang; - - lang = xmlNodeGetLang (node); - if (lang) - { - node = drop_other_languages - (sh, node->name, node); - xmlFree (lang); - } - else - { - select_language (sh, node->children); - node = node->next; - } - } -} - -static char * -mozilla_bookmarks (void) -{ - GSList *l; - char *dir; - char *result; - - dir = g_build_filename (g_get_home_dir (), ".mozilla", NULL); - l = ephy_file_find (dir, "bookmarks.html", 4); - g_free (dir); - - result = l ? g_strdup (l->data) : NULL; - - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); - - return result; -} - -static char * -galeon_bookmarks (void) -{ - GSList *l; - char *dir; - char *result; - - dir = g_build_filename (g_get_home_dir (), ".galeon", NULL); - l = ephy_file_find (dir, "bookmarks.xbel", 4); - g_free (dir); - - result = l ? g_strdup (l->data) : NULL; - - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); - - return result; -} - -static char * -konqueror_bookmarks (void) -{ - GSList *l; - char *dir; - char *result; - - dir = g_build_filename (g_get_home_dir (), ".kde", "share", - "apps", "konqueror", NULL); - l = ephy_file_find (dir, "bookmarks.xml", 4); - g_free (dir); - - result = l ? g_strdup (l->data) : NULL; - - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); - - return result; -} - -static void -attach_content (EphyStartHere *sh, xmlNodePtr node, xmlChar *id) -{ - if (xmlStrEqual (id, "bookmarks-import")) - { - xmlNodePtr child; - char *bmk_file; - - bmk_file = mozilla_bookmarks (); - if (bmk_file) - { - child = xmlNewDocNode (sh->priv->doc, NULL, "action", - _("Import Mozilla bookmarks")); - xmlSetProp (child, "id", "import-mozilla-bookmarks"); - xmlSetProp (child, "param", bmk_file); - xmlAddChild (node, child); - } - g_free (bmk_file); - - bmk_file = galeon_bookmarks (); - if (bmk_file) - { - child = xmlNewDocNode (sh->priv->doc, NULL, "action", - _("Import Galeon bookmarks")); - xmlSetProp (child, "id", "import-galeon-bookmarks"); - xmlSetProp (child, "param", bmk_file); - xmlAddChild (node, child); - } - g_free (bmk_file); - - bmk_file = konqueror_bookmarks (); - if (bmk_file) - { - child = xmlNewDocNode (sh->priv->doc, NULL, "action", - _("Import Konqueror bookmarks")); - xmlSetProp (child, "id", "import-konqueror-bookmarks"); - xmlSetProp (child, "param", bmk_file); - xmlAddChild (node, child); - } - g_free (bmk_file); - - } -} - -static char * -color_to_string (GdkColor color) -{ - return g_strdup_printf ("#%.2x%.2x%.2x", - color.red >> 8, - color.green >> 8, - color.blue >> 8); -} - -static void -build_content (EphyStartHere *sh, xmlNodePtr node) -{ - while (node) - { - xmlChar *id; - - id = xmlGetProp (node, "id"); - if (id) - { - attach_content (sh, node, id); - xmlFree (id); - } - - if (xmlStrEqual (node->name, "section")) - { - GtkWidget *widget, *window; - GdkColor color; - char *str; - - /* create a random widget that we will use to get - * the current style - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - widget = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (window), widget); - gtk_widget_realize (window); - gtk_widget_realize (widget); - gtk_widget_ensure_style (widget); - - color = widget->style->bg[GTK_STATE_NORMAL]; - str = color_to_string (color); - xmlSetProp (node, "bg", str); - g_free (str); - - color = widget->style->text[GTK_STATE_SELECTED]; - str = color_to_string (color); - xmlSetProp (node, "title", str); - g_free (str); - - color = widget->style->bg[GTK_STATE_ACTIVE]; - str = color_to_string (color); - xmlSetProp (node, "title-bg", str); - g_free (str); - - color = widget->style->bg[GTK_STATE_SELECTED]; - str = color_to_string (color); - xmlSetProp (node, "link", str); - g_free (str); - - color = widget->style->text[GTK_STATE_NORMAL]; - str = color_to_string (color); - xmlSetProp (node, "text", str); - g_free (str); - - gtk_widget_destroy (window); - } - - build_content (sh, node->children); - node = node->next; - } -} -char * -ephy_start_here_get_page (EphyStartHere *sh, const char *id) -{ - xmlNodePtr root; - const char *xml_filepath; - char *xml_filename; - xmlChar *content; - int size; - - xml_filename = g_strconcat ("starthere/", id, ".xml", NULL); - xml_filepath = ephy_file (xml_filename); - if (!xml_filepath) return NULL; - g_free (xml_filename); - - sh->priv->doc = xmlParseFile (xml_filepath); - root = xmlDocGetRootElement (sh->priv->doc); - - select_language (sh, root); - build_content (sh, root); - - xmlDocDumpMemory (sh->priv->doc, &content, &size); - - xmlFreeDoc (sh->priv->doc); - - return content; -} - -const char * -ephy_start_here_get_base_uri (EphyStartHere *sh) -{ - return sh->priv->base_uri; -} diff --git a/lib/ephy-start-here.h b/lib/ephy-start-here.h deleted file mode 100644 index df2b2ce26..000000000 --- a/lib/ephy-start-here.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2002 Marco Pesenti Gritti - * - * 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, 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. - */ - -#ifndef EPHY_START_HERE_H -#define EPHY_START_HERE_H - -#include <glib-object.h> - -#include "ephy-node.h" - -G_BEGIN_DECLS - -typedef struct EphyStartHereClass EphyStartHereClass; - -#define EPHY_START_HERE_TYPE (ephy_start_here_get_type ()) -#define EPHY_START_HERE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_START_HERE_TYPE, EphyStartHere)) -#define EPHY_START_HERE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_START_HERE_TYPE, EphyStartHereClass)) -#define IS_EPHY_START_HERE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_START_HERE_TYPE)) -#define IS_EPHY_START_HERE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_START_HERE_TYPE)) - -typedef struct EphyStartHere EphyStartHere; -typedef struct EphyStartHerePrivate EphyStartHerePrivate; - -struct EphyStartHere -{ - GObject parent; - EphyStartHerePrivate *priv; -}; - -struct EphyStartHereClass -{ - GObjectClass parent_class; -}; - -GType ephy_start_here_get_type (void); - -EphyStartHere *ephy_start_here_new (void); - -char *ephy_start_here_get_page (EphyStartHere *sh, - const char *id); - -const char *ephy_start_here_get_base_uri (EphyStartHere *sh); - -G_END_DECLS - -#endif |