Can I cause folders to sort to the top of the list when presented with the folder contents?

Hi,

Can I cause folders to sort to the top of the list when presented with folder contents?

While re-linking my media objects my brain gets sore from expecting folders to be at the top. When navigating a multi-level tree with a lot in each level, it’s a pain in the keester. I don’t care about files until I reach my target folder.

Thanks again,

Carey
GrampsAIO64-5.1.3-2 on Win 10

I am not totally sure which folders you are referring.

If is within the “Select a media object” window, alas the GTK+ handler that Gramps uses treats folder and file names the same and sort both the same by name or date/time modified. I am not aware of any hack to alter this function.

I try to keep all my raw files within folders that do not have additional sub-folders and try to keep the sub-folders only one folder deep. This keeps folder and file names from mixing.

You do have the ability to add a media file by drag-n-drop. Open the gallery tab in Gramps where the record will be linked with the person, event, citation, etc. Then using the file manager of your OS, find the file you want and D-N-D it into the gallery tab. You can then open the media file’s record in Gramps and edit the Title and Date for the record.

My file chooser already defaults to sorting folders to top.

However, Gramps uses the GTK+ file chooser. And the settings of other GTK driven programs could have modified the default behavior. Are you using other such programs like LibreOffice? (I use GIMP but it hasn’t made such a change. Although my folders bookmarked for Gramps are also bookmarked for GIMP.)

There IS a “sort-directories-first” behavior switch for the file-chooser.

See the following community forum page for ubuntu for more information about using dconf-editor to customize the behavior of the GTK+ file-chooser:

Thanks Dave, maybe the Drag-N-Drop from the OS file manager would be best. I pretty much have a mental map of that tree anyway.

My workflow intentionally mixes files and folders. If I find something that references a Parks, but I don’t wish to drop the thread I’m pursuing to see that it gets to it’s forever home, I’ll toss it into the Parks folder. Then when I come to deal with that item, I can just drag it into the proper folder, which is right handy, being in the same open folder.

I could make a “Parks generic” folder as a peer of the individual folders I suppose, but then dragging a file to a folder isn’t so handy. Pick your poison I guess.

And thanks to Emy, I will see what I can do with the “ sort-directories-first ” behavior switch for the file-chooser too. It never hurts to learn something. And then, the select media object chooser will look like the tree I have in my head.

Carey

And thanks to your question, I looked for a customization. Now I can check to see if there are options to make the file-chooser interface more closely match my OS.

The mix of single-click actions into Windoze’s double-click OS always throws me off. Maybe I can make Gramps conformant.

Hi again, I finally got around to pursuing the file chooser behavior switch and went looking for the dconf-editor, hoping that it came along with the GRAMPS install. Sorry I’m fairly ignorant of *inx these days, my last exposure was on a VAX-11/780 if that tells you anything. Damn Windoze!

Anyway, do I need to instal the GTK dev environment to get the editor? Can do, it might be fun, but as I’m editing a lot of video for movies these days I never have enough hard drive and will just remove it again. Thoughts?

Thanks in advance,

Carey

1 Like

I just looked a little deeper. It looks like DconfEditor would be an interesting tool to experiment with… but overkill in this case.

The file is a plain text XML file. AFTER MAKING A BACKUP, you can edit with something like Notepad++.

On a 64-bit Windoze 10 box with the 5.1.4 version of Gramps, the path was:
C:\Program Files\GrampsAIO64-5.1.4\share\glib-2.0\schemas\org.gtk.Settings.FileChooser.gschema.xml

look for the following block and change false to true

    <key type="b" name="sort-directories-first">
      <default>false</default>
      <summary>Show folders first</summary>
      <description>
        If set to true, then folders are shown before files in the list.
      </description>
    </key>

Oooh, that was fun, nearly as much fun as editing the registry. :wink: Got it done and even upgraded GRAMPS to 5.1.4, so thanks for that.

But, the media selection form still sorts in alpha sequence. Hmm… I re-opened the xml file to ensure it was saved, and it was. I clicked the headers on the file list in the form to make sure it wasn’t sorted by date or anything, and clicking name did flip ascending and descending, but files and folders were intermingled.

It’s not a big deal now that I can DND the files from the windows file browser.

Is there something I need to do to have GRAMPS re-parse the XML? Is it remembering my last open form too well or something? Just fishing obviously.

Thanks,

Carey

PS - I edited with the TED editor which seems OK for that kind of stuff. I can get my code aware editor back if that helps.

I don’t know if this change requires clearing the cached compiled files. I’ve done patches where that was necessary.

Of course, the next boot is a LOT slower as Python recompiles the missing caches.

I did a new install of 5.1.4. The compiled file in the schema folder where you recommended the modification was installed as already compiled before the first launch of Gramps when the regular code files get compiled.

Discovered that there is a GUI accessible control for Sort Folders before Files in the GTK File Chooser.
The right-click context :computer_mouse:menu includes that as a menu item.