Replace FindQuick with direct '.' and '/' search hotkey support
Using an action for a single character turned out to be a bad idea and rather than trying to work around it, we implement '/' and '.' hotkeys directly in the view.
This commit is contained in:
parent
c106e52fca
commit
1b094dda75
2 changed files with 7 additions and 17 deletions
|
@ -273,8 +273,6 @@ _midori_browser_update_interface (MidoriBrowser* browser)
|
||||||
midori_view_can_find (MIDORI_VIEW (view)));
|
midori_view_can_find (MIDORI_VIEW (view)));
|
||||||
_action_set_sensitive (browser, "FindPrevious",
|
_action_set_sensitive (browser, "FindPrevious",
|
||||||
midori_view_can_find (MIDORI_VIEW (view)));
|
midori_view_can_find (MIDORI_VIEW (view)));
|
||||||
_action_set_sensitive (browser, "FindQuick",
|
|
||||||
midori_view_can_find (MIDORI_VIEW (view)));
|
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (browser->find_highlight),
|
gtk_widget_set_sensitive (GTK_WIDGET (browser->find_highlight),
|
||||||
midori_view_can_find (MIDORI_VIEW (view)));
|
midori_view_can_find (MIDORI_VIEW (view)));
|
||||||
|
|
||||||
|
@ -2164,15 +2162,6 @@ _action_find_previous_activate (GtkAction* action,
|
||||||
_midori_browser_find (browser, FALSE);
|
_midori_browser_find (browser, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_action_find_quick_activate (GtkAction* action,
|
|
||||||
MidoriBrowser* browser)
|
|
||||||
{
|
|
||||||
GtkWidget* view = midori_browser_get_current_tab (browser);
|
|
||||||
if (view)
|
|
||||||
g_signal_emit_by_name (view, "search-text", TRUE, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_find_highlight_toggled (GtkToggleToolButton* toolitem,
|
_find_highlight_toggled (GtkToggleToolButton* toolitem,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
|
@ -3926,9 +3915,6 @@ static const GtkActionEntry entries[] = {
|
||||||
N_("Find _Previous"), "<Ctrl><Shift>g",
|
N_("Find _Previous"), "<Ctrl><Shift>g",
|
||||||
N_("Find the previous occurrence of a word or phrase"),
|
N_("Find the previous occurrence of a word or phrase"),
|
||||||
G_CALLBACK (_action_find_previous_activate) },
|
G_CALLBACK (_action_find_previous_activate) },
|
||||||
{ "FindQuick", GTK_STOCK_FIND,
|
|
||||||
N_("_Quick Find"), "period",
|
|
||||||
N_("Quickly jump to a word or phrase"), G_CALLBACK (_action_find_quick_activate) },
|
|
||||||
{ "Preferences", GTK_STOCK_PREFERENCES,
|
{ "Preferences", GTK_STOCK_PREFERENCES,
|
||||||
NULL, "<Ctrl><Alt>p",
|
NULL, "<Ctrl><Alt>p",
|
||||||
N_("Configure the application preferences"), G_CALLBACK (_action_preferences_activate) },
|
N_("Configure the application preferences"), G_CALLBACK (_action_preferences_activate) },
|
||||||
|
@ -4190,7 +4176,6 @@ static const gchar* ui_markup =
|
||||||
"<separator/>"
|
"<separator/>"
|
||||||
"<menuitem action='Find'/>"
|
"<menuitem action='Find'/>"
|
||||||
"<menuitem action='FindNext'/>"
|
"<menuitem action='FindNext'/>"
|
||||||
"<menuitem action='FindQuick'/>"
|
|
||||||
"<separator/>"
|
"<separator/>"
|
||||||
"<menuitem action='Preferences'/>"
|
"<menuitem action='Preferences'/>"
|
||||||
"</menu>"
|
"</menu>"
|
||||||
|
|
|
@ -1009,10 +1009,15 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
|
||||||
if (character == (event->keyval | 0x01000000))
|
if (character == (event->keyval | 0x01000000))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (view->find_while_typing && !webkit_web_view_can_cut_clipboard (web_view)
|
if (character == '.' || character == '/')
|
||||||
|
character = '\0';
|
||||||
|
else if (!view->find_while_typing)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!webkit_web_view_can_cut_clipboard (web_view)
|
||||||
&& !webkit_web_view_can_paste_clipboard (web_view))
|
&& !webkit_web_view_can_paste_clipboard (web_view))
|
||||||
{
|
{
|
||||||
gchar* text = g_strdup_printf ("%c", character);
|
gchar* text = character ? g_strdup_printf ("%c", character) : g_strdup ("");
|
||||||
|
|
||||||
g_signal_emit (view, signals[SEARCH_TEXT], 0, TRUE, text);
|
g_signal_emit (view, signals[SEARCH_TEXT], 0, TRUE, text);
|
||||||
g_free (text);
|
g_free (text);
|
||||||
|
|
Loading…
Reference in a new issue