After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668978 - Add timeout to search entry.
Add timeout to search entry.
Status: RESOLVED FIXED
Product: devhelp
Classification: Applications
Component: General
3.2.x
Other Linux
: Normal enhancement
: ---
Assigned To: devhelp-maint
devhelp-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-30 00:23 UTC by huzheng001@gmail.com
Modified: 2018-01-04 21:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description huzheng001@gmail.com 2012-01-30 00:23:09 UTC
When input a string in search entry, devhelp will search every time when you input and add a character, even when you input it fast, this is not very convenient. The normal way should be only search after you input over the whole string. Add a timeout to the search entry can solve this problem.

Some example code:
=====
gboolean on_word_change_timeout(gpointer data)
{
    // Do real search.
}

on_entry_changed()
{
    if (word_change_timeout_id) {
        // stop word change timer
        g_source_remove(word_change_timeout_id);
        word_change_timeout_id = 0;
    }
    int word_change_timeout = conf->get_int_at("main_window/word_change_timeout"); // Default 300.
    if(word_change_timeout > 0) {
        word_change_timeout_id = g_timeout_add(word_change_timeout, on_word_change_timeout, NULL);
    } else {
        //Allow word_change_timeout to be 0, so do an immediate search.
        on_word_change_timeout(NULL);
    }
}
=====

A configure in preferences dialog on word_change_timeout would be nice!
StarDict has this feature!

Thanks!
Comment 1 huzheng001@gmail.com 2012-02-13 09:48:19 UTC
Do this to add a clear icon is recommended too!

gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
Comment 2 Sébastien Wilmet 2017-06-29 10:51:35 UTC
GtkSearchEntry is now used, so for the timeout it would be a better idea to use the GtkSearchEntry::search-changed signal.
Comment 3 Sébastien Wilmet 2018-01-04 21:49:37 UTC
Done with commit f4186c4581f9ea552e0eed3e17040f6b4ebf4ef0.