Top | ![]() |
![]() |
![]() |
![]() |
Functions
GtkWidget * | gtk_app_chooser_button_new () |
void | gtk_app_chooser_button_append_custom_item () |
void | gtk_app_chooser_button_append_separator () |
void | gtk_app_chooser_button_set_active_custom_item () |
gboolean | gtk_app_chooser_button_get_show_default_item () |
void | gtk_app_chooser_button_set_show_default_item () |
gboolean | gtk_app_chooser_button_get_show_dialog_item () |
void | gtk_app_chooser_button_set_show_dialog_item () |
const char * | gtk_app_chooser_button_get_heading () |
void | gtk_app_chooser_button_set_heading () |
gboolean | gtk_app_chooser_button_get_modal () |
void | gtk_app_chooser_button_set_modal () |
Properties
char * | heading | Read / Write |
gboolean | modal | Read / Write / Construct |
gboolean | show-default-item | Read / Write / Construct |
gboolean | show-dialog-item | Read / Write / Construct |
Implemented Interfaces
GtkAppChooserButton implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkAppChooser.
Description
The GtkAppChooserButton is a widget that lets the user select an application. It implements the GtkAppChooser interface.
Initially, a GtkAppChooserButton selects the first application
in its list, which will either be the most-recently used application
or, if “show-default-item” is TRUE
, the
default application.
The list of applications shown in a GtkAppChooserButton includes the recommended applications for the given content type. When “show-default-item” is set, the default application is also included. To let the user chooser other applications, you can set the “show-dialog-item” property, which allows to open a full GtkAppChooserDialog.
It is possible to add custom items to the list, using
gtk_app_chooser_button_append_custom_item()
. These items cause
the “custom-item-activated” signal to be
emitted when they are selected.
To track changes in the selected application, use the “changed” signal.
Functions
gtk_app_chooser_button_new ()
GtkWidget *
gtk_app_chooser_button_new (const char *content_type
);
Creates a new GtkAppChooserButton for applications that can handle content of the given type.
gtk_app_chooser_button_append_custom_item ()
void gtk_app_chooser_button_append_custom_item (GtkAppChooserButton *self
,const char *name
,const char *label
,GIcon *icon
);
Appends a custom item to the list of applications that is shown
in the popup; the item name must be unique per-widget.
Clients can use the provided name as a detail for the
“custom-item-activated” signal, to add a
callback for the activation of a particular custom item in the list.
See also gtk_app_chooser_button_append_separator()
.
gtk_app_chooser_button_append_separator ()
void
gtk_app_chooser_button_append_separator
(GtkAppChooserButton *self
);
Appends a separator to the list of applications that is shown in the popup.
gtk_app_chooser_button_set_active_custom_item ()
void gtk_app_chooser_button_set_active_custom_item (GtkAppChooserButton *self
,const char *name
);
Selects a custom item previously added with
gtk_app_chooser_button_append_custom_item()
.
Use gtk_app_chooser_refresh()
to bring the selection
to its initial state.
gtk_app_chooser_button_get_show_default_item ()
gboolean
gtk_app_chooser_button_get_show_default_item
(GtkAppChooserButton *self
);
Returns the current value of the “show-default-item” property.
gtk_app_chooser_button_set_show_default_item ()
void gtk_app_chooser_button_set_show_default_item (GtkAppChooserButton *self
,gboolean setting
);
Sets whether the dropdown menu of this button should show the default application for the given content type at top.
gtk_app_chooser_button_get_show_dialog_item ()
gboolean
gtk_app_chooser_button_get_show_dialog_item
(GtkAppChooserButton *self
);
Returns the current value of the “show-dialog-item” property.
gtk_app_chooser_button_set_show_dialog_item ()
void gtk_app_chooser_button_set_show_dialog_item (GtkAppChooserButton *self
,gboolean setting
);
Sets whether the dropdown menu of this button should show an entry to trigger a GtkAppChooserDialog.
gtk_app_chooser_button_get_heading ()
const char *
gtk_app_chooser_button_get_heading (GtkAppChooserButton *self
);
Returns the text to display at the top of the dialog.
gtk_app_chooser_button_set_heading ()
void gtk_app_chooser_button_set_heading (GtkAppChooserButton *self
,const char *heading
);
Sets the text to display at the top of the dialog. If the heading is not set, the dialog displays a default text.
gtk_app_chooser_button_get_modal ()
gboolean
gtk_app_chooser_button_get_modal (GtkAppChooserButton *self
);
Gets whether the dialog is modal.
gtk_app_chooser_button_set_modal ()
void gtk_app_chooser_button_set_modal (GtkAppChooserButton *self
,gboolean modal
);
Sets whether the dialog should be modal.
Property Details
The “heading”
property
“heading” char *
The text to show at the top of the dialog that can be opened from the button. The string may contain Pango markup.
Owner: GtkAppChooserButton
Flags: Read / Write
Default value: NULL
The “modal”
property
“modal” gboolean
Whether the dialog should be modal.
Owner: GtkAppChooserButton
Flags: Read / Write / Construct
Default value: TRUE
The “show-default-item”
property
“show-default-item” gboolean
The “show-default-item” property determines whether the dropdown menu should show the default application on top for the provided content type.
Owner: GtkAppChooserButton
Flags: Read / Write / Construct
Default value: FALSE
The “show-dialog-item”
property
“show-dialog-item” gboolean
The “show-dialog-item” property determines whether the dropdown menu should show an item that triggers a GtkAppChooserDialog when clicked.
Owner: GtkAppChooserButton
Flags: Read / Write / Construct
Default value: FALSE
Signal Details
The “changed”
signal
void user_function (GtkAppChooserButton *self, gpointer user_data)
Emitted when the active application on the GtkAppChooserButton changes.
Parameters
self |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “custom-item-activated”
signal
void user_function (GtkAppChooserButton *self, char *item_name, gpointer user_data)
Emitted when a custom item, previously added with
gtk_app_chooser_button_append_custom_item()
, is activated from the
dropdown menu.
Parameters
self |
the object which received the signal |
|
item_name |
the name of the activated item |
|
user_data |
user data set when the signal handler was connected. |
Flags: Has Details