emblems api

Peter de Ridder peter at xfce.org
Thu Jul 23 18:49:29 CEST 2009


On Thu, Jul 23, 2009 at 8:53 AM, Nick Schermer<nickschermer at gmail.com> wrote:
> 2009/7/22 Peter de Ridder <peter at xfce.org>:
>> On Tue, Jul 21, 2009 at 9:42 AM, Nick Schermer<nickschermer at gmail.com> wrote:
>>> For ThunarxFileInfoIface we only need to add a virtual method void
>>> (*add_emblem) (ThunarxFileInfo *file_info, const gchar *emblem_name);
>>> including a function thunarx_file_info_add_emblem(), maybe a
>>> remove_emblem call too, that probably makes sense for the vcs plugin.
>>
>> I would agree to a thunarx api since other desktop environment would
>> implement this plugin related stuff there way.
>> You "specify" an api to set/unset emblems to a file, this would be
>> sufficient for a plugin like vcs plugin. But, especially, for the vcs
>> plugin this would mean it needs to listen to all file changes to see
>> if a file has changed and emblems need updating.
>> Would a provider plugin api, more like how the context menu works, be
>> a better choice? A thunarx-emblem-provider to query a plugin about the
>> emblems in the current view, since emblems are only interesting when
>> viewed.
>
> Maybe more global implementation would be a new thunarx provider to
> allow the plugins to monitor the current view. If that provider send a
> list of ThunarxFileInfo's the plugin can alter, then you can use for
> example the thunarx_file_info_add_emblem() function to set the
> required emblems.
>

This is similar to what I tried to say in the later section, but that
wasn't really clear.
would the interface be called one time for the whole directory, giving
a list of all files in that directory. Or only a list of files
currently displayed, in case of huge amount of files?
I don't know if Thunar (or the plugin) could use threading in case
processing all files in the directory could take much time, so it
would hang the interface or displaying the file without e.g. the
emblems.

For the thunar-vcs-plugin the emblems could be cached (like it does
now) and it would need an thunarx_file_info_add_emblem,
thunarx_file_info_remove_emblem and something like
thunarx_file_info_get_emblem_list, to see which emblems need to be
removed to update to the current vcs status.
Or the emblems are temporary only for the current view, when the view
is left the emblems are forgotten. This wouldn't make sense to other
plugins beside thunar-vcs-plugin.

If there comes an desktop independent storage location for the emblems
and thunar uses it there could get some problems. We might just forget
the for now, but still here are my thoughts:
File content dependent emblems set by a thunar plugin will show up in
other file browers but not updated. 1. These emblems could be stored
in a thunar specific location. 2. other file browers with a similar
plugin will update these emblems. 3. the thunar plugin will have to
remove temporary emblems on exit or view leave.

>> Another option would be to emit signal to a plugin about which
>> directory is currently viewed so it can update visual information
>> about that directory (emblems and maybe other info too), this could
>> use add_emblem, remove_emblem without a file change listener.
>
> Yeah that could work, but then we abuse the iface and turn it in to
> possible monitor implementation, let's keep the iface for change 1
> file at a time.
>

With this signal I meant the view provider interface you suggested.
If a plugin would need to update information on file changes, should
it connect to the file monitor interface while the view is still
"active". Or would the view provider call the plugin with that file
only to say "i'm redrawing the information" since a file size could be
changed or a file could be added and thunar would need to update his
information anyway.

Regards,
Peter



More information about the Xfce4-dev mailing list