## gedit-utils

gedit-utils

## Synopsis

    #define             GBOOLEAN_TO_POINTER                 (i)
    #define             GPOINTER_TO_BOOLEAN                 (i)
    #define             IS_VALID_BOOLEAN                    (v)
    void                gedit_utils_menu_position_under_widget
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);
    void                gedit_utils_menu_position_under_tree_view
                                                            (GtkMenu *menu,
                                                             gint *x,
                                                             gint *y,
                                                             gboolean *push_in,
                                                             gpointer user_data);
    GtkWidget *         gedit_gtk_button_new_with_stock_icon
                                                            (const gchar *label,
                                                             const gchar *stock_id);
    GtkWidget *         gedit_dialog_add_button             (GtkDialog *dialog,
                                                             const gchar *text,
                                                             const gchar *stock_id,
                                                             gint response_id);
    gchar *             gedit_utils_escape_underscores      (const gchar *text,
                                                             gssize length);
    gchar *             gedit_utils_str_middle_truncate     (const gchar *string,
                                                             guint truncate_length);
    void                gedit_utils_set_atk_name_description
                                                            (GtkWidget *widget,
                                                             const gchar *name,
                                                             const gchar *description);
    void                gedit_utils_set_atk_relation        (GtkWidget *obj1,
                                                             GtkWidget *obj2,
                                                             AtkRelationType rel_type);
    gchar *             gedit_utils_escape_search_text      (const gchar *text);
    gchar *             gedit_utils_unescape_search_text    (const gchar *text);
    void                gedit_warning                       (GtkWindow *parent,
                                                             const gchar *format,
                                                             ...);
    gchar *             gedit_utils_make_valid_utf8         (const char *name);
    gchar *             gedit_utils_uri_get_dirname         (const char *uri);
    gchar *             gedit_utils_replace_home_dir_with_tilde
                                                            (const gchar *uri);
    guint               gedit_utils_get_current_workspace   (GdkScreen *screen);
    guint               gedit_utils_get_window_workspace    (GtkWindow *gtkwindow);
    gchar *             gedit_utils_make_canonical_uri_from_shell_arg
                                                            (const gchar *str);

## Description

## Details

### GBOOLEAN_TO_POINTER()

    #define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))

### GPOINTER_TO_BOOLEAN()

    #define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))

### IS_VALID_BOOLEAN()

    #define IS_VALID_BOOLEAN(v) (((v == TRUE) || (v == FALSE)) ? TRUE : FALSE)

### gedit_utils_menu_position_under_widget ()

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

### gedit_utils_menu_position_under_tree_view ()

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

### gedit_gtk_button_new_with_stock_icon ()

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

Returns : | . [transfer full]

### gedit_dialog_add_button ()

    GtkWidget *         gedit_dialog_add_button             (GtkDialog *dialog,
                                                             const gchar *text,
                                                             const gchar *stock_id,
                                                             gint response_id);

Returns : | . [transfer none]

### gedit_utils_escape_underscores ()

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

### gedit_utils_str_middle_truncate ()

    gchar *             gedit_utils_str_middle_truncate     (const gchar *string,
                                                             guint truncate_length);

### gedit_utils_set_atk_name_description ()

    void                gedit_utils_set_atk_name_description
                                                            (GtkWidget *widget,
                                                             const gchar *name,
                                                             const gchar *description);

This function sets up name and description for a specified gtk widget.

`widget` : | The Gtk widget for which name/description to be set
`name` : | Atk name string
`description` : | Atk description string

### gedit_utils_set_atk_relation ()

    void                gedit_utils_set_atk_relation        (GtkWidget *obj1,
                                                             GtkWidget *obj2,
                                                             AtkRelationType rel_type);

### gedit_utils_escape_search_text ()

    gchar *             gedit_utils_escape_search_text      (const gchar *text);

### Warning

`gedit_utils_escape_search_text` has been deprecated since version 3.10 and should not be used in newly-written code. Use `gtk_source_utils_escape_search_text()` instead.

### gedit_utils_unescape_search_text ()

    gchar *             gedit_utils_unescape_search_text    (const gchar *text);

### Warning

`gedit_utils_unescape_search_text` has been deprecated since version 3.10 and should not be used in newly-written code. Use `gtk_source_utils_unescape_search_text()` instead.

### gedit_warning ()

    void                gedit_warning                       (GtkWindow *parent,
                                                             const gchar *format,
                                                             ...);

### gedit_utils_make_valid_utf8 ()

    gchar *             gedit_utils_make_valid_utf8         (const char *name);

### gedit_utils_uri_get_dirname ()

    gchar *             gedit_utils_uri_get_dirname         (const char *uri);

Note: this function replace home dir with ~

### gedit_utils_replace_home_dir_with_tilde ()

    gchar *             gedit_utils_replace_home_dir_with_tilde
                                                            (const gchar *uri);

### gedit_utils_get_current_workspace ()

    guint               gedit_utils_get_current_workspace   (GdkScreen *screen);

Get the currently visible workspace for the GdkScreen.

If the X11 window property isn't found, 0 (the first workspace) is returned.

`screen` : | a GdkScreen

### gedit_utils_get_window_workspace ()

    guint               gedit_utils_get_window_workspace    (GtkWindow *gtkwindow);

Get the workspace the window is on

This function gets the workspace that the GtkWindow is visible on, it returns GEDIT_ALL_WORKSPACES if the window is sticky, or if the window manager doesn support this function

### gedit_utils_make_canonical_uri_from_shell_arg ()

    gchar *             gedit_utils_make_canonical_uri_from_shell_arg
                                                            (const gchar *str);