aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@svn.gnome.org>2007-09-10 01:49:34 +0800
committerCosimo Cecchi <cosimoc@src.gnome.org>2007-09-10 01:49:34 +0800
commit0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7 (patch)
treeb3be6fb6aa486e4b971e2d45bbab67df012df5d9 /src/bookmarks/ephy-bookmarks-editor.c
parent56a321d56e13c6ba2b635e2b2066d4337a5046ad (diff)
downloadgsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar.gz
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar.bz2
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar.lz
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar.xz
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.tar.zst
gsoc2013-epiphany-0e3d0325dab1bfa25b1af72cc8b1f8dcddfa9dc7.zip
Modifies the EphySearchEntry to inherit from EphyIconEntry instead of
2007-09-09 Cosimo Cecchi <cosimoc@svn.gnome.org> * lib/widgets/ephy-search-entry.c: (ephy_search_entry_get_type), (ephy_search_entry_timeout_cb), (ephy_search_entry_changed_cb), (ephy_search_entry_init), (ephy_search_entry_clear): * lib/widgets/ephy-search-entry.h: * src/bookmarks/ephy-bookmarks-editor.c: (search_entry_clear_cb), (build_search_box): Modifies the EphySearchEntry to inherit from EphyIconEntry instead of GtkEntry, to have icons on it. Adds a cleaner icon in the search entry of Bookmarks Editor. Fixes bug #463469. svn path=/trunk/; revision=7358
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index c853afc83..1e7b3f4a2 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1605,12 +1605,33 @@ search_entry_search_cb (GtkWidget *entry, const char *search_text, EphyBookmarks
ephy_node_filter_done_changing (editor->priv->bookmarks_filter);
}
+static gboolean
+search_entry_clear_cb (GtkWidget *ebox,
+ GdkEventButton *event,
+ GtkWidget *entry)
+{
+ guint state = event->state & gtk_accelerator_get_default_mod_mask ();
+
+ if (event->type == GDK_BUTTON_RELEASE &&
+ event->button == 1 &&
+ state == 0 /* left */)
+ {
+ ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry));
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static GtkWidget *
build_search_box (EphyBookmarksEditor *editor)
{
GtkWidget *box;
GtkWidget *label;
GtkWidget *entry;
+ GtkWidget *cleaner;
+ GtkWidget *ebox;
char *str;
box = gtk_hbox_new (FALSE, 6);
@@ -1619,12 +1640,29 @@ build_search_box (EphyBookmarksEditor *editor)
entry = ephy_search_entry_new ();
editor->priv->search_entry = entry;
- gtk_widget_show (entry);
+
+ cleaner = gtk_image_new_from_stock (GTK_STOCK_CLEAR,
+ GTK_ICON_SIZE_MENU);
+ ebox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
+
+ gtk_widget_add_events (ebox, GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK);
+ g_signal_connect (ebox , "button-release-event",
+ G_CALLBACK (search_entry_clear_cb),
+ entry);
+ gtk_widget_set_tooltip_text (ebox,
+ _("Clear"));
+ gtk_container_add (GTK_CONTAINER (ebox), cleaner);
+ ephy_icon_entry_pack_widget ((EPHY_ICON_ENTRY (entry)), ebox, FALSE);
+
g_signal_connect (G_OBJECT (entry), "search",
G_CALLBACK (search_entry_search_cb),
editor);
add_entry_monitor (editor, entry);
add_focus_monitor (editor, entry);
+
+ gtk_widget_show_all (entry);
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);