Add a Preference to disable automatic inline find while typing

This commit is contained in:
Christian Dywan 2009-03-01 19:21:27 +01:00
parent 047f086a53
commit 73feaf9ae1
3 changed files with 33 additions and 1 deletions

View file

@ -506,6 +506,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
SPANNED_ADD (button, 1, 2, 3, 4);
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
SPANNED_ADD (button, 0, 1, 4, 5);
button = katze_property_proxy (settings, "find-while-typing", NULL);
SPANNED_ADD (button, 1, 2, 4, 5);
label = katze_property_label (settings, "location-entry-search");
INDENTED_ADD (label, 0, 1, 5, 6);
entry = katze_property_proxy (settings, "location-entry-search", NULL);

View file

@ -67,6 +67,7 @@ struct _MidoriView
gboolean open_tabs_in_the_background;
gboolean close_buttons_on_tabs;
MidoriNewPage open_new_pages_in;
gboolean find_while_typing;
GtkWidget* menu_item;
GtkWidget* tab_label;
@ -817,7 +818,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
if (character == (event->keyval | 0x01000000))
return FALSE;
if (!webkit_web_view_can_cut_clipboard (web_view)
if (view->find_while_typing && !webkit_web_view_can_cut_clipboard (web_view)
&& !webkit_web_view_can_paste_clipboard (web_view))
{
gchar* text = g_strdup_printf ("%c", character);
@ -1365,6 +1366,7 @@ _midori_view_update_settings (MidoriView* view)
"open-new-pages-in", &view->open_new_pages_in,
"middle-click-opens-selection", &view->middle_click_opens_selection,
"open-tabs-in-the-background", &view->open_tabs_in_the_background,
"find-while-typing", &view->find_while_typing,
NULL);
if (view->web_view)
@ -1412,6 +1414,10 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
{
view->open_tabs_in_the_background = g_value_get_boolean (&value);
}
else if (name == g_intern_string ("find-while-typing"))
{
view->find_while_typing = g_value_get_boolean (&value);
}
g_value_unset (&value);
}

View file

@ -63,6 +63,7 @@ struct _MidoriWebSettings
gboolean open_popups_in_tabs;
gboolean zoom_text_and_images;
gboolean find_while_typing;
MidoriAcceptCookies accept_cookies;
gboolean original_cookies_only;
gint maximum_cookie_age;
@ -131,6 +132,7 @@ enum
PROP_ENFORCE_96_DPI,
PROP_ENABLE_DEVELOPER_EXTRAS,
PROP_ZOOM_TEXT_AND_IMAGES,
PROP_FIND_WHILE_TYPING,
PROP_ACCEPT_COOKIES,
PROP_ORIGINAL_COOKIES_ONLY,
PROP_MAXIMUM_COOKIE_AGE,
@ -698,6 +700,22 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"full-content-zoom") ? G_PARAM_READWRITE : G_PARAM_READABLE)
| G_PARAM_STATIC_STRINGS));
/**
* MidoriWebSettings:find-while-typing:
*
* Whether to automatically find inline while typing something.
*
* Since: 0.1.4
*/
g_object_class_install_property (gobject_class,
PROP_FIND_WHILE_TYPING,
g_param_spec_boolean (
"find-while-typing",
_("Find inline while typing"),
_("Whether to automatically find inline while typing"),
TRUE,
flags));
g_object_class_install_property (gobject_class,
PROP_ACCEPT_COOKIES,
g_param_spec_enum (
@ -1104,6 +1122,9 @@ midori_web_settings_set_property (GObject* object,
case PROP_ZOOM_TEXT_AND_IMAGES:
web_settings->zoom_text_and_images = g_value_get_boolean (value);
break;
case PROP_FIND_WHILE_TYPING:
web_settings->find_while_typing = g_value_get_boolean (value);
break;
case PROP_ACCEPT_COOKIES:
web_settings->accept_cookies = g_value_get_enum (value);
break;
@ -1277,6 +1298,9 @@ midori_web_settings_get_property (GObject* object,
case PROP_ZOOM_TEXT_AND_IMAGES:
g_value_set_boolean (value, web_settings->zoom_text_and_images);
break;
case PROP_FIND_WHILE_TYPING:
g_value_set_boolean (value, web_settings->find_while_typing);
break;
case PROP_ACCEPT_COOKIES:
g_value_set_enum (value, web_settings->accept_cookies);
break;