BaulWidgetViewProvider: Baul Extension Reference Manual

## BaulWidgetViewProvider BaulWidgetViewProvider — Interface to provide widgets view. |

## Functions

gboolean | baul_widget_view_provider_supports_uri ()
CtkWidget * | baul_widget_view_provider_get_widget ()
void | baul_widget_view_provider_set_location ()
void | baul_widget_view_provider_set_window ()
void | baul_widget_view_provider_add_file ()
gchar * | baul_widget_view_provider_get_first_visible_file ()
guint | baul_widget_view_provider_get_item_count ()
void | baul_widget_view_provider_clear ()

## Types and Values

| BaulWidgetViewProvider
struct | BaulWidgetViewProviderIface

## Object Hierarchy

        GInterface
        ╰── BaulWidgetViewProvider

## Prerequisites

BaulWidgetViewProvider requires GObject.

## Includes

    #include <libbaul-extension/baul-widget-view-provider.h>

## Description

BaulWidgetViewProvider allows extension to provide widgets view in the file manager.

## Functions

### baul_widget_view_provider_supports_uri ()

    gboolean
    baul_widget_view_provider_supports_uri
                                   (BaulWidgetViewProvider *provider,
                                    const char *uri,
                                    GFileType file_type,
                                    const char *mime_type);

Whether this widget view works for the uri.

#### Parameters

provider | a BaulWidgetViewProvider |
uri | the location to visit. |
file_type | The GFileType for the uri |
mime_type | The mimetype for the uri |

#### Returns

True to use custom widget view, False to ignore, and baul use normal view.

### baul_widget_view_provider_get_widget ()

    CtkWidget *
    baul_widget_view_provider_get_widget (BaulWidgetViewProvider *provider);

Return a CtkWidget to show the current location content.

#### Parameters

provider | a BaulWidgetViewProvider |

#### Returns

The CtkWidget used to show the contents.

### baul_widget_view_provider_set_location ()

    void
    baul_widget_view_provider_set_location
                                   (BaulWidgetViewProvider *provider,
                                    const char *location);

Set the location of this BaulWidgetViewProvider.

#### Parameters

provider | a BaulWidgetViewProvider |
uri | the URI of the location |

### baul_widget_view_provider_set_window ()

    void
    baul_widget_view_provider_set_window (BaulWidgetViewProvider *provider,
                                          CtkWindow *window);

Set parent CtkWindow of this BaulWidgetViewProvider.

#### Parameters

provider | a BaulWidgetViewProvider |
window | parent CtkWindow |

### baul_widget_view_provider_add_file ()

    void
    baul_widget_view_provider_add_file (BaulWidgetViewProvider *provider,
                                        BaulFile *file,
                                        BaulFile *directory);

Add a file of this location into the widget view.

#### Parameters

provider | a BaulWidgetViewProvider |
file | add a BaulFile into the widget view. |
directory | the directory of the file. |

### baul_widget_view_provider_get_first_visible_file ()

    gchar *
    baul_widget_view_provider_get_first_visible_file
                                   (BaulWidgetViewProvider *provider);

Return the first visible file. When use start visit the location, the baul's status is waiting, until get the first visible file.

#### Parameters

provider | a BaulWidgetViewProvider |

#### Returns

the first visible file.

### baul_widget_view_provider_get_item_count ()

    guint
    baul_widget_view_provider_get_item_count
                                   (BaulWidgetViewProvider *provider);

#### Parameters

provider | a BaulWidgetViewProvider |

#### Returns

The item count of this BaulWidgetViewProvider

### baul_widget_view_provider_clear ()

    void
    baul_widget_view_provider_clear (BaulWidgetViewProvider *provider);

Clear the content of this widget view.

#### Parameters

provider | a BaulWidgetViewProvider |

## Types and Values

### BaulWidgetViewProvider

    typedef struct _BaulWidgetViewProvider BaulWidgetViewProvider;

### struct BaulWidgetViewProviderIface

    struct BaulWidgetViewProviderIface {
        GTypeInterface g_iface;

        gboolean  (*supports_uri)   (BaulWidgetViewProvider *provider,
                                     const char *uri,
                                     GFileType file_type,
                                     const char *mime_type);
        CtkWidget* (*get_widget)     (BaulWidgetViewProvider *provider);
        void       (*add_file)       (BaulWidgetViewProvider *provider, BaulFile *file, BaulFile *directory);
        void       (*set_location)   (BaulWidgetViewProvider *provider, const char *location);
        void       (*set_window)     (BaulWidgetViewProvider *provider, CtkWindow *window);
        guint      (*get_item_count) (BaulWidgetViewProvider *provider);
        gchar*     (*get_first_visible_file) (BaulWidgetViewProvider *provider);
        void       (*clear)          (BaulWidgetViewProvider *provider);
    };

Interface for extensions to provide widgets view for content.

#### Members

`supports_uri` () | Whether this extension works for this uri |
`get_widget` () | Returns a CtkWidget. See `baul_widget_view_provider_get_widget()` for details. |
`add_file` () | Adds a file to this widget view. |
`set_location` () | Set location to this widget view. |
`set_window` () | Set the main window to this widget view. |
`get_item_count` () | Return the item count of this widget view. |
`get_first_visible_file` () | Return the first visible file from this widget view. |
`clear` () | Clear items in this widget view. |