GtkAppChooserWidget

GtkAppChooserWidget — Application chooser widget that can be embedded in other widgets

Properties

char * default-text Read / Write
gboolean show-all Read / Write / Construct
gboolean show-default Read / Write / Construct
gboolean show-fallback Read / Write / Construct
gboolean show-other Read / Write / Construct
gboolean show-recommended Read / Write / Construct

Signals

void application-activated Run First
void application-selected Run First

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkAppChooserWidget

Implemented Interfaces

GtkAppChooserWidget implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkAppChooser.

Includes

#include <gtk/gtk.h>

Description

GtkAppChooserWidget is a widget for selecting applications. It is the main building block for GtkAppChooserDialog. Most applications only need to use the latter; but you can use this widget as part of a larger widget if you have special needs.

GtkAppChooserWidget offers detailed control over what applications are shown, using the “show-default”, “show-recommended”, “show-fallback”, “show-other” and “show-all” properties. See the GtkAppChooser documentation for more information about these groups of applications.

To keep track of the selected application, use the “application-selected” and “application-activated” signals.

CSS nodes

GtkAppChooserWidget has a single CSS node with name appchooser.

Functions

gtk_app_chooser_widget_new ()

GtkWidget *
gtk_app_chooser_widget_new (const char *content_type);

Creates a new GtkAppChooserWidget for applications that can handle content of the given type.

Parameters

content_type

the content type to show applications for

Returns

a newly created GtkAppChooserWidget

gtk_app_chooser_widget_set_show_default ()

void
gtk_app_chooser_widget_set_show_default
                               (GtkAppChooserWidget *self,
                                gboolean setting);

Sets whether the app chooser should show the default handler for the content type in a separate section.

Parameters

self

a GtkAppChooserWidget

setting

the new value for “show-default”

gtk_app_chooser_widget_get_show_default ()

gboolean
gtk_app_chooser_widget_get_show_default
                               (GtkAppChooserWidget *self);

Returns the current value of the “show-default” property.

Parameters

Returns

the value of “show-default”

void
gtk_app_chooser_widget_set_show_recommended
                               (GtkAppChooserWidget *self,
                                gboolean setting);

Sets whether the app chooser should show recommended applications for the content type in a separate section.

Parameters

self

a GtkAppChooserWidget

setting

the new value for “show-recommended”

gboolean
gtk_app_chooser_widget_get_show_recommended
                               (GtkAppChooserWidget *self);

Returns the current value of the “show-recommended” property.

Parameters

Returns

the value of “show-recommended”

gtk_app_chooser_widget_set_show_fallback ()

void
gtk_app_chooser_widget_set_show_fallback
                               (GtkAppChooserWidget *self,
                                gboolean setting);

Sets whether the app chooser should show related applications for the content type in a separate section.

Parameters

self

a GtkAppChooserWidget

setting

the new value for “show-fallback”

gtk_app_chooser_widget_get_show_fallback ()

gboolean
gtk_app_chooser_widget_get_show_fallback
                               (GtkAppChooserWidget *self);

Returns the current value of the “show-fallback” property.

Parameters

Returns

the value of “show-fallback”

gtk_app_chooser_widget_set_show_other ()

void
gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
                                       gboolean setting);

Sets whether the app chooser should show applications which are unrelated to the content type.

Parameters

self

a GtkAppChooserWidget

setting

the new value for “show-other”

gtk_app_chooser_widget_get_show_other ()

gboolean
gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self);

Returns the current value of the “show-other” property.

Parameters

Returns

the value of “show-other”

gtk_app_chooser_widget_set_show_all ()

void
gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
                                     gboolean setting);

Sets whether the app chooser should show all applications in a flat list.

Parameters

self

a GtkAppChooserWidget

setting

the new value for “show-all”

gtk_app_chooser_widget_get_show_all ()

gboolean
gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self);

Returns the current value of the “show-all” property.

Parameters

Returns

the value of “show-all”

gtk_app_chooser_widget_set_default_text ()

void
gtk_app_chooser_widget_set_default_text
                               (GtkAppChooserWidget *self,
                                const char *text);

Sets the text that is shown if there are not applications that can handle the content type.

Parameters

self

a GtkAppChooserWidget

text

the new value for “default-text”

gtk_app_chooser_widget_get_default_text ()

const char *
gtk_app_chooser_widget_get_default_text
                               (GtkAppChooserWidget *self);

Returns the text that is shown if there are not applications that can handle the content type.

Parameters

Returns

the value of “default-text”.

[nullable]

Types and Values

GtkAppChooserWidget

typedef struct _GtkAppChooserWidget GtkAppChooserWidget;

Property Details

The “default-text” property

  “default-text”             char *

The “default-text” property determines the text that appears in the widget when there are no applications for the given content type. See also gtk_app_chooser_widget_set_default_text().

Owner: GtkAppChooserWidget

Flags: Read / Write

Default value: NULL

The “show-all” property

  “show-all”                 gboolean

If the “show-all” property is TRUE, the app chooser presents all applications in a single list, without subsections for default, recommended or related applications.

Owner: GtkAppChooserWidget

Flags: Read / Write / Construct

Default value: FALSE

The “show-default” property

  “show-default”             gboolean

The ::show-default property determines whether the app chooser should show the default handler for the content type in a separate section. If FALSE, the default handler is listed among the recommended applications.

Owner: GtkAppChooserWidget

Flags: Read / Write / Construct

Default value: FALSE

The “show-fallback” property

  “show-fallback”            gboolean

The “show-fallback” property determines whether the app chooser should show a section for fallback applications. If FALSE, the fallback applications are listed among the other applications.

Owner: GtkAppChooserWidget

Flags: Read / Write / Construct

Default value: FALSE

The “show-other” property

  “show-other”               gboolean

The “show-other” property determines whether the app chooser should show a section for other applications.

Owner: GtkAppChooserWidget

Flags: Read / Write / Construct

Default value: FALSE

  “show-recommended”         gboolean

The “show-recommended” property determines whether the app chooser should show a section for recommended applications. If FALSE, the recommended applications are listed among the other applications.

Owner: GtkAppChooserWidget

Flags: Read / Write / Construct

Default value: TRUE

Signal Details

The “application-activated” signal

void
user_function (GtkAppChooserWidget *self,
               GAppInfo            *application,
               gpointer             user_data)

Emitted when an application item is activated from the widget's list.

This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

Parameters

self

the object which received the signal

application

the activated GAppInfo

user_data

user data set when the signal handler was connected.

Flags: Run First

The “application-selected” signal

void
user_function (GtkAppChooserWidget *self,
               GAppInfo            *application,
               gpointer             user_data)

Emitted when an application item is selected from the widget's list.

Parameters

self

the object which received the signal

application

the selected GAppInfo

user_data

user data set when the signal handler was connected.

Flags: Run First

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkAppChooserWidget.html