diff options
author | Bastien Nocera <hadess@hadess.net> | 2012-11-06 19:19:59 +0800 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2012-12-10 15:46:47 +0800 |
commit | 4666852818b260e239b33092678fcad78a1f031c (patch) | |
tree | 31d5cc42cd6f28c3b2ba509f5826b36d9658b16f | |
parent | 52b87722689ed8a124b6cafcf51f7309b7c7104c (diff) | |
download | gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar.gz gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar.bz2 gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar.lz gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar.xz gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.tar.zst gsoc2013-epiphany-4666852818b260e239b33092678fcad78a1f031c.zip |
lib: Remove unused EphySearchEntry widget
https://bugzilla.gnome.org/show_bug.cgi?id=687744
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | doc/reference/epiphany-docs.sgml | 1 | ||||
-rw-r--r-- | doc/reference/epiphany-sections.txt | 8 | ||||
-rw-r--r-- | doc/reference/epiphany.types | 2 | ||||
-rw-r--r-- | lib/widgets/Makefile.am | 2 | ||||
-rw-r--r-- | lib/widgets/ephy-search-entry.c | 211 | ||||
-rw-r--r-- | lib/widgets/ephy-search-entry.h | 65 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/ephy-search-entry-test.c | 75 |
10 files changed, 0 insertions, 370 deletions
diff --git a/.gitignore b/.gitignore index 7f23d9baf..280ec511c 100644 --- a/.gitignore +++ b/.gitignore @@ -59,5 +59,4 @@ src/epiphany.h tests/test-ephy-embed-persist tests/test-ephy-embed-single tests/test-ephy-location-entry -tests/test-ephy-search-entry tests/test-ephy-zoom-control diff --git a/doc/reference/epiphany-docs.sgml b/doc/reference/epiphany-docs.sgml index 55a6ea4f4..17d4320b7 100644 --- a/doc/reference/epiphany-docs.sgml +++ b/doc/reference/epiphany-docs.sgml @@ -23,7 +23,6 @@ <title>Widgets</title> <xi:include href="xml/ephy-location-entry.xml"/> <xi:include href="xml/ephy-node-view.xml"/> - <xi:include href="xml/ephy-search-entry.xml"/> <xi:include href="xml/ephy-tree-model-node.xml"/> <xi:include href="xml/ephy-tree-model-sort.xml"/> <xi:include href="xml/ephy-zoom-action.xml"/> diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt index 5163dd4e2..180a7501d 100644 --- a/doc/reference/epiphany-sections.txt +++ b/doc/reference/epiphany-sections.txt @@ -93,14 +93,6 @@ ephy_node_view_popup </SECTION> <SECTION> -<FILE>ephy-search-entry</FILE> -<TITLE>EphySearchEntry</TITLE> -EphySearchEntry -ephy_search_entry_new -ephy_search_entry_clear -</SECTION> - -<SECTION> <FILE>ephy-tree-model-node</FILE> <TITLE>EphyTreeModelNode</TITLE> EphyTreeModelNode diff --git a/doc/reference/epiphany.types b/doc/reference/epiphany.types index 94e7eb221..00416bf32 100644 --- a/doc/reference/epiphany.types +++ b/doc/reference/epiphany.types @@ -4,13 +4,11 @@ ephy_web_view_get_type #include <ephy-node-view.h> #include <ephy-location-entry.h> -#include <ephy-search-entry.h> #include <ephy-tree-model-sort.h> #include <ephy-zoom-action.h> ephy_node_view_get_type ephy_location_entry_get_type -ephy_search_entry_get_type ephy_tree_model_node_get_type ephy_tree_model_sort_get_type ephy_zoom_action_get_type diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index 3259bb703..7bf331674 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -85,8 +85,6 @@ libephywidgets_la_SOURCES = \ ephy-overview-store.h \ ephy-removable-pixbuf-renderer.c \ ephy-removable-pixbuf-renderer.h \ - ephy-search-entry.c \ - ephy-search-entry.h \ ephy-tree-model-node.c \ ephy-tree-model-node.h \ ephy-tree-model-sort.c \ diff --git a/lib/widgets/ephy-search-entry.c b/lib/widgets/ephy-search-entry.c deleted file mode 100644 index 2a5e971e6..000000000 --- a/lib/widgets/ephy-search-entry.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright © 2002 Jorn Baayen <jorn@nl.linux.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include <glib/gi18n.h> - -#include "ephy-search-entry.h" - -/** - * SECTION:ephy-search-entry - * @short_description: A search entry widget - * @see_also: #GtkEntry - * - * #EphySearchEntry implements a #GtkEntry for handling user search input. - * It implements a search timeout and easy cleaning. - */ - -static void ephy_search_entry_class_init (EphySearchEntryClass *klass); -static void ephy_search_entry_init (EphySearchEntry *entry); - -#define EPHY_SEARCH_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryPrivate)) - -struct _EphySearchEntryPrivate -{ - gboolean clearing; - guint timeout; -}; - -enum -{ - SEARCH, - LAST_SIGNAL -}; - -static guint ephy_search_entry_signals[LAST_SIGNAL] = { 0 }; - -G_DEFINE_TYPE (EphySearchEntry, ephy_search_entry, GTK_TYPE_ENTRY) - -static void -ephy_search_entry_class_init (EphySearchEntryClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - /** - * EphySearchEntry::search: - * @entry: the object on which the signal is emitted - * @text: the text introduced by the user - * - * Emitted when the user activates the search entry after introducing - * text. - * - */ - ephy_search_entry_signals[SEARCH] = - g_signal_new ("search", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EphySearchEntryClass, search), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, - 1, - G_TYPE_STRING); - - g_type_class_add_private (object_class, sizeof (EphySearchEntryPrivate)); -} - -static gboolean -ephy_search_entry_timeout_cb (EphySearchEntry *entry) -{ - g_signal_emit (entry, ephy_search_entry_signals[SEARCH], 0, - gtk_entry_get_text (GTK_ENTRY (entry))); - entry->priv->timeout = 0; - - return FALSE; -} - -static void -ephy_search_entry_changed_cb (GtkEditable *editable, - EphySearchEntry *entry) -{ - if (entry->priv->clearing == TRUE) - { - g_signal_emit (entry, ephy_search_entry_signals[SEARCH], 0, - gtk_entry_get_text (GTK_ENTRY (entry))); - return; - } - - if (entry->priv->timeout != 0) - { - g_source_remove (entry->priv->timeout); - entry->priv->timeout = 0; - } - - entry->priv->timeout = g_timeout_add (300, (GSourceFunc) ephy_search_entry_timeout_cb, entry); -} - -static void -ephy_search_entry_destroy_cb (GtkEditable *editable, - EphySearchEntry *entry) -{ - if (entry->priv->timeout) - { - g_source_remove (entry->priv->timeout); - entry->priv->timeout = 0; - } -} - -static gboolean -search_entry_clear_cb (GtkWidget *entry, - GtkEntryIconPosition position, - GdkEventButton *event, - gpointer user_data) -{ - guint state = event->state & gtk_accelerator_get_default_mod_mask (); - - if (event->button == 1 /* left */ && - state == 0 && - position == GTK_ENTRY_ICON_SECONDARY) - { - ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry)); - - return TRUE; - } - - return FALSE; -} - -static void -ephy_search_entry_init (EphySearchEntry *entry) -{ - gboolean ltr; - - entry->priv = EPHY_SEARCH_ENTRY_GET_PRIVATE (entry); - ltr = gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR; - - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), - GTK_ENTRY_ICON_SECONDARY, - ltr ? "edit-clear-symbolic" : - "edit-clear-rtl-symbolic"); - gtk_entry_set_icon_activatable (GTK_ENTRY (entry), - GTK_ENTRY_ICON_SECONDARY, - TRUE); - gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry), - GTK_ENTRY_ICON_SECONDARY, - _("Clear")); - g_signal_connect (entry, - "icon-press", - G_CALLBACK (search_entry_clear_cb), - NULL); - g_signal_connect (entry, - "destroy", - G_CALLBACK (ephy_search_entry_destroy_cb), - entry); - g_signal_connect (entry, - "changed", - G_CALLBACK (ephy_search_entry_changed_cb), - entry); -} - -/** - * ephy_search_entry_new: - * - * Creates a new #EphySearchEntry. - * - * Returns: a new #EphySearchEntry, as a #GtkWidget - **/ -GtkWidget * -ephy_search_entry_new (void) -{ - return gtk_widget_new (EPHY_TYPE_SEARCH_ENTRY, NULL); -} - -/** - * ephy_search_entry_clear: - * @entry: an #EphySearchEntry - * - * Clears the text of the internal #GtkEntry of @entry. - * - **/ -void -ephy_search_entry_clear (EphySearchEntry *entry) -{ - if (entry->priv->timeout != 0) - { - g_source_remove (entry->priv->timeout); - entry->priv->timeout = 0; - } - - entry->priv->clearing = TRUE; - - gtk_entry_set_text (GTK_ENTRY (entry), ""); - - entry->priv->clearing = FALSE; -} diff --git a/lib/widgets/ephy-search-entry.h b/lib/widgets/ephy-search-entry.h deleted file mode 100644 index 5ea2526d2..000000000 --- a/lib/widgets/ephy-search-entry.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright © 2002 Jorn Baayen <jorn@nl.linux.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only <epiphany/epiphany.h> can be included directly." -#endif - -#ifndef EPHY_SEARCH_ENTRY_H -#define EPHY_SEARCH_ENTRY_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define EPHY_TYPE_SEARCH_ENTRY (ephy_search_entry_get_type ()) -#define EPHY_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntry)) -#define EPHY_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass)) -#define EPHY_IS_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SEARCH_ENTRY)) -#define EPHY_IS_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SEARCH_ENTRY)) -#define EPHY_SEARCH_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass)) - -typedef struct _EphySearchEntryClass EphySearchEntryClass; -typedef struct _EphySearchEntry EphySearchEntry; -typedef struct _EphySearchEntryPrivate EphySearchEntryPrivate; - -struct _EphySearchEntryClass -{ - GtkEntryClass parent; - - void (*search) (EphySearchEntry *entry, const char *text); -}; - -struct _EphySearchEntry -{ - GtkEntry parent; - - /*< private >*/ - EphySearchEntryPrivate *priv; -}; - -GType ephy_search_entry_get_type (void); - -GtkWidget *ephy_search_entry_new (void); - -void ephy_search_entry_clear (EphySearchEntry *entry); - -G_END_DECLS - -#endif /* __EPHY_SEARCH_ENTRY_H */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 5f1122d9c..da16e8c12 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,7 +30,6 @@ lib/widgets/ephy-download-widget.c lib/widgets/ephy-hosts-store.c lib/widgets/ephy-hosts-view.c lib/widgets/ephy-location-entry.c -lib/widgets/ephy-search-entry.c lib/widgets/ephy-urls-view.c src/bookmarks/ephy-bookmark-action.c src/bookmarks/ephy-bookmark-properties.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 3fd1000ea..992547eb7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,7 +11,6 @@ noinst_PROGRAMS = \ test-ephy-history \ test-ephy-location-entry \ test-ephy-migration \ - test-ephy-search-entry \ test-ephy-session \ test-ephy-shell \ test-ephy-snapshot-service \ @@ -150,9 +149,6 @@ test_ephy_location_entry_SOURCES = \ test_ephy_migration_SOURCES = \ ephy-migration-test.c -test_ephy_search_entry_SOURCES = \ - ephy-search-entry-test.c - test_ephy_session_SOURCES = \ ephy-session-test.c \ $(top_builddir)/src/epiphany-resources.c \ diff --git a/tests/ephy-search-entry-test.c b/tests/ephy-search-entry-test.c deleted file mode 100644 index f2eb5bccd..000000000 --- a/tests/ephy-search-entry-test.c +++ /dev/null @@ -1,75 +0,0 @@ -/* vim: set sw=2 ts=2 sts=2 et: */ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * ephy-search-entry-test.c - * This file is part of Epiphany - * - * Copyright © 2008 - Diego Escalante Urrelo - * - * Epiphany 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. - * - * Epiphany 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 Epiphany; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "ephy-search-entry.h" -#include <glib.h> -#include <gtk/gtk.h> - -static void -test_entry_new (void) -{ - - EphySearchEntry *entry; - entry = EPHY_SEARCH_ENTRY (ephy_search_entry_new ()); - - g_assert (GTK_IS_WIDGET (entry)); - g_assert (GTK_IS_ENTRY (entry)); -} - -static void -test_entry_clear (void) -{ - const char *set = "test"; - const char *get = NULL; - - EphySearchEntry *entry; - entry = EPHY_SEARCH_ENTRY (ephy_search_entry_new ()); - - gtk_entry_set_text (GTK_ENTRY (entry), set); - get = gtk_entry_get_text (GTK_ENTRY (entry)); - - g_assert_cmpstr (set, ==, get); - - /* At this point, the text in the entry is either 'vanilla' or the - * contents of 'set' char* - */ - ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry)); - get = gtk_entry_get_text (GTK_ENTRY (entry)); - - g_assert_cmpstr ("", ==, get); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv); - - g_test_add_func ("/lib/widgets/ephy-search-entry/new", - test_entry_new); - g_test_add_func ("/lib/widgets/ephy-search-entry/clear", - test_entry_clear); - - return g_test_run (); -} |