Gtk.File_Chooser_Button

Entities

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

The Gtk.File_Chooser_Button.Gtk_File_Chooser_Button is a widget that lets the user select a file. It implements the Gtk.File_Chooser.Gtk_File_Chooser interface. Visually, it is a file name with a button to bring up a Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog. The user can then use that dialog to change the file associated with that button. This widget does not support setting the Gtk.File_Chooser.Gtk_File_Chooser:select-multiple property to True.

## Create a button to let the user select a file in /etc

{
  GtkWidget *button;

  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");
}

The Gtk.File_Chooser_Button.Gtk_File_Chooser_Button supports the Gtk_File_Chooser_Actions Gtk.File_Chooser.Action_Open and Gtk.File_Chooser.Action_Select_Folder.

> The Gtk.File_Chooser_Button.Gtk_File_Chooser_Button will ellipsize the label, and will thus > request little horizontal space. To give the button more space, > you should call Gtk.Widget.Get_Preferred_Size, > Gtk.File_Chooser_Button.Set_Width_Chars, or pack the button in > such a way that other interface elements give space to the > widget.

# CSS nodes

GtkFileChooserButton has a CSS node with name "filechooserbutton", containing a subnode for the internal button with name "button" and style class ".file".

<group>Buttons and Toggles</group>

"+"

function "+"
  (Widget : access Gtk_File_Chooser_Button_Record'Class)
return Gtk.Buildable.Gtk_Buildable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_File_Chooser_Button_Record'Class)
return Gtk.File_Chooser.Gtk_File_Chooser
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_File_Chooser_Button_Record'Class)
return Gtk.Orientable.Gtk_Orientable
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_File_Chooser_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.File_Chooser.Gtk_File_Chooser)
return Gtk_File_Chooser_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Orientable.Gtk_Orientable)
return Gtk_File_Chooser_Button
Parameters
Interf
Return Value

Add_Choice

procedure Add_Choice
   (Chooser       : not null access Gtk_File_Chooser_Button_Record;
    Id            : UTF8_String;
    Label         : UTF8_String;
    Options       : GNAT.Strings.String_List;
    Option_Labels : GNAT.Strings.String_List)
Parameters
Chooser
Id
Label
Options
Option_Labels

Add_Filter

procedure Add_Filter
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class)
Parameters
Chooser
Filter

Add_Shortcut_Folder

function Add_Shortcut_Folder
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Folder  : UTF8_String) return Boolean
Parameters
Chooser
Folder
Return Value

Add_Shortcut_Folder_Uri

function Add_Shortcut_Folder_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String) return Boolean
Parameters
Chooser
URI
Return Value

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_File_Chooser_Button_Void

type Cb_Gtk_File_Chooser_Button_Void is not null access procedure
  (Self : access Gtk_File_Chooser_Button_Record'Class);
Parameters
Self

Dialog_Property

Dialog_Property : constant Glib.Properties.Property_Interface;

Type: Gtk.File_Chooser.Gtk_File_Chooser Flags: write Instance of the Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog associated with the button.

Get_Action

function Get_Action
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.File_Chooser.Gtk_File_Chooser_Action
Parameters
Chooser
Return Value

Get_Choice

function Get_Choice
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Id      : UTF8_String) return UTF8_String
Parameters
Chooser
Id
Return Value

Get_Create_Folders

function Get_Create_Folders
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Current_Folder

function Get_Current_Folder
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Current_Folder_Uri

function Get_Current_Folder_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Current_Name

function Get_Current_Name
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Do_Overwrite_Confirmation

function Get_Do_Overwrite_Confirmation
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Extra_Widget

function Get_Extra_Widget
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Widget.Gtk_Widget
Parameters
Chooser
Return Value

Get_Filename

function Get_Filename
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Filenames

function Get_Filenames
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Enums.String_SList.GSlist
Parameters
Chooser
Return Value

Get_Filter

function Get_Filter
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.File_Filter.Gtk_File_Filter
Parameters
Chooser
Return Value

Get_Focus_On_Click

function Get_Focus_On_Click
   (Button : not null access Gtk_File_Chooser_Button_Record)
    return Boolean

Returns whether the button grabs focus when it is clicked with the mouse. See Gtk.File_Chooser_Button.Set_Focus_On_Click. Since: gtk+ 2.10 Deprecated since 3.20, 1

Parameters
Button
Return Value

True if the button grabs focus when it is clicked with the mouse.

