Functions¶
Details¶
- TelepathyGLib.asv_get_boolean(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
a boolean value for key
- Return type:
If a value for key in asv is present and boolean, return it, and set valid to
True
if valid is notNone
.Otherwise return
False
, and set valid toFalse
if valid is notNone
.New in version 0.7.9.
- TelepathyGLib.asv_get_boxed(asv, key, type)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look uptype (
GObject.GType
) – The type that the key’s value should have, which must be derived fromGObject.TYPE_BOXED
- Returns:
the value of key, or
None
- Return type:
If a value for key in asv is present and is of the desired type, return it.
Otherwise return
None
.The returned value is not copied, and is only valid as long as the value for key in asv is not removed or altered. Copy it, for instance with
GObject.boxed_copy
(), if you need to keep it for longer.New in version 0.7.9.
- TelepathyGLib.asv_get_bytes(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the string value of key, or
None
- Return type:
If a value for key in asv is present and is an array of bytes (its
GObject.GType
is %DBUS_TYPE_G_UCHAR_ARRAY), return it.Otherwise return
None
.The returned value is not copied, and is only valid as long as the value for key in asv is not removed or altered. Copy it with
GObject.boxed_copy
(DBUS_TYPE_G_UCHAR_ARRAY, …) if you need to keep it for longer.New in version 0.7.9.
- TelepathyGLib.asv_get_double(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the double precision floating-point value of key, or 0.0
- Return type:
If a value for key in asv is present and has any numeric type used by dbus-glib (guchar,
int
,int
, gint64, guint64 orfloat
), return it as a double, and if valid is notNone
, set valid toTrue
.Otherwise, return 0.0, and if valid is not
None
, set valid toFalse
.New in version 0.7.9.
- TelepathyGLib.asv_get_int32(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the 32-bit signed integer value of key, or 0
- Return type:
If a value for key in asv is present, has an integer type used by dbus-glib (guchar,
int
,int
, gint64 or guint64) and fits in the range of a gint32, return it, and if valid is notNone
, set valid toTrue
.Otherwise, return 0, and if valid is not
None
, set valid toFalse
.New in version 0.7.9.
- TelepathyGLib.asv_get_int64(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the 64-bit signed integer value of key, or 0
- Return type:
If a value for key in asv is present, has an integer type used by dbus-glib (guchar,
int
,int
, gint64 or guint64) and fits in the range of a gint64, return it, and if valid is notNone
, set valid toTrue
.Otherwise, return 0, and if valid is not
None
, set valid toFalse
.New in version 0.7.9.
- TelepathyGLib.asv_get_object_path(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the object-path value of key, or
None
- Return type:
If a value for key in asv is present and is an object path, return it.
Otherwise return
None
.The returned value is not copied, and is only valid as long as the value for key in asv is not removed or altered. Copy it with
GLib.strdup
() if you need to keep it for longer.New in version 0.7.9.
- TelepathyGLib.asv_get_string(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the string value of key, or
None
- Return type:
If a value for key in asv is present and is a string, return it.
Otherwise return
None
.The returned value is not copied, and is only valid as long as the value for key in asv is not removed or altered. Copy it with
GLib.strdup
() if you need to keep it for longer.New in version 0.7.9.
- TelepathyGLib.asv_get_strv(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
- Return type:
If a value for key in asv is present and is an array of strings (strv), return it.
Otherwise return
None
.The returned value is not copied, and is only valid as long as the value for key in asv is not removed or altered. Copy it with
GLib.strdupv
() if you need to keep it for longer.New in version 0.7.9.
- TelepathyGLib.asv_get_uint32(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the 32-bit unsigned integer value of key, or 0
- Return type:
If a value for key in asv is present, has an integer type used by dbus-glib (guchar,
int
,int
, gint64 or guint64) and fits in the range of a guint32, return it, and if valid is notNone
, set valid toTrue
.Otherwise, return 0, and if valid is not
None
, set valid toFalse
.New in version 0.7.9.
- TelepathyGLib.asv_get_uint64(asv, key)¶
- Parameters:
asv ({
str
:GObject.Value
}) – AGLib.HashTable
where the keys are strings and the values are GValueskey (
str
) – The key to look up
- Returns:
the 64-bit unsigned integer value of key, or 0
- Return type:
If a value for key in asv is present, has an integer type used by dbus-glib (guchar,
int
,int
, gint64 or guint64) and is non-negative, return it, and if valid is notNone
, set valid toTrue
.Otherwise, return 0, and if valid is not
None
, set valid toFalse
.New in version 0.7.9.
- TelepathyGLib.dbus_check_valid_bus_name(name, allow_types)¶
- Parameters:
name (
str
) – a possible bus nameallow_types (
TelepathyGLib.DBusNameType
) – some combination ofTelepathyGLib.DBusNameType.UNIQUE
,TelepathyGLib.DBusNameType.WELL_KNOWN
orTelepathyGLib.DBusNameType.BUS_DAEMON
(often this will beTelepathyGLib.DBusNameType.NOT_BUS_DAEMON
orTelepathyGLib.DBusNameType.ANY
)
- Raises:
- Returns:
True
if name is valid- Return type:
Check that the given string is a valid D-Bus bus name of an appropriate type.
New in version 0.7.1.
- TelepathyGLib.dbus_check_valid_interface_name(name)¶
- Parameters:
name (
str
) – a possible interface name- Raises:
- Returns:
True
if name is valid- Return type:
Check that the given string is a valid D-Bus interface name. This is also appropriate to use to check for valid error names.
Since GIO 2.26,
Gio.dbus_is_interface_name
() should always return the same thing, although the GLib function does not raise an error explaining why the interface name is incorrect.New in version 0.7.1.
- TelepathyGLib.dbus_check_valid_member_name(name)¶
-
Check that the given string is a valid D-Bus member (method or signal) name.
Since GIO 2.26,
Gio.dbus_is_member_name
() should always return the same thing, although the GLib function does not raise an error explaining why the interface name is incorrect.New in version 0.7.1.
- TelepathyGLib.dbus_check_valid_object_path(path)¶
-
Check that the given string is a valid D-Bus object path. Since GLib 2.24,
GLib.Variant.is_object_path
() should always return the same thing as this function, although it doesn’t provide an error explaining why the object path is invalid.New in version 0.7.1.
- TelepathyGLib.dbus_properties_mixin_class_init(cls, offset)¶
- Parameters:
cls (
GObject.ObjectClass
) – a subclass ofGObject.ObjectClass
offset (
int
) – the offset within cls of aTelepathyGLib.DBusPropertiesMixinClass
structure
Initialize the class cls to use the D-Bus Properties mixin. The given struct member, of size sizeof(
TelepathyGLib.DBusPropertiesMixinClass
), will be used to store property implementation information.Each property and each interface must have been declared as a member of a GInterface implemented by cls, using
TelepathyGLib.svc_interface_set_dbus_properties_info
().Before calling this function, the array interfaces must have been placed in the
TelepathyGLib.DBusPropertiesMixinClass
structure; if it would be empty, it may instead beNone
.This function should be called from the class_init callback in such a way that it will only be called once, even if the class is subclassed.
Changed in 0.7.9:
TelepathyGLib.DBusPropertiesMixinClass
::interfaces
may now beNone
, which means that only interfaces whose properties are set up using tp_dbus_properties_mixin_implement_interface() will be used.Changed in 0.7.15: offset may now be 0, in which case the
TelepathyGLib.DBusPropertiesMixinClass
can be omitted from cls. It is treated as if it were present, but with all fields (includingTelepathyGLib.DBusPropertiesMixinClass
::interfaces
) beingNone
, so only interfaces whose properties are set using tp_dbus_properties_mixin_implement_interface() will be used.New in version 0.7.3.
- TelepathyGLib.dbus_properties_mixin_dup_all(self, interface_name)¶
- Parameters:
self (
GObject.Object
) – an object with this mixininterface_name (
str
) – a D-Bus interface name
- Returns:
a map from property name (without the interface name) to value
- Return type:
{
str
:GObject.Value
}
Get all the properties of a particular interface. This implementation never returns an error: it will return an empty map if the interface is unknown.
New in version 0.21.2.
- TelepathyGLib.dbus_properties_mixin_emit_properties_changed(object, interface_name, properties)¶
- Parameters:
object (
GObject.Object
) – an object which uses the D-Bus properties mixininterface_name (
str
) – the interface on which properties have changedproperties (
str
orNone
) – aNone
-terminated array of (unqualified) property names whose values have changed.
Emits the PropertiesChanged signal for the provided properties. Depending on the EmitsChangedSignal annotations in the introspection XML, either the new value of the property will be included in the signal, or merely the fact that the property has changed.
For example, the MPRIS specification defines a TrackList interface with two properties, one of which is annotated with EmitsChangedSignal=true and one annotated with EmitsChangedSignal=invalidates. The following call would include the new value of CanEditTracks and list Tracks as invalidated:
const gchar *properties[] = { "CanEditTracks", "Tracks", NULL }; tp_dbus_properties_mixin_emit_properties_changed (G_OBJECT (self), "org.mpris.MediaPlayer2.TrackList", properties);
It is an error to pass a property to this function if the property is annotated with EmitsChangedSignal=false, or is unannotated.
New in version 0.15.6.
- TelepathyGLib.dbus_properties_mixin_get(self, interface_name, property_name, value)¶
- Parameters:
self (
GObject.Object
) – an object with this mixininterface_name (
str
) – a D-Bus interface nameproperty_name (
str
) – a D-Bus property namevalue (
GObject.Value
) – an unsetGObject.Value
(initialized to all zeroes)
- Raises:
- Returns:
True
(filling value) on success,False
(setting error) on failure- Return type:
Initialize value with the type of the property property_name on interface_name, and write the value of that property into it as if by calling the D-Bus method org.freedesktop.DBus.Properties.Get.
If Get would return a D-Bus error, value remains unset and error is filled in instead.
New in version 0.7.13.
- TelepathyGLib.dbus_properties_mixin_getter_gobject_properties(object, iface, name, value, getter_data)¶
- Parameters:
object (
GObject.Object
) – The exported object with the propertiesiface (
int
) – A quark representing the D-Bus interface namename (
int
) – A quark representing the D-Bus property namevalue (
GObject.Value
) – AGObject.Value
pre-initialized to the right type, into which to put the valuegetter_data (
object
orNone
) – The getter_data from theTelepathyGLib.DBusPropertiesMixinPropImpl
, which must be a string containing theGObject.Object
property’s name
An implementation of
TelepathyGLib.DBusPropertiesMixinGetter
which assumes that the getter_data is the name of a readableGObject.Object
property of an appropriate type, and uses it for the value of the D-Bus property.
- TelepathyGLib.dbus_properties_mixin_iface_init(g_iface, iface_data)¶
- Parameters:
Declare that the DBus.Properties interface represented by g_iface is implemented using this mixin.
- TelepathyGLib.dbus_properties_mixin_set(self, interface_name, property_name, value)¶
- Parameters:
self (
GObject.Object
) – an object with this mixininterface_name (
str
) – a D-Bus interface nameproperty_name (
str
) – a D-Bus property namevalue (
GObject.Value
) – aGObject.Value
containing the new value for this property.
- Raises:
- Returns:
- Return type:
Sets a property to the value specified by value, as if by calling the D-Bus method org.freedesktop.DBus.Properties.Set.
If Set would return a D-Bus error, sets error and returns
False
New in version 0.15.8.
- TelepathyGLib.dbus_properties_mixin_setter_gobject_properties(object, iface, name, value, setter_data)¶
- Parameters:
object (
GObject.Object
) – The exported object with the propertiesiface (
int
) – A quark representing the D-Bus interface namename (
int
) – A quark representing the D-Bus property namevalue (
GObject.Value
) – The new value for the propertysetter_data (
object
orNone
) – The setter_data from theTelepathyGLib.DBusPropertiesMixinPropImpl
, which must be a string containing theGObject.Object
property’s name
- Raises:
- Returns:
- Return type:
An implementation of
TelepathyGLib.DBusPropertiesMixinSetter
which assumes that the setter_data is the name of a writableGObject.Object
property of an appropriate type, and sets that property to the given value.
- TelepathyGLib.debug_divert_messages(filename)¶
-
Open the given file for writing and duplicate its file descriptor to be used for stdout and stderr. This has the effect of closing the previous stdout and stderr, and sending all messages that would have gone there to the given file instead.
By default the file is truncated and hence overwritten each time the process is executed. Since version 0.7.14, if the filename is prefixed with ‘+’ then the file is not truncated and output is added at the end of the file.
Passing
None
to this function is guaranteed to have no effect. This is so you can call it with the recommended usagetp_debug_divert_messages (g_getenv ("MYAPP_LOGFILE"))
and it won’t do anything if the environment variable is not set.This function still works if telepathy-glib was compiled without debug support.
New in version 0.7.1.
- TelepathyGLib.debug_set_flags(flags_string)¶
- Parameters:
flags_string (
str
) – The flags to set, comma-separated. IfNone
or empty, no additional flags are set.
Set the debug flags indicated by flags_string, in addition to any already set.
The parsing matches that of
GLib.parse_debug_string
().If telepathy-glib was compiled with –disable-debug (not recommended), this function has no practical effect, since the debug messages it would enable were removed at compile time.
New in version 0.6.1.
- TelepathyGLib.debug_set_persistent(persistent)¶
- Parameters:
persistent (
bool
) –True
prevents the connection manager mainloop from exiting,False
enables exiting if there are no connections (the default behavior).
Used to enable persistent operation of the connection manager process for debugging purposes.
- TelepathyGLib.debug_timestamped_log_handler(log_domain, log_level, message, ignored)¶
- Parameters:
log_domain (
str
) – the message’s log domainlog_level (
GLib.LogLevelFlags
) – the log level of the messagemessage (
str
) – the message to process
A
GLib.LogFunc
that prepends the UTC time (currently in ISO 8601 format, with microsecond resolution) to the message, then callsGLib.log_default_handler
.Intended usage is:
if (g_getenv ("MYPROG_TIMING") != NULL) g_log_set_default_handler (tp_debug_timestamped_log_handler, NULL);
If telepathy-glib was compiled with –disable-debug (not recommended), this function is equivalent to
GLib.log_default_handler
().Changed in 0.9.0: timestamps are now printed in UTC, in RFC-3339 format. Previously, they were printed in local time, in a format similar to RFC-3339.
New in version 0.7.1.
- TelepathyGLib.error_get_dbus_name(error)¶
- Parameters:
error (
TelepathyGLib.Error
) – a member of theTelepathyGLib.Error
enum.- Returns:
the D-Bus error name corresponding to error.
- Return type:
New in version 0.7.31.
- TelepathyGLib.error_quark()¶
- Return type:
Return the error domain quark for
TelepathyGLib.Error
.New in version 0.11.13.
- TelepathyGLib.escape_as_identifier(name)¶
- Parameters:
name (
str
) – The string to be escaped- Returns:
the escaped string, which must be freed by the caller with
GLib.free
- Return type:
Escape an arbitrary string so it follows the rules for a C identifier, and hence an object path component, interface element component, bus name component or member name in D-Bus.
Unlike
GLib.strcanon
this is a reversible encoding, so it preserves distinctness.The escaping consists of replacing all non-alphanumerics, and the first character if it’s a digit, with an underscore and two lower-case hex digits:
“0123abc_xyz\x01\xff” -> _30123abc_5fxyz_01_ff
i.e. similar to URI encoding, but with _ taking the role of %, and a smaller allowed set. As a special case, “” is escaped to “_” (just for completeness, really).
- TelepathyGLib.handle_ensure(self, id, context)¶
- Parameters:
self (
TelepathyGLib.HandleRepoIface
) – A handle repository implementationid (
str
) – A string whose handle is requiredcontext (
object
orNone
) – User data to be passed to the normalization callback
- Raises:
- Returns:
the handle corresponding to the given string, or 0 if it is invalid.
- Return type:
Return a handle for the given string, creating one if necessary. The string is normalized, if possible.
- TelepathyGLib.handle_type_to_string(type)¶
- Parameters:
type (
TelepathyGLib.HandleType
) – A handle type, which need not be valid- Returns:
a human-readable string describing the handle type, e.g. “contact”. For invalid handle types, returns “(no handle)” for 0 or “(invalid handle type)” for others.
- Return type:
<!—->
- TelepathyGLib.iface_quark_call_content_media_description_interface_rtcp_extended_reports()¶
- Return type:
- TelepathyGLib.iface_quark_call_content_media_description_interface_rtcp_feedback()¶
- Return type:
- TelepathyGLib.iface_quark_call_content_media_description_interface_rtp_header_extensions()¶
- Return type:
- TelepathyGLib.intset_from_array(array)¶
- Parameters:
- Returns:
A set containing the same integers as array.
- Return type:
Returns: says it all
- TelepathyGLib.list_connection_managers(bus_daemon, callback, user_data, weak_object)¶
- Parameters:
bus_daemon (
TelepathyGLib.DBusDaemon
) – proxy for the D-Bus daemoncallback (
TelepathyGLib.ConnectionManagerListCb
) – callback to be called when listing the CMs succeeds or fails; not called if the weak_object goes awayuser_data (
object
orNone
) – user-supplied data for the callbackweak_object (
GObject.Object
orNone
) – if notNone
, will be weakly referenced; the callback will not be called, and the call will be cancelled, if the object has vanished
List the available (running or installed) connection managers. Call the callback when done.
Since 0.7.26, this function will wait for each
TelepathyGLib.ConnectionManager
to be ready, so all connection managers passed to callback will have their %TP_CONNECTION_MANAGER_FEATURE_CORE feature prepared, unless an error occurred while launching that connection manager.New in version 0.7.1.
Deprecated since version ???: since 0.19.1, use
TelepathyGLib.list_connection_managers_async
()
- TelepathyGLib.list_connection_managers_async(dbus_daemon, callback, *user_data)¶
- Parameters:
dbus_daemon (
TelepathyGLib.DBusDaemon
orNone
) – aTelepathyGLib.DBusDaemon
, orNone
to useTelepathyGLib.DBusDaemon.dup
()callback (
Gio.AsyncReadyCallback
orNone
) – a callback to call with a list of CMs
List the available (running or installed) connection managers, asynchronously, and wait for their %TP_CONNECTION_MANAGER_FEATURE_CORE feature to be ready.
New in version 0.17.6.
- TelepathyGLib.list_connection_managers_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – the result ofTelepathyGLib.list_connection_managers_async
()- Raises:
- Returns:
a newly allocated list of references to
TelepathyGLib.ConnectionManager
objects- Return type:
Finish listing the available connection managers.
Free the list after use, for instance with
g_list_free_full (list, g_object_unref)
.New in version 0.17.6.
- TelepathyGLib.list_connection_names(bus_daemon, callback, user_data, weak_object)¶
- Parameters:
bus_daemon (
TelepathyGLib.DBusDaemon
) – proxy for the D-Bus daemoncallback (
TelepathyGLib.ConnectionNameListCb
) – callback to be called when listing the connections succeeds or fails; not called if the D-Bus connection fails completely or if the weak_object goes awayuser_data (
object
orNone
) – user-supplied data for the callbackweak_object (
GObject.Object
orNone
) – if notNone
, will be weakly referenced; the callback will not be called if the object has vanished
List the bus names of all the connections that currently exist, together with the connection manager name and the protocol name for each connection. Call the callback when done.
The bus names passed to the callback can be used to construct
TelepathyGLib.Connection
objects for any connections that are of interest.New in version 0.7.1.
- TelepathyGLib.simple_async_report_success_in_idle(source, callback, user_data, source_tag)¶
- Parameters:
source (
GObject.Object
orNone
) – the source objectcallback (
Gio.AsyncReadyCallback
orNone
) – the callbacksource_tag (
object
orNone
) – the source tag for theGio.SimpleAsyncResult
Create a new
Gio.SimpleAsyncResult
with no operation result, and callGio.SimpleAsyncResult.complete_in_idle
() on it.This is like a successful version of g_simple_async_report_error_in_idle(), suitable for asynchronous functions that (conceptually) either succeed and return nothing, or raise an error, such as
TelepathyGLib.Proxy.prepare_async
().The corresponding finish function should not call a function that attempts to get a result, such as g_simple_async_result_get_op_res_gpointer().
New in version 0.11.9.
- TelepathyGLib.svc_interface_set_dbus_properties_info(g_interface, info)¶
- Parameters:
g_interface (
GObject.GType
) – TheGObject.GType
of a service interfaceinfo (
TelepathyGLib.DBusPropertiesMixinIfaceInfo
) – an interface description
Declare that g_interface implements the given D-Bus interface, with the given properties. This may only be called once per GInterface, usually from a section of its base_init function that only runs once.
This is typically only used within generated code; there is normally no reason to call it manually.
New in version 0.7.3.
- TelepathyGLib.user_action_time_from_x11(x11_time)¶
- Parameters:
x11_time (
int
) – an X11 timestamp, or 0 to indicate the current time- Returns:
a nonzero Telepathy user action time, or %TP_USER_ACTION_TIME_CURRENT_TIME
- Return type:
Convert an X11 timestamp into a user action time as used in Telepathy.
This also works for the timestamps used by GDK 2, GDK 3 and Clutter 1.0; it may or may not work with other toolkits or versions.
New in version 0.11.13.
- TelepathyGLib.user_action_time_should_present(user_action_time)¶
- Parameters:
user_action_time (
int
) – the Telepathy user action time- Returns:
True
if it would be appropriate to present a window- x11_time:
a pointer to guint32 used to return an X11 timestamp, or 0 to indicate the current time; if
False
is returned, the value placed here is not meaningful
- Return type:
Interpret a Telepathy user action time to decide whether a Handler should attempt to gain focus. If
True
is returned, it would be appropriate to call gtk_window_present_with_time() using x11_time as input, for instance.x11_time is used to return a timestamp in the right format for X11, GDK 2, GDK 3 and Clutter 1.0; it may or may not work with other toolkits or versions.
New in version 0.11.13.
- TelepathyGLib.utf8_make_valid(name)¶
- Parameters:
name (
str
) – string to coerce into UTF8- Returns:
a new valid UTF8 string
- Return type:
Validate that the provided string is valid UTF8. If not, replace all invalid bytes with unicode replacement character (U+FFFD).
This method is a verbatim copy of glib’s internal _g_utf8_make_valid () function, and will be deprecated as soon as the glib one becomes public.
New in version 0.13.15.
- TelepathyGLib.value_array_free(va)¶
- Parameters:
va (
GObject.ValueArray
) – aGObject.ValueArray
Free va. This is exactly the same as g_value_array_free(), but does not provoke deprecation warnings from GLib when used in conjunction with tp_value_array_build() and tp_value_array_unpack().
New in version 0.23.0.