util

util

Functions

Description

Functions

phosh_async_error_warn()

#define             phosh_async_error_warn(err, ...)

Prints a warning when err is 'real' error. If it merely represents a canceled operation it just logs a debug message. This is useful to avoid this common pattern in async callbacks.

Parameters

err

The error to check and print.

[nullable]

...

Format string followed by parameters to insert into the format string (as with printf())

 

Returns

TRUE if err is cancellation.


phosh_dbus_service_error_warn()

#define             phosh_dbus_service_error_warn(err, ...)

Prints a warning when err is 'real' error. If it merely indicates that the DBus service is not present at all it just logs a debug message.

Parameters

err

The error to check and print.

[nullable]

...

Format string followed by parameters to insert into the format string (as with printf())

 

Returns

TRUE if err is cancellation.


phosh_cp_widget_destroy ()

void
phosh_cp_widget_destroy (void *widget);

phosh_get_desktop_app_info_for_app_id ()

GDesktopAppInfo *
phosh_get_desktop_app_info_for_app_id (const char *app_id);

Looks up an app info object for specified application ID. Tries a bunch of transformations in order to maximize compatibility with X11 and non-GTK applications that may not report the exact same string as their app-id and in their desktop file.

Parameters

app_id

the app_id

 

Returns

GDesktopAppInfo for requested app_id.

[transfer full]


phosh_munge_app_id ()

gchar *
phosh_munge_app_id (const gchar *app_id);

Munges an app_id according to the rules used by gnome-shell, feedbackd and phoc for gsettings:

Parameters

app_id

the app_id

 

Returns

The munged_app id


phosh_strip_suffix_from_app_id ()

char *
phosh_strip_suffix_from_app_id (const char *app_id);

Strip the desktop suffix from app_id.

Parameters

app_id

the app_id

 

Returns

The munged_app id.

[transfer full]


phosh_find_systemd_session ()

gboolean
phosh_find_systemd_session (char **session_id);

phosh_error_warnv ()

gboolean
phosh_error_warnv (const char *log_domain,
                   GError *err,
                   GQuark domain,
                   int code,
                   const gchar *fmt,
                   ...);

phosh_create_shm_file ()

int
phosh_create_shm_file (off_t size);

Create a file share memory file of the given size.

Parameters

size

The file size

 

Returns

a file descriptor on success or -1 on error.


phosh_util_escape_markup ()

char *
phosh_util_escape_markup (const char *markup,
                          gboolean allow_markup);

Escapes the given markup either fully or (when allow_markup is TRUE) in a way that is suitable for a notification body

Parameters

markup

The markup to escape

 

allow_markup

Whether to allow certain markup

 

Returns

The escaped text.

[transfer full]


phosh_util_local_date ()

char *
phosh_util_local_date (void);

phosh_util_gesture_is_touch ()

gboolean
phosh_util_gesture_is_touch (GtkGestureSingle *gesture);

phosh_util_have_gnome_software ()

gboolean
phosh_util_have_gnome_software (gboolean scan);

Parameters

scan

Whether to scan $PATH again

 

Returns

the (cached) answer if gnome-software can be found in the path.


phosh_util_toggle_style_class ()

void
phosh_util_toggle_style_class (GtkWidget *widget,
                               const char *style_class,
                               gboolean toggle);

Adds or removes the specified style class on the widget.

Parameters

widget

Widget to change styling of

 

style_class

The name of CSS class

 

toggle

Whether the class should be set or unset

 

phosh_util_get_stylesheet ()

const char *
phosh_util_get_stylesheet (const char *theme_name);

Parameters

theme_name

A theme name

 

Returns

The stylesheet to be used for the given theme