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 144969 - mdns/dns-sd support
mdns/dns-sd support
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Interface
unspecified
Other Linux
: Normal enhancement
: 1.8
Assigned To: Epiphany Maintainers
Marco Pesenti Gritti
: 152245 (view as bug list)
Depends on: 310292
Blocks:
 
 
Reported: 2004-06-25 09:31 UTC by Marco Pesenti Gritti
Modified: 2005-07-24 13:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-add-local-menu.patch (7.86 KB, patch)
2005-04-03 15:54 UTC, Bastien Nocera
none Details | Review
ephy-add-local-menu-3.patch (13.41 KB, patch)
2005-04-03 16:49 UTC, Bastien Nocera
none Details | Review
ephy-add-local-menu-4.patch (12.31 KB, patch)
2005-04-03 17:03 UTC, Bastien Nocera
needs-work Details | Review
ephy-add-local-menu-5.patch (9.03 KB, patch)
2005-07-06 16:10 UTC, Bastien Nocera
committed Details | Review

Description Marco Pesenti Gritti 2004-06-25 09:31:45 UTC
Comment from Alex on possible user interface:

Yeah. Something like that, or perhaps a services menu with the browsedservices
in it. The list of mDNS services is dynamic, so perhaps a menuworks better than
a webpage.
Safari currently has a "Rendezvous" bookmark "source" which shows allthe locally
(link-local that is) availible web servers, so that you caneasily browse peoples
webservers on ad-hoc networks without having totype in the ip addresses or
anything like that.
We should be able to do that, and we should also support site-widedns-sd
configurations, so that you can easilly access a list ofimportant web services
for the domain you're currently in. For instance,a redhat box called
"foo.devel.redhat.com" would automatically browsethe domains listed in the
devel.redhat.com domain and show things like: intranet, bugzilla, internal web
apps, etc.
Comment 1 Bastien Nocera 2004-09-09 15:01:53 UTC
*** Bug 152245 has been marked as a duplicate of this bug. ***
Comment 2 Bastien Nocera 2004-09-09 17:35:52 UTC
It should be possible to implement this as an epiphany-extensions.
Unfortunately, the extensions API isn't very clear. It should be easy to
implement this if examples were provided for:
- toolbar sub-menus
- a way to override the URL bar (you wouldn't want to bookmark the actual
resolution of a service name)
Comment 3 Bastien Nocera 2004-10-05 14:33:57 UTC
Marco said that this could be added to the core, rather than as an extension.
Comment 4 Christian Persch 2004-10-13 10:51:05 UTC
Mass reassigning of Epiphany bugs to epiphany-maint@b.g.o
Comment 5 pah06 2004-11-12 11:35:00 UTC
'Rendezvous' might be able to be added as a special topic (like the 'Most
Visited' topic) in the current bookmarks system. This would have to be
implemented within the core though, and not as an extension. How exactly do we
get the list of local URLs?

A longer term goal would be to allow for multiple bookmark sources. I'll be
looking into it soonish.

If you want this implemented sooner you can write it as an extension (separate
from the bookmarks system), which creates it's own menu in the window. That
should be simple enough to do, assuming that we can get the list of URLs easily.

Look at ephy-topic-action.c for an example of a toolbar widget which has a
drop-down menu. But you will have some problems getting an item added to the
toolbar. I have been making largish changes to the toolbar code to fix this, but
it's nowhere near ready to commit to CVS.

Btw, what is the problem with bookmarking the resolution of a service name?
Isn't the 'resolution of a service name' effectively just a URL? I've never
dealt with Rendezvous before so please correct me if I'm wrong.
Comment 6 Christian Persch 2005-01-04 22:41:28 UTC
Is there any program using the gnome-vfs SD APIs that I could look at to see how
it's done?

Also, what type of service should we look for, only "http" ?
[http://www.dns-sd.org/ServiceTypes.html]
Comment 7 Bryan W Clark 2005-01-04 23:27:42 UTC
Hmmm, not sure about anyone using gnome-vfs SD.  It seems most people have gone
straight to howl instead.  Of course Alex did put in a test program that might
help you.

http://cvs.gnome.org/viewcvs/gnome-vfs/test/test-dns-sd.c?view=markup

Also, this is a good thread with a few explanations:
http://mail.gnome.org/archives/gnome-vfs-list/2004-July/msg00000.html

Here's a quick list of other programs that use howl in case that's any help.

Gnome Meeting
   - Publisher
http://cvs.gnome.org/viewcvs/gnomemeeting/src/zeroconf_publisher.cpp?rev=1.7&view=auto
   - Browser
http://cvs.gnome.org/viewcvs/gnomemeeting/lib/contacts/gm_contacts-zeroconf.cpp?rev=1.9&view=auto

Gnome User Share does publishing of a service, so you can check out the howl API
for setup and such through there.
http://cvs.gnome.org/viewcvs/gnome-user-share/user_share.c?rev=1.9&view=auto

Gnome VFS has browsing of services:
http://cvs.gnome.org/viewcvs/gnome-vfs/libgnomevfs/gnome-vfs-dns-sd.c?rev=1.9&view=auto
Comment 8 Bastien Nocera 2005-03-31 16:38:08 UTC
Some discussion with Christian, on IRC:
<chpe> hadess: I see, hmm. I think it could be done by adding a special "Local
sites" topic in the bookmarks (like the "All", "Most visited" topics). To add it
to the bmbar, you'd have to dnd it from the bme to the bmbar, then
<chpe> (adding the topic can be done mostly from extension, but I'm not opposed
to it being in core, either)
<chpe> hadess: the code is in src/bookmarks/ephy-bookmarks.c
<chpe> hadess: if we have the "Local sites" topic, it's just a matter of adding
a bookmark for the discovered site, and adding it to the topic (ephy_node_add_child)
<chpe> would need a tiny change in ephy itself so as to not save those 'bookmarks'
Comment 9 Bastien Nocera 2005-04-03 15:54:20 UTC
Created attachment 39636 [details] [review]
ephy-add-local-menu.patch

First draft of the patch. We need to make changes to EphyNode to allow the
local sites not to be saved.
Comment 10 Bastien Nocera 2005-04-03 16:49:47 UTC
Created attachment 39640 [details] [review]
ephy-add-local-menu-3.patch

As above, but doesn't save .local sites. Those changes are from Christian.
The local sites bookmarks are still removable though...
Comment 11 Bastien Nocera 2005-04-03 16:58:03 UTC
I haven't managed to make the bookmarks undeletable. Christian, Marco, is the
code still good to go in?
Comment 12 Bastien Nocera 2005-04-03 17:03:21 UTC
Created attachment 39641 [details] [review]
ephy-add-local-menu-4.patch

There was one line too much, removing menu entries works now.
Comment 13 Christian Persch 2005-04-08 18:21:07 UTC
Comment on attachment 39641 [details] [review]
ephy-add-local-menu-4.patch

First, thanks for the patch!

* I committed a slightly modified version of the save filter patch to Epiphany
HEAD, so this patch needs an update.

* This still allows the user to choose Properties from the context menu in the
bookmarks editor, and then change its properties. I think we should disallow
that. A simple way would be to introduce ephy_node_[gs]et_immutable() and check
that before opening props dialogue (or better, set properties insensitive in
context menu and main menu).

* The user could conceivably DND one of the local bookmarks to the bookmarks
bar, as a shortcut. That poses the question of how we should represent the
data: can the same 'service' later refer to a different URL? If so, we should
perhaps invent a special 'URL' for the bookmark derived from its service name,
and only resolve the real URL when loading the bookmark?

* The user also might DND the local bmk to another topic. We need to either
disable that, or have a way to store this association.

* Now a few code comment:

>Index: src/bookmarks/ephy-bookmarks.c
>@@ -767,6 +796,135 @@
> }
> 
> static void
>+resolve_cb (GnomeVFSDNSSDResolveHandle *handle,
>+		GnomeVFSResult result,
>+		const GnomeVFSDNSSDService *service,
>+		const char *host,
>+		int port,
>+		const GHashTable *text,
>+		int text_raw_len,
>+		const char *text_raw,
>+		gpointer callback_data)
Nit: align after '(' on the resolve_cb line.

>+	if (result != GNOME_VFS_OK)
>+		return;
Nit: on one line.

>+
>+	if (text != NULL) {
>+		path = g_hash_table_lookup ((GHashTable *) text, "path");
>+	} else {
>+		path = "/";
>+	}
Nit: code style is '{' on its own line.

>+	//FIXME we need to add it to the bookmarks as well, otherwise
>+	//it doesn't show up in the bookmark editor, but it will save it
This is solved, right?

>+			if (g_str_equal (ephy_node_get_property_string (ptr, EPHY_NODE_BMK_PROP_TITLE), service->name) != FALSE) {
Just "if (...)", no need to test != FALSE here.

>+	if (gnome_vfs_dns_sd_resolve (&reshandle,
>+				service->name, service->type, service->domain,
>+				3000,
>+				resolve_cb,
>+				eb,
>+				NULL) == GNOME_VFS_OK) {
Introduce a #define'd constant for the '3000' timeout value.

>+		eb->priv->resolve_list = g_list_append (eb->priv->resolve_list,
g_list_prepend, please :)

>+	l = eb->priv->resolve_list;
>+	while (l != NULL) {
>+		gnome_vfs_dns_sd_cancel_resolve (l->data);
>+		l = l->next;
>+	}
g_list_foreach ?
Comment 14 Christian Persch 2005-07-03 13:34:01 UTC
Bastien: any chance you could have a look at this again? I'd like to get this
before freeze :)
Comment 13 contains a patch review and a few points that should be addressed.
Thanks!
Comment 15 Bastien Nocera 2005-07-06 15:56:33 UTC
A bit of work would be required to make it apply again to current CVS HEAD,
which I should be able to do.
However, I still haven't figured out how to make the bookmark
uneditable/unremovable/uncopiable.
Comment 16 Bastien Nocera 2005-07-06 16:10:22 UTC
Created attachment 48727 [details] [review]
ephy-add-local-menu-5.patch
Comment 17 Christian Persch 2005-07-10 20:57:21 UTC
Thanks for the patch!

+resolve_cb (GnomeVFSDNSSDResolveHandle *handle,
[...]
+	g_value_init (&value, G_TYPE_INT);
+	g_value_set_int (&value, EPHY_NODE_SPECIAL_PRIORITY);
+	ephy_node_set_property (eb->priv->favorites,
+				EPHY_NODE_KEYWORD_PROP_PRIORITY,
+				&value);
+	g_value_unset (&value);

I suppose you meant eb->priv->local here, but I still don't get what this is
supposed to do; the priority is already set in ephy_bookmarks_init...

I implemented drag disallowing, fixed it crashing on shutdown with no browse
handler, and fixes saving.

Since I have no local sites I cannot test this at all; could you please test and
tell me if it all works: not allow drag of one of the local sites to another
topic, not allow dragging other bookmarks to the local sites topic, but still
allow dragging the local sites topic to the bookmarksbar?
Comment 18 Christian Persch 2005-07-11 19:49:00 UTC
Fixed the dragging checks, and tested.
Comment 19 Bastien Nocera 2005-07-13 20:46:24 UTC
Using mDNSPublish to create a service with a path:
mDNSPublish "test" _http._tcp 80 path=/tmp

mDNSBrowse shows the path:
browse reply: Add Service 0x3 test _http._tcp. local.
resolve reply: 0x3 test _http._tcp. local. 192.168.1.5 80
Txt: [path]=[/tmp] - (4 bytes)

However, the path isn't being used in ephy. I don't know if the bug is in the
ephy code, gnome-vfs or howl...
Comment 20 Christian Persch 2005-07-13 22:09:01 UTC
In src/bookmarks/ephy-bookmarks.c:resolve_cb() we get the patch from the hash table:

819             if (text != NULL)
820             {
821                     path = g_hash_table_lookup ((GHashTable *) text, "path");
822             }
823             else
824             {
825                     path = "/";

However, the hashtable we get presented with is NULL !

  • #0 resolve_cb
    at ../../../src/bookmarks/ephy-bookmarks.c line 828
$1 = 0x8624400 "\tpath=/tmp"
(gdb) p text
$2 = (const GHashTable *) 0x0

Looks like a gnome-vfs bug to me: howl_resolve_idle always passes NULL as
hashtable! [http://cvs.gnome.org/viewcvs/gnome-vfs/libgnomevfs/gnome-vfs-dns-sd.c]