Discussion:
marking filenames bold in filebrowser when loading project
Andrius
2014-01-23 12:40:19 UTC
Permalink
When loading project, we add filenames to the filebrowser and marking them bold in advance, before filling tree model with entries. This works satisfactory in flat or dual view mode in filebrowser. However, in tree view mode there is one problem. If we have project with files located in several folders (the more complicated structure of folders is the more visible this issue is), then after project load we are getting "floating" file names in the tree that looks weird. The reason of this is that while filename is added to the tree model, the folder where file belongs might not yet exists in tree model.
I am attaching patch that is free of this issue. The marking of files bold is moved to dir_changed_lcb() callback, which is fired after certain directory is refreshed. We check if opened documents filenames are marked bold, and if not, we mark them. The files that are already marked are skipped. When we gradually fill tree model with entries, all opened files are marked. There is probably small performance penalty, but it is really small, I think.

Any comments?
Andrius
Olivier Sessink
2014-01-23 13:23:02 UTC
Permalink
Post by Andrius
When loading project, we add filenames to the filebrowser and marking
them bold in advance, before filling tree model with entries. This works
satisfactory in flat or dual view mode in filebrowser. However, in tree
view mode there is one problem. If we have project with files located in
several folders (the more complicated structure of folders is the more
visible this issue is), then after project load we are getting
"floating" file names in the tree that looks weird. The reason of this
is that while filename is added to the tree model, the folder where file
belongs might not yet exists in tree model.
I am attaching patch that is free of this issue. The marking of files
bold is moved to dir_changed_lcb() callback, which is fired after
certain directory is refreshed. We check if opened documents filenames
are marked bold, and if not, we mark them. The files that are already
marked are skipped. When we gradually fill tree model with entries, all
opened files are marked. There is probably small performance penalty,
but it is really small, I think.
Any comments?
Andrius
this was my first approach, but with 500 documents open this can become
quite slow (looking up if a file is already open for every file you
refresh in the filebrowser). I have to check why it looks weird. The
directories you refer to should be created too (although empty).

Olivier
Andrius
2014-01-23 13:47:47 UTC
Permalink
Olivier,
I doubt anybody opens 500 documents at once :-). For more real-world number of 30 documents I did not noticed any slowdown.
From the other hand, I have to mention, that it does not checks if document is open. I added doc->mark_bold flag. If the flag is FALSE it just continues without any checks.
Another approach would be to create one more GList of opened documents, and remove entries from it when we mark document bold. Once documents are marked, the list will get short with virtually zero with no penalty on performance.
Andrius
________________________________
this was my first approach, but with 500 documents open this can become
quite slow (looking up if a file is already open for every file you
refresh in the filebrowser). I have to check why it looks weird. The
directories you refer to should be created too (although empty).
Olivier Sessink
2014-01-23 20:55:30 UTC
Permalink
Post by Andrius
Olivier,
I doubt anybody opens 500 documents at once :-).
I've tested Bluefish with up to 10.000 files, and I've used it several
times to convert websites with over 500 to 1000 files (with search and
replace actions over all files).
Post by Andrius
Another approach would be to create one more GList of opened documents,
and remove entries from it when we mark document bold. Once documents
are marked, the list will get short with virtually zero with no penalty
on performance.
that would be a good approach too.

Attached is what it looks like over here, so I don't see the 'floating'
files (and for me this looks fine). What does it look like on your machine?

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Andrius
2014-01-24 22:00:12 UTC
Permalink
Olivier,
one more approach would be to add extra column to treemodel, say "visible" and modify filter func to do not show files or folders that are set to invisible. Newly added file would stay invisible until we refresh directory.
For comparison I am adding filebrowser view after we load project in patched version. Note, there are no folders without names and lone files, so in my opinion it looks more clean.
Andrius
________________________________
Post by Andrius
Another approach would be to create one more GList of opened documents,
and remove entries from it when we mark document bold. Once documents
are marked, the list will get short with virtually zero with no penalty
on performance.
that would be a good approach too.
Olivier Sessink
2014-01-26 12:05:21 UTC
Permalink
Post by Andrius
Olivier,
one more approach would be to add extra column to treemodel, say
"visible" and modify filter func to do not show files or folders that
are set to invisible. Newly added file would stay invisible until we
refresh directory.
For comparison I am adding filebrowser view after we load project in
patched version. Note, there are no folders without names and lone
files, so in my opinion it looks more clean.
the filter model as done by gtk uses quite a lot of memory and is slow.
However, we could implement this same idea in our file_treemodel, just
add an extra bit if a file is already refreshed from disk. The function
that adds file into a file_treemodel should then check this bit for a
file that exists, and unset it.

Olivier
Andrius
2014-01-27 07:08:31 UTC
Permalink
Olivier,
I guess You mean to introduce extra guint8 variable in UriRecord?
Will You take care of coding this?
Andrius
Post by Olivier Sessink
the filter model as done by gtk uses quite a lot of memory and is slow.
However, we could implement this same idea in our file_treemodel, just
add an extra bit if a file is already refreshed from disk. The function
that adds file into a file_treemodel should then check this bit for a
file that exists, and unset it.
Olivier Sessink
2014-01-27 20:24:03 UTC
Permalink
Post by Andrius
Olivier,
I guess You mean to introduce extra guint8 variable in UriRecord?
Will You take care of coding this?
Andrius
hmm I just tried, but it's harder than I thought. Not showing a record
in the treeview means that a lot of existing functions don't work
anymore. For example the number of children no longer equals the number
of records.

I anyway don't want to include this in 2.2.5, I don't want to risk any
unstable code. We still miss a few translations, but I think we have
waited long enough. Agreed?

