Top | ![]() |
![]() |
![]() |
![]() |
GVariant *
fcmdr_json_value_to_variant (JsonNode *json_node
);
Converts a JsonNode containing a fundamental type to a GVariant. The resulting GVariantType will be one of G_VARIANT_TYPE_INT64, G_VARIANT_TYPE_DOUBLE, G_VARIANT_TYPE_BOOLEAN or G_VARIANT_TYPE_STRING.
gchar **
fcmdr_json_array_to_strv (JsonArray *json_array
);
Builds a NULL
-terminated string array from the string elements in
json_array
. Free the returned string array with g_strfreev()
.
JsonArray *
fcmdr_strv_to_json_array (gchar **strv
);
Converts a NULL
-terminated string array to a JsonArray with
equivalent string elements. If strv
is NULL
, the function
returns an empty JsonArray.
gint fcmdr_strv_find (gchar **haystack
,const gchar *needle
);
Returns the array index of needle
in haystack
, or -1 if not found.
As a convenience, haystack
may be NULL
, in which case the function
returns -1.
gint fcmdr_compare_uints (gconstpointer a
,gconstpointer b
);
Compares two unsigned integers stuffed into pointers with GUINT_TO_POINTER. For use with functions that take a GCompareFunc.
gchar * fcmdr_replace_variables (const gchar *string
,GHashTable *symbol_table
);
Scans string
for occurrences of the pattern "${SYMBOL}" and replaces them
with the string value for "SYMBOL" in symbol_table
(if it exists). Free
the returned string with g_free()
.
gboolean fcmdr_recursive_delete_sync (GFile *file
,GCancellable *cancellable
,GError **error
);
Deletes file
. If file
is a directory, its contents are deleted
recursively before file
itself is deleted. The recursive delete
operation will stop on the first error.
If cancellable
is not NULL
, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error G_IO_ERROR_CANCELLED will be
returned.
gboolean fcmdr_get_connection_unix_user_sync (GDBusConnection *connection
,const gchar *bus_name
,uid_t *out_uid
,GCancellable *cancellable
,GError **error
);
Returns the UNIX user ID of the process owning the given bus_name
.
If unable to determine it, the function sets error
and returns FALSE
.
This function synchronously invokes the "GetConnectionUnixUser" method
of the "org.freedesktop.DBus" interface on the message bus represented
by connection
.
connection |
||
bus_name |
a name owned by |
|
out_uid |
return location for a user ID |
|
cancellable |
optional GCancellable object, or |
|
error |