From 996340290e12fa08e92787b87f724b0a9d6bccc5 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 12 Sep 2007 15:24:21 +0000 Subject: Adapt EphyHistoryWindow to the iconified EphySearchEntry and adds a 2007-09-12 Cosimo Cecchi * src/ephy-history-window.c: (search_entry_clear_cb), (build_search_box): Adapt EphyHistoryWindow to the iconified EphySearchEntry and adds a cleaner button in its search entry, like in Bookmarks Editor. Fixes bug #476179. svn path=/trunk/; revision=7391 --- ChangeLog | 9 +++++++++ src/ephy-history-window.c | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11bc2f433..4908d069b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-09-12 Cosimo Cecchi + + * src/ephy-history-window.c: (search_entry_clear_cb), + (build_search_box): + + Adapt EphyHistoryWindow to the iconified EphySearchEntry and adds + a cleaner button in its search entry, like in Bookmarks Editor. + Fixes bug #476179. + 2007-09-12 Cosimo Cecchi * src/ephy-find-toolbar.c: (ephy_find_toolbar_open): diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 7df73628f..5163e8d90 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -1012,11 +1012,31 @@ time_combo_changed_cb (GtkWidget *combo, EphyHistoryWindow *editor) setup_filters (editor, TRUE, TRUE); } +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 /* left */ && + state == 0) + { + ephy_search_entry_clear (EPHY_SEARCH_ENTRY (entry)); + + return TRUE; + } + + return FALSE; +} + static GtkWidget * build_search_box (EphyHistoryWindow *editor) { GtkWidget *box, *label, *entry; GtkWidget *combo; + GtkWidget *cleaner, *ebox; char *str; int time_range; @@ -1027,8 +1047,24 @@ build_search_box (EphyHistoryWindow *editor) entry = ephy_search_entry_new (); add_focus_monitor (editor, entry); add_entry_monitor (editor, entry); - editor->priv->search_entry = entry; - gtk_widget_show (entry); + editor->priv->search_entry = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (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); + + gtk_widget_show_all (entry); label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -- cgit v1.2.3