## gtr-utils

gtr-utils

## Synopsis

    gchar **            gtr_utils_split_string_in_words     (const gchar *string);
    xmlDocPtr           gtr_xml_new_doc                     (const gchar *name);
    xmlDocPtr           gtr_xml_open_file                   (const gchar *filename);
    GtkWidget *         gtr_gtk_button_new_with_stock_icon  (const gchar *label,
                                                             const gchar *stock_id);
    void                gtr_utils_menu_position_under_widget
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);
    void                gtr_utils_menu_position_under_tree_view
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);
    gboolean            gtr_utils_get_ui_objects            (const gchar *filename,
                                                             gchar **root_objects,
                                                             GtkWidget **error_widget,
                                                             const gchar *object_name,
                                                             ...);
    GSList *            gtr_utils_drop_get_locations        (GtkSelectionData *selection_data);
    gchar *             gtr_utils_escape_search_text        (const gchar *text);
    gchar *             gtr_utils_unescape_search_text      (const gchar *text);
    gboolean            g_utf8_caselessnmatch               (const gchar *s1,
                                                             const gchar *s2,
                                                             gssize n1,
                                                             gssize n2);
    void                gtr_utils_help_display              (GtkWindow *parent,
                                                             const gchar *doc_id,
                                                             const gchar *file_name);
    gchar *             gtr_utils_get_user_config_dir       (void);
    gchar *             gtr_utils_get_current_date          (void);
    gchar *             gtr_utils_get_current_time          (void);
    gchar *             gtr_utils_get_current_year          (void);
    void                gtr_utils_scan_dir                  (GFile *dir,
                                                             GSList **list,
                                                             const gchar *po_name);
    gchar *             gtr_utils_reduce_path               (const gchar *path);
    gchar *             gtr_utils_escape_underscores        (const gchar *text,
                                                             gssize length);
    gchar *             gtr_utils_get_file_from_pixmapsdir  (const gchar *filename);
    gchar *             gtr_utils_get_file_from_pkgdatadir  (const gchar *filename);
    gchar *             gtr_utils_get_datadir               (void);
    gchar *             gtr_utils_get_win32_plugindir       (void);

## Description

## Details

### gtr_utils_split_string_in_words ()

    gchar **            gtr_utils_split_string_in_words     (const gchar *string);

Process a text and split it in words using pango.

`string` : | the text to process
Returns : | an array of words of the processed text

### gtr_xml_new_doc ()

    xmlDocPtr           gtr_xml_new_doc                     (const gchar *name);

### gtr_xml_open_file ()

    xmlDocPtr           gtr_xml_open_file                   (const gchar *filename);

### gtr_gtk_button_new_with_stock_icon ()

    GtkWidget *         gtr_gtk_button_new_with_stock_icon  (const gchar *label,
                                                             const gchar *stock_id);

Convenience function to create a GtkButton with a stock image.

`label` : | the label of the button
`stock_id` : | the id of the stock image
Returns : | a new GtkButton

### gtr_utils_menu_position_under_widget ()

    void                gtr_utils_menu_position_under_widget
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);

It returns the position to popup a menu in a TreeView.

`menu` : | a GtkMenu
`x` : | the x position of the widget
`y` : | the y position of the widget
`user_data` : | the widget to get the position

### gtr_utils_menu_position_under_tree_view ()

    void                gtr_utils_menu_position_under_tree_view
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);

### gtr_utils_get_ui_objects ()

    gboolean            gtr_utils_get_ui_objects            (const gchar *filename,
                                                             gchar **root_objects,
                                                             GtkWidget **error_widget,
                                                             const gchar *object_name,
                                                             ...);

This function gets the requested objects from a GtkBuilder ui file. In case of error it returns FALSE and sets error_widget to a GtkLabel containing the error message to display.

`filename` : | the path to the gtk builder file
`root_objects` : | a NULL terminated list of root objects to load or NULL to load all objects
`error_widget` : | a pointer were a GtkLabel
`object_name` : | the name of the first object
`...` : | a pointer were the first object is returned, followed by more name / object pairs and terminated by NULL.
Returns : | FALSE if an error occurs, TRUE on success.

### gtr_utils_drop_get_locations ()

    GSList *            gtr_utils_drop_get_locations        (GtkSelectionData *selection_data);

### gtr_utils_escape_search_text ()

    gchar *             gtr_utils_escape_search_text        (const gchar *text);

### gtr_utils_unescape_search_text ()

    gchar *             gtr_utils_unescape_search_text      (const gchar *text);

### g_utf8_caselessnmatch ()

    gboolean            g_utf8_caselessnmatch               (const gchar *s1,
                                                             const gchar *s2,
                                                             gssize n1,
                                                             gssize n2);

### gtr_utils_help_display ()

    void                gtr_utils_help_display              (GtkWindow *parent,
                                                             const gchar *doc_id,
                                                             const gchar *file_name);

Shows the help for an specific document in the default help browser.

`parent` : | a GtkWindow
`doc_id` : | the name of the type of doc
`file_name` : | the name of the doc

### gtr_utils_get_user_config_dir ()

    gchar *             gtr_utils_get_user_config_dir       (void);

### gtr_utils_get_current_date ()

    gchar *             gtr_utils_get_current_date          (void);

### gtr_utils_get_current_time ()

    gchar *             gtr_utils_get_current_time          (void);

### gtr_utils_get_current_year ()

    gchar *             gtr_utils_get_current_year          (void);

### gtr_utils_scan_dir ()

    void                gtr_utils_scan_dir                  (GFile *dir,
                                                             GSList **list,
                                                             const gchar *po_name);

Scans the directory and subdirectories of `dir` looking for filenames remained with .po or files that matches `po_name`. `list` must be freed with g_slist_free_full (list, g_object_unref).

`dir` : | the dir to parse
`list` : | the list where to store the GFiles
`po_name` : | the name of the specific po file to search or NULL.

### gtr_utils_reduce_path ()

    gchar *             gtr_utils_reduce_path               (const gchar *path);

### gtr_utils_escape_underscores ()

    gchar *             gtr_utils_escape_underscores        (const gchar *text,
                                                             gssize length);

### gtr_utils_get_file_from_pixmapsdir ()

    gchar *             gtr_utils_get_file_from_pixmapsdir  (const gchar *filename);

### gtr_utils_get_file_from_pkgdatadir ()

    gchar *             gtr_utils_get_file_from_pkgdatadir  (const gchar *filename);

### gtr_utils_get_datadir ()

    gchar *             gtr_utils_get_datadir               (void);

### gtr_utils_get_win32_plugindir ()

    gchar *             gtr_utils_get_win32_plugindir       (void);