Top | ![]() |
![]() |
![]() |
![]() |
enum | EFocus |
enum | ERestoreWindowFlags |
#define | E_ASCII_DTOSTR_BUF_SIZE |
#define | E_UTILS_LIGHTNESS_MULT |
#define | E_UTILS_DARKNESS_MULT |
#define | E_UTILS_DEFAULT_THEME_BG_COLOR |
#define | E_UTILS_DEFAULT_THEME_BASE_COLOR |
#define | E_UTILS_DEFAULT_THEME_FG_COLOR |
#define | E_UTILS_DEFAULT_THEME_TEXT_COLOR |
#define | E_UTILS_DEFAULT_THEME_SELECTED_BG_COLOR |
#define | E_UTILS_DEFAULT_THEME_SELECTED_FG_COLOR |
#define | E_UTILS_DEFAULT_THEME_UNFOCUSED_SELECTED_BG_COLOR |
#define | E_UTILS_DEFAULT_THEME_UNFOCUSED_SELECTED_FG_COLOR |
ESupportedLocales |
void e_show_uri (GtkWindow *parent
,const gchar *uri
);
Launches the default application to show the given URI. The URI must
be of a form understood by GIO. If the URI cannot be shown, it presents
a dialog describing the error. The dialog is set as transient to parent
if parent
is non-NULL
.
void e_display_help (GtkWindow *parent
,const gchar *link_id
);
Opens the user documentation to the section given by link_id
, or to the
table of contents if link_id
is NULL
. If the user documentation cannot
be opened, it presents a dialog describing the error. The dialog is set
as transient to parent
if parent
is non-NULL
.
void e_restore_window (GtkWindow *window
,const gchar *settings_path
,ERestoreWindowFlags flags
);
This function can restore one of or both a window's size and position
using GSettings keys at settings_path
which conform to the relocatable
schema "org.gnome.evolution.window".
If E_RESTORE_WINDOW_SIZE is present in flags
, restore window
's
previously recorded size and maximize state.
If E_RESTORE_WINDOW_POSITION is present in flags
, move window
to
the previously recorded screen coordinates.
The respective GSettings values will be updated when the window is resized and/or moved.
GtkWidget * e_builder_get_widget (GtkBuilder *builder
,const gchar *widget_name
);
Gets the widget named widget_name
. Note that this function does not
increment the reference count of the returned widget. If widget_name
could not be found in the builder
's object tree, a run-time
warning is emitted since this usually indicates a programming error.
This is a convenience function to work around the awkwardness of GtkBuilder returning GObject pointers, when the vast majority of the time you want a GtkWidget pointer.
If you need something from builder
other than a GtkWidget, or you
want to test for the existence of some widget name without incurring
a run-time warning, use gtk_builder_get_object()
.
void e_load_ui_builder_definition (GtkBuilder *builder
,const gchar *basename
);
Loads a UI definition into builder
from Evolution's UI directory.
Failure here is fatal, since the application can't function without
its UI definitions.
void e_categories_add_change_hook (GHookFunc func
,gpointer object
);
A saner alternative to e_categories_register_change_listener()
.
Adds a hook function to be called when a category is added, removed or
modified. If object
is not NULL
, the hook function is automatically
removed when object
is finalized.
gdouble e_flexible_strtod (const gchar *nptr
,gchar **endptr
);
Converts a string to a gdouble value. This function detects strings either in the standard C locale or in the current locale.
This function is typically used when reading configuration files or other non-user input that should not be locale dependent, but may have been in the past. To handle input from the user you should normally use the locale-sensitive system strtod function.
To convert from a double to a string in a locale-insensitive way, use
g_ascii_dtostr
.
gchar * e_ascii_dtostr (gchar *buffer
,gint buf_len
,const gchar *format
,gdouble d
);
Converts a double to a string, using the '.' as decimal_point. To format the number you pass in a printf-style formating string. Allowed conversion specifiers are eEfFgG.
If you want to generates enough precision that converting
the string back using g_strtod
gives the same machine-number
(on machines with IEEE compatible 64bit doubles) use the format
string "%.17g". If you do this it is guaranteed that the size
of the resulting string will never be larger than
G_ASCII_DTOSTR_BUF_SIZE
bytes.
gchar *
e_str_without_underscores (const gchar *string
);
Strips underscores from a string in the same way
gtk_label_new_with_mnemonics
does. The returned string should be freed
using g_free()
.
GString * e_str_replace_string (const gchar *text
,const gchar *find
,const gchar *replace
);
Replaces every occurrence of the string before
with the string after
in
the string text
and returns a GString with result that should be freed
with g_string_free()
.
gboolean
e_str_is_empty (const gchar *value
);
Returns whether a string is NULL
, the empty string, or completely made up of
whitespace characters.
Since: 3.56
guint32
e_rgba_to_value (const GdkRGBA *rgba
);
Converts GdkRGBA to a 24-bit RGB color value
void e_utils_get_theme_color (GtkWidget *widget
,const gchar *color_names
,const gchar *fallback_color_ident
,GdkRGBA *rgba
);
Reads named theme color from a GtkStyleContext of widget
.
The color_names
are read one after another from left to right,
the next are meant as fallbacks, in case the theme doesn't
define the previous color. If none is found then the fallback_color_ident
is set to rgba
.
GdkRGBA
e_utils_get_text_color_for_background (const GdkRGBA *bg_rgba
);
gint (*ESortCompareFunc) (gconstpointer first
,gconstpointer second
,gpointer closure
);
void e_bsearch (gconstpointer key
,gconstpointer base
,gsize nmemb
,gsize size
,ESortCompareFunc compare
,gpointer closure
,gsize *start
,gsize *end
);
gsize e_strftime_fix_am_pm (gchar *str
,gsize max
,const gchar *fmt
,const struct tm *tm
);
gsize e_utf8_strftime_fix_am_pm (gchar *str
,gsize max
,const gchar *fmt
,const struct tm *tm
);
gsize e_utf8_strftime_match_lc_messages (gchar *string
,gsize max
,const gchar *fmt
,const struct tm *tm
);
The UTF-8 equivalent of e_strftime()
, which also
makes sure that the locale used for time and date
formatting matches the locale used by the
application so that, for example, the quoted
message header produced by the mail composer in a
reply uses only one locale (i.e. LC_MESSAGES, where
available, overrides LC_TIME for consistency).
string |
The string to store the result in. |
|
max |
The size of the |
|
fmt |
The formatting to use on |
|
tm |
The time value to format. |
Since: 3.22
const gchar * e_get_month_name (GDateMonth month
,gboolean abbreviated
);
Returns the localized name for month
. If abbreviated
is TRUE
,
returns the locale's abbreviated month name.
const gchar * e_get_weekday_name (GDateWeekday weekday
,gboolean abbreviated
);
Returns the localized name for weekday
. If abbreviated
is TRUE
,
returns the locale's abbreviated weekday name.
GDateWeekday
e_weekday_get_next (GDateWeekday weekday
);
Returns the GDateWeekday after weekday
.
GDateWeekday
e_weekday_get_prev (GDateWeekday weekday
);
Returns the GDateWeekday before weekday
.
GDateWeekday e_weekday_add_days (GDateWeekday weekday
,guint n_days
);
Increments weekday
by n_days
.
GDateWeekday e_weekday_subtract_days (GDateWeekday weekday
,guint n_days
);
Decrements weekday
by n_days
.
guint e_weekday_get_days_between (GDateWeekday weekday1
,GDateWeekday weekday2
);
Counts the number of days starting at weekday1
and ending at weekday2
.
gint
e_weekday_to_tm_wday (GDateWeekday weekday
);
Converts a GDateWeekday to the numbering used in struct tm.
GDateWeekday
e_weekday_from_tm_wday (gint tm_wday
);
Converts a weekday in the numbering used in struct tm to a GDateWeekday.
gchar * e_util_guess_mime_type (const gchar *filename
,gboolean localfile
);
Tries to determine the MIME type for filename
. Free the returned
string with g_free()
.
GList *
e_util_dup_searchable_categories (void
);
Returns a list of the searchable categories, with each item being a UTF-8
category name. The list should be freed with g_list_free()
when done with it,
and the items should be freed with g_free()
. Everything can be freed at once
using g_list_free_full()
.
gboolean e_util_get_open_source_job_info (const gchar *extension_name
,const gchar *source_display_name
,gchar **description
,gchar **alert_ident
,gchar **alert_arg_0
);
Populates description
, alert_ident
and alert_arg_0
to be used
to open an ESource with extension extension_name
. The values
can be used for functions like e_alert_sink_submit_thread_job()
.
If TRUE is returned, then the caller is responsible to free
all description
, alert_ident
and alert_arg_0
with g_free()
,
when no longer needed.
extension_name |
an extension name of the source |
|
source_display_name |
an ESource's display name |
|
description |
a description to use. |
[out][transfer-full] |
alert_ident |
an alert ident to use on failure. |
[out][transfer-full] |
alert_arg_0 |
an alert argument 0 to use on failure. |
[out][transfer-full] |
TRUE, if the values for description
, alert_ident
and alert_arg_0
were set for the given extension_name
; when FALSE is returned, then
none of these out variables are changed.
Since: 3.16
void e_util_propagate_open_source_job_error (struct _EAlertSinkThreadJobData *job_data
,const gchar *extension_name
,GError *local_error
,GError **error
);
Propagates (and cosumes) the local_error
into the error
, eventually
changes alert_ident for the job_data
for well-known error codes,
where is available better error description.
job_data |
an EAlertSinkThreadJobData instance |
|
extension_name |
what extension name had beeing opened |
|
local_error |
a GError as obtained in a thread job; can be NULL for success. |
[allow none] |
error |
an output GError, to which propagate the |
[allow none] |
Since: 3.16
EClient * e_util_open_client_sync (struct _EAlertSinkThreadJobData *job_data
,struct _EClientCache *client_cache
,const gchar *extension_name
,ESource *source
,guint32 wait_for_connected_seconds
,GCancellable *cancellable
,GError **error
);
gboolean e_binding_transform_color_to_string (GBinding *binding
,const GValue *source_value
,GValue *target_value
,gpointer not_used
);
Transforms a GdkRGBA value to a color string specification.
gboolean e_binding_transform_string_to_color (GBinding *binding
,const GValue *source_value
,GValue *target_value
,gpointer not_used
);
Transforms a color string specification to a GdkRGBA.
gboolean e_binding_transform_source_to_uid (GBinding *binding
,const GValue *source_value
,GValue *target_value
,ESourceRegistry *registry
);
Transforms an ESource object to its UID string.
gboolean e_binding_transform_uid_to_source (GBinding *binding
,const GValue *source_value
,GValue *target_value
,ESourceRegistry *registry
);
Transforms an ESource UID string to the corresponding ESource object
in registry
.
gboolean e_binding_transform_text_non_null (GBinding *binding
,const GValue *source_value
,GValue *target_value
,gpointer user_data
);
Transforms a text value to a text value which is never NULL; an empty string is used instead of NULL.
gboolean e_binding_transform_text_to_uri (GBinding *binding
,const GValue *source_value
,GValue *target_value
,gpointer not_used
);
Transforms a URI string into a GUri. It expects the source object to be an ESourceExtension descendant, then it adds also the user name from its ESourceAuthentication extension.
gboolean e_binding_transform_uri_to_text (GBinding *binding
,const GValue *source_value
,GValue *target_value
,gpointer not_used
);
Transforms a GUri into a string.
GBinding * e_binding_bind_object_text_property (gpointer source
,const gchar *source_property
,gpointer target
,const gchar *target_property
,GBindingFlags flags
);
Installs a new text property object binding, using e_binding_bind_property_full()
,
with transform functions to make sure that a NULL pointer is not
passed in either way. Instead of NULL an empty string is used.
gulong e_signal_connect_notify (gpointer instance
,const gchar *notify_name
,GCallback c_handler
,gpointer user_data
);
This installs a special handler in front of c_handler
, which will
call the c_handler
only if the property value changed since the last
time it was checked. Due to this, these handlers cannot be disconnected
by by any of the g_signal_handlers_* functions, but only with the returned
handler ID. A convenient e_signal_disconnect_notify_handler()
was added
to make it easier.
gulong e_signal_connect_notify_after (gpointer instance
,const gchar *notify_name
,GCallback c_handler
,gpointer user_data
);
This installs a special handler in front of c_handler
, which will
call the c_handler
only if the property value changed since the last
time it was checked. Due to this, these handlers cannot be disconnected
by by any of the g_signal_handlers_* functions, but only with the returned
handler ID. A convenient e_signal_disconnect_notify_handler()
was added
to make it easier.
gulong e_signal_connect_notify_swapped (gpointer instance
,const gchar *notify_name
,GCallback c_handler
,gpointer user_data
);
This installs a special handler in front of c_handler
, which will
call the c_handler
only if the property value changed since the last
time it was checked. Due to this, these handlers cannot be disconnected
by by any of the g_signal_handlers_* functions, but only with the returned
handler ID. A convenient e_signal_disconnect_notify_handler()
was added
to make it easier.
gulong e_signal_connect_notify_object (gpointer instance
,const gchar *notify_name
,GCallback c_handler
,gpointer gobject
,GConnectFlags connect_flags
);
This installs a special handler in front of c_handler
, which will
call the c_handler
only if the property value changed since the last
time it was checked. Due to this, these handlers cannot be disconnected
by by any of the g_signal_handlers_* functions, but only with the returned
handler ID. A convenient e_signal_disconnect_notify_handler()
was added
to make it easier.
void e_signal_disconnect_notify_handler (gpointer instance
,gulong *handler_id
);
Convenient handler disconnect function to be used with
returned handler IDs from:
e_signal_connect_notify()
e_signal_connect_notify_after()
e_signal_connect_notify_swapped()
e_signal_connect_notify_object()
but not necessarily only with these functions.
GSettings *
e_util_ref_settings (const gchar *schema_id
);
Either returns an existing referenced GSettings object for the given schema_id
,
or creates a new one and remembers it for later use, to avoid having too many
GSettings objects created for the same schema_id
.
A GSettings for the given schema_id
. The returned GSettings object
is referenced, thus free it with g_object_unref()
when done with it.
Since: 3.16
void
e_util_cleanup_settings (void
);
Frees all the memory taken by e_util_ref_settings()
.
Since: 3.16
GdkPixbuf * e_misc_util_ref_pixbuf (const gchar *filename
,GError **error
);
Loads filename
as a GdkPixbuf and cached it in case it's needed
again, without a need to load it repeatedly.
filename |
a pixbuf file name to load |
|
error |
return location to store a GError on failure, or |
Since: 3.50
gboolean e_util_prompt_user (GtkWindow *parent
,const gchar *settings_schema
,const gchar *promptkey
,const gchar *tag
,...
);
Convenience function to query the user with a Yes/No dialog and a
"Do not show this dialog again" checkbox. If the user checks that
checkbox, then promptkey
is set to FALSE
, otherwise it is set to
TRUE
.
Returns TRUE
if the user clicks Yes or FALSE
otherwise.
void e_util_set_entry_issue_hint (GtkWidget *entry
,const gchar *hint
);
Sets a hint
on the secondary entry
icon about an entered value issue,
or unsets it, when the hint
is NULL
.
Since: 3.20
gchar *
e_util_save_image_from_clipboard (GtkClipboard *clipboard
);
Saves the image from clipboard
to a temporary file and returns its URI.
Since: 3.22
void
e_util_save_file_chooser_folder (GtkFileChooser *file_chooser
);
Saves the current folder of the file_chooser
, thus it could be used
by e_util_load_file_chooser_folder()
to open it in the last chosen folder.
Since: 3.24
void
e_util_load_file_chooser_folder (GtkFileChooser *file_chooser
);
Sets the current folder to the file_chooser
to the one previously saved
by e_util_save_file_chooser_folder()
. The function does nothing if none
or invalid is saved.
Since: 3.24
gboolean
e_util_get_webkit_developer_mode_enabled
(void
);
Whether WebKit developer mode is enabled. This is read only once, thus any changes in the GSettings property require restart of the Evolution.
Since: 3.24
gchar * e_util_next_uri_from_uri_list (guchar **uri_list
,gint *len
,gint *list_len
);
uri_list |
array of URIs separated by new lines |
|
len |
a length of the found URI. |
[out] |
list_len |
a length of the array. |
[out] |
Since: 3.26
void e_util_resize_window_for_screen (GtkWindow *window
,gint window_width
,gint window_height
,const GSList *children
);
Calculates the size of the window
considering preferred sizes of children
,
and shrinks the window
in case it won't be completely visible on the screen
it is assigned to.
window |
a GtkWindow |
|
window_width |
the |
|
window_height |
the |
|
children |
(nullable): a GSList with children to calculate with. |
[element-type GtkWidget] |
Since: 3.26
gboolean e_util_query_ldap_root_dse_sync (const gchar *host
,guint16 port
,ESourceLDAPSecurity security
,gchar ***out_root_dse
,GCancellable *cancellable
,GError **error
);
Queries an LDAP server identified by host
and port
for supported
search bases and returns them as a NULL-terminated array of strings
at out_root_dse
. It sets out_root_dse
to NULL on error.
Free the returned out_root_dse
with g_strfreev()
when no longer needed.
The function fails and sets error
to G_IO_ERROR_NOT_SUPPORTED when
Evolution had been compiled without LDAP support.
host |
an LDAP server host name |
|
port |
an LDAP server port |
|
security |
an |
|
out_root_dse |
NULL-terminated array of the server root DSE-s, or |
[out][transfer full] |
cancellable |
optional GCancellable object, or |
|
error |
return location for a GError, or |
Since: 3.28
gchar *
e_util_get_language_name (const gchar *language_tag
);
Since: 3.32
gboolean e_util_get_language_info (const gchar *language_tag
,gchar **out_language_name
,gchar **out_country_name
);
Splits language tag into a localized language name and country name (the variant).
The out_language_name
is always filled when the function returns TRUE
, but
the out_countr_name
can be NULL
. That's for cases when the language_tag
contains only the country part, like "en".
The function returns FALSE
when it could not decode language name from
the given language_tag
. When either of the out_language_name
and out_country_name
is non-NULL and the function returns TRUE
, then their respective values
should be freed with g_free()
, when no longer needed.
language_tag |
Language tag to get its name for, like "en_US" |
|
out_language_name |
Return location for the language name, or |
[out][nullable][transfer full] |
out_country_name |
Return location for the country name, or |
[out][nullable][transfer full] |
Since: 3.32
void
e_misc_util_free_global_memory (void
);
Frees global memory allocated by evolution-util library. This is usually called at the end of the application.
Since: 3.32
gboolean
e_util_can_preview_filename (const gchar *filename
);
Whether the filename
can be used to create a preview
in GtkFileChooser and such widgets. For example directories,
pipes and sockets cannot by used.
Since: 3.32
void e_util_markup_append_escaped (GString *buffer
,const gchar *format
,...
);
Appends escaped markup text into buffer
. This function is
similar to g_markup_printf_escaped()
, except it appends
the escaped text into a GString.
buffer |
a GString buffer to append escaped text to |
|
format |
printf-like format of the string to append |
|
... |
arguments for the format |
Since: 3.36
void e_util_markup_append_escaped_text (GString *buffer
,const gchar *text
);
Markup-escapes text
and appends it to buffer
.
buffer |
a GString buffer to append escaped text to |
|
text |
a text to escape and append to the buffer |
Since: 3.46
void
e_util_ensure_scrolled_window_height (GtkScrolledWindow *scrolled_window
);
gboolean e_util_setup_toolbar_icon_size (GtkToolbar *toolbar
,GtkIconSize default_size
);
gboolean e_util_link_requires_reference (const gchar *href
,const gchar *text
);
Checks whether the link's href
and the text
differ in a way that
they require a reference when converting it from HTML to text. Some
protocols can be completely ignored.
Since: 3.52
void
e_util_call_malloc_trim_limited (void
);
Calls e_util_call_malloc_trim()
, but not more often than once per 30 minutes.
Since: 3.52
void
e_util_connect_menu_detach_after_deactivate
(GtkMenu *menu
);
Connects a signal handler on a "deactivate" signal of the menu
and
calls gtk_menu_detach()
after the handler is invoked, which can cause
destroy of the menu
. The menu
should be already attached to a widget.
As the GAction-s are not executed immediately by the GTK, the detach can be
called only later, not in the deactivate signal handler. This function makes
it simpler and consistent to detach (and possibly free) the menu
after the user
dismisses it either by clicking elsewhere or by picking an item from it.
Since: 3.56
gboolean
e_util_ignore_accel_for_focused (GtkWidget *focused
);
Returns whether an accel key press should be ignored, due to the focused
might use it. Returns FALSE
, when the focused
is NULL
.
Since: 3.56