I'm writing a program which uses "gtk_tree_view" to display the contents
of a folder. This folder is selected by the user through a
"gtk_file_chooser_dialog". Now while I can get my app to display the
files of any folder I want when I tell it which folder to scan by
'hardcoding' in the path (so the model is filled and created when the app is first started), I can't figure out how to call the appropriate
functions when 'user-selecting' this path. To clarify:

This is the basic structure of my program. I'm guessing that because I
am 'recalling' "create_view_and_model" from within "openDIALOG" the list
is not getting drawn inside the widget. I know that the
'data'(folder) is getting to my function, as I can dump them with
printf();
How do I solve this?

_________________"...and also because he is one of those people who find reasons to blame Microsoft for almost all their problems in life."

I would recommend a few things. First, why not use GtkFileChooserButton instead of your own button? You can use the file chooser button's "selection-changed" signal to check when it was changed.

You can use g_get_home_dir() to check what the user's home directory is. Connect the selection-changed signal, and then set the file chooser button's folder to the home directory or whatever hardcoded folder you want. Then, that will do the initial population. Even if it doesn't, you can just call the callback function explicitly.

First let me say thank you for your reply! :)
However, I don't think that the type of button that calls the file_chooser_dialog makes any difference regarding my problem.
This is the function 'my' button calls when clicked:

This pops up the file_choose_dialog and the user can select what he wants.On 'clicking' OK, "folder" is mapped to the selected path, and "create_view_and_model" is called. Now as far as I can work out, the TreeView-model is getting populated with the correct data, but it is not (re-)connected to the actual view. (When "folder" is mapped at start-up, the "model" is populated and the view 'shows' its data accordingly)This is the function that gets called from the file_chooser:

Who is online

Users browsing this forum: Google [Bot] and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum