Commit b00b0ade authored by Jürg Billeter's avatar Jürg Billeter Committed by Martyn Russell

libtracker-bus: Do not use GDBusProxy

The finalizer of GDBusProxy schedules an idle function to disconnect
the name owner changed signal. This leaks a GMainContext if the
corresponding loop was already terminated.

Fixes NB#285426.
parent e10a8886
......@@ -7,6 +7,7 @@ AM_VALAFLAGS = \
--header tracker-bus.h \
--vapi tracker-bus.vapi \
--pkg gio-2.0 --pkg gio-unix-2.0 --pkg posix \
--vapidir $(top_srcdir)/src/vapi \
$(BUILD_VALAFLAGS) \
$(top_srcdir)/src/libtracker-common/libtracker-common.vapi \
$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi
......
......@@ -17,81 +17,10 @@
* Boston, MA 02110-1301, USA.
*/
[DBus (name = "org.freedesktop.Tracker1.Resources")]
private interface Tracker.Bus.Resources : DBusProxy {
public abstract void load (string uri, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (name = "Load")]
public abstract async void load_async (string uri, Cancellable? cancellable) throws Sparql.Error, DBusError;
}
[DBus (name = "org.freedesktop.Tracker1.Steroids")]
private interface Tracker.Bus.Steroids : DBusProxy {
public abstract async string[] query (string query, UnixOutputStream result_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
public abstract async void update (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (signature = "aaa{ss}")]
public abstract async Variant update_blank (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
public abstract async void batch_update (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (signature = "as")]
public abstract async Variant update_array (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (visible = false)]
public void update_begin (UnixInputStream sparql_stream, int priority, Cancellable? cancellable, AsyncReadyCallback callback) {
if (priority <= GLib.Priority.DEFAULT) {
update.begin (sparql_stream, cancellable, callback);
} else {
batch_update.begin (sparql_stream, cancellable, callback);
}
}
}
[DBus (name = "org.freedesktop.Tracker1.Statistics")]
private interface Tracker.Bus.Statistics : DBusProxy {
public abstract string[,] Get (Cancellable? cancellable) throws DBusError;
public async abstract string[,] Get_async (Cancellable? cancellable) throws DBusError;
}
// Actual class definition
public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
Resources resources_object;
Steroids steroids_object;
Statistics statistics_object;
public Connection () throws Sparql.Error, IOError, DBusError {
}
void ensure_resources_object () throws IOError, DBusError {
if (resources_object != null) {
return;
}
resources_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_RESOURCES,
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
resources_object.set_default_timeout (int.MAX);
}
void ensure_steroids_object () throws IOError, DBusError {
if (steroids_object != null) {
return;
}
steroids_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STEROIDS,
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
steroids_object.set_default_timeout (int.MAX);
}
void ensure_statistics_object () throws IOError, DBusError {
if (statistics_object != null) {
return;
}
statistics_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STATISTICS,
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
// ensure that error domain is registered with GDBus
new Sparql.Error.INTERNAL ("");
}
void pipe (out UnixInputStream input, out UnixOutputStream output) throws IOError {
......@@ -103,6 +32,29 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
output = new UnixOutputStream (pipefd[1], true);
}
void handle_error_reply (DBusMessage message) throws Sparql.Error, IOError, DBusError {
try {
message.to_gerror ();
} catch (IOError e_io) {
throw e_io;
} catch (Sparql.Error e_sparql) {
throw e_sparql;
} catch (DBusError e_dbus) {
throw e_dbus;
} catch (Error e) {
throw new IOError.FAILED (e.message);
}
}
void send_query (DBusConnection connection, string sparql, UnixOutputStream output, Cancellable? cancellable, AsyncReadyCallback? callback) throws GLib.IOError {
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_STEROIDS, TRACKER_DBUS_INTERFACE_STEROIDS, "Query");
var fd_list = new UnixFDList ();
message.set_body (new Variant ("(sh)", sparql, fd_list.append (output.fd)));
message.set_unix_fd_list (fd_list);
connection.send_message_with_reply.begin (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable, callback);
}
public override Sparql.Cursor query (string sparql, Cancellable? cancellable) throws Sparql.Error, IOError, DBusError {
// use separate main context for sync operation
var context = new MainContext ();
......@@ -119,16 +71,16 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
public async override Sparql.Cursor query_async (string sparql, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_steroids_object ();
UnixInputStream input;
UnixOutputStream output;
pipe (out input, out output);
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
// send D-Bus request
AsyncResult dbus_res = null;
bool received_result = false;
steroids_object.query.begin (sparql, output, cancellable, (o, res) => {
send_query (connection, sparql, output, cancellable, (o, res) => {
dbus_res = res;
if (received_result) {
query_async.callback ();
......@@ -146,11 +98,24 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
if (dbus_res == null) {
yield;
}
string[] variable_names = steroids_object.query.end (dbus_res);
var reply = connection.send_message_with_reply.end (dbus_res);
handle_error_reply (reply);
string[] variable_names = (string[]) reply.get_body ().get_child_value (0);
mem_stream.close ();
return new FDCursor (mem_stream.steal_data (), mem_stream.data_size, variable_names);
}
void send_update (DBusConnection connection, string method, UnixInputStream input, Cancellable? cancellable, AsyncReadyCallback? callback) throws GLib.IOError {
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_STEROIDS, TRACKER_DBUS_INTERFACE_STEROIDS, method);
var fd_list = new UnixFDList ();
message.set_body (new Variant ("(h)", fd_list.append (input.fd)));
message.set_unix_fd_list (fd_list);
connection.send_message_with_reply.begin (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable, callback);
}
public override void update (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
// use separate main context for sync operation
var context = new MainContext ();
......@@ -167,16 +132,16 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
public async override void update_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_steroids_object ();
UnixInputStream input;
UnixOutputStream output;
pipe (out input, out output);
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
// send D-Bus request
AsyncResult dbus_res = null;
bool sent_update = false;
steroids_object.update_begin (input, priority, cancellable, (o, res) => {
send_update (connection, priority <= GLib.Priority.DEFAULT ? "Update" : "BatchUpdate", input, cancellable, (o, res) => {
dbus_res = res;
if (sent_update) {
update_async.callback ();
......@@ -196,24 +161,21 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
yield;
}
if (priority <= GLib.Priority.DEFAULT) {
steroids_object.update.end (dbus_res);
} else {
steroids_object.batch_update.end (dbus_res);
}
var reply = connection.send_message_with_reply.end (dbus_res);
handle_error_reply (reply);
}
public async override GenericArray<Error?>? update_array_async (string[] sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_steroids_object ();
UnixInputStream input;
UnixOutputStream output;
pipe (out input, out output);
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
// send D-Bus request
AsyncResult dbus_res = null;
bool sent_update = false;
steroids_object.update_array.begin (input, cancellable, (o, res) => {
send_update (connection, "UpdateArray", input, cancellable, (o, res) => {
dbus_res = res;
if (sent_update) {
update_array_async.callback ();
......@@ -236,10 +198,13 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
yield;
}
var reply = connection.send_message_with_reply.end (dbus_res);
handle_error_reply (reply);
// process results (errors)
var result = new GenericArray<Error?> ();
Variant resultv;
resultv = steroids_object.update_array.end (dbus_res);
resultv = reply.get_body ().get_child_value (0);
var iter = resultv.iterator ();
string code, message;
while (iter.next ("s", out code)) {
......@@ -274,16 +239,16 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
public async override GLib.Variant? update_blank_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_steroids_object ();
UnixInputStream input;
UnixOutputStream output;
pipe (out input, out output);
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
// send D-Bus request
AsyncResult dbus_res = null;
bool sent_update = false;
steroids_object.update_blank.begin (input, cancellable, (o, res) => {
send_update (connection, "UpdateBlank", input, cancellable, (o, res) => {
dbus_res = res;
if (sent_update) {
update_blank_async.callback ();
......@@ -303,32 +268,40 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
yield;
}
return steroids_object.update_blank.end (dbus_res);
var reply = connection.send_message_with_reply.end (dbus_res);
handle_error_reply (reply);
return reply.get_body ().get_child_value (0);
}
public override void load (File file, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_resources_object ();
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
resources_object.load (file.get_uri (), cancellable);
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_RESOURCES, TRACKER_DBUS_INTERFACE_RESOURCES, "Load");
message.set_body (new Variant ("(s)", file.get_uri ()));
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
var reply = connection.send_message_with_reply_sync (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable);
handle_error_reply (reply);
}
public async override void load_async (File file, Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_resources_object ();
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
yield resources_object.load_async (file.get_uri (), cancellable);
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_RESOURCES, TRACKER_DBUS_INTERFACE_RESOURCES, "Load");
message.set_body (new Variant ("(s)", file.get_uri ()));
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
var reply = yield connection.send_message_with_reply (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable);
handle_error_reply (reply);
}
public override Sparql.Cursor? statistics (Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_statistics_object ();
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_STATISTICS, TRACKER_DBUS_INTERFACE_STATISTICS, "Get");
string[,] results = statistics_object.Get (cancellable);
var reply = connection.send_message_with_reply_sync (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable);
handle_error_reply (reply);
string[,] results = (string[,]) reply.get_body ().get_child_value (0);
Sparql.ValueType[] types = new Sparql.ValueType[2];
string[] var_names = new string[2];
......@@ -345,9 +318,14 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
public async override Sparql.Cursor? statistics_async (Cancellable? cancellable = null) throws Sparql.Error, IOError, DBusError {
ensure_statistics_object ();
var connection = GLib.Bus.get_sync (BusType.SESSION, cancellable);
var message = new DBusMessage.method_call (TRACKER_DBUS_SERVICE, TRACKER_DBUS_OBJECT_STATISTICS, TRACKER_DBUS_INTERFACE_STATISTICS, "Get");
var reply = yield connection.send_message_with_reply (message, DBusSendMessageFlags.NONE, int.MAX, null, cancellable);
handle_error_reply (reply);
string[,] results = yield statistics_object.Get_async (cancellable);
string[,] results = (string[,]) reply.get_body ().get_child_value (0);
Sparql.ValueType[] types = new Sparql.ValueType[2];
string[] var_names = new string[2];
......
include $(top_srcdir)/Makefile.decl
EXTRA_DIST = \
gio-2.0.vapi
/* gio-2.0.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "G", gir_namespace = "Gio", gir_version = "2.0", lower_case_cprefix = "g_")]
namespace GLib {
namespace Bus {
[CCode (cheader_filename = "gio/gio.h")]
public static async GLib.DBusConnection @get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
[CCode (cheader_filename = "gio/gio.h")]
public static async T get_proxy<T> (GLib.BusType bus_type, string name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
[CCode (cheader_filename = "gio/gio.h")]
public static T get_proxy_sync<T> (GLib.BusType bus_type, string name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
[CCode (cheader_filename = "gio/gio.h")]
public static GLib.DBusConnection get_sync (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
[CCode (cheader_filename = "gio/gio.h", cname = "g_bus_own_name_with_closures")]
public static uint own_name (GLib.BusType bus_type, string name, GLib.BusNameOwnerFlags flags, [CCode (type = "GClosure*")] owned GLib.BusAcquiredCallback? bus_acquired_handler = null, [CCode (type = "GClosure*")] owned GLib.BusNameAcquiredCallback? name_acquired_handler = null, [CCode (type = "GClosure*")] owned GLib.BusNameLostCallback? name_lost_handler = null);
[CCode (cheader_filename = "gio/gio.h", cname = "g_bus_own_name_on_connection_with_closures")]
public static uint own_name_on_connection (GLib.DBusConnection connection, string name, GLib.BusNameOwnerFlags flags, [CCode (type = "GClosure*")] owned GLib.BusNameAcquiredCallback? name_acquired_handler = null, [CCode (type = "GClosure*")] owned GLib.BusNameLostCallback? name_lost_handler = null);
[CCode (cheader_filename = "gio/gio.h")]
public static void unown_name (uint owner_id);
[CCode (cheader_filename = "gio/gio.h")]
public static void unwatch_name (uint watcher_id);
[CCode (cheader_filename = "gio/gio.h", cname = "g_bus_watch_name_with_closures")]
public static uint watch_name (GLib.BusType bus_type, string name, GLib.BusNameWatcherFlags flags, [CCode (type = "GClosure*")] owned GLib.BusNameAppearedCallback? name_appeared_handler, [CCode (type = "GClosure*")] owned GLib.BusNameVanishedCallback? name_vanished_handler);
[CCode (cheader_filename = "gio/gio.h", cname = "g_bus_watch_name_on_connection_with_closures")]
public static uint watch_name_on_connection (GLib.DBusConnection connection, string name, GLib.BusNameWatcherFlags flags, [CCode (type = "GClosure*")] owned GLib.BusNameAppearedCallback? name_appeared_handler, [CCode (type = "GClosure*")] owned GLib.BusNameVanishedCallback? name_vanished_handler);
}
namespace ContentType {
[CCode (cheader_filename = "gio/gio.h")]
public static bool can_be_executable (string type);
[CCode (cheader_filename = "gio/gio.h")]
public static bool equals (string type1, string type2);
[CCode (cheader_filename = "gio/gio.h")]
public static string from_mime_type (string mime_type);
[CCode (cheader_filename = "gio/gio.h")]
public static string get_description (string type);
[CCode (cheader_filename = "gio/gio.h")]
public static GLib.Icon get_icon (string type);
[CCode (cheader_filename = "gio/gio.h")]
public static string get_mime_type (string type);
[CCode (cheader_filename = "gio/gio.h")]
public static string guess (string? filename, uchar[]? data, out bool result_uncertain);
[CCode (array_length = false, array_null_terminated = true, cheader_filename = "gio/gio.h")]
public static string[] guess_for_tree (GLib.File root);
[CCode (cheader_filename = "gio/gio.h")]
public static bool is_a (string type, string supertype);
[CCode (cheader_filename = "gio/gio.h")]
public static bool is_unknown (string type);
}
[CCode (cheader_filename = "gio/gio.h")]
[Compact]
public class ActionEntry {
public weak GLib.Callback activate;
public weak GLib.Callback change_state;
public weak string name;
[CCode (array_length = false)]
public weak size_t[] padding;
public weak string parameter_type;
public weak string state;
}
[CCode (cheader_filename = "gio/gio.h")]
public class AppLaunchContext : GLib.Object {
[CCode (has_construct_function = false)]
public AppLaunchContext ();
public virtual string get_display (GLib.AppInfo info, GLib.List<GLib.File> files);
public virtual string get_startup_notify_id (GLib.AppInfo info, GLib.List<GLib.File> files);
public virtual void launch_failed (string startup_notify_id);
}
[CCode (cheader_filename = "gio/gio.h", cname = "GApplication")]
public class Application : GLib.Object, GLib.ActionGroup {
[CCode (has_construct_function = false)]
public Application (string application_id, GLib.ApplicationFlags flags);
[NoWrapper]
public virtual void add_platform_data (GLib.VariantBuilder builder);
[NoWrapper]
public virtual void after_emit (GLib.Variant platform_data);
[NoWrapper]
public virtual void before_emit (GLib.Variant platform_data);
public unowned string get_application_id ();
public GLib.ApplicationFlags get_flags ();
public uint get_inactivity_timeout ();
public bool get_is_registered ();
public bool get_is_remote ();
public void hold ();
public static bool id_is_valid (string application_id);
[NoWrapper]
public virtual bool local_command_line ([CCode (array_length = false, array_null_terminated = true)] ref unowned string[] arguments, out int exit_status);
[CCode (cname = "g_application_quit_with_data")]
public bool quit (GLib.Variant? platform_data = null);
[NoWrapper]
public virtual void quit_mainloop ();
public bool register (GLib.Cancellable? cancellable = null) throws GLib.Error;
public void release ();
public int run ([CCode (array_length_pos = 0.9)] string[]? argv = null);
[NoWrapper]
public virtual void run_mainloop ();
public void set_action_group (GLib.ActionGroup action_group);
public void set_application_id (string application_id);
public void set_flags (GLib.ApplicationFlags flags);
public void set_inactivity_timeout (uint inactivity_timeout);
public GLib.ActionGroup action_group { set; }
public string application_id { get; set construct; }
public GLib.ApplicationFlags flags { get; set; }
public uint inactivity_timeout { get; set; }
public bool is_registered { get; }
public bool is_remote { get; }
[HasEmitter]
public virtual signal void activate ();
public virtual signal int command_line (GLib.ApplicationCommandLine command_line);
[HasEmitter]
public virtual signal void open (GLib.File[] files, string hint);
public virtual signal void startup ();
}
[CCode (cheader_filename = "gio/gio.h")]
public class ApplicationCommandLine : GLib.Object {
[CCode (has_construct_function = false)]
protected ApplicationCommandLine ();
public string[] get_arguments ();
public unowned string get_cwd ();
public unowned string get_environ ();
public int get_exit_status ();
public bool get_is_remote ();
public GLib.Variant? get_platform_data ();
public unowned string getenv (string name);
[PrintfFormat]
public void print (string format, ...);
[NoWrapper]
public virtual void print_literal (string message);
[PrintfFormat]
public void printerr (string format, ...);
[NoWrapper]
public virtual void printerr_literal (string message);
public void set_exit_status (int exit_status);
public GLib.Variant arguments { construct; }
public bool is_remote { get; }
public GLib.Variant platform_data { construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class BufferedInputStream : GLib.FilterInputStream {
[CCode (has_construct_function = false, type = "GInputStream*")]
public BufferedInputStream (GLib.InputStream base_stream);
public virtual ssize_t fill (ssize_t count, GLib.Cancellable? cancellable = null) throws GLib.Error;
public virtual async ssize_t fill_async (ssize_t count, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws GLib.Error;
public size_t get_available ();
public size_t get_buffer_size ();
public size_t peek ([CCode (array_length_pos = 2.9, array_length_type = "gsize")] uint8[] buffer, size_t offset = 0);
[CCode (array_length_type = "gsize")]
public unowned uint8[] peek_buffer ();
public int read_byte (GLib.Cancellable? cancellable = null) throws GLib.Error;
public void set_buffer_size (size_t size);
[CCode (has_construct_function = false, type = "GInputStream*")]
public BufferedInputStream.sized (GLib.InputStream base_stream, size_t size);
public uint buffer_size { get; set construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class BufferedOutputStream : GLib.FilterOutputStream {
[CCode (has_construct_function = false, type = "GOutputStream*")]
public BufferedOutputStream (GLib.OutputStream base_stream);
public bool get_auto_grow ();
public size_t get_buffer_size ();
public void set_auto_grow (bool auto_grow);
public void set_buffer_size (size_t size);
[CCode (has_construct_function = false, type = "GOutputStream*")]
public BufferedOutputStream.sized (GLib.OutputStream base_stream, size_t size);
public bool auto_grow { get; set; }
public uint buffer_size { get; set construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class Cancellable : GLib.Object {
[CCode (has_construct_function = false)]
public Cancellable ();
public void cancel ();
public ulong connect ([CCode (type = "GCallback*")] owned GLib.Func<GLib.Cancellable> callback);
public void disconnect (ulong handler_id);
public static unowned GLib.Cancellable? get_current ();
public int get_fd ();
public bool is_cancelled ();
public bool make_pollfd (GLib.PollFD pollfd);
public void pop_current ();
public void push_current ();
public void release_fd ();
public void reset ();
public bool set_error_if_cancelled () throws GLib.IOError;
public unowned GLib.TimeoutSource source_new ();
public virtual signal void cancelled ();
}
[CCode (cheader_filename = "gio/gio.h")]
public class CharsetConverter : GLib.Object, GLib.Converter, GLib.Initable {
[CCode (has_construct_function = false)]
public CharsetConverter (string to_charset, string from_charset) throws GLib.Error;
public uint get_num_fallbacks ();
public bool get_use_fallback ();
public void set_use_fallback (bool use_fallback);
[NoAccessorMethod]
public string from_charset { owned get; construct; }
[NoAccessorMethod]
public string to_charset { owned get; construct; }
public bool use_fallback { get; set construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class ConverterInputStream : GLib.FilterInputStream {
[CCode (has_construct_function = false, type = "GInputStream*")]
public ConverterInputStream (GLib.InputStream base_stream, GLib.Converter converter);
public unowned GLib.Converter get_converter ();
public GLib.Converter converter { get; construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class ConverterOutputStream : GLib.FilterOutputStream {
[CCode (has_construct_function = false, type = "GOutputStream*")]
public ConverterOutputStream (GLib.OutputStream base_stream, GLib.Converter converter);
public unowned GLib.Converter get_converter ();
public GLib.Converter converter { get; construct; }
}
[CCode (cheader_filename = "gio/gio.h")]
public class Credentials : GLib.Object {
[CCode (has_construct_function = false)]
public Credentials ();
public void* get_native (GLib.CredentialsType native_type);
public uint get_unix_user () throws GLib.Error;
public bool is_same_user (GLib.Credentials other_credentials) throws GLib.Error;
public void set_native (GLib.CredentialsType native_type, void* native);
public bool set_unix_user (uint uid) throws GLib.Error;
public unowned string to_string ();
}
[CCode (cheader_filename = "gio/gio.h")]
[Compact]
public class CredentialsClass {
}
[CCode (cheader_filename = "gio/gio.h", ref_function = "g_dbus_annotation_info_ref", type_id = "g_dbus_annotation_info_get_type ()", unref_function = "g_dbus_annotation_info_unref")]
[Compact]
public class DBusAnnotationInfo {
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusAnnotationInfo[] annotations;
public weak string key;
public int ref_count;
public weak string value;
public unowned string lookup (string name);
}
[CCode (cheader_filename = "gio/gio.h", ref_function = "g_dbus_arg_info_ref", type_id = "g_dbus_arg_info_get_type ()", unref_function = "g_dbus_arg_info_unref")]
[Compact]
public class DBusArgInfo {
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusAnnotationInfo[] annotations;
public weak string name;
public int ref_count;
public weak string signature;
}
[CCode (cheader_filename = "gio/gio.h")]
public class DBusAuthObserver : GLib.Object {
[CCode (has_construct_function = false)]
public DBusAuthObserver ();
[HasEmitter]
public virtual signal bool authorize_authenticated_peer (GLib.IOStream p0, GLib.Credentials p1);
}
[CCode (cheader_filename = "gio/gio.h", cname = "GDBusConnection")]
public class DBusConnection : GLib.Object, GLib.Initable, GLib.AsyncInitable {
[CCode (has_construct_function = false, type = "void")]
public async DBusConnection (GLib.IOStream stream, string guid, GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
public uint add_filter (owned GLib.DBusMessageFilterFunction filter_function);
public async GLib.Variant call (string bus_name, string object_path, string interface_name, string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
public GLib.Variant call_sync (string bus_name, string object_path, string interface_name, string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async GLib.Variant call_with_unix_fd_list (string bus_name, string object_path, string interface_name, string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int timeout_msec, GLib.UnixFDList? fd_list, GLib.Cancellable? cancellable = null, out GLib.UnixFDList? out_fd_list) throws GLib.Error;
public GLib.Variant call_with_unix_fd_list_sync (string bus_name, string object_path, string interface_name, string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int timeout_msec, GLib.UnixFDList? fd_list, out GLib.UnixFDList? out_fd_list, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool close (GLib.Cancellable? cancellable = null) throws GLib.Error;
public bool close_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
public bool emit_signal (string? destination_bus_name, string object_path, string interface_name, string signal_name, GLib.Variant parameters) throws GLib.Error;
public async bool flush (GLib.Cancellable? cancellable = null) throws GLib.Error;
public bool flush_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
[CCode (has_construct_function = false, type = "void")]
public async DBusConnection.for_address (string address, GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
[CCode (has_construct_function = false)]
public DBusConnection.for_address_sync (string address, GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
public GLib.DBusCapabilityFlags get_capabilities ();
public bool get_exit_on_close ();
public unowned string get_guid ();
public unowned GLib.Credentials get_peer_credentials ();
public async T get_proxy<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
public T get_proxy_sync<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
public unowned GLib.IOStream get_stream ();
public unowned string get_unique_name ();
public bool is_closed ();
public uint register_object<T> (string object_path, T object) throws GLib.IOError;
public uint register_subtree (string object_path, GLib.DBusSubtreeVTable vtable, GLib.DBusSubtreeFlags flags, GLib.DestroyNotify user_data_free_func) throws GLib.Error;
public void remove_filter (uint filter_id);
public bool send_message (GLib.DBusMessage message, GLib.DBusSendMessageFlags flags, out uint32 out_serial) throws GLib.Error;
public async GLib.DBusMessage send_message_with_reply (GLib.DBusMessage message, GLib.DBusSendMessageFlags flags, int timeout_msec, uint32* out_serial = null, GLib.Cancellable? cancellable = null) throws GLib.IOError;
public GLib.DBusMessage send_message_with_reply_sync (GLib.DBusMessage message, GLib.DBusSendMessageFlags flags, int timeout_msec, out uint32 out_serial, GLib.Cancellable? cancellable = null) throws GLib.IOError;
public void set_exit_on_close (bool exit_on_close);
public uint signal_subscribe (string? sender, string? interface_name, string? member, string? object_path, string? arg0, GLib.DBusSignalFlags flags, owned GLib.DBusSignalCallback callback);
public void signal_unsubscribe (uint subscription_id);
public void start_message_processing ();
[CCode (has_construct_function = false)]
public DBusConnection.sync (GLib.IOStream stream, string guid, GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
public bool unregister_object (uint registration_id);
public bool unregister_subtree (uint registration_id);
public string address { construct; }
public GLib.DBusAuthObserver authentication_observer { construct; }
public GLib.DBusCapabilityFlags capabilities { get; }
public bool exit_on_close { get; set; }
public GLib.DBusConnectionFlags flags { construct; }
public string guid { get; construct; }
public GLib.IOStream stream { get; construct; }
public string unique_name { get; }
public virtual signal void closed (bool p0, GLib.Error p1);
}
[CCode (cheader_filename = "gio/gio.h")]
[Compact]
public class DBusErrorEntry {
public weak string dbus_error_name;
public int error_code;
}
[CCode (cheader_filename = "gio/gio.h", ref_function = "g_dbus_interface_info_ref", type_id = "g_dbus_interface_info_get_type ()", unref_function = "g_dbus_interface_info_unref")]
[Compact]
public class DBusInterfaceInfo {
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusAnnotationInfo[] annotations;
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusMethodInfo[] methods;
public weak string name;
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusPropertyInfo[] properties;
public int ref_count;
[CCode (array_length = false, array_null_terminated = true)]
public weak GLib.DBusSignalInfo[] signals;
public void cache_build ();
public void cache_release ();
public void generate_xml (uint indent, GLib.StringBuilder string_builder);
public unowned GLib.DBusMethodInfo lookup_method (string name);
public unowned GLib.DBusPropertyInfo lookup_property (string name);
public unowned GLib.DBusSignalInfo lookup_signal (string name);
}
[CCode (cheader_filename = "gio/gio.h")]
public class DBusInterfaceSkeleton : GLib.Object, GLib.DBusInterface {
[CCode (has_construct_function = false)]
protected DBusInterfaceSkeleton ();
public bool export (GLib.DBusConnection connection, string object_path) throws GLib.Error;
public virtual void flush ();
public unowned GLib.DBusConnection get_connection ();
public GLib.DBusInterfaceSkeletonFlags get_flags ();
public virtual unowned GLib.DBusInterfaceInfo get_info ();
public unowned string get_object_path ();
public virtual unowned GLib.Variant get_properties ();
public virtual unowned GLib.DBusInterfaceVTable get_vtable ();
public void set_flags (GLib.DBusInterfaceSkeletonFlags flags);
public void unexport ();
[NoAccessorMethod]
public GLib.DBusInterfaceSkeletonFlags g_flags { get; set; }
public virtual signal bool g_authorize_method (GLib.DBusMethodInvocation invocation);
}
[CCode (cheader_filename = "gio/gio.h")]
[Compact]
public class DBusInterfaceVTable {
public weak GLib.DBusInterfaceGetPropertyFunc get_property;
public weak GLib.DBusInterfaceMethodCallFunc method_call;
public void* padding;
public weak GLib.DBusInterfaceSetPropertyFunc set_property;
}
[CCode (cheader_filename = "gio/gio.h")]
public class DBusMessage : GLib.Object {
[CCode (has_construct_function = false)]
public DBusMessage ();
public static ssize_t bytes_needed (uchar[] blob, size_t blob_len) throws GLib.Error;
public unowned GLib.DBusMessage copy () throws GLib.Error;
[CCode (has_construct_function = false)]
public DBusMessage.from_blob (uchar[] blob, size_t blob_len, GLib.DBusCapabilityFlags capabilities) throws GLib.Error;
public unowned string get_arg0 ();
public unowned GLib.Variant get_body ();
public GLib.DBusMessageByteOrder get_byte_order ();
public unowned string get_destination ();
public unowned string get_error_name ();
public GLib.DBusMessageFlags get_flags ();
public unowned GLib.Variant get_header (GLib.DBusMessageHeaderField header_field);
public unowned uchar[] get_header_fields ();
public unowned string get_interface ();
public bool get_locked ();
public unowned string get_member ();
public GLib.DBusMessageType get_message_type ();
public uint32 get_num_unix_fds ();
public unowned string get_path ();
public uint32 get_reply_serial ();
public unowned string get_sender ();
public uint32 get_serial ();
public unowned string get_signature ();
public unowned GLib.UnixFDList get_unix_fd_list ();
public void @lock ();
[CCode (has_construct_function = false)]
public DBusMessage.method_call (string name, string path, string interface_, string method);
[CCode (has_construct_function = false)]
public DBusMessage.method_error (GLib.DBusMessage method_call_message, string error_name, string error_message_format);
[CCode (has_construct_function = false)]
public DBusMessage.method_error_literal (GLib.DBusMessage method_call_message, string error_name, string error_message);
[CCode (has_construct_function = false)]
public DBusMessage.method_error_valist (GLib.DBusMessage method_call_message, string error_name, string error_message_format, void* var_args);
[CCode (has_construct_function = false)]
public DBusMessage.method_reply (GLib.DBusMessage method_call_message);
public unowned string print (uint indent = 0);
public void set_body (GLib.Variant body);
public void set_byte_order (GLib.DBusMessageByteOrder byte_order);
public void set_destination (string value);
public void set_error_name (string value);
public void set_flags (GLib.DBusMessageFlags flags);
public void set_header (GLib.DBusMessageHeaderField header_field, GLib.Variant value);
public void set_interface (string value);
public void set_member (string value);
public void set_message_type (GLib.DBusMessageType type);
public void set_num_unix_fds (uint32 value);
public void set_path (string value);
public void set_reply_serial (uint32 value);
public void set_sender (string value);
public void set_serial (uint32 serial);
public void set_signature (string value);
public void set_unix_fd_list (GLib.UnixFDList fd_list);