[Glade-users] Suppressing states of File Chooser Button, Data retrieving from a dialog



On Wed, Jun 24, 2009 at 2:12 PM, Umut Emin<js_bach at freenet.de> wrote:
Hi all,

I want to be able to pick a file in a dialog, therefore i have chosen
a File Chooser Button(GtkFileChooserButton) for it. My problem is that
this widget prints the state in the button before and after i choose a
file. As the dialog appears, i have a "(None)" initial state, whereafter
a file has been chosen, the path of file printed to the left part of the
button.

What Ive done in similar cases is just use a GtkButton with an icon
(choose size button or size menu depending), and when the button
is clicked I use the GTK+ api to fire a filechooser dialog on the fly
and run it.


My second question is more general and about retrieving data from a
dialog. What is best way to retrieve data from dialogs with a long
children tree? I implemented a recursive look-up method which searches
the children widgets by label. Why do gtk libraries not offer such a
call?

When you load your UI, use gtk_builder_get_object() at initialization time
for every specific widget that you need, load these addresses to a control
object in your application (i.e. the actual object that creates the UI and
calls gtk_builder_add_from_file()), add a member to your application object
for every widget you actually need a pointer to.

After that you will have all your pointers in place, and you can change
the Glade file so long as the correct widgets are still available to
your application.

You could also keep a GtkBuilder instance around to perform the hash
table lookup by name every time you need a pointer from the UI, depends
how you look at it, IMO you really dont have any need for the extra
builder object lying around with a hash table of widgets by name.

Cheers,
       -Tristan


Thanks,
Umut

_______________________________________________
Glade-users maillist ?- ?Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]