Re: [gnomemm] Gnome::FileEntry -- get_full_path causes crash



From the Gnome::FileEntry object you can call fentry->gtk_entry().get_text() -- since a Gnome::FileEntry is a Gnome::Entry, which has the gtk_entry() accessor.

With gnomemm2, a Gnome::UI::FileEntry has a gtk_entry() accessor directly, so the same call would work.

It would of course be better if this problem were fixed on gnomemm's side, but for the time being you can do things like check for a length greater than 0 and use things like g_file_exists (g_file_test(str, G_FILE_TEST_EXISTS) in glib2) to make sure the path is decent before getting it.

Julian

Jeremy Dinsel wrote:
I can't seem to find out how to use this widget after reading all the
docs that I can find. Any assistance would be appreciated.

If I'm going the following:

// Create
this->transaction_log_file = manage(new class Gnome::FileEntry());

...

// Read from in a callback
pbox->transaction_log_file->get_full_path(true);


... and the value that the user supplied is either NULL or does not match
what the method expects (a directory when looking for a file, for
example), how can I prevent the routine from crashing? It returns an
improperly formed STL String class. Is there a way that I can get the
entry from the Gnome::FileEntry without using the get_full_path() method
-- similar to Gtk::Entry's or Gtk::SpinButton's get_text()? Gnome::Entry
is a mystery, too.

If anyone would like to comment on adding history to the selected values
of Gnome::FileEntry and Gnome::Entry, I'd appreciate that, too.

I've been reading documents here:

http://gtkmm.sourceforge.net/gtkmm2/
http://david.hedbor.org/pikeman/pigtk/

There don't seem to be many example Gnome::FileEntry programs available,
either. I've tried downloading code form sourceforge or items linked off
of the gnome.org page and reading the code, but haven't had success
there either.

Thanks,
-j
--
- Jeremy Dinsel
- somewhere in the monkey house




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