## thunar-util

thunar-util

## Functions

void | (*ThunarBookmarksFunc) ()
gchar * | thunar_util_str_get_extension ()
void | thunar_util_load_bookmarks ()
gboolean | thunar_util_looks_like_an_uri ()
gchar * | thunar_util_expand_filename ()
gchar * | thunar_util_humanize_file_time ()
GdkScreen * | thunar_util_parse_parent ()
time_t | thunar_util_time_from_rfc3339 ()
gchar * | thunar_util_change_working_directory ()
void | thunar_setup_display_cb ()
gchar * | thunar_util_next_new_file_name ()
gboolean | thunar_util_is_a_search_query ()
gchar * | thunar_util_strjoin_list ()
void | thunar_util_clip_view_background ()

## Types and Values

#define | THUNAR_THREADS_ENTER
#define | THUNAR_THREADS_LEAVE
enum | ThunarNextFileNameMode
extern const char * | SEARCH_PREFIX

## Description

## Functions

### ThunarBookmarksFunc ()

    void
    (*ThunarBookmarksFunc) (GFile *file,
                            const gchar *name,
                            gint row_num,
                            gpointer user_data);

### thunar_util_str_get_extension ()

    gchar *
    thunar_util_str_get_extension (const gchar *name);

Returns a pointer to the extension in `filename` .

This is an improved version of g_utf8_strrchr with improvements to recognize compound extensions like ".tar.gz" and ".desktop.in.in".

#### Parameters

filename | an UTF-8 filename |

#### Returns

pointer to the extension in `filename` or NULL.

### thunar_util_load_bookmarks ()

    void
    thunar_util_load_bookmarks (GFile *bookmarks_file,
                                ThunarBookmarksFunc foreach_func,
                                gpointer user_data);

### thunar_util_looks_like_an_uri ()

    gboolean
    thunar_util_looks_like_an_uri (const gchar *string);

### thunar_util_expand_filename ()

    gchar *
    thunar_util_expand_filename (const gchar *filename,
                                 GFile *working_directory,
                                 GError **error);

Takes a user-typed `filename` and expands a tilde at the beginning of the `filename` . It also resolves paths prefixed with '.' using the current working directory.

The caller is responsible to free the returned string using `g_free()` when no longer needed.

#### Parameters

filename | a local filename. |
working_directory | GFile of the current working directory. |
error | return location for errors or `NULL`. |

#### Returns

the expanded `filename` or `NULL` on error.

### thunar_util_humanize_file_time ()

    gchar *
    thunar_util_humanize_file_time (guint64 file_time,
                                    ThunarDateStyle date_style,
                                    const gchar *date_custom_style);

Returns a human readable date representation of the specified `file_time` . The caller is responsible to free the returned string using `g_free()` when no longer needed.

#### Parameters

file_time | a guint64 timestamp. |
date_style | the ThunarDateFormat used to humanize the `file_time` . |
date_custom_style | custom style to apply, if `date_style` is set to custom |

#### Returns

a human readable date representation of `file_time` according to the `date_format` .

### thunar_util_parse_parent ()

    GdkScreen *
    thunar_util_parse_parent (gpointer parent,
                              GtkWindow **window_return);

Determines the screen for the `parent` and returns that GdkScreen. If `window_return` is not `NULL`, the pointer to the GtkWindow is placed into it, or `NULL` if the window could not be determined.

#### Parameters

parent | a GtkWidget, a GdkScreen or `NULL`. |
window_return | return location for the toplevel GtkWindow or `NULL`. |

#### Returns

the GdkScreen for the `parent` .

### thunar_util_time_from_rfc3339 ()

    time_t
    thunar_util_time_from_rfc3339 (const gchar *date_string);

Decodes the `date_string` , which must be in the special RFC 3339 format `YYYY-MM-DDThh:mm:ss`. This method is used to decode deletion dates of files in the trash. See the Trash Specification for details.

#### Parameters

date_string | an RFC 3339 encoded date string. |

#### Returns

the time value matching the `date_string` or `0` if the `date_string` could not be parsed.

### thunar_util_change_working_directory ()

    gchar *
    thunar_util_change_working_directory (const gchar *new_directory);

### thunar_setup_display_cb ()

    void
    thunar_setup_display_cb (gpointer data);

### thunar_util_next_new_file_name ()

    gchar *
    thunar_util_next_new_file_name (ThunarFile *dir,
                                    const gchar *file_name,
                                    ThunarNextFileNameMode name_mode);

Returns a filename that is like `file_name` with the possible addition of a number to differentiate it from other similarly named files. In other words it searches `dir` for incrementally named files starting from `file_name` and returns the first available increment.

e.g. in a folder with the following files:

- file

- empty

- file_copy

Calling this functions with the above folder and `file_name` equal to 'file' the returned filename will be 'file 1' for the mode "new file".

The caller is responsible to free the returned string using `g_free()` when no longer needed.

#### Parameters

dir | the directory to search for a free filename |
file_name | the filename which will be used as the basis/default |
ThunarNextFileNameMode | To decide if the naming should follow "file copy","file link" or "new file" syntax |

#### Returns

pointer to the new filename.

### thunar_util_is_a_search_query ()

    gboolean
    thunar_util_is_a_search_query (const gchar *string);

#### Parameters

string | the string to check |

#### Returns

a boolean that is TRUE if `string` starts with 'Search: '.

### thunar_util_strjoin_list ()

    gchar *
    thunar_util_strjoin_list (GList *string_list,
                              const gchar *separator);

Joins a number of strings together to form one long string, with the optional separator inserted between each of them. It skips all the NULL values passed in the list. The returned string should be freed with `g_free()`. Similar to `g_strjoin()`.

The caller is responsible to free the returned text using `g_free()` when it is no longer needed

#### Parameters

data | list of strings which needs to be appended. |
separator | text which needs to be added as a seperator |

#### Returns

the concatenated string

### thunar_util_clip_view_background ()

    void
    thunar_util_clip_view_background (GtkCellRenderer *cell,
                                      cairo_t *cr,
                                      const GdkRectangle *background_area,
                                      GtkWidget *widget,
                                      GtkCellRendererState flags);

## Types and Values

### THUNAR_THREADS_ENTER

    #define             THUNAR_THREADS_ENTER

### THUNAR_THREADS_LEAVE

    #define             THUNAR_THREADS_LEAVE

### enum ThunarNextFileNameMode

#### Members

THUNAR_NEXT_FILE_NAME_MODE_NEW |  |
THUNAR_NEXT_FILE_NAME_MODE_COPY |  |
THUNAR_NEXT_FILE_NAME_MODE_LINK |  |

### SEARCH_PREFIX

    extern const char *SEARCH_PREFIX;