Olivier
Andrius
2014-01-28 09:15:05 UTC
Permalink
Well, yes, I think we need to proceed with 2.2.5. I think it would be better to release new version every 3 months or so, even if translations are not ready.
Andrius
________________________________
Sent: Monday, January 27, 2014 10:24 PM
Subject: Re: marking filenames bold in filebrowser when loading project
Post by Andrius
Olivier,
I guess You mean to introduce extra guint8 variable in UriRecord?
Will You take care of coding this?
Andrius
hmm I just tried, but it's harder than I thought. Not showing a record
in the treeview means that a lot of existing functions don't work
anymore. For example the number of children no longer equals the number
of records.
I anyway don't want to include this in 2.2.5, I don't want to risk any
unstable code. We still miss a few translations, but I think we have
waited long enough. Agreed?
Olivier
--
To unsubscribe from this list: send the line "unsubscribe bluefish-dev" in
Bluefish web site: http://bluefish.openoffice.nl/
Andrius
2014-01-23 15:21:39 UTC
Permalink
Since You will be looking into fb code, there is one more glitch I would like to report.

Some of file types does not get any icon in the filebroswer. On my system, for example, *.modules, *.php, *.pdf etc. They do not get even blank page icon. Does this happens only on MacOSX or it also visible on others?

Andrius
________________________________
this was my first approach, but with 500 documents open this can become
quite slow (looking up if a file is already open for every file you
refresh in the filebrowser). I have to check why it looks weird. The
directories you refer to should be created too (although empty).
Olivier Sessink
2014-01-23 20:07:13 UTC
Permalink
Post by Andrius
Since You will be looking into fb code, there is one more glitch I would like to report.
Some of file types does not get any icon in the filebroswer. On my
system, for example, *.modules, *.php, *.pdf etc. They do not get even
blank page icon. Does this happens only on MacOSX or it also visible on
others?
not for files like pdf or php, these get a php or pdf icon, but truly
unknown files indeed do not get an icon. I see these have a NULL icon
name, hat seems very easy to change.

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Olivier Sessink
2014-01-23 20:36:31 UTC
Permalink
Post by Olivier Sessink
not for files like pdf or php, these get a php or pdf icon, but truly
unknown files indeed do not get an icon. I see these have a NULL icon
name, hat seems very easy to change.
any record without icon_name now gets the icon "gtk-file".

please test if this works on OSX too.

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Andrius
2014-01-24 05:28:58 UTC
Permalink
Here how it looks on my system with icon patch applied. Now I have icons, but they seems to be "broken" icons, not gtk-file icons. Is this gtk bug/issue?
Also note how treeview looks when I open project. BUGS file belongs to trunk folder, while gtk-keys.css - to macosx-gtk+3 folder. When I refresh folders, then it starts to look better :-)
Basedir of the project is set to src, but since active file is outside it, it redefines basedir to trunk.
With patch I proposed BUGS and gtk-keys.css are simply not visible when I load project.
Andrius
________________________________
Sent: Thursday, January 23, 2014 10:07 PM
Subject: Re: marking filenames bold in filebrowser when loading project
Post by Andrius
Since You will be looking into fb code, there is one more glitch I would like to report.
Some of file types does not get any icon in the filebroswer. On my
system, for example, *.modules, *.php, *.pdf etc. They do not get even
blank page icon. Does this happens only on MacOSX or it also visible on
others?
not for files like pdf or php, these get a php or pdf icon, but truly
unknown files indeed do not get an icon. I see these have a NULL icon
name, hat seems very easy to change.
Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
--
To unsubscribe from this list: send the line "unsubscribe bluefish-dev" in
Bluefish web site: http://bluefish.openoffice.nl/
Olivier Sessink
2014-01-24 21:42:52 UTC
Permalink
Post by Andrius
Here how it looks on my system with icon patch applied. Now I have
icons, but they seems to be "broken" icons, not gtk-file icons. Is
this gtk bug/issue?
this is a stock item? that's why I chose to use that name...
http://www.gtk.org/api/2.6/gtk/gtk-Stock-Items.html#GTK-STOCK-FILE:CAPS
Post by Andrius
Also note how treeview looks when I open project. BUGS file belongs to
trunk folder, while gtk-keys.css - to macosx-gtk+3 folder. When I
refresh folders, then it starts to look better :-)
Basedir of the project is set to src, but since active file is outside
it, it redefines basedir to trunk.
With patch I proposed BUGS and gtk-keys.css are simply not visible when I load project.
Andrius
I personally like the old behavior better but it's not a very strong
preference. What do other people think?

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Andrius
2014-01-24 21:25:16 UTC
Permalink
Olivier,
on MacOSX the default icon is called text-x-generic instead of gtk-file. Then I am getting correct icon.

Also, would it be more efficient to pass it to the treemodel in icon_name_from_icon() instead of filetreemodel_get_value()?
Andrius
________________________________
not for files like pdf or php, these get a php or pdf icon, but truly
unknown files indeed do not get an icon. I see these have a NULL icon
name, hat seems very easy to change.
Olivier Sessink
2014-01-24 22:06:44 UTC
Permalink
Post by Andrius
Olivier,
on MacOSX the default icon is called text-x-generic instead of
gtk-file. Then I am getting correct icon.
ok, I'll try that on Linux
Post by Andrius
Also, would it be more efficient to pass it to the treemodel in
icon_name_from_icon() instead of filetreemodel_get_value()?
I thought about that, but that would use more memory, and we would loose
the ability to see that this file is not really text/generic but has an
undefined icon. That's why I chose this way.

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Loading...