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 709459 - Need UI for configuring search engine
Need UI for configuring search engine
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Preferences
3.10.x (obsolete)
Other Linux
: Normal enhancement
: ---
Assigned To: Michael Catanzaro
Epiphany Maintainers
polish
Depends on:
Blocks:
 
 
Reported: 2013-10-05 02:01 UTC by Michael Catanzaro
Modified: 2013-12-22 16:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a preference for setting the search engine (12.23 KB, patch)
2013-12-16 22:45 UTC, Michael Catanzaro
none Details | Review
Add a preference for setting the search engine (12.37 KB, patch)
2013-12-16 22:52 UTC, Michael Catanzaro
none Details | Review
screenshot (46.91 KB, image/png)
2013-12-16 23:23 UTC, William Jon McCann
  Details
Add a preference for setting the search engine (13.04 KB, patch)
2013-12-17 02:23 UTC, Michael Catanzaro
reviewed Details | Review
Mark keyword-search-url default for translation (2.15 KB, patch)
2013-12-17 02:24 UTC, Michael Catanzaro
none Details | Review
Mark keyword-search-url default for translation (2.17 KB, patch)
2013-12-17 02:39 UTC, Michael Catanzaro
committed Details | Review
Add a preference for setting the search engine (13.80 KB, patch)
2013-12-17 19:10 UTC, Michael Catanzaro
none Details | Review
Add a preference for setting the search engine (13.89 KB, patch)
2013-12-17 19:28 UTC, Michael Catanzaro
reviewed Details | Review
Add a preference for setting the search engine (13.80 KB, patch)
2013-12-19 21:42 UTC, Michael Catanzaro
none Details | Review
Forgot to add DEFAULT_SMART_BOOKMARK_TEXT macro (14.45 KB, patch)
2013-12-20 00:25 UTC, Michael Catanzaro
none Details | Review
Add a preference for setting the search engine (14.45 KB, patch)
2013-12-20 00:29 UTC, Michael Catanzaro
committed Details | Review

Description Michael Catanzaro 2013-10-05 02:01:59 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/
Comment 1 Claudio Saavedra 2013-10-05 09:45:15 UTC
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.
Comment 2 Reinout van Schouwen 2013-10-05 10:37:30 UTC
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?
Comment 3 Claudio Saavedra 2013-10-08 08:01:55 UTC
Technically it might be possible, but no, I don't think an extension is the way to go.
Comment 4 William Jon McCann 2013-12-12 20:43:49 UTC
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.
Comment 5 Michael Catanzaro 2013-12-13 02:45:48 UTC
I'll take a stab at it this weekend.
Comment 6 Michael Catanzaro 2013-12-16 22:45:17 UTC
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.
Comment 7 Michael Catanzaro 2013-12-16 22:52:37 UTC
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.
Comment 8 William Jon McCann 2013-12-16 23:23:05 UTC
Created attachment 264375 [details]
screenshot

Works great here. Except for one spurious item in the dropdown - the one that looks like a URL.
Comment 9 Michael Catanzaro 2013-12-16 23:59:23 UTC
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.
Comment 10 Michael Catanzaro 2013-12-17 02:23:52 UTC
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.
Comment 11 Michael Catanzaro 2013-12-17 02:24:25 UTC
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.
Comment 12 Michael Catanzaro 2013-12-17 02:39:48 UTC
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.
Comment 13 William Jon McCann 2013-12-17 14:56:30 UTC
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.
Comment 14 William Jon McCann 2013-12-17 14:58:35 UTC
Review of attachment 264381 [details] [review]:

LGTM
Comment 15 Michael Catanzaro 2013-12-17 19:10:50 UTC
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.
Comment 16 Michael Catanzaro 2013-12-17 19:17:00 UTC
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).
Comment 17 Michael Catanzaro 2013-12-17 19:28:00 UTC
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.
Comment 18 Claudio Saavedra 2013-12-18 15:12:22 UTC
Review of attachment 264381 [details] [review]:

Good to go.
Comment 19 Claudio Saavedra 2013-12-18 15:40:07 UTC
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?
Comment 20 Michael Catanzaro 2013-12-19 19:02:43 UTC
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.)
Comment 21 William Jon McCann 2013-12-19 19:26:08 UTC
(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...
Comment 22 Michael Catanzaro 2013-12-19 21:42:02 UTC
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()
Comment 23 Michael Catanzaro 2013-12-20 00:25:26 UTC
Created attachment 264598 [details] [review]
Forgot to add DEFAULT_SMART_BOOKMARK_TEXT macro
Comment 24 Michael Catanzaro 2013-12-20 00:29:00 UTC
Created attachment 264599 [details] [review]
Add a preference for setting the search engine

Another fixup....
Comment 25 Claudio Saavedra 2013-12-20 09:27:41 UTC
Review of attachment 264599 [details] [review]:

Looks good.
Comment 26 Michael Catanzaro 2013-12-22 16:03:25 UTC
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
Comment 27 Michael Catanzaro 2013-12-22 16:08:06 UTC
(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