Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-06

gtk-file-chooser-button

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,
I wanted to use a gtk_file_chooser_button, but I couldn't because gtk_file_chooser_button_new doesn't exist (v2.0.3 and svn-version). So I added it (and some others) in gtkfilechooser.inc (see enclosed diff). Is this the right place ? I still have to find out how to get the file-name out of the control.
If this patch gets included, would it be backported to 2.0.3 ? Since I need 2.0.3 for my arm-board and svn is broken for arm-linux I would like to have it. If it is not possible I will have to patch it myself every time I get a new 2.0.3.
Regards,
Koenraad Lelong.

Michalis Kamburelis
to Koenraad Lelong
Koenraad Lelong wrote 5 lines
Hi, I wanted to use a gtk_file_chooser_button, but I couldn't because gtk_file_chooser_button_new doesn't exist (v2.0.3 and svn-version). So I added it (and some others) in gtkfilechooser.inc (see enclosed diff). Is this the right place ?

I think it should go to separate file gtkfilechooserbutton.inc, to follow C header convention: it's defined in gtk/gtkfilechooserbutton.h. You should add this file to gtkincludes.inc somewhere under {$IFDEF HasGTK2_6} --- for example right after the line {$include gtkfilechooserentry.inc}.

I still have to find out how to get the file-name out of the control.

You just use the functions of GtkFileChooser, because GtkFileChooserButton implements GtkFileChooser interface. Translating to Pascal small example from
[http://developer.gimp.org/api/2.0/gtk/GtkFileChooserButton.html]:

{ Example 6. Create a button to let the user select a file in /etc }
var
  button: PGtkWidget;
begin
  button := gtk_file_chooser_button_new ('Select a file',
                                        GTK_FILE_CHOOSER_ACTION_OPEN);
  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),
                                       '/etc');
end;

So you should be able to just cast "button" to GtkFileChooser and use all gtk_file_chooser_xxx functions, see
[http://developer.gimp.org/api/2.0/gtk/GtkFileChooser.html].

Michalis