Get_Local_Only

function Get_Local_Only
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Orientation

function Get_Orientation
   (Self : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Enums.Gtk_Orientation
Parameters
Self
Return Value

Get_Preview_Filename

function Get_Preview_Filename
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Preview_Uri

function Get_Preview_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Preview_Widget

function Get_Preview_Widget
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Widget.Gtk_Widget
Parameters
Chooser
Return Value

Get_Preview_Widget_Active

function Get_Preview_Widget_Active
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Select_Multiple

function Get_Select_Multiple
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Show_Hidden

function Get_Show_Hidden
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Title

function Get_Title
   (Button : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String

Retrieves the title of the browse dialog used by Button. The returned value should not be modified or freed. Since: gtk+ 2.6

Parameters
Button
Return Value

a pointer to the browse dialog's title.

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Uri

function Get_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return UTF8_String
Parameters
Chooser
Return Value

Get_Uris

function Get_Uris
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Enums.String_SList.GSlist
Parameters
Chooser
Return Value

Get_Use_Preview_Label

function Get_Use_Preview_Label
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Boolean
Parameters
Chooser
Return Value

Get_Width_Chars

function Get_Width_Chars
   (Button : not null access Gtk_File_Chooser_Button_Record)
    return Glib.Gint

Retrieves the width in characters of the Button widget's entry and/or label. Since: gtk+ 2.6

Parameters
Button
Return Value

an integer width (in characters) that the button will use to size itself.

Gtk_File_Chooser_Button

type Gtk_File_Chooser_Button is access all Gtk_File_Chooser_Button_Record'Class;

Gtk_File_Chooser_Button_New

function Gtk_File_Chooser_Button_New
   (Title  : UTF8_String;
    Action : Gtk.File_Chooser.Gtk_File_Chooser_Action)
    return Gtk_File_Chooser_Button

Creates a new file-selecting button widget. Since: gtk+ 2.6

Parameters
Title

the title of the browse dialog.

Action

the open mode for the widget.

Return Value

Gtk_File_Chooser_Button_New_With_Dialog

function Gtk_File_Chooser_Button_New_With_Dialog
   (Dialog : not null access Gtk.Widget.Gtk_Widget_Record'Class)
    return Gtk_File_Chooser_Button

Creates a Gtk.File_Chooser_Button.Gtk_File_Chooser_Button widget which uses Dialog as its file-picking window. Note that Dialog must be a Gtk.Dialog.Gtk_Dialog (or subclass) which implements the Gtk.File_Chooser.Gtk_File_Chooser interface and must not have GTK_DIALOG_DESTROY_WITH_PARENT set. Also note that the dialog needs to have its confirmative button added with response GTK_RESPONSE_ACCEPT or GTK_RESPONSE_OK in order for the button to take over the file selected in the dialog. Since: gtk+ 2.6

Parameters
Dialog

the widget to use as dialog

Return Value

Gtk_File_Chooser_Button_Record

type Gtk_File_Chooser_Button_Record is new Gtk_Box_Record with null record;

Gtk_New

procedure Gtk_New
   (Button : out Gtk_File_Chooser_Button;
    Title  : UTF8_String;
    Action : Gtk.File_Chooser.Gtk_File_Chooser_Action)

Creates a new file-selecting button widget. Since: gtk+ 2.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Button
Title

the title of the browse dialog.

Action

the open mode for the widget.

Gtk_New_With_Dialog

procedure Gtk_New_With_Dialog
   (Button : out Gtk_File_Chooser_Button;
    Dialog : not null access Gtk.Widget.Gtk_Widget_Record'Class)

Creates a Gtk.File_Chooser_Button.Gtk_File_Chooser_Button widget which uses Dialog as its file-picking window. Note that Dialog must be a Gtk.Dialog.Gtk_Dialog (or subclass) which implements the Gtk.File_Chooser.Gtk_File_Chooser interface and must not have GTK_DIALOG_DESTROY_WITH_PARENT set. Also note that the dialog needs to have its confirmative button added with response GTK_RESPONSE_ACCEPT or GTK_RESPONSE_OK in order for the button to take over the file selected in the dialog. Since: gtk+ 2.6 Initialize_With_Dialog does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Button
Dialog

the widget to use as dialog

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_File_Chooser_Button_Record, Gtk_File_Chooser_Button);

Implements_Gtk_File_Chooser

package Implements_Gtk_File_Chooser is new Glib.Types.Implements
  (Gtk.File_Chooser.Gtk_File_Chooser, Gtk_File_Chooser_Button_Record, Gtk_File_Chooser_Button);

Implements_Gtk_Orientable

package Implements_Gtk_Orientable is new Glib.Types.Implements
  (Gtk.Orientable.Gtk_Orientable, Gtk_File_Chooser_Button_Record, Gtk_File_Chooser_Button);

Initialize

procedure Initialize
   (Button : not null access Gtk_File_Chooser_Button_Record'Class;
    Title  : UTF8_String;
    Action : Gtk.File_Chooser.Gtk_File_Chooser_Action)

Creates a new file-selecting button widget. Since: gtk+ 2.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Button
Title

the title of the browse dialog.

Action

the open mode for the widget.

Initialize_With_Dialog

procedure Initialize_With_Dialog
   (Button : not null access Gtk_File_Chooser_Button_Record'Class;
    Dialog : not null access Gtk.Widget.Gtk_Widget_Record'Class)

Creates a Gtk.File_Chooser_Button.Gtk_File_Chooser_Button widget which uses Dialog as its file-picking window. Note that Dialog must be a Gtk.Dialog.Gtk_Dialog (or subclass) which implements the Gtk.File_Chooser.Gtk_File_Chooser interface and must not have GTK_DIALOG_DESTROY_WITH_PARENT set. Also note that the dialog needs to have its confirmative button added with response GTK_RESPONSE_ACCEPT or GTK_RESPONSE_OK in order for the button to take over the file selected in the dialog. Since: gtk+ 2.6 Initialize_With_Dialog does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Button
Dialog

the widget to use as dialog

List_Filters

function List_Filters
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Glib.Object.Object_List.GSlist
Parameters
Chooser
Return Value

List_Shortcut_Folder_Uris

function List_Shortcut_Folder_Uris
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Enums.String_SList.GSlist
Parameters
Chooser
Return Value

List_Shortcut_Folders

function List_Shortcut_Folders
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
    return Gtk.Enums.String_SList.GSlist
Parameters
Chooser
Return Value

On_File_Set

procedure On_File_Set
   (Self  : not null access Gtk_File_Chooser_Button_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::file-set signal is emitted when the user selects a file.

Note that this signal is only emitted when the user changes the file.

Parameters
Self
Call
Slot
After

On_File_Set

procedure On_File_Set
   (Self  : not null access Gtk_File_Chooser_Button_Record;
    Call  : Cb_Gtk_File_Chooser_Button_Void;
    After : Boolean := False)

The ::file-set signal is emitted when the user selects a file.

Note that this signal is only emitted when the user changes the file.

Parameters
Self
Call
After

Remove_Choice

procedure Remove_Choice
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Id      : UTF8_String)
Parameters
Chooser
Id

Remove_Filter

procedure Remove_Filter
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class)
Parameters
Chooser
Filter

Remove_Shortcut_Folder

function Remove_Shortcut_Folder
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Folder  : UTF8_String) return Boolean
Parameters
Chooser
Folder
Return Value

Remove_Shortcut_Folder_Uri

function Remove_Shortcut_Folder_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String) return Boolean
Parameters
Chooser
URI
Return Value

Select_All

procedure Select_All
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
Parameters
Chooser

Select_Filename

function Select_Filename
   (Chooser  : not null access Gtk_File_Chooser_Button_Record;
    Filename : UTF8_String) return Boolean
Parameters
Chooser
Filename
Return Value

Select_Uri

function Select_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String) return Boolean
Parameters
Chooser
URI
Return Value

Set_Action

procedure Set_Action
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Action  : Gtk.File_Chooser.Gtk_File_Chooser_Action)
Parameters
Chooser
Action

Set_Choice

procedure Set_Choice
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Id      : UTF8_String;
    Option  : UTF8_String)
Parameters
Chooser
Id
Option

Set_Create_Folders

procedure Set_Create_Folders
   (Chooser        : not null access Gtk_File_Chooser_Button_Record;
    Create_Folders : Boolean)
Parameters
Chooser
Create_Folders

Set_Current_Folder

function Set_Current_Folder
   (Chooser  : not null access Gtk_File_Chooser_Button_Record;
    Filename : UTF8_String) return Boolean
Parameters
Chooser
Filename
Return Value

Set_Current_Folder_Uri

function Set_Current_Folder_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String) return Boolean
Parameters
Chooser
URI
Return Value

Set_Current_Name

procedure Set_Current_Name
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Name    : UTF8_String)
Parameters
Chooser
Name

Set_Do_Overwrite_Confirmation

procedure Set_Do_Overwrite_Confirmation
   (Chooser                   : not null access Gtk_File_Chooser_Button_Record;
    Do_Overwrite_Confirmation : Boolean)
Parameters
Chooser
Do_Overwrite_Confirmation

Set_Extra_Widget

procedure Set_Extra_Widget
   (Chooser      : not null access Gtk_File_Chooser_Button_Record;
    Extra_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
Parameters
Chooser
Extra_Widget

Set_Filename

function Set_Filename
   (Chooser  : not null access Gtk_File_Chooser_Button_Record;
    Filename : UTF8_String) return Boolean
Parameters
Chooser
Filename
Return Value

Set_Filter

procedure Set_Filter
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class)
Parameters
Chooser
Filter

Set_Focus_On_Click

procedure Set_Focus_On_Click
   (Button         : not null access Gtk_File_Chooser_Button_Record;
    Focus_On_Click : Boolean)

Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don't want the keyboard focus removed from the main area of the application. Since: gtk+ 2.10 Deprecated since 3.20, 1

Parameters
Button
Focus_On_Click

whether the button grabs focus when clicked with the mouse

Set_Local_Only

procedure Set_Local_Only
   (Chooser    : not null access Gtk_File_Chooser_Button_Record;
    Local_Only : Boolean)
Parameters
Chooser
Local_Only

Set_Orientation

procedure Set_Orientation
   (Self        : not null access Gtk_File_Chooser_Button_Record;
    Orientation : Gtk.Enums.Gtk_Orientation)
Parameters
Self
Orientation

Set_Preview_Widget

procedure Set_Preview_Widget
   (Chooser        : not null access Gtk_File_Chooser_Button_Record;
    Preview_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
Parameters
Chooser
Preview_Widget

Set_Preview_Widget_Active

procedure Set_Preview_Widget_Active
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    Active  : Boolean)
Parameters
Chooser
Active

Set_Select_Multiple

procedure Set_Select_Multiple
   (Chooser         : not null access Gtk_File_Chooser_Button_Record;
    Select_Multiple : Boolean)
Parameters
Chooser
Select_Multiple

Set_Show_Hidden

procedure Set_Show_Hidden
   (Chooser     : not null access Gtk_File_Chooser_Button_Record;
    Show_Hidden : Boolean)
Parameters
Chooser
Show_Hidden

Set_Title

procedure Set_Title
   (Button : not null access Gtk_File_Chooser_Button_Record;
    Title  : UTF8_String)

Modifies the Title of the browse dialog used by Button. Since: gtk+ 2.6

Parameters
Button
Title

the new browse dialog title.

Set_Uri

function Set_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String) return Boolean
Parameters
Chooser
URI
Return Value

Set_Use_Preview_Label

procedure Set_Use_Preview_Label
   (Chooser   : not null access Gtk_File_Chooser_Button_Record;
    Use_Label : Boolean)
Parameters
Chooser
Use_Label

Set_Width_Chars

procedure Set_Width_Chars
   (Button  : not null access Gtk_File_Chooser_Button_Record;
    N_Chars : Glib.Gint)

Sets the width (in characters) that Button will use to N_Chars. Since: gtk+ 2.6

Parameters
Button
N_Chars

the new width, in characters.

Signal_File_Set

Signal_File_Set : constant Glib.Signal_Name := "file-set";

The ::file-set signal is emitted when the user selects a file.

Note that this signal is only emitted when the user changes the file.

Title_Property

Title_Property : constant Glib.Properties.Property_String;

Title to put on the Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog associated with the button.

Unselect_All

procedure Unselect_All
   (Chooser : not null access Gtk_File_Chooser_Button_Record)
Parameters
Chooser

Unselect_Filename

procedure Unselect_Filename
   (Chooser  : not null access Gtk_File_Chooser_Button_Record;
    Filename : UTF8_String)
Parameters
Chooser
Filename

Unselect_Uri

procedure Unselect_Uri
   (Chooser : not null access Gtk_File_Chooser_Button_Record;
    URI     : UTF8_String)
Parameters
Chooser
URI

Width_Chars_Property

Width_Chars_Property : constant Glib.Properties.Property_Int;

The width of the entry and label inside the button, in characters.