## File properties dialog

File properties dialog — Dialog window for changing properties of file.

## Functions

GtkDialog * | fm_file_properties_widget_new ()
gboolean | fm_show_file_properties ()
gboolean | fm_file_properties_add_for_mime_type ()

## Types and Values

struct | FmFilePropertiesExtensionInit
#define | FM_MODULE_gtk_file_prop_VERSION
extern FmFilePropertiesExtensionInit | fm_module_init_gtk_file_prop

## Description

`include` : libfm/fm-gtk.h

The file properties dialog is a window with few tabs and buttons "OK" and "Cancel". Most of content of those tabs is handled by the widget itself but there is a possibility to change its content for some file type. See `fm_file_properties_add_for_mime_type()` for details.

Default content of tabs of file properties dialog follows (each tab has a GtkAlignment element, tab ids below meant of those):

Tab 1: contains GtkTable (id general_table) with items:

- GtkImage (id icon) : file icon, eventbox: id icon_eventbox

- GtkLabel (id file) : reserved (hidden), hidden label: id file_label

- GtkEntry (id name) : label: "Name"

- GtkLabel (id dir) : label: "Location"

- GtkLabel (id target) : label: "Target", id target_label

- GtkLabel (id type) : label: "File type"

- GtkComboBox (id open_with) : label: "Open with", id open_with_label

- GtkLabel (id total_files) : (hidden) label: "Total count of files", id total_files_label

- GtkLabel (id total_size) : label: "Total Size of Files", id total_size_label

- GtkLabel (id size_on_disk) : label: "Size on Disk", id size_on_disk_label

- GtkLabel (id mtime) : label: "Last Modification", id mtime_label

- GtkLabel (id atime) : label: "Last Access", id atime_label

- GtkLabel (id ctime) : (hidden) label: "Last Permissions Change", id ctime_label

Tab 2: id permissions_tab, contains items inside:

- GtkEntry (id owner) : label: "Owner", id owner_label

- GtkEntry (id group) : label: "Group", id group_label

- GtkComboBox (id read_perm) : label: "View content"

- GtkComboBox (id write_perm) : label: "Change content"

- GtkComboBox (id exec_perm) : label: "Execute", id exec_label

- GtkComboBox (id flags_set_file) : label: "Special bits", id flags_label

- GtkComboBox (id flags_set_dir) : share the place with flags_set_file

- GtkCheckButton (id hidden) "Hidden file"

Tab 3: id extra_tab (hidden), empty, label: id extra_tab_label

Since `gtk_table_get_size()` is available only for GTK 2.22 ... GTK 3.4 it is not generally recommended to change size of GtkTable but be also aware that `gtk_table_attach()` is marked deprecated in GTK 3.4 though.

Widget sets icon activatable if target file supports icon change. If user changes icon then its name (either themed name or file path) will be stored as GQuark fm_qdata_id in GtkImage "icon" (see above).

Widget sets name entry editable if target file supports renaming. Both icon name and file name will be checked after extensions are finished therefore extensions have a chance to reset the data and widget will not do own processing.

## Functions

### fm_file_properties_widget_new ()

    GtkDialog *
    fm_file_properties_widget_new (FmFileInfoList *files,
                                   gboolean toplevel);

Creates new dialog widget for change properties of `files` .

#### Parameters

files | list of files |
toplevel | choose appearance of dialog |

#### Returns

a new widget.

[transfer full]

Since: 0.1.0

### fm_show_file_properties ()

    gboolean
    fm_show_file_properties (GtkWindow *parent,
                             FmFileInfoList *files);

Creates and shows file properties dialog for `files` .

#### Parameters

parent | a window to put dialog over it |
files | list of files |

#### Returns

`TRUE`.

Since: 0.1.0

### fm_file_properties_add_for_mime_type ()

    gboolean
    fm_file_properties_add_for_mime_type (const char *mime_type,
                                          FmFilePropertiesExtensionInit *callbacks);

Adds a handler for some mime type into file properties dialog. The handler will be used if file properties dialog is opened for single file or for few files of the same type to extend its functionality. The value "*" of `mime_type` has special meaning - the handler will be used for file types where no other extension is applied. No wildcards are allowed otherwise.

#### Parameters

mime_type | mime type to add handler for |
callbacks | table of handler callbacks |

#### Returns

`TRUE` if handler was added successfully.

Since: 1.2.0

## Types and Values

### struct FmFilePropertiesExtensionInit

    struct FmFilePropertiesExtensionInit {
        gpointer (*init)(GtkBuilder *ui, gpointer uidata, FmFileInfoList *files);
        void (*finish)(gpointer data, gboolean cancelled);
    };

The structure describing callbacks for File Properties dialog extension specific for some file type.

The `init` callback is called before dialog window is opened. Callback can disable or enable elements in dialog window, add triggers on those elements, append new elements, etc. Callback gets three arguments: the actual UI from builder, internal widget data pointer, and file infos list. Internal widget data pointer may be used to block widget builtin signal handler (that may be required if extension has own handler for some GtkEntry element). Callback should return some own internal data pointer which will be used as argument for `finish` callback later.

The `finish` callback is called before dialog window is closed. It gets two arguments: the data pointer that was returned by `init` callback before and boolean value indicating if dialog was closed not by "OK" button. Callback should free any resources allocated by `init` callback before.

This structure is used for "gtk_file_prop" module initialization. The key for module of this type is content type (MIME name) to support. The value "*" has special meaning - the module will be used for file types where no other extension is applied. No wildcards are allowed otherwise.

#### Members

`init` () | callback to make ui fields specific to file type |
`finish` () | callback to optionally apply changes |

Since: 1.2.0

### FM_MODULE_gtk_file_prop_VERSION

    #define FM_MODULE_gtk_file_prop_VERSION 1

### fm_module_init_gtk_file_prop

    extern FmFilePropertiesExtensionInit fm_module_init_gtk_file_prop;