CajaWidgetViewProvider: Caja Extension Reference Manual

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

## Functions

gboolean | caja_widget_view_provider_supports_uri ()
GtkWidget * | caja_widget_view_provider_get_widget ()
void | caja_widget_view_provider_set_location ()
void | caja_widget_view_provider_set_window ()
void | caja_widget_view_provider_add_file ()
gchar * | caja_widget_view_provider_get_first_visible_file ()
guint | caja_widget_view_provider_get_item_count ()
void | caja_widget_view_provider_clear ()

## Types and Values

| CajaWidgetViewProvider
struct | CajaWidgetViewProviderIface

## Object Hierarchy

        GInterface
        ╰── CajaWidgetViewProvider

## Prerequisites

CajaWidgetViewProvider requires GObject.

## Includes

    #include <libcaja-extension/caja-widget-view-provider.h>

## Description

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

## Functions

### caja_widget_view_provider_supports_uri ()

    gboolean
    caja_widget_view_provider_supports_uri
                                   (CajaWidgetViewProvider *provider,
                                    const char *uri,
                                    GFileType file_type,
                                    const char *mime_type);

Whether this widget view works for the uri.

#### Parameters

provider | a CajaWidgetViewProvider |
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 caja use normal view.

### caja_widget_view_provider_get_widget ()

    GtkWidget *
    caja_widget_view_provider_get_widget (CajaWidgetViewProvider *provider);

Return a GtkWidget to show the current location content.

#### Parameters

provider | a CajaWidgetViewProvider |

#### Returns

The GtkWidget used to show the contents.

### caja_widget_view_provider_set_location ()

    void
    caja_widget_view_provider_set_location
                                   (CajaWidgetViewProvider *provider,
                                    const char *location);

Set the location of this CajaWidgetViewProvider.

#### Parameters

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

### caja_widget_view_provider_set_window ()

    void
    caja_widget_view_provider_set_window (CajaWidgetViewProvider *provider,
                                          GtkWindow *window);

Set parent GtkWindow of this CajaWidgetViewProvider.

#### Parameters

provider | a CajaWidgetViewProvider |
window | parent GtkWindow |

### caja_widget_view_provider_add_file ()

    void
    caja_widget_view_provider_add_file (CajaWidgetViewProvider *provider,
                                        CajaFile *file,
                                        CajaFile *directory);

Add a file of this location into the widget view.

#### Parameters

provider | a CajaWidgetViewProvider |
file | add a CajaFile into the widget view. |
directory | the directory of the file. |

### caja_widget_view_provider_get_first_visible_file ()

    gchar *
    caja_widget_view_provider_get_first_visible_file
                                   (CajaWidgetViewProvider *provider);

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

#### Parameters

provider | a CajaWidgetViewProvider |

#### Returns

the first visible file.

### caja_widget_view_provider_get_item_count ()

    guint
    caja_widget_view_provider_get_item_count
                                   (CajaWidgetViewProvider *provider);

#### Parameters

provider | a CajaWidgetViewProvider |

#### Returns

The item count of this CajaWidgetViewProvider

### caja_widget_view_provider_clear ()

    void
    caja_widget_view_provider_clear (CajaWidgetViewProvider *provider);

Clear the content of this widget view.

#### Parameters

provider | a CajaWidgetViewProvider |

## Types and Values

### CajaWidgetViewProvider

    typedef struct _CajaWidgetViewProvider CajaWidgetViewProvider;

### struct CajaWidgetViewProviderIface

    struct CajaWidgetViewProviderIface {
        GTypeInterface g_iface;

        gboolean  (*supports_uri)   (CajaWidgetViewProvider *provider,
                                     const char *uri,
                                     GFileType file_type,
                                     const char *mime_type);
        GtkWidget* (*get_widget)     (CajaWidgetViewProvider *provider);
        void       (*add_file)       (CajaWidgetViewProvider *provider, CajaFile *file, CajaFile *directory);
        void       (*set_location)   (CajaWidgetViewProvider *provider, const char *location);
        void       (*set_window)     (CajaWidgetViewProvider *provider, GtkWindow *window);
        guint      (*get_item_count) (CajaWidgetViewProvider *provider);
        gchar*     (*get_first_visible_file) (CajaWidgetViewProvider *provider);
        void       (*clear)          (CajaWidgetViewProvider *provider);
    };

Interface for extensions to provide widgets view for content.

#### Members

`supports_uri` () | Whether this extension works for this uri |
`get_widget` () | Returns a GtkWidget. See `caja_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. |