Comment 3 for bug 956663

Dylan McCall (dylanmccall) wrote :

Okay, I'm attaching a branch that implements this feature. Here's a screenshot!
I copied that link using the Publish and Copy Web Link option, too. (Yes, a little cheeky :b)

It wasn't quite as simple as I'd expected. Syncdaemon doesn't give us an on-success callback when we tell it to publish a file, and making that change would be rather invasive, so I had to get a little creative. I implemented this feature using a new function in file-watcher.c:

void file_watcher_notify_when_published (FileWatcher *watcher, const gchar *path, NotifyWhenPublishedCBFunc callback);

That function tells the watcher to keep track of the given path and, from its existing file_published_cb, it runs the callback _once_ when the requested file has been published.

Since I was testing this, I noticed some finicky behaviour with the context menu. If I choose Stop Publishing, all the options for the given file are disabled permanently. Also, in some cases, after publishing a file the context menu still shows as if the file is unpublished I refresh the view.
I'm pointing those out because I tested both versions, and those problems are not new. Same problem in the current release. So, in case you notice them now, my changes (most likely) have not caused those problems.