## Shell Utilities

Shell Utilities — high-level utilities with shell integration

## Synopsis

    #include <shell/e-shell-utils.h>

    void                e_shell_configure_ui_manager        (EShell *shell,
                                                             EUIManager *ui_manager);
    void                e_shell_configure_web_view          (EShell *shell,
                                                             EWebView *web_view);
    GFile *             e_shell_run_open_dialog             (EShell *shell,
                                                             const gchar *title,
                                                             GtkCallback customize_func,
                                                             gpointer customize_data);
    GFile *             e_shell_run_save_dialog             (EShell *shell,
                                                             const gchar *title,
                                                             const gchar *suggestion,
                                                             const gchar *filters,
                                                             GtkCallback customize_func,
                                                             gpointer customize_data);
    guint               e_shell_utils_import_uris           (EShell *shell,
                                                             gchar **uris);
    void                e_shell_hide_widgets_for_express_mode
                                                            (EShell *shell,
                                                             GtkBuilder *builder,
                                                             const gchar *widget_name,
                                                             ...);

## Description

## Details

### e_shell_configure_ui_manager ()

    void                e_shell_configure_ui_manager        (EShell *shell,
                                                             EUIManager *ui_manager);

Adds shell integration to `ui_manager`. In particular, it keeps `ui_manager`'s EUIManager:express-mode property synchronized with `shell`'s EShell:express-mode property.

`shell` : | an EShell
`ui_manager` : | an EUIManager

### e_shell_configure_web_view ()

    void                e_shell_configure_web_view          (EShell *shell,
                                                             EWebView *web_view);

Adds shell integration to `web_view`. In particular, it configures `web_view` to honor the printing and save-to-disk lockdown options.

`shell` : | an EShell
`web_view` : | an EWebView

### e_shell_run_open_dialog ()

    GFile *             e_shell_run_open_dialog             (EShell *shell,
                                                             const gchar *title,
                                                             GtkCallback customize_func,
                                                             gpointer customize_data);

Runs a GtkFileChooserDialog in open mode with the given title and returns the selected GFile. It automatically remembers the selected folder. If `customize_func` is provided, the function is called just prior to running the dialog (the file chooser is the first argument, `customize` data is the second). If the user cancels the dialog the function will return `NULL`.

`shell` : | an EShell
`title` : | file chooser dialog title
`customize_func` : | optional dialog customization function
`customize_data` : | optional data to pass to `customize_func`
Returns : | the GFile to open, or `NULL`

### e_shell_run_save_dialog ()

    GFile *             e_shell_run_save_dialog             (EShell *shell,
                                                             const gchar *title,
                                                             const gchar *suggestion,
                                                             const gchar *filters,
                                                             GtkCallback customize_func,
                                                             gpointer customize_data);

Runs a GtkFileChooserDialog in save mode with the given title and returns the selected GFile. It automatically remembers the selected folder. If `customize_func` is provided, the function is called just prior to running the dialog (the file chooser is the first argument, `customize_data` is the second). If the user cancels the dialog the function will return `NULL`.

With non-`NULL` `filters` will be added also file filters to the dialog. The string format is "pat1:mt1;pat2:mt2:...", where 'pat' is a pattern and 'mt' is a MIME type for the pattern to be used. There can be more than one MIME type, those are separated by comma.

`shell` : | an EShell
`title` : | file chooser dialog title
`suggestion` : | file name suggestion, or `NULL`
`filters` : | Possible filters for dialog, or `NULL`
`customize_func` : | optional dialog customization function
`customize_data` : | optional data to pass to `customize_func`
Returns : | the GFile to save to, or `NULL`

### e_shell_utils_import_uris ()

    guint               e_shell_utils_import_uris           (EShell *shell,
                                                             gchar **uris);

Imports given URIs to Evolution, giving user a choice what to import if more than one importer can be applied, and where to import it, if the importer itself is configurable.

URIs should be either a filename or URI of form file://. All others are skipped.

`shell` : | The EShell instance
`uris` : | `NULL`-terminated list of URIs to import
Returns : | the number of URIs successfully handled

### e_shell_hide_widgets_for_express_mode ()

    void                e_shell_hide_widgets_for_express_mode
                                                            (EShell *shell,
                                                             GtkBuilder *builder,
                                                             const gchar *widget_name,
                                                             ...);

If Evolution is running in Express mode (i.e. if the specified `shell` is in Express mode), then this function will hide a list of widgets, based on their specified names. The list of names must be NULL-terminated, and each element of that list must be the name of a widget present in `builder`. Those widgets will then get hidden.

This can be used to simplify preference dialogs and such in an easy fashion, for use in Express mode.

If Evolution is not running in Express mode, this function does nothing.

`shell` : | an EShell
`builder` : | a GtkBuilder
`widget_name` : | NULL-terminated list of strings
`...` : |