aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-12-05 05:52:05 +0800
committerChristian Persch <chpe@src.gnome.org>2005-12-05 05:52:05 +0800
commit45def779c085277b160b016d0fa75004a82f8439 (patch)
treee40444720e42a02cd0812f2096a8d283d9b2d6d8
parentda002ee07fd517b377656ca1ddf86cb122881e0a (diff)
downloadgsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar.gz
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar.bz2
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar.lz
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar.xz
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.tar.zst
gsoc2013-epiphany-45def779c085277b160b016d0fa75004a82f8439.zip
While in find mode, set the selection colour to "attention".
2005-12-04 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-find.c: (ephy_embed_find_set_selection): * embed/ephy-embed-find.h: * embed/mozilla/EphyFind.cpp: * embed/mozilla/EphyFind.h: * embed/mozilla/mozilla-embed-find.cpp: While in find mode, set the selection colour to "attention". * src/ephy-find-toolbar.c: (set_status), (clear_status), (tab_search_key_press_cb), (entry_key_press_event_cb), (entry_activate_cb), (set_focus_cb), (ephy_find_toolbar_set_window), (ephy_find_toolbar_init), (ephy_find_toolbar_class_init), (ephy_find_toolbar_set_embed), (ephy_find_toolbar_open), (ephy_find_toolbar_close), (ephy_find_toolbar_request_close): * src/ephy-find-toolbar.h: * src/ephy-window.c: (sync_tab_document_type), (find_toolbar_close_cb), (ephy_window_set_print_preview), (ephy_window_get_find_toolbar), (ephy_window_get_context_event): Refactor find toolbar closing not to crash with auto-closing popups. Unset the selection colour on close. Remove dead #ifdef FIND_WHILE_TYPING_IN_EMBED code.
-rw-r--r--ChangeLog26
-rw-r--r--embed/ephy-embed-find.c8
-rw-r--r--embed/ephy-embed-find.h5
-rw-r--r--embed/mozilla/EphyFind.cpp60
-rw-r--r--embed/mozilla/EphyFind.h3
-rw-r--r--embed/mozilla/mozilla-embed-find.cpp11
-rw-r--r--src/ephy-find-toolbar.c174
-rw-r--r--src/ephy-find-toolbar.h2
-rw-r--r--src/ephy-window.c21
9 files changed, 148 insertions, 162 deletions
diff --git a/ChangeLog b/ChangeLog
index cb6983242..1de8e65ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
2005-12-04 Christian Persch <chpe@cvs.gnome.org>
+ * embed/ephy-embed-find.c: (ephy_embed_find_set_selection):
+ * embed/ephy-embed-find.h:
+ * embed/mozilla/EphyFind.cpp:
+ * embed/mozilla/EphyFind.h:
+ * embed/mozilla/mozilla-embed-find.cpp:
+
+ While in find mode, set the selection colour to "attention".
+
+ * src/ephy-find-toolbar.c: (set_status), (clear_status),
+ (tab_search_key_press_cb), (entry_key_press_event_cb),
+ (entry_activate_cb), (set_focus_cb),
+ (ephy_find_toolbar_set_window), (ephy_find_toolbar_init),
+ (ephy_find_toolbar_class_init), (ephy_find_toolbar_set_embed),
+ (ephy_find_toolbar_open), (ephy_find_toolbar_close),
+ (ephy_find_toolbar_request_close):
+ * src/ephy-find-toolbar.h:
+ * src/ephy-window.c: (sync_tab_document_type),
+ (find_toolbar_close_cb), (ephy_window_set_print_preview),
+ (ephy_window_get_find_toolbar), (ephy_window_get_context_event):
+
+ Refactor find toolbar closing not to crash with auto-closing popups.
+ Unset the selection colour on close.
+ Remove dead #ifdef FIND_WHILE_TYPING_IN_EMBED code.
+
+2005-12-04 Christian Persch <chpe@cvs.gnome.org>
+
* embed/mozilla/GtkNSSDialog.cpp:
Add a comment for translators.
diff --git a/embed/ephy-embed-find.c b/embed/ephy-embed-find.c
index 80ef28b18..7fd05d51a 100644
--- a/embed/ephy-embed-find.c
+++ b/embed/ephy-embed-find.c
@@ -78,6 +78,14 @@ ephy_embed_find_find_again (EphyEmbedFind *find,
return iface->find_again (find, forward);
}
+void
+ephy_embed_find_set_selection (EphyEmbedFind *find,
+ gboolean attention)
+{
+ EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
+ iface->set_selection (find, attention);
+}
+
/**
* ephy_embed_find_activate_link:
* @embed: an #EphyEmbedFind
diff --git a/embed/ephy-embed-find.h b/embed/ephy-embed-find.h
index 0370e8c6c..decc96737 100644
--- a/embed/ephy-embed-find.h
+++ b/embed/ephy-embed-find.h
@@ -62,6 +62,8 @@ struct _EphyEmbedFindIface
gboolean links_only);
EphyEmbedFindResult (* find_again) (EphyEmbedFind *find,
gboolean forward);
+ void (* set_selection) (EphyEmbedFind *find,
+ gboolean attention);
gboolean (* activate_link) (EphyEmbedFind *find,
GdkModifierType mask);
};
@@ -82,6 +84,9 @@ EphyEmbedFindResult ephy_embed_find_find (EphyEmbedFind *find,
EphyEmbedFindResult ephy_embed_find_find_again (EphyEmbedFind *find,
gboolean forward);
+void ephy_embed_find_set_selection (EphyEmbedFind *find,
+ gboolean attention);
+
gboolean ephy_embed_find_activate_link (EphyEmbedFind *find,
GdkModifierType mask);
diff --git a/embed/mozilla/EphyFind.cpp b/embed/mozilla/EphyFind.cpp
index c6b9b7c9b..1eab78c34 100644
--- a/embed/mozilla/EphyFind.cpp
+++ b/embed/mozilla/EphyFind.cpp
@@ -50,8 +50,12 @@
#include <nsIDOMHTMLAnchorElement.h>
#ifdef HAVE_TYPEAHEADFIND
+#include <nsISimpleEnumerator.h>
#include <nsIDocShell.h>
+#include <nsIDocShellTreeItem.h>
#include <nsITypeAheadFind.h>
+#include <nsISelectionDisplay.h>
+#include <nsISelectionController.h>
#else
#include <nsIWebBrowserFind.h>
#include <nsMemory.h>
@@ -68,6 +72,9 @@ static const PRUnichar kKeyPress[] = { 'k', 'e', 'y', 'p', 'r', 'e', 's', 's', '
EphyFind::EphyFind ()
: mCurrentEmbed(nsnull)
+#ifdef HAVE_TYPEAHEADFIND
+, mAttention(PR_FALSE)
+#endif
{
LOG ("EphyFind ctor [%p]", this);
}
@@ -83,6 +90,8 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed)
nsresult rv = NS_OK;
if (aEmbed == mCurrentEmbed) return rv;
+ SetSelectionAttention (PR_FALSE);
+
mCurrentEmbed = nsnull;
mWebBrowser = nsnull;
@@ -147,6 +156,53 @@ EphyFind::SetFindProperties (const char *aSearchString,
#endif /* TYPEAHEADFIND */
}
+void
+EphyFind::SetSelectionAttention (PRBool aAttention)
+{
+#ifdef HAVE_TYPEAHEADFIND
+ if (aAttention && mAttention) return;
+
+ mAttention = aAttention;
+
+ nsresult rv;
+ nsCOMPtr<nsIDocShell> shell (do_GetInterface (mWebBrowser, &rv));
+ /* It's okay for this to fail, if the tab is closing, or if
+ * we weren't attached to any tab yet
+ */
+ if (NS_FAILED (rv) || !shell) return;
+
+ nsCOMPtr<nsISimpleEnumerator> enumerator;
+ rv = shell->GetDocShellEnumerator (nsIDocShellTreeItem::typeContent,
+ nsIDocShell::ENUMERATE_FORWARDS,
+ getter_AddRefs (enumerator));
+ NS_ENSURE_SUCCESS (rv, );
+
+ PRInt16 display;
+ if (aAttention) {
+ display = nsISelectionController::SELECTION_ATTENTION;
+ } else {
+ display = nsISelectionController::SELECTION_ON;
+ }
+
+ PRBool hasMore = PR_FALSE;
+ while (NS_SUCCEEDED (enumerator->HasMoreElements (&hasMore)) && hasMore) {
+ nsCOMPtr<nsISupports> element;
+ nsCOMPtr<nsISelectionDisplay> sd;
+
+ enumerator->GetNext (getter_AddRefs (element));
+ if (!element) continue;
+
+ sd = do_GetInterface (element);
+ if (!sd) continue;
+
+ nsCOMPtr<nsISelectionController> controller (do_QueryInterface (sd));
+ if (!controller) continue;
+
+ controller->SetDisplaySelection (display);
+ }
+#endif
+}
+
EphyEmbedFindResult
EphyFind::Find (const char *aSearchString,
PRBool aLinksOnly)
@@ -158,6 +214,8 @@ EphyFind::Find (const char *aSearchString,
NS_CSTRING_ENCODING_UTF8, uSearchString);
#ifdef HAVE_TYPEAHEADFIND
+ SetSelectionAttention (PR_TRUE);
+
nsresult rv;
PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
rv = mFinder->Find (uSearchString, aLinksOnly, &found);
@@ -182,6 +240,8 @@ EphyFind::FindAgain (PRBool aForward)
if (!mFinder) return EPHY_EMBED_FIND_NOTFOUND;
#ifdef HAVE_TYPEAHEADFIND
+ SetSelectionAttention (PR_TRUE);
+
nsresult rv;
PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
if (aForward) {
diff --git a/embed/mozilla/EphyFind.h b/embed/mozilla/EphyFind.h
index d5dd8e239..d2a636df8 100644
--- a/embed/mozilla/EphyFind.h
+++ b/embed/mozilla/EphyFind.h
@@ -40,7 +40,7 @@ class EphyFind
nsresult SetEmbed (EphyEmbed *aEmbed);
void SetFindProperties (const char *aSearchString,
PRBool aCaseSensitive);
-
+ void SetSelectionAttention (PRBool aAttention);
EphyEmbedFindResult Find (const char *aSearchString,
PRBool aLinksOnly);
EphyEmbedFindResult FindAgain (PRBool aForward);
@@ -53,6 +53,7 @@ class EphyFind
#ifdef HAVE_TYPEAHEADFIND
nsCOMPtr<nsITypeAheadFind> mFinder;
+ PRBool mAttention;
#else
nsCOMPtr<nsIWebBrowserFind> mFinder;
#endif
diff --git a/embed/mozilla/mozilla-embed-find.cpp b/embed/mozilla/mozilla-embed-find.cpp
index 3026a3934..1c057f577 100644
--- a/embed/mozilla/mozilla-embed-find.cpp
+++ b/embed/mozilla/mozilla-embed-find.cpp
@@ -83,6 +83,16 @@ impl_find_again (EphyEmbedFind *efind,
return priv->find->FindAgain (forward);
}
+static void
+impl_set_selection (EphyEmbedFind *efind,
+ gboolean attention)
+{
+ MozillaEmbedFind *find = MOZILLA_EMBED_FIND (efind);
+ MozillaEmbedFindPrivate *priv = find->priv;
+
+ priv->find->SetSelectionAttention (attention);
+}
+
static gboolean
impl_activate_link (EphyEmbedFind *efind,
GdkModifierType mask)
@@ -100,6 +110,7 @@ ephy_find_iface_init (EphyEmbedFindIface *iface)
iface->set_properties = impl_set_properties;
iface->find = impl_find;
iface->find_again = impl_find_again;
+ iface->set_selection = impl_set_selection;
iface->activate_link = impl_activate_link;
}
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c
index 741e1f908..35b59b24a 100644
--- a/src/ephy-find-toolbar.c
+++ b/src/ephy-find-toolbar.c
@@ -40,8 +40,6 @@
#include <gtk/gtkmain.h>
#include <string.h>
-#undef FIND_WHILE_TYPING_IN_EMBED
-
#define EPHY_FIND_TOOLBAR_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object),EPHY_TYPE_FIND_TOOLBAR, EphyFindToolbarPrivate))
struct _EphyFindToolbarPrivate
@@ -127,10 +125,10 @@ set_status (EphyFindToolbar *toolbar,
text = NULL;
break;
case EPHY_EMBED_FIND_NOTFOUND:
- text = _("Phrase not found");
+ text = _("Not found");
break;
case EPHY_EMBED_FIND_FOUNDWRAPPED:
- text = _("Find wrapped");
+ text = _("Wrapped");
break;
}
@@ -148,6 +146,7 @@ clear_status (EphyFindToolbar *toolbar)
gtk_widget_hide (GTK_WIDGET (priv->sep));
gtk_widget_hide (GTK_WIDGET (priv->status_item));
+ gtk_label_set_text (GTK_LABEL (priv->status_label), "");
}
static void
@@ -160,42 +159,6 @@ tab_content_changed_cb (EphyEmbed *embed,
#ifdef HAVE_TYPEAHEADFIND
-#ifdef FIND_WHILE_TYPING_IN_EMBED
-
-/* Cut and paste from gtkwindow.c */
-static void
-send_focus_change (GtkWidget *widget,
- gboolean in)
-{
- GdkEvent *event;
-
- event = gdk_event_new (GDK_FOCUS_CHANGE);
-
- g_object_ref (widget);
-
- if (in)
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- }
- else
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- }
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = (GdkWindow *) g_object_ref (widget->window);
- event->focus_change.in = in;
-
- gtk_widget_event (widget, event);
-
- g_object_notify (G_OBJECT (widget), "has_focus");
-
- g_object_unref (widget);
- gdk_event_free (event);
-}
-
-#endif /* FIND_WHILE_TYPING_IN_EMBED */
-
/* Code adapted from gtktreeview.c:gtk_tree_view_key_press() and
* gtk_tree_view_real_start_interactive_seach()
*/
@@ -206,12 +169,6 @@ tab_search_key_press_cb (EphyEmbed *embed,
{
EphyFindToolbarPrivate *priv = toolbar->priv;
GtkWidget *widget = (GtkWidget *) toolbar;
-#ifdef FIND_WHILE_TYPING_IN_EMBED
- GtkEntry *entry = (GtkEntry *) priv->entry;
- GdkWindow *event_window;
- gboolean retval = FALSE;
- guint oldhash, newhash;
-#endif
g_return_val_if_fail (event != NULL, FALSE);
@@ -234,58 +191,8 @@ tab_search_key_press_cb (EphyEmbed *embed,
}
return FALSE;
-
-#ifdef FIND_WHILE_TYPING_IN_EMBED
- /* don't do anything if the find toolbar is hidden */
- if (GTK_WIDGET_VISIBLE (widget) == FALSE ||
- event->keyval == GDK_Return ||
- event->keyval == GDK_KP_Enter ||
- event->keyval == GDK_ISO_Enter)
- {
- return FALSE;
- }
-
- oldhash = g_str_hash (gtk_entry_get_text (entry));
-
- event_window = event->window;
- event->window = priv->entry->window;
-
- /* Send the event to the window. If the preedit_changed signal is emitted
- * during this event, we will set priv->imcontext_changed */
- priv->preedit_changed = priv->activated = FALSE;
- priv->prevent_activate = TRUE;
- retval = gtk_widget_event (priv->entry, (GdkEvent*) event);
- priv->prevent_activate = FALSE;
-
- /* restore event window, else gdk_event_free below will crash */
- event->window = event_window;
-
- newhash = g_str_hash (gtk_entry_get_text (entry));
-
- /* FIXME: is this correct? */
- return retval && (oldhash != newhash || priv->preedit_changed) && !priv->activated;
-#endif /* FIND_WHILE_TYPING_IN_EMBED */
-}
-
-#ifdef FIND_WHILE_TYPING_IN_EMBED
-
-static gboolean
-tab_dom_mouse_click_cb (EphyEmbed *embed,
- gpointer event,
- EphyFindToolbar *toolbar)
-{
- EphyFindToolbarPrivate *priv = toolbar->priv;
-
- if (!priv->explicit_focus)
- {
- ephy_find_toolbar_close (toolbar);
- }
-
- return FALSE;
}
-#endif /* FIND_WHILE_TYPING_IN_EMBED */
-
#endif /* HAVE_TYPEAHEADFIND */
static void
@@ -329,15 +236,6 @@ entry_changed_cb (GtkEntry *entry,
set_controls (toolbar, found, found);
}
-#ifdef FIND_WHILE_TYPING_IN_EMBED
-static void
-entry_preedit_changed_cb (GtkIMContext *context,
- EphyFindToolbar *toolbar)
-{
- toolbar->priv->preedit_changed = TRUE;
-}
-#endif
-
static gboolean
entry_key_press_event_cb (GtkEntry *entry,
GdkEventKey *event,
@@ -349,7 +247,7 @@ entry_key_press_event_cb (GtkEntry *entry,
/* Hide the toolbar when ESC is pressed */
if ((event->state & mask) == 0 && event->keyval == GDK_Escape)
{
- g_signal_emit (toolbar, signals[CLOSE], 0);
+ ephy_find_toolbar_request_close (toolbar);
handled = TRUE;
}
else if ((event->state & mask) == GDK_CONTROL_MASK &&
@@ -367,11 +265,6 @@ entry_activate_cb (GtkWidget *entry,
{
EphyFindToolbarPrivate *priv = toolbar->priv;
-#ifdef FIND_WHILE_TYPING_IN_EMBED
- priv->activated = TRUE;
- if (priv->prevent_activate) return;
-#endif
-
if (priv->typing_ahead)
{
ephy_embed_find_activate_link (get_find (toolbar), 0);
@@ -402,18 +295,7 @@ set_focus_cb (EphyWindow *window,
}
else if (priv->explicit_focus)
{
- g_signal_emit (toolbar, signals[CLOSE], 0);
- }
-}
-
-static void
-sync_print_preview_mode (EphyWindow *window,
- GParamSpec *pspec,
- EphyFindToolbar *toolbar)
-{
- if (ephy_window_get_is_print_preview (window) && GTK_WIDGET_VISIBLE (GTK_WIDGET (toolbar)))
- {
- ephy_find_toolbar_close (toolbar);
+ ephy_find_toolbar_request_close (toolbar);
}
}
@@ -424,10 +306,6 @@ ephy_find_toolbar_set_window (EphyFindToolbar *toolbar,
EphyFindToolbarPrivate *priv = toolbar->priv;
priv->window = window;
-
- sync_print_preview_mode (window, NULL, toolbar);
- g_signal_connect (window, "notify::print-preview-mode",
- G_CALLBACK (sync_print_preview_mode), toolbar);
}
static void
@@ -531,10 +409,6 @@ ephy_find_toolbar_init (EphyFindToolbar *toolbar)
G_CALLBACK (entry_key_press_event_cb), toolbar);
g_signal_connect_after (priv->entry, "changed",
G_CALLBACK (entry_changed_cb), toolbar);
-#ifdef FIND_WHILE_TYPING_IN_EMBED
- g_signal_connect (GTK_ENTRY (priv->entry)->im_context, "preedit-changed",
- G_CALLBACK (entry_preedit_changed_cb), toolbar);
-#endif
g_signal_connect (priv->entry, "activate",
G_CALLBACK (entry_activate_cb), toolbar);
g_signal_connect_swapped (priv->next, "clicked",
@@ -600,7 +474,6 @@ ephy_find_toolbar_class_init (EphyFindToolbarClass *klass)
klass->next = ephy_find_toolbar_find_next;
klass->previous = ephy_find_toolbar_find_previous;
- klass->close = ephy_find_toolbar_close;
signals[NEXT] =
g_signal_new ("next",
@@ -705,6 +578,8 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar,
if (embed != NULL)
{
set_controls (toolbar, TRUE, TRUE);
+ clear_status (toolbar);
+
g_signal_connect_object (embed, "ge-content-change",
G_CALLBACK (tab_content_changed_cb),
toolbar, G_CONNECT_AFTER);
@@ -712,11 +587,6 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar,
g_signal_connect_object (embed, "ge-search-key-press",
G_CALLBACK (tab_search_key_press_cb),
toolbar, 0);
-#ifdef FIND_WHILE_TYPING_IN_EMBED
- g_signal_connect_object (embed, "dom-mouse-click",
- G_CALLBACK (tab_dom_mouse_click_cb),
- toolbar, 0);
-#endif /* FIND_WHILE_TYPING_IN_EMBED */
#endif /* HAVE_TYPEAHEADFIND */
if (priv->find != NULL)
@@ -780,19 +650,7 @@ ephy_find_toolbar_open (EphyFindToolbar *toolbar,
gtk_widget_show (GTK_WIDGET (toolbar));
-#if defined(HAVE_TYPEAHEADFIND) && defined(FIND_WHILE_TYPING_IN_EMBED)
- gtk_widget_grab_focus (GTK_WIDGET (priv->embed));
-
- send_focus_change (priv->entry, TRUE);
-
- if (strlen(gtk_entry_get_text (GTK_ENTRY (priv->entry))) != 0)
- {
- entry_changed_cb (GTK_ENTRY (priv->entry), toolbar);
- }
-#else
gtk_widget_grab_focus (GTK_WIDGET (toolbar));
-#endif
-
}
void
@@ -800,13 +658,17 @@ ephy_find_toolbar_close (EphyFindToolbar *toolbar)
{
EphyFindToolbarPrivate *priv = toolbar->priv;
- g_return_if_fail (priv->embed != NULL);
-
- gtk_widget_hide (GTK_WIDGET (toolbar));
-
/* first unset explicit_focus, else we get infinite recursion */
priv->explicit_focus = FALSE;
-#ifndef FIND_WHILE_TYPING_IN_EMBED
- gtk_widget_grab_focus (GTK_WIDGET (priv->embed));
-#endif
+
+ gtk_widget_hide (GTK_WIDGET (toolbar));
+
+ if (priv->embed == NULL) return;
+ ephy_embed_find_set_selection (get_find (toolbar), FALSE);
+}
+
+void
+ephy_find_toolbar_request_close (EphyFindToolbar *toolbar)
+{
+ g_signal_emit (toolbar, signals[CLOSE], 0);
}
diff --git a/src/ephy-find-toolbar.h b/src/ephy-find-toolbar.h
index 10d11859e..b6b2aa248 100644
--- a/src/ephy-find-toolbar.h
+++ b/src/ephy-find-toolbar.h
@@ -76,6 +76,8 @@ void ephy_find_toolbar_open (EphyFindToolbar *toolbar,
void ephy_find_toolbar_close (EphyFindToolbar *toolbar);
+void ephy_find_toolbar_request_close (EphyFindToolbar *toolbar);
+
G_END_DECLS
#endif /* EPHY_FIND_TOOLBAR_H */
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0ca6088df..6f64ff023 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1343,7 +1343,7 @@ sync_tab_document_type (EphyTab *tab,
if (!can_find)
{
- ephy_find_toolbar_close (priv->find_toolbar);
+ ephy_find_toolbar_request_close (priv->find_toolbar);
}
}
@@ -2951,7 +2951,17 @@ static void
find_toolbar_close_cb (EphyFindToolbar *toolbar,
EphyWindow *window)
{
- gtk_widget_hide (GTK_WIDGET (toolbar));
+ EphyWindowPrivate *priv = window->priv;
+ EphyTab *tab;
+
+ if (priv->closing) return;
+
+ ephy_find_toolbar_close (priv->find_toolbar);
+
+ tab = ephy_window_get_active_tab (window);
+ if (tab == NULL) return;
+
+ gtk_widget_grab_focus (GTK_WIDGET (tab));
}
static void
@@ -3205,6 +3215,8 @@ ephy_window_set_print_preview (EphyWindow *window,
{
g_return_if_fail (priv->ppview_toolbar == NULL);
+ ephy_find_toolbar_request_close (priv->find_toolbar);
+
priv->ppview_toolbar = ppview_toolbar_new (window);
gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group);
}
@@ -3279,9 +3291,9 @@ ephy_window_get_notebook (EphyWindow *window)
GtkWidget *
ephy_window_get_find_toolbar (EphyWindow *window)
{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
- return GTK_WIDGET (window->priv->find_toolbar);
+ return GTK_WIDGET (window->priv->find_toolbar);
}
/**
@@ -3689,4 +3701,3 @@ ephy_window_get_context_event (EphyWindow *window)
return window->priv->context_event;
}
-