## ThunarxPropertyPageProvider ThunarxPropertyPageProvider — The interface to extensions that provide additional property pages |

## Functions

GList * | thunarx_property_page_provider_get_pages ()

## Types and Values

| ThunarxPropertyPageProvider
struct | ThunarxPropertyPageProviderIface

## Object Hierarchy

        GInterface
        ╰── ThunarxPropertyPageProvider

## Prerequisites

ThunarxPropertyPageProvider requires GObject.

## Includes

    #include <thunarx/thunarx.h>

## Description

To add a property page to the file properties dialog, extensions must implement the

ThunarxPropertyPageProvider interface. This interface has only one virtual

method, `get_pages`, that is passed a list of ThunarxFileInfo objects and returns a list of ThunarxPropertyPage objects.

## Functions

### thunarx_property_page_provider_get_pages ()

    GList *
    thunarx_property_page_provider_get_pages
                                   (ThunarxPropertyPageProvider *provider,
                                    GList *files);

Returns the list of ThunarxPropertyPages that `provider` has to offer for `files` .

Extensions that implement this interface, must first check whether they support all the ThunarxFileInfos in the list of `files` . Most extensions will probably only support ThunarxPropertyPages for exactly one file of a certain type. For example an MP3-Tag editor property page will most probably support only a single audio file, and so the method would be implemented like this

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    GList*
    tag_provider_get_pages (ThunarxPropertyPageProvider *property_page_provider,
                            GList                       *files)
    {
      if (g_list_length (files) != 1)
        return NULL;
      else if (!thunarx_file_info_has_mime_type (files->data, "audio/mp3"))
        return NULL;
      else
        return g_list_append (NULL, tag_page_new (files->data));
    }

where `tag_page_new()` allocates a new TagPage instance for a ThunarxFileInfo object passed to it. See the description of the ThunarxPropertyPage class for additional information about the TagPage example class.

As a special note, this method automatically takes a reference on the `provider` for every ThunarxPropertyPage object returned from the real implementation of this method in `provider` . This is to make sure that the extension stays in memory for atleast the time that the pages are used. If the extension wants to stay in memory for a longer time, it'll need to take care of this itself (e.g. by taking an additional reference on the `provider` itself, that's released at a later time).

The caller is responsible to free the returned list of pages using something like this when no longer needed:

    1
    2
    g_list_foreach (list, (GFunc) g_object_ref_sink, NULL);
    g_list_free_full (list, g_object_unref);

[skip]

#### Parameters

provider | a ThunarxPropertyPageProvider. |
files | the list of ThunarxFileInfos for which a properties dialog will be displayed. | [element-type ThunarxFileInfo]

#### Returns

the list of ThunarxPropertyPages that `provider` has to offer for `files` .

[transfer full][element-type ThunarxPropertyPage]

## Types and Values

### ThunarxPropertyPageProvider

    typedef struct _ThunarxPropertyPageProvider ThunarxPropertyPageProvider;

### struct ThunarxPropertyPageProviderIface

    struct ThunarxPropertyPageProviderIface {
      GList *(*get_pages) (ThunarxPropertyPageProvider *provider,
                           GList                       *files);
    };

Interface with virtual methods implemented by extensions that provide additional pages for the file properties dialog.

#### Members

`get_pages` () | see `thunarx_property_page_provider_get_pages()`. |