## IBusObservedPath

IBusObservedPath — Path object of IBus.

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    struct              IBusObservedPath;
    struct              IBusObservedPathClass;
    gboolean            ibus_observed_path_check_modification
                                                            (IBusObservedPath *path);
    IBusObservedPath *  ibus_observed_path_new              (const gchar *path,
                                                             gboolean fill_stat);
    IBusObservedPath *  ibus_observed_path_new_from_xml_node
                                                            (XMLNode *node,
                                                             gboolean fill_stat);
    void                ibus_observed_path_output           (IBusObservedPath *path,
                                                             GString *output,
                                                             gint indent);
    GList *             ibus_observed_path_traverse         (IBusObservedPath *path,
                                                             gboolean dir_only);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusSerializable
                         +----IBusObservedPath

## Description

IBusObservedPath provides methods for file path manipulation, such as monitor modification, directory tree traversal.

## Details

### struct IBusObservedPath

    struct IBusObservedPath {
        gchar *path;
        glong mtime;
        gboolean is_dir;
        gboolean is_exist;
    };

Data structure of IBusObservedPath.

gchar *`path`; | Path to be handled.
glong `mtime`; | Modified time.
gboolean `is_dir`; | Whether the file is the path directory.
gboolean `is_exist`; | Whether the file exists.

### struct IBusObservedPathClass

    struct IBusObservedPathClass {
        IBusSerializableClass parent;

        /* class members */
    };

### ibus_observed_path_check_modification ()

    gboolean            ibus_observed_path_check_modification
                                                            (IBusObservedPath *path);

Checks whether the path is modified by comparing the mtime in object and mtime in file system. Returns TRUE if imtime is changed, otherwise FALSE.

`path` : | An IBusObservedPath.
Returns : | TRUE if mtime is changed; FALSE otherwise.

### ibus_observed_path_new ()

    IBusObservedPath *  ibus_observed_path_new              (const gchar *path,
                                                             gboolean fill_stat);

New an IBusObservedPath from an XML node.

`path` : | The path string.
`fill_stat` : | Auto-fill the path status.
Returns : | A newly allocated IBusObservedPath.

### ibus_observed_path_new_from_xml_node ()

    IBusObservedPath *  ibus_observed_path_new_from_xml_node
                                                            (XMLNode *node,
                                                             gboolean fill_stat);

New an IBusObservedPath from an XML node.

`node` : | An XML node that contain path.
`fill_stat` : | Auto-fill the path status.
Returns : | A newly allocated IBusObservedPath.

### ibus_observed_path_output ()

    void                ibus_observed_path_output           (IBusObservedPath *path,
                                                             GString *output,
                                                             gint indent);

Append the observed path to a string with following format: <path mtime="<i>modified time</i>" ><i>path</i></path>

`path` : | An IBusObservedPath.
`output` : | Path is appended to.
`indent` : | number of indent.

### ibus_observed_path_traverse ()

    GList *             ibus_observed_path_traverse         (IBusObservedPath *path,
                                                             gboolean dir_only);

Recursively traverse the path and put the files and subdirectory in to a newly allocated GLists, if the `path` is a directory. Otherwise returns NULL.

`path` : | An IBusObservedPath.
`dir_only` : | Only looks for subdirs, not files
Returns : | A newly allocate GList which holds content in path; NULL if `path` is not directory. [element-type IBusObservedPath]