Functions

util_activate_ui (action, arg)

util_activate_ui_sync (action, arg)

util_empty_with_confirmation (client, settings, history)

util_empty_with_confirmation_sync (client, settings, history)

util_ensure_history_dir_exists (settings)

util_get_dbus_au_result (variant, len)

util_get_dbus_item_result (variant)

util_get_dbus_items_result (variant)

util_get_history_dir ()

util_get_history_dir_path ()

util_get_history_file (name, extension)

util_get_history_file_path (name, extension)

util_has_gnome_shell ()

util_read_pid_file (component)

util_replace (text, pattern, substitution)

util_spawn (app)

util_spawn_sync (app)

util_write_pid_file (component)

util_xml_decode (text)

util_xml_encode (text)

Details

GPaste.util_activate_ui(action, arg)
Parameters:

Activate an action on a GPaste app

GPaste.util_activate_ui_sync(action, arg)
Parameters:
Raises:

GLib.Error

Returns:

whether the action was successful

Return type:

bool

activate an action from GPaste Ui

GPaste.util_empty_with_confirmation(client, settings, history)
Parameters:

Empty a history after confirmation. Confirmation is skipped if GPaste is configured to do so.

GPaste.util_empty_with_confirmation_sync(client, settings, history)
Parameters:
Raises:

GLib.Error

Returns:

whether the action was successful

Return type:

bool

Empty a history after confirmation. Confirmation is skipped if GPaste is configured to do so.

GPaste.util_ensure_history_dir_exists(settings)
Parameters:

settings (GPaste.Settings) – a GPaste.Settings instance

Returns:

where it exists or if there was an error creating it

Return type:

bool

Ensure the history dir exists

GPaste.util_get_dbus_au_result(variant, len)
Parameters:
Return type:

int

GPaste.util_get_dbus_item_result(variant)
Parameters:

variant (GLib.Variant) – a GLib.Variant

Returns:

The item

Return type:

GPaste.ClientItem

Get the “(ss)” GLib.Variant as an item

GPaste.util_get_dbus_items_result(variant)
Parameters:

variant (GLib.Variant) – a GLib.Variant

Returns:

The items

Return type:

[GPaste.ClientItem]

Get the “a(ss)” GLib.Variant as a list of items

GPaste.util_get_history_dir()
Returns:

the directory

Return type:

Gio.File

Get the directory where we store the history

GPaste.util_get_history_dir_path()
Returns:

the directory path

Return type:

str

Get the path to the directory where we store the history

GPaste.util_get_history_file(name, extension)
Parameters:
  • name (str) – the name of the history

  • extension (str) – the file extension

Returns:

the file

Return type:

Gio.File

Get the file in which we store the history

GPaste.util_get_history_file_path(name, extension)
Parameters:
  • name (str) – the name of the history

  • extension (str) – the file extension

Returns:

the file path

Return type:

str

Get the path to the file in which we store the history

GPaste.util_has_gnome_shell()
Returns:

True if gnome-shell is installed

Return type:

bool

Check whether gnome-shell is installed or not

GPaste.util_read_pid_file(component)
Parameters:

component (str) – The component we’re handling

Returns:

the pid

Return type:

int

Read the pid file

GPaste.util_replace(text, pattern, substitution)
Parameters:
  • text (str) –

  • pattern (str) –

  • substitution (str) –

Return type:

str

GPaste.util_spawn(app)
Parameters:

app (str) – the GPaste app to spawn

spawn a GPaste app

GPaste.util_spawn_sync(app)
Parameters:

app (str) – the GPaste app to spawn

Raises:

GLib.Error

Returns:

whether the spawn was successful

Return type:

bool

spawn a GPaste app

GPaste.util_write_pid_file(component)
Parameters:

component (str) – The component we’re handling

Write the pid file

GPaste.util_xml_decode(text)
Parameters:

text (str) – The text to decode

Returns:

the decoded text

Return type:

str

Decode the text to its original pre-xml form

GPaste.util_xml_encode(text)
Parameters:

text (str) – The text to encode

Returns:

the encoded text

Return type:

str

Encode the text into its xml form