From 92a7cf00b53402be364d8cf3d51f7ec8487d7065 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sat, 28 Jun 2008 13:58:59 +0000 Subject: embed: remove ephy-embed-find and the webkit implementation. svn path=/trunk/; revision=8292 --- embed/Makefile.am | 2 - embed/ephy-embed-factory.c | 6 -- embed/ephy-embed-find.c | 128 ---------------------------- embed/ephy-embed-find.h | 101 ---------------------- embed/webkit/Makefile.am | 2 - embed/webkit/webkit-embed-find.c | 179 --------------------------------------- embed/webkit/webkit-embed-find.h | 57 ------------- 7 files changed, 475 deletions(-) delete mode 100644 embed/ephy-embed-find.c delete mode 100644 embed/ephy-embed-find.h delete mode 100644 embed/webkit/webkit-embed-find.c delete mode 100644 embed/webkit/webkit-embed-find.h (limited to 'embed') diff --git a/embed/Makefile.am b/embed/Makefile.am index 1640334d8..f8fc09861 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -13,7 +13,6 @@ NOINST_H_FILES = \ downloader-view.h \ ephy-download.h \ ephy-embed-dialog.h \ - ephy-embed-find.h \ ephy-encodings.h \ ephy-favicon-cache.h @@ -53,7 +52,6 @@ libephyembed_la_SOURCES = \ ephy-embed-container.c \ ephy-embed-dialog.c \ ephy-embed-event.c \ - ephy-embed-find.c \ ephy-embed-persist.c \ ephy-embed-single.c \ ephy-embed-shell.c \ diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c index 5aacc9f59..78daacf0b 100644 --- a/embed/ephy-embed-factory.c +++ b/embed/ephy-embed-factory.c @@ -22,11 +22,9 @@ #include "ephy-embed-factory.h" #include "webkit-embed.h" -#include "webkit-embed-find.h" #include "webkit-embed-persist.h" #include "webkit-embed-single.h" #include "ephy-embed.h" -#include "ephy-embed-find.h" #include "ephy-embed-persist.h" #include "ephy-embed-single.h" @@ -51,10 +49,6 @@ ephy_embed_factory_new_object (GType type) { object = g_object_new (WEBKIT_TYPE_EMBED_PERSIST, NULL); } - else if (type == EPHY_TYPE_EMBED_FIND) - { - object = g_object_new (WEBKIT_TYPE_EMBED_FIND, NULL); - } else if (type == EPHY_TYPE_EMBED_SINGLE) { object = g_object_new (WEBKIT_TYPE_EMBED_SINGLE, NULL); diff --git a/embed/ephy-embed-find.c b/embed/ephy-embed-find.c deleted file mode 100644 index 45e88a0b3..000000000 --- a/embed/ephy-embed-find.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright © 2005 Christian Persch - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#include "config.h" - -#include "ephy-embed-find.h" - -void -ephy_embed_find_set_embed (EphyEmbedFind *find, - EphyEmbed *embed) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - iface->set_embed (find, embed); -} - -/** - * ephy_embed_find_set_properties: - * @find: an #EphyEmbedFind - * @case_sensitive: %TRUE for "case sensitive" to be set - * - * Sets the properties of @find - **/ -void -ephy_embed_find_set_properties (EphyEmbedFind *find, - const char *search_string, - gboolean case_sensitive) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - iface->set_properties (find, search_string, case_sensitive); -} - -/** - * ephy_embed_find_find: - * @embed: an #EphyEmbedFind - * @search_string: the text to search for - * @links_only: whether to only search the text in links - * - * Return value: whether a match was found - **/ -EphyEmbedFindResult -ephy_embed_find_find (EphyEmbedFind *find, - const char *search_string, - gboolean links_only) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - return iface->find (find, search_string, links_only); -} - -/** - * ephy_embed_find_find_again: - * @embed: an #EphyEmbedFind - * @forward %TRUE to search forwards in the document - * @links_only: whether to only search the text in links - * - * Return value: whether a match was found - **/ -EphyEmbedFindResult -ephy_embed_find_find_again (EphyEmbedFind *find, - gboolean forward, - gboolean links_only) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - return iface->find_again (find, forward, links_only); -} - -void -ephy_embed_find_set_selection (EphyEmbedFind *find, - gboolean attention) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - iface->set_selection (find, attention); -} - -/** - * ephy_embed_find_activate_link: - * @embed: an #EphyEmbedFind - * @mask: - * - * Activates the currently focused link, if there is any. - * - * Return value: %TRUE if a link was activated - **/ -gboolean -ephy_embed_find_activate_link (EphyEmbedFind *find, - GdkModifierType mask) -{ - EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find); - return iface->activate_link (find, mask); -} - -GType -ephy_embed_find_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - const GTypeInfo our_info = - { - sizeof (EphyEmbedFindIface), - NULL, - NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "EphyEmbedFind", - &our_info, (GTypeFlags) 0); - } - - return type; -} diff --git a/embed/ephy-embed-find.h b/embed/ephy-embed-find.h deleted file mode 100644 index 7179e8abc..000000000 --- a/embed/ephy-embed-find.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright © 2005 Christian Persch - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef EPHY_EMBED_FIND_H -#define EPHY_EMBED_FIND_H - -#include -#include - -#include "ephy-embed.h" -#include - -G_BEGIN_DECLS - -#define EPHY_TYPE_EMBED_FIND (ephy_embed_find_get_type ()) -#define EPHY_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_FIND, EphyEmbedFind)) -#define EPHY_EMBED_FIND_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_FIND, EphyEmbedFindIface)) -#define EPHY_IS_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_FIND)) -#define EPHY_IS_EMBED_FIND_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_FIND)) -#define EPHY_EMBED_FIND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED_FIND, EphyEmbedFindIface)) - -typedef struct _EphyEmbedFind EphyEmbedFind; -typedef struct _EphyEmbedFindIface EphyEmbedFindIface; - -/* Keep these the same as in nsITypeAheadFind */ -typedef enum -{ - EPHY_EMBED_FIND_FOUND = 0, - EPHY_EMBED_FIND_NOTFOUND = 1, - EPHY_EMBED_FIND_FOUNDWRAPPED = 2 -} EphyEmbedFindResult; - -struct _EphyEmbedFindIface -{ - GTypeInterface base_iface; - - /* Methods */ - void (* set_embed) (EphyEmbedFind *find, - EphyEmbed *embed); - void (* set_properties) (EphyEmbedFind *find, - const char *search_string, - gboolean case_sensitive); - EphyEmbedFindResult (* find) (EphyEmbedFind *find, - const char *search_string, - gboolean links_only); - EphyEmbedFindResult (* find_again) (EphyEmbedFind *find, - gboolean forward, - gboolean links_only); - void (* set_selection) (EphyEmbedFind *find, - gboolean attention); - gboolean (* activate_link) (EphyEmbedFind *find, - GdkModifierType mask); -}; - -GType ephy_embed_find_get_type (void); - -void ephy_embed_find_set_embed (EphyEmbedFind *find, - EphyEmbed *embed); - -void ephy_embed_find_set_properties (EphyEmbedFind *find, - const char *search_string, - gboolean case_sensitive); - -EphyEmbedFindResult ephy_embed_find_find (EphyEmbedFind *find, - const char *search_string, - gboolean links_only); - -EphyEmbedFindResult ephy_embed_find_find_again (EphyEmbedFind *find, - gboolean forward, - gboolean links_only); - -void ephy_embed_find_set_selection (EphyEmbedFind *find, - gboolean attention); - -gboolean ephy_embed_find_activate_link (EphyEmbedFind *find, - GdkModifierType mask); - -G_END_DECLS - -#endif diff --git a/embed/webkit/Makefile.am b/embed/webkit/Makefile.am index ea327f855..74d157bc2 100644 --- a/embed/webkit/Makefile.am +++ b/embed/webkit/Makefile.am @@ -3,8 +3,6 @@ noinst_LTLIBRARIES = libephywebkitembed.la libephywebkitembed_la_SOURCES = \ webkit-embed.c \ webkit-embed.h \ - webkit-embed-find.c \ - webkit-embed-find.h \ webkit-embed-persist.c \ webkit-embed-persist.h \ webkit-embed-prefs.c \ diff --git a/embed/webkit/webkit-embed-find.c b/embed/webkit/webkit-embed-find.c deleted file mode 100644 index b91545989..000000000 --- a/embed/webkit/webkit-embed-find.c +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ -/* - * Copyright © 2000-2004 Marco Pesenti Gritti - * Copyright © 2003, 2004 Christian Persch - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include "ephy-debug.h" -#include "ephy-embed-find.h" -#include "ephy-embed-shell.h" - -#include - -#include "webkit-embed-find.h" - -#define WEBKIT_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_FIND, WebKitEmbedFindPrivate)) - -struct _WebKitEmbedFindPrivate -{ - WebKitWebView *web_view; - char *find_string; - gboolean case_sensitive; -}; - -static void -impl_set_embed (EphyEmbedFind *efind, - EphyEmbed *embed) -{ - WebKitEmbedFindPrivate *priv = WEBKIT_EMBED_FIND (efind)->priv; - - priv->web_view = WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (embed))))); -} - -static void -set_string_and_highlight (WebKitEmbedFindPrivate *priv, const char *find_string) -{ - WebKitWebView *web_view = priv->web_view; - - if (g_strcmp0 (priv->find_string, find_string) != 0) { - g_free (priv->find_string); - priv->find_string = g_strdup (find_string); - } - webkit_web_view_unmark_text_matches (web_view); - webkit_web_view_mark_text_matches (web_view, - priv->find_string, - priv->case_sensitive, - 0); - webkit_web_view_set_highlight_text_matches (web_view, TRUE); -} - -static void -impl_set_properties (EphyEmbedFind *efind, - const char *find_string, - gboolean case_sensitive) -{ - WebKitEmbedFindPrivate *priv = WEBKIT_EMBED_FIND (efind)->priv; - - priv->case_sensitive = case_sensitive; - set_string_and_highlight (priv, find_string); -} - -static EphyEmbedFindResult -real_find (WebKitEmbedFind *wefind, - gboolean forward) -{ - WebKitEmbedFindPrivate *priv = wefind->priv; - WebKitWebView *web_view = priv->web_view; - - if (!webkit_web_view_search_text - (web_view, priv->find_string, priv->case_sensitive, TRUE, FALSE)) { - /* not found, try to wrap */ - if (!webkit_web_view_search_text - (web_view, priv->find_string, priv->case_sensitive, TRUE, TRUE)) { - /* there's no result */ - return EPHY_EMBED_FIND_NOTFOUND; - } else { - /* found wrapped */ - return EPHY_EMBED_FIND_FOUNDWRAPPED; - } - } - - return EPHY_EMBED_FIND_FOUND; -} - -static EphyEmbedFindResult -impl_find (EphyEmbedFind *efind, - const char *find_string, - gboolean links_only) -{ - WebKitEmbedFindPrivate *priv = WEBKIT_EMBED_FIND (efind)->priv; - - set_string_and_highlight (priv, find_string); - - return real_find (WEBKIT_EMBED_FIND (efind), TRUE); -} - -static EphyEmbedFindResult -impl_find_again (EphyEmbedFind *efind, - gboolean forward, - gboolean links_only) -{ - return real_find (WEBKIT_EMBED_FIND (efind), forward); -} - -static void -impl_set_selection (EphyEmbedFind *efind, - gboolean attention) -{ - WebKitWebView *web_view = WEBKIT_EMBED_FIND (efind)->priv->web_view; - - webkit_web_view_set_highlight_text_matches (web_view, attention); -} - -static gboolean -impl_activate_link (EphyEmbedFind *efind, - GdkModifierType mask) -{ - return FALSE; -} - -static void -ephy_find_iface_init (EphyEmbedFindIface *iface) -{ - iface->set_embed = impl_set_embed; - iface->set_properties = impl_set_properties; - iface->find = impl_find; - iface->find_again = impl_find_again; - iface->set_selection = impl_set_selection; - iface->activate_link = impl_activate_link; -} - -static void -webkit_embed_find_init (WebKitEmbedFind *find) -{ - WebKitEmbedFindPrivate *priv = find->priv = WEBKIT_EMBED_FIND_GET_PRIVATE (find); - - priv->web_view = NULL; - priv->case_sensitive = FALSE; - priv->find_string = NULL; -} - -G_DEFINE_TYPE_WITH_CODE (WebKitEmbedFind, webkit_embed_find, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_FIND, - ephy_find_iface_init)) - -static void -webkit_embed_find_finalize (GObject *o) -{ - WebKitEmbedFindPrivate *priv = WEBKIT_EMBED_FIND (o)->priv; - - g_free (priv->find_string); - G_OBJECT_CLASS (webkit_embed_find_parent_class)->finalize (o); -} - -static void -webkit_embed_find_class_init (WebKitEmbedFindClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = webkit_embed_find_finalize; - - g_type_class_add_private (object_class, sizeof (WebKitEmbedFindPrivate)); -} diff --git a/embed/webkit/webkit-embed-find.h b/embed/webkit/webkit-embed-find.h deleted file mode 100644 index aab646efc..000000000 --- a/embed/webkit/webkit-embed-find.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2000-2004 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#ifndef WEBKIT_EMBED_FIND_H -#define WEBKIT_EMBED_FIND_H - -#include -#include - -G_BEGIN_DECLS - -#define WEBKIT_TYPE_EMBED_FIND (webkit_embed_find_get_type ()) -#define WEBKIT_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_FIND, WebKitEmbedFind)) -#define WEBKIT_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_FIND, WebKitEmbedFindClass)) -#define WEBKIT_IS_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_FIND)) -#define WEBKIT_IS_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_FIND)) -#define WEBKIT_EMBED_FIND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_FIND, WebKitEmbedFindClass)) - -typedef struct _WebKitEmbedFindClass WebKitEmbedFindClass; -typedef struct _WebKitEmbedFind WebKitEmbedFind; -typedef struct _WebKitEmbedFindPrivate WebKitEmbedFindPrivate; - -struct _WebKitEmbedFind -{ - GObject parent_instance; - - /*< private >*/ - WebKitEmbedFindPrivate *priv; -}; - -struct _WebKitEmbedFindClass -{ - GObjectClass parent_class; -}; - -GType webkit_embed_find_get_type (void); - -G_END_DECLS - -#endif -- cgit v1.2.3