KDirWatch emitting dirty signal many times for one change

Sébastien Laoût sebastien.laout at tuxfamily.org
Tue Apr 13 18:34:34 BST 2004


Le mar 13/04/2004 à 12:50, David Faure a écrit :
> Sure.
> Same problem as the one we have in kdesktop, where we try to
> preserve the icon position when a file is renamed. The position is that
> "meta data".

Yes it's true !

> > On top of that I would want to rename file inside my app.
> That's the easy case.

Not as easy. Two ways :
- I trust the "renaming detection" and just rename the file
- I don't trust (as you said it's the way I can expect more) and should
detect deletions, renamings and modify signals... and only keep those I
need for the rename (and only those : not more, not less)... Or keep a
list of files I've renamed to filter them when receive deleted/created
signals and ignore them...
It's too hard.

> > Is it Konqueror independant ?
> Yes/no. It's KIO-dependent.

No problem.

> We're developing a GUI environment. IMHO it's fine to say that some features
> don't work well when people start messing around with the console.

1/ OK I agree we must be able to have a 100% graphic environment.
BUT, we are on UNIX. And we also must provide command line
equivalents...
With your reasonment we go back on the MS way : 100% GUI... or do
nothing.

2/ For the moment, my program just save items to files when they are
modified in the app.
I would want to be able to reload changed files because :
- I have a lot of editors : text, html and soon image and sound.
I can't have very good editors for all those types.
And some peoples want to be able to edit items/files with theire
favorite text editor. It can include Gedit, but I've received some
requests to be able to edit items via emacs or vim : all those programs
are not KDE ones and cannot be replaced by KDE ones for those peoples
(without regard of future image editing : I want to edit them in Gimp
and not in KPaint...).
So, I must detect changes from GLOBAL SYSTEM.
- To provide an easy KIO protocol to edit items (OK : for KDE apps only
but it will redirect read/write from/to the corresponding deeply hidden
save folder).

> > Or in a Nautilus ???
> Talk them into using KDirNotify :-)
> I'm kidding, but if you're after a cross-desktop standard, then it needs
> to be discussed on freedesktop. Maybe DBUS could send those
> "file renamed" signals, dunno.

I've heard that KDE do not want to switch to DBUS for KDE 4 !!
IMHO, for a common desktop, we must have common bases and DBUS or
GStremer are those bases.
So, it do not resolve the problem : I can't wait year 2037 to be able to
*just* be noticed when file system change.

Because for me it's a basic OS feature !

> > Or anywhere else than Konqueror/KDE_KIO_progs ?
> > It's not too trustable as far as I see it.
> Well, that depends on how much you want to support.
> Within KIO-enabled applications, it's very trustable.

As I said, I want to provide a KIO protocol, but ALSO allow console,
GNOME, X, GTK... apps to edit my items : give the choice to users.

> > As I browse the KDE doc, I see class KDirListerCache that provide
> > addd/removed/changed/renamed.
> > But it's a lister ?
> Forget about KDirListerCache, it's an internal class.
> KDirLister is the class you want to use for listing.

Erf. It's heavy !

> > Ho... another thing :
> > void  FilesAdded ( const KURL &directory )
> > It say files was added to a directory.
> > But it don't say What files ?
> Right. One needs to re-list the directory (e.g. with KDirLister), to find
> out all the new files. FilesAdded wouldn't be able to provide enough
> information anyway. Well, it could ship the URLs I guess.... Tell me if
> you need that, it could be arranged :) But that's a detail.

Yes I need that :-)

> IMHO the real fix for this would be that somehow DNOTIFY would emit
> "renamed" (or moved) instead of "deleted+added".  But I have no idea
> if that's possible.

You talk about DNOTIFY ?
But what about for other one, such as FAM.
Note that I don't know what they are and just know when browsing this
thread.
Why is this done by a deamon (if it is) ?
Why not by the OS, all easily ?
And why they are as numerous ?
On which OSs are all the sorts of "FS surveilors" spread ?

Le mar 13/04/2004 à 12:56, Waldo Bastian a écrit :
> There is no reliable way to get this information. When the user
> renames the file in konqueror or with KDesktop you will get the
> signals that David mentioned, but when the user renames the files
> on the command line the only information that KDirWatcher gets is
> that one file disappeared and that another one appeared at roughly
> the same time.

Pff... All my 0.4.x TODO points are fall down to water, now !

> KDirLister might have enough information to be able to reconstruct
> that this was actually a renaming of a file, but at the moment I don't
> think it does.

Yes ? KDirLister could detect GNOME/CommandLine renames ?
Good news... Even if this could be done only for KDE 3.3, or even 4.0...





More information about the kde-core-devel mailing list