From 4666852818b260e239b33092678fcad78a1f031c Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 6 Nov 2012 12:19:59 +0100 Subject: lib: Remove unused EphySearchEntry widget https://bugzilla.gnome.org/show_bug.cgi?id=687744 --- lib/widgets/Makefile.am | 2 - lib/widgets/ephy-search-entry.c | 211 ---------------------------------------- lib/widgets/ephy-search-entry.h | 65 ------------- 3 files changed, 278 deletions(-) delete mode 100644 lib/widgets/ephy-search-entry.c delete mode 100644 lib/widgets/ephy-search-entry.h (limited to 'lib/widgets') 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 - * - * 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 - -#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 - * - * 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 can be included directly." -#endif - -#ifndef EPHY_SEARCH_ENTRY_H -#define EPHY_SEARCH_ENTRY_H - -#include - -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 */ -- cgit v1.2.3