diff options
author | Cosimo Cecchi <cosimoc@svn.gnome.org> | 2007-09-12 23:24:21 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@src.gnome.org> | 2007-09-12 23:24:21 +0800 |
commit | 996340290e12fa08e92787b87f724b0a9d6bccc5 (patch) | |
tree | 8d822adf09fdcbaccdd9bff99b127fb6454a77cc /src | |
parent | c1fc79ecff20dbdd4f79055f7d87e6b9253c22ce (diff) | |
download | gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar.gz gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar.bz2 gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar.lz gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar.xz gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.tar.zst gsoc2013-epiphany-996340290e12fa08e92787b87f724b0a9d6bccc5.zip |
Adapt EphyHistoryWindow to the iconified EphySearchEntry and adds a
2007-09-12 Cosimo Cecchi <cosimoc@svn.gnome.org>
* 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
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-history-window.c | 40 |
1 files changed, 38 insertions, 2 deletions
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); |