GNOME Bugzilla – Bug 709459
Need UI for configuring search engine
Last modified: 2013-12-22 16:08:06 UTC
We're getting some complaints from people who want to change their search engine back to Google. [1] Currently there is no UI for this. Honestly, though I try to use DDG whenever I can, it's hard to contest that Google's results are significantly better. I really think we want this in the Preferences dialog somewhere. I don't think we want to expose the user to search URLs; maybe it could be a simple combo box with options DDG, Google, and Bing. [1] http://worldofgnome.org/howto-change-search-provider-in-gnome-web-3-10/
I don't have a strong opinion on whether we should expose this to the user, but just for reference, if you *want* to use DDG but occasionally search in google, you just need to add !g to your search query.
Just thinking out loud: would it perhaps be possible to put an extension on extensions.gnome.org that changes the gsettings key for the default search URL?
Technically it might be possible, but no, I don't think an extension is the way to go.
Sounds like a great idea to me. Probably in the General Tab under a Search heading. Michael, want to have a go at it? If not I can.
I'll take a stab at it this weekend.
Created attachment 264371 [details] [review] Add a preference for setting the search engine This combo box allows the user to select from: * DuckDuckGo, Google, and Bing, always. * Any smart bookmarks the user may have added. * The current value of the gsetting, if the user has manually edited it. An improvement would be to provide a better UI for the creation of smart bookmarks in the preferences dialog.
Created attachment 264372 [details] [review] Add a preference for setting the search engine This combo box allows the user to select from: * DuckDuckGo, Google, and Bing, always. * Any smart bookmarks the user may have added. * The current value of the gsetting, if the user has manually edited it. An improvement would be to provide a better UI for the creation of smart bookmarks in the preferences dialog.
Created attachment 264375 [details] screenshot Works great here. Except for one spurious item in the dropdown - the one that looks like a URL.
Hm... you'll probably only see that the first time you visit the preferences dialog. Will try to fix that. I see you also have a spurious "Search the Web" entry - that's a smart bookmark that's installed by default, which I deleted long ago on my machine. I'll filter that out manually.
Created attachment 264379 [details] [review] Add a preference for setting the search engine This combo box allows the user to select from: * DuckDuckGo, Google, and Bing, always. * Any smart bookmarks the user may have added. * The current value of the gsetting, if the user has manually edited it. An improvement would be to provide a better UI for the creation of smart bookmarks in the preferences dialog.
Created attachment 264380 [details] [review] Mark keyword-search-url default for translation We allow region parameters in the default "Search the web" smart bookmark, which probably nobody ever uses, so why not in the default search engine that people actually DO use? Also needed because the DDG URL in the preferences dialog will be translatable, and this must match it to avoid being detected as a custom bookmark.
Created attachment 264381 [details] [review] Mark keyword-search-url default for translation Just fixing the commit message on this one: to avoid being detected as a separate, custom search engine.
Review of attachment 264379 [details] [review]: Looking very good! A few small comments. ::: src/prefs-dialog.c @@ +1065,3 @@ + * the search engine combo in the preferences dialog. */ + if (strcmp (bookmark_name, _("Search the web")) == 0) + continue; Any chance the title can be null? @@ +1097,3 @@ + + if (strcmp (original_url, url) == 0) + in_combo = TRUE; Can the original ever be null? @@ +1119,3 @@ + + store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING); + Could probably create this in the builder file but is fine here too. ::: src/resources/prefs-dialog.ui @@ +191,3 @@ </child> <child> + <object class="GtkVBox" id="vbox6"> GtkVBox is deprecated I think. Better to use a box with an orientation property. Ditto for HBox below.
Review of attachment 264381 [details] [review]: LGTM
Created attachment 264430 [details] [review] Add a preference for setting the search engine This combo box allows the user to select from: * DuckDuckGo, Google, and Bing, always. * Any smart bookmarks the user may have added. * The current value of the gsetting, if the user has manually edited it. An improvement would be to provide a better UI for the creation of smart bookmarks in the preferences dialog.
Thanks (In reply to comment #13) > Any chance the title can be null? > Can the original ever be null? I don't believe they currently can be, but I added checks regardless. (Forgot to actually add one of these in the patch above, so new one incoming....) > @@ +1119,3 @@ > + > + store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING); > + > > Could probably create this in the builder file but is fine here too. I moved it to the builder. > ::: src/resources/prefs-dialog.ui > @@ +191,3 @@ > </child> > <child> > + <object class="GtkVBox" id="vbox6"> > > GtkVBox is deprecated I think. Better to use a box with an orientation > property. Ditto for HBox below. Changed to not add any new GtkVBoxes or GtkHBoxes (but the dialog has many others).
Created attachment 264434 [details] [review] Add a preference for setting the search engine This combo box allows the user to select from: * DuckDuckGo, Google, and Bing, always. * Any smart bookmarks the user may have added. * The current value of the gsetting, if the user has manually edited it. An improvement would be to provide a better UI for the creation of smart bookmarks in the preferences dialog.
Review of attachment 264381 [details] [review]: Good to go.
Review of attachment 264434 [details] [review]: Looks good, only a few comments. ::: src/prefs-dialog.c @@ +1024,3 @@ + { N_("Bing"), + /* For the preferences dialog. Consider a regional variant, like uk.bing.com */ + N_("http://www.bing.com/search?q=%s")} }; I think, since we are here, we should add popular search engines in certain regions, too. Like Yandex in Rusia and Baidu in China? @@ +1067,3 @@ + /* Name of a default smart bookmark, to NOT be displayed in + * the search engine combo in the preferences dialog. */ + if (strcmp (bookmark_name, _("Search the web")) == 0) Perhaps it is time to make this a macro, something like DEFAULT_SMART_BOOKMARK_TEXT in ephy-bookmarks.h ? @@ +1100,3 @@ + + gtk_tree_model_get_value (GTK_TREE_MODEL (store), &iter, + SEARCH_ENGINE_COL_URL, &value); Why do we need to use a GValue for this? @@ +1148,3 @@ + combo_set_mapping, + combo, + NULL); If I get this right, this means that when the user changes whatever custom value he has added, this will be replaced with no possibility to undo it. I suspect most people wouldn't do that, though. ::: src/resources/prefs-dialog.ui @@ +20,3 @@ + <column type="gchararray"/> + <!-- column-name url --> + <column type="gchararray"/> How about we add favicons too?
Thanks. > I think, since we are here, we should add popular search engines in certain > regions, too. Like Yandex in Rusia and Baidu in China? Do you want those two added to the hardcoded list? Alternatively, we could somehow give translators full control of the list of options, but I'm not sure how that would be done. > @@ +1067,3 @@ > + /* Name of a default smart bookmark, to NOT be displayed in > + * the search engine combo in the preferences dialog. */ > + if (strcmp (bookmark_name, _("Search the web")) == 0) > > Perhaps it is time to make this a macro, something like > DEFAULT_SMART_BOOKMARK_TEXT in ephy-bookmarks.h ? Sounds good, though note this would be the only use of that macro (the only other use is in default-bookmarks.rdf.in). > @@ +1100,3 @@ > + > + gtk_tree_model_get_value (GTK_TREE_MODEL (store), &iter, > + SEARCH_ENGINE_COL_URL, &value); > > Why do we need to use a GValue for this? Because I don't know how to use GTK+. I guess I should instead use gtk_tree_model_get_string_from_iter(). > If I get this right, this means that when the user changes whatever custom > value he has added, this will be replaced with no possibility to undo it. I > suspect most people wouldn't do that, though. Yes; this is the best fallback I was able to think of. We probably don't want to store the old value and keep it forever (where would we store it?), since the URL in the combo box is not exactly pretty. I figure a user advanced enough to manually modify a gsetting won't be too confused by this, and can always change it back the same way he did before. Some people will have already tweaked this setting since it's the only way to change the search engine; others might do this because the smart bookmark feature is not discoverable, nor is the fact that I add the smart bookmarks to the combo. It'd be good to have better UI for this (but I'm not volunteering to work on that). > How about we add favicons too? That's the plan; if I can figure it out, I'll send in another patch in a few days. (I presume we want this even without favicons.)
(In reply to comment #20) > Thanks. > > > I think, since we are here, we should add popular search engines in certain > > regions, too. Like Yandex in Rusia and Baidu in China? > > Do you want those two added to the hardcoded list? Alternatively, we could > somehow give translators full control of the list of options, but I'm not sure > how that would be done. Hmm, I don't really like the idea of adding those by default. They won't be useful at all for me will they? We'd need to indicate that to the user somehow. I think we should punt this part and open a new bug for figuring out the best way to handle locale specific engines. > > @@ +1100,3 @@ > > + > > + gtk_tree_model_get_value (GTK_TREE_MODEL (store), &iter, > > + SEARCH_ENGINE_COL_URL, &value); > > > > Why do we need to use a GValue for this? > > Because I don't know how to use GTK+. I guess I should instead use > gtk_tree_model_get_string_from_iter(). Typically use gtk_tree_model_get(). > > > How about we add favicons too? > > That's the plan; if I can figure it out, I'll send in another patch in a few > days. (I presume we want this even without favicons.) I can help with this too. I'd really like to get the basic feature in to the release asap. I'm fine with adding icons later... especially since we're probably going to have to ask permission to include them...
Created attachment 264575 [details] [review] Add a preference for setting the search engine Uses gtk_tree_model_get() instead of gtk_tree_model_get_value()
Created attachment 264598 [details] [review] Forgot to add DEFAULT_SMART_BOOKMARK_TEXT macro
Created attachment 264599 [details] [review] Add a preference for setting the search engine Another fixup....
Review of attachment 264599 [details] [review]: Looks good.
Attachment 264381 [details] pushed as c986763 - Mark keyword-search-url default for translation Attachment 264599 [details] pushed as 438e566 - Add a preference for setting the search engine
(In reply to comment #21) > Hmm, I don't really like the idea of adding those by default. They won't be > useful at all for me will they? We'd need to indicate that to the user somehow. > I think we should punt this part and open a new bug for figuring out the best > way to handle locale specific engines. Bug #720936 > I can help with this too. I'd really like to get the basic feature in to the > release asap. I'm fine with adding icons later... especially since we're > probably going to have to ask permission to include them... Bug #720935