From 039aef986f3843c92800b2e7aaf0577e943db392 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Fri, 14 Apr 2017 17:50:31 +0200 Subject: [PATCH] Automatically generate GIR D bindings at build-time --- .gitmodules | 3 - contrib/girwrap/APILookup.txt | 126 ++ contrib/girwrap/APILookupAppStream.txt | 32 + contrib/girwrap/APILookupGLib.txt | 2021 ++++++++++++++++++++++++ contrib/girwrap/APILookupGObject.txt | 666 ++++++++ contrib/girwrap/APILookupGio.txt | 650 ++++++++ contrib/girwrap/find-d-intf-files.sh | 8 + meson.build | 347 +--- src/girepo | 1 - 9 files changed, 3534 insertions(+), 320 deletions(-) delete mode 100644 .gitmodules create mode 100644 contrib/girwrap/APILookup.txt create mode 100644 contrib/girwrap/APILookupAppStream.txt create mode 100644 contrib/girwrap/APILookupGLib.txt create mode 100644 contrib/girwrap/APILookupGObject.txt create mode 100644 contrib/girwrap/APILookupGio.txt create mode 100755 contrib/girwrap/find-d-intf-files.sh delete mode 160000 src/girepo diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 7e4535c..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/girepo"] - path = src/girepo - url = https://github.com/ximion/d-bindings.git diff --git a/contrib/girwrap/APILookup.txt b/contrib/girwrap/APILookup.txt new file mode 100644 index 0000000..95d422b --- /dev/null +++ b/contrib/girwrap/APILookup.txt @@ -0,0 +1,126 @@ +# +# Licensed under the GNU Lesser General Public License Version 3 +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the license, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + + +# define the license to use +license: start +/* + * Licensed under the GNU Lesser General Public License Version 3 + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the license, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +// generated automatically - do not change + + +license: end + +includeComments: y + +# defines the simple token substitution +# TODO allow to create real aliases on the code and simple static token replacement +alias: volatile +alias: G_CONST_RETURN +alias: gint int +alias: guint uint +alias: gboolean bool +alias: gpointer void* +alias: gconstpointer void* +alias: gchar char +alias: guchar char +alias: gshort short +alias: gushort ushort +alias: gint8 byte +alias: guint8 ubyte +alias: gint16 short +alias: guint16 ushort +alias: gint32 int +alias: gint64 long +alias: guint32 uint +alias: guint64 ulong +alias: guintptr size_t +alias: gfloat float +alias: gdouble double +alias: goffset long +alias: gsize size_t +alias: gssize ptrdiff_t +alias: va_list void* +alias: unichar dchar +alias: unichar2 wchar +alias: uchar ubyte +alias: XID uint + +alias: gunichar dchar +alias: gunichar2 wchar + +alias: time_t uint +alias: uid_t uid_t + +alias: alias alias_ +alias: align alig +alias: body bod +alias: continue continu +alias: debug dbg +alias: default defaulx +alias: delete delet +alias: export expor +alias: foreach foreac +alias: function funct +alias: Function Funct +alias: in inn +alias: instance instanc +alias: interface iface +alias: module modul +alias: out output +alias: package p +alias: ref doref +alias: scope scop +alias: string str +alias: switch switc +alias: union unio +alias: version versio + +alias: GLIB_SYSDEF_POLLIN =1 +alias: GLIB_SYSDEF_POLLOUT =4 +alias: GLIB_SYSDEF_POLLPRI =2 +alias: GLIB_SYSDEF_POLLHUP =16 +alias: GLIB_SYSDEF_POLLERR =8 +alias: GLIB_SYSDEF_POLLNVAL =32 + +########################################################### +### predifined: lib +########################################################### + +inputRoot: invalid +srcDir: . +bindDir: gi + +lookup: APILookupAppStream.txt +lookup: APILookupGLib.txt +lookup: APILookupGObject.txt +lookup: APILookupGio.txt +#lookup: APILookupGdkPixbuf.txt diff --git a/contrib/girwrap/APILookupAppStream.txt b/contrib/girwrap/APILookupAppStream.txt new file mode 100644 index 0000000..92e56f2 --- /dev/null +++ b/contrib/girwrap/APILookupAppStream.txt @@ -0,0 +1,32 @@ +# +# Licensed under the GNU Lesser General Public License Version 3 +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the license, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +############################################# +### Definitions for wrapping Gtk+ ########### +############################################# + +# must start with wrap +wrap: appstream +file: /usr/share/gir-1.0/AppStream-1.0.gir + +addAliases: start + public import gi.glibtypes; + public import gi.gobjecttypes; + public import gi.giotypes; + + public import core.stdc.stdio; + public import core.stdc.string; +addAliases: end diff --git a/contrib/girwrap/APILookupGLib.txt b/contrib/girwrap/APILookupGLib.txt new file mode 100644 index 0000000..f02a29d --- /dev/null +++ b/contrib/girwrap/APILookupGLib.txt @@ -0,0 +1,2021 @@ +# +# Licensed under the GNU Lesser General Public License Version 3 +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the license, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +############################################# +### Definitions for wrapping Gtk+ ########### +############################################# + +# must start with wrap +wrap: glib +file: /usr/share/gir-1.0/GLib-2.0.gir +file: /usr/share/gir-1.0/GModule-2.0.gir + +addAliases: start + public alias uint uid_t; + public alias int pid_t; + + version( Windows ) + { + alias int glong; + alias uint gulong; + } + else version( X86_64 ) + { + alias long glong; + alias ulong gulong; + } + else + { + alias int glong; + alias uint gulong; + } + + version( Windows ) + enum _utfPostfix = "_utf8"; + else + enum _utfPostfix = ""; + + version (Windows) + { + private import core.stdc.stdio; + + static if( !is(typeof(fdopen(0, null))) ) + { + extern (C) FILE* fdopen(int, char*); + } + } + + static if ( __VERSION__ >= 2063 ) + { + public import std.typecons : scoped; + + template Scoped(T) + { + alias typeof(scoped!T(cast(typeof(T.tupleof[0]))null)) Scoped; + } + } + else + { + // I'm getting the following error on the older dmd versions: + // this for Scoped_store needs to be type Scoped not type inout(Scoped!(T)). + // Unlike the phobos version this does use GC alocated memory for the object. + // Within GtkD this is used to make sure destroy is called on the object + // so it releases the resources it holds. + struct Scoped(T) + { + T payload; + + alias payload this; + + @disable this(); + @disable this(this); + + ~this() + { + .destroy(payload); + } + } + + auto scoped(T, Args...)(auto ref Args args) if (is(T == class)) + { + Scoped!(T) result = void; + result.payload = new T(args); + + return result; + } + } + + /** + * Get the length of a zero terminated array. + */ + size_t getArrayLength(T)(T* arr) + { + size_t len; + + for ( ; arr[len]; len++ ){} + + return len; + } + + unittest + { + assert(getArrayLength("aaaaaaaaa\0".ptr) == 9); + } + + Type* gMalloc(Type)() + { + import gi.glib; + return cast(Type*)g_malloc0(Type.sizeof); + } + + alias void* GIConv; +addAliases: end + +addEnums: start + + enum GPriority + { + HIGH = -100, + DEFAULT = 0, + HIGH_IDLE = 100, + DEFAULT_IDLE = 200, + LOW = 300 + } + +addEnums: end + +struct: Array +class: ArrayG + +struct: Base64 +move: base64_decode_step Base64 decode_step +move: base64_decode_inplace Base64 decode_inplace +noCode: decode_step +array: decode_inplace Return out_len +code: start + /** + * Incrementally decode a sequence of binary data from its Base-64 stringified + * representation. By calling this function multiple times you can convert + * data in chunks to avoid having to have the full encoded data in memory. + * + * The output buffer must be large enough to fit all the data that will + * be written to it. Since base64 encodes 3 bytes in 4 chars you need + * at least: (@len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero + * state). + * + * Params: + * inn = binary input data + * len = max length of @in data to decode + * output = output buffer + * state = Saved state between steps, initialize to 0 + * save = Saved state between steps, initialize to 0 + * + * Return: The number of bytes of output that was written + * + * Since: 2.12 + */ + public static size_t decodeStep(string inn, ref ubyte[] output, ref int state, ref uint save) + { + auto p = g_base64_decode_step(Str.toStringz(inn), cast(int)inn.length, cast(char*)output.ptr, &state, &save); + + return p; + } +code: end + +struct: BookmarkFile +out: load_from_data_dirs full_path +array: set_groups groups length + +struct: ByteArray +class: ByteArray + +struct: Bytes +noCode: new_take +noCode: new_static + +struct: Checksum +noCode: get_digest +code: start + /** + * Gets the digest from checksum as a raw binary vector and places it + * into buffer. The size of the digest depends on the type of checksum. + * + * Once this function has been called, the Checksum is closed and can + * no longer be updated with update(). + * + * Params: + * buffer = output buffer + * digestLen = an inout parameter. The caller initializes it to the size of buffer. + * After the call it contains the length of the digest. + * + * Since: 2.16 + */ + public void getDigest(ref ubyte[] buffer) + { + size_t digestLen = buffer.length; + + g_checksum_get_digest(gChecksum, buffer.ptr, &digestLen); + + buffer = buffer[0 .. digestLen]; + } +code: end + +struct: ConstructionException +namespace: +code: start + class ConstructionException : Exception + { + this(string message) + { + super(message); + } + + override string toString() + { + return "Construction failure, " ~ msg; + } + } +code: end + +struct: DateTime +structWrap: gpointer DateTime +noCode: new_now_utc +noCode: new_now_local +noCode: new_from_unix_local +noCode: new_from_unix_utc +noCode: new_from_timeval_local +noCode: new_from_timeval_utc +noCode: new_local +noCode: new_utc +noCode: hash +code: start + /** + * Creates a DateTime corresponding to the given Unix time t + * Unix time is the number of seconds that have elapsed since 1970-01-01 + * 00:00:00 UTC, regardless of the local time offset. + * + * This call can fail (ConstructionException) if t represents a time outside + * of the supported range of GDateTime. + * You should release the return value by calling unref() + * when you are done with it + * + * Params: + * t = the Unix time + * utc = If true use utc else use the local timezone. + * + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.26 + */ + public this (long t, bool utc = true) + { + GDateTime* p; + + if ( utc ) + { + p = g_date_time_new_from_unix_utc(t); + } + else + { + p = g_date_time_new_from_unix_local(t); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_date_time_new_from_unix_local(t)"); + } + this(cast(GDateTime*) p); + } + + /** + * Creates a DateTime corresponding to the given TimeVal tv. + * The time contained in a TimeVal is always stored in the form of + * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the + * local time offset. + * + * This call can fail (ConstructionException) if tv represents a time outside + * of the supported range of DateTime. + * You should release the return value by calling unref() + * when you are done with it. + * + * Params: + * tv = a GTimeVal + * utc = If true use utc else use the local timezone. + * + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.26 + */ + public this (ref GTimeVal tv, bool utc = true) + { + GDateTime* p; + + if ( utc ) + { + p = g_date_time_new_from_timeval_utc(&tv); + } + else + { + p = g_date_time_new_from_timeval_local(&tv); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_date_time_new_from_timeval_local((tv is null) ? null : tv.getTimeValStruct())"); + } + this(cast(GDateTime*) p); + } + + /** */ + override bool opEquals(Object rhs) + { + DateTime date = cast(DateTime)rhs; + + if ( date is null ) + return false; + + return equal(this, date) != 0; + } + + /** */ + override int opCmp(Object rhs) + { + DateTime date = cast(DateTime)rhs; + + if ( date is null ) + return int.min; + + return compare(this, date); + } + + /** */ + override nothrow @trusted hash_t toHash() + { + return hash(); + } + + /** + * Hashes datetime into a guint, suitable for use within GHashTable. + * Since 2.26 + * Params: + * datetime = a GDateTime + * Returns: a guint containing the hash + */ + public nothrow @trusted uint hash() + { + try + { + return g_date_time_hash(gDateTime); + } + catch(Exception e) + { + return 0; + } + } +code: end + +struct: Dir +class: Directory + +struct: Error +class: ErrorG +move: propagate_error Error +move: set_error_literal Error +out: set_error_literal err +out: propagate_error dest + +struct: GException +namespace: +import: glib.ErrorG +import: glib.Str +code: start + class GException : Exception + { + ErrorG error; + + this(ErrorG error) + { + super( Str.toString(error.getErrorGStruct().message) ); + this.error = error; + } + } +code: end + +struct: GLib +namespace: +code: start + static import glib.Version; + deprecated("moves to the glib.Version module") + alias glib.Version.Version Version; +code: end + +struct: HashTable +class: HashTable + +struct: Hmac +noCode: get_digest +move: compute_hmac_for_data Hmac +move: compute_hmac_for_string Hmac +array: compute_hmac_for_data data length +array: compute_hmac_for_string str length +code: start + /** + * Gets the digest from checksum as a raw binary array and places it + * into buffer. The size of the digest depends on the type of checksum. + * + * Once this function has been called, the Hmac is closed and can + * no longer be updated with update(). + * + * Params: + * buffer = output buffer + * + * Since: 2.30 + */ + public void getDigest(ref ubyte[] buffer) + { + size_t digestLen = buffer.length; + + g_hmac_get_digest(gHmac, buffer.ptr, &digestLen); + + buffer = buffer[0 .. digestLen]; + } +code: end + +struct: IConv +namespace: +noStruct: true +ref: iconv inbuf +out: iconv inbytes_left +array: iconv inbuf inbytes_left +ref: iconv outbuf +out: iconv outbytes_left +array: iconv outbuf outbytes_left + +struct: Idle +class: Idle +cType: +code: start + /** Holds all idle delegates */ + bool delegate()[] idleListeners; + /** our idle ID */ + uint idleID; + + /** + * Creates a new idle cycle. + * Params: + * interval = the idle in milieconds + * dlg = the delegate to be executed + * fireNow = When true the delegate will be executed emmidiatly + */ + this(bool delegate() dlg, bool fireNow=false) + { + idleListeners ~= dlg; + idleID = g_idle_add(cast(GSourceFunc)&idleCallback, cast(void*)this); + if ( fireNow ) + { + if ( !dlg() ) + { + idleListeners.length = 0; + } + } + } + + /** + * Creates a new idle cycle. + * Params: + * dlg = the delegate to be executed + * priority = Priority for the idle function + * fireNow = When true the delegate will be executed emmidiatly + */ + this(bool delegate() dlg, GPriority priority, bool fireNow=false) + { + idleListeners ~= dlg; + idleID = g_idle_add_full(priority, cast(GSourceFunc)&idleCallback, cast(void*)this, null); + if ( fireNow ) + { + if ( !dlg() ) + { + idleListeners.length = 0; + } + } + } + + /** */ + public void stop() + { + if ( idleID > 0 ) + { + g_source_remove(idleID); + } + idleListeners.length = 0; + } + + /** + * Removes the idle from gtk + */ + ~this() + { + stop(); + } + + /** + * Adds a new delegate to this idle cycle + * Params: + * dlg = + * fireNow = + */ + public void addListener(bool delegate() dlg, bool fireNow=false) + { + idleListeners ~= dlg; + if ( fireNow ) + { + if ( !dlg() ) + { + idleListeners.length = idleListeners.length - 1; + } + } + } + + /** + * The callback execution from glib + * Params: + * idle = + * Returns: + */ + extern(C) static bool idleCallback(Idle idle) + { + return idle.callAllListeners(); + } + + /** + * Executes all delegates on the execution list + * Returns: + */ + private bool callAllListeners() + { + bool runAgain = false; + + int i = 0; + + while ( i 0 ) --l; + + return line[0..l]; + } + + extern(C) static void childWatchCallback(int pid, int status, Spawn spawn) + { + //writefln("Spawn.childWatchCallback %s %s", pid, status); + spawn.exitStatus = status; + if ( spawn.externalWatch !is null ) + { + spawn.externalWatch(spawn); + } + spawn.close(); + } + + + public bool endOfOutput() + { + if ( standardOutput is null ) return true; + return feof(standardOutput) != 0; + } + + public bool endOfError() + { + if ( standardError is null ) return true; + return feof(standardError) != 0; + } + + string getOutputString() + { + return Str.toString(strOutput); + } + + string getErrorString() + { + return Str.toString(strError); + } + + int getExitStatus() + { + return exitStatus; + } + + /** + * Executes a command synchronasly and + * optionally calls delegates for sysout, syserr and end of job + * + */ + public int commandLineSync( + ChildWatch externalWatch = null, + bool delegate(string) readOutput = null, + bool delegate(string) readError = null ) + { + string commandLine; + foreach ( int count, string arg; argv) + { + if ( count > 0 ) + { + commandLine ~= ' '; + } + commandLine ~= arg; + } + int status = g_spawn_command_line_sync( + Str.toStringz(commandLine), + &strOutput, + &strError, + &exitStatus, + &error); + if ( readOutput != null ) + { + foreach ( string line ; splitLines(Str.toString(strOutput)) ) + { + readOutput(line); + } + } + if ( readError != null ) + { + foreach ( string line ; splitLines(Str.toString(strError)) ) + { + readError(line); + } + } + if ( externalWatch != null ) + { + externalWatch(this); + } + return status; + } +code: end + +struct: Str +import: core.stdc.stdio +import: core.stdc.string +import: gi.gobjecttypes +code: start + /* + * Convert C-style 0 terminated string s to char[] string. + * copied from phobos + */ + public static string toString(const(char)* s, size_t len = 0) + { + if ( s is null ) + return cast(string)null; + + if ( len == 0 ) + len = strlen(s); + + return s[0 .. len].idup; + } + + /* + * Convert array of chars s[] to a C-style 0 terminated string. + * copied from phobos + */ + public static char* toStringz(string s) + { + if ( s is null ) return null; + char[] copy; + + if (s.length == 0) + { + copy = "\0".dup; + } + else + { + // Need to make a copy + copy = new char[s.length + 1]; + copy[0..s.length] = s[]; + copy[s.length] = 0; + } + + return copy.ptr; + } + + /** */ + public static char** toStringzArray(string[] args) + { + if ( args is null ) + { + return null; + } + char** argv = (new char*[args.length]).ptr; + int argc = 0; + foreach (string p; args) + { + argv[argc++] = cast(char*)(p.dup~'\0'); + } + argv[argc] = null; + + return argv; + } + + /** */ + public static char*** toStringzArray(string[][] args) + { + if ( args is null ) + { + return null; + } + char**[] argv = new char**[args.length]; + int argc = 0; + foreach( string[] p; args ) + { + argv[argc++] = toStringzArray(p); + } + argv[argc] = null; + + return argv.ptr; + } + + /** */ + public static string[] toStringArray(const(char*)* args) + { + if ( args is null ) + { + return null; + } + string[] argv; + + while ( *args !is null ) + { + argv ~= toString(*args); + args++; + } + + return argv; + } + + /** */ + public static string[] toStringArray(const(char*)* args, size_t len) + { + string[] argv = new string[len]; + + for ( int i; i < len; i++ ) + { + argv[i] = toString(args[i]); + } + + return argv; + } + + /** */ + public static string[][] toStringArray(char*** args) + { + string[][] argv; + + if ( args is null ) + { + return null; + } + + while ( *args !is null ) + { + argv ~= toStringArray(*args); + args++; + } + + return argv; + } + + /** */ + public static void freeString(char* str) + { + g_free(str); + } + + /** */ + public static void freeStringArray(char** str) + { + g_strfreev(str); + } + + /** */ + public static void freeStringArray(char*** str) + { + while ( *str !is null ) + { + g_strfreev(*str); + str++; + } + + g_free(str); + } +code: end + +struct: String +class: StringG + +struct: Thread +noCode: new + +struct: Timeout +class: Timeout +cType: +code: start + /** Holds all timeout delegates */ + bool delegate()[] timeoutListeners; + /** our gtk timeout ID */ + uint timeoutID; + + + /** + * Creates a new timeout cycle with the default priority, GPriority.DEFAULT. + * + * Note that timeout functions may be delayed, due to the processing of other + * event sources. Thus they should not be relied on for precise timing. + * After each call to the timeout function, the time of the next timeout is + * recalculated based on the current time and the given interval + * (it does not try to 'catch up' time lost in delays). + * Params: + * interval = the timeout in milieconds + * delegate() = the delegate to be executed + * fireNow = When true the delegate will be executed emmidiatly + */ + this(uint interval, bool delegate() dlg, bool fireNow=false) + { + timeoutListeners ~= dlg; + timeoutID = g_timeout_add(interval, cast(GSourceFunc)&timeoutCallback, cast(void*)this); + if ( fireNow ) + { + if ( !dlg() ) + { + timeoutListeners.length = 0; + } + } + } + + /** + * Creates a new timeout cycle. + * Params: + * interval = the timeout in milieconds + * delegate() = the delegate to be executed + * priority = Priority for the timeout function + * fireNow = When true the delegate will be executed emmidiatly + */ + this(uint interval, bool delegate() dlg, GPriority priority, bool fireNow=false) + { + timeoutListeners ~= dlg; + timeoutID = g_timeout_add_full(priority, interval, cast(GSourceFunc)&timeoutCallback, cast(void*)this, null); + if ( fireNow ) + { + if ( !dlg() ) + { + timeoutListeners.length = 0; + } + } + } + + /** + * Creates a new timeout cycle with the default priority, GPriority.DEFAULT. + * Params: + * delegate() = the delegate to be executed + * seconds = interval in seconds. + * fireNow = When true the delegate will be executed emmidiatly + */ + this(bool delegate() dlg, uint seconds, bool fireNow=false) + { + timeoutListeners ~= dlg; + timeoutID = g_timeout_add_seconds(seconds, cast(GSourceFunc)&timeoutCallback, cast(void*)this); + if ( fireNow ) + { + if ( !dlg() ) + { + timeoutListeners.length = 0; + } + } + } + + /** + * Creates a new timeout cycle. + * Params: + * delegate() = the delegate to be executed + * seconds = interval in seconds. + * priority = Priority for the timeout function + * fireNow = When true the delegate will be executed emmidiatly + */ + this(bool delegate() dlg, uint seconds, GPriority priority, bool fireNow=false) + { + timeoutListeners ~= dlg; + timeoutID = g_timeout_add_seconds_full(priority, seconds, cast(GSourceFunc)&timeoutCallback, cast(void*)this, null); + if ( fireNow ) + { + if ( !dlg() ) + { + timeoutListeners.length = 0; + } + } + } + + /** */ + public void stop() + { + if ( timeoutID > 0 ) + { + g_source_remove(timeoutID); + } + timeoutID = 0; + timeoutListeners.length = 0; + } + + /** + * Removes the timeout from gtk + */ + ~this() + { + stop(); + } + + /** + * Adds a new delegate to this timeout cycle + * Params: + * dlg = + * fireNow = + */ + public void addListener(bool delegate() dlg, bool fireNow=false) + { + timeoutListeners ~= dlg; + if ( fireNow ) + { + if ( !dlg() ) + { + timeoutListeners.length = timeoutListeners.length - 1; + } + } + } + + /** + * The callback execution from glib + * Params: + * timeout = + * Returns: + */ + extern(C) static bool timeoutCallback(Timeout timeout) + { + return timeout.callAllListeners(); + } + + /** + * Executes all delegates on the execution list + * Returns: + */ + private bool callAllListeners() + { + bool runAgain = false; + + int i = 0; + + while ( i. + + +############################################# +### Definitions for wrapping Gtk+ ########### +############################################# + +# must start with wrap +wrap: gobject +file: GObject-2.0.gir + +addAliases: start + public import gi.glibtypes; +addAliases: end + +noAlias: Type +addEnums: start + + /** + * A value which represents the unique identifier of a registered type. + */ + enum GType : size_t + { + INVALID = 0<<2, + NONE = 1<<2, + INTERFACE = 2<<2, + CHAR = 3<<2, + UCHAR = 4<<2, + BOOLEAN = 5<<2, + INT = 6<<2, + UINT = 7<<2, + LONG = 8<<2, + ULONG = 9<<2, + INT64 = 10<<2, + UINT64 = 11<<2, + ENUM = 12<<2, + FLAGS = 13<<2, + FLOAT = 14<<2, + DOUBLE = 15<<2, + STRING = 16<<2, + POINTER = 17<<2, + BOXED = 18<<2, + PARAM = 19<<2, + OBJECT = 20<<2, + VARIANT = 21<<2, + } +addEnums: end + +struct: CClosure +class: CClosure +import: glib.ConstructionException +import: gobject.ObjectG +noCode: new +noCode: new_swap +noCode: new_object +noCode: new_object_swap +code: start + /** + * Creates a new closure which invokes callbackFunc with userData as + * the last parameter. + * + * Params: + * callbackFunc = the function to invoke + * userData = user data to pass to callbackFunc + * destroyData = destroy notify to be called when userData is no longer used + * swap = if true invoce with usrData as the first parameter + * + * Throws: ConstructionException GTK+ fails to create the object. + */ + public this(GCallback callbackFunc, void* userData, GClosureNotify destroyData, bool swap) + { + GClosure* p; + + if ( swap ) + p = g_cclosure_new_swap(callbackFunc, userData, destroyData); + else + p = g_cclosure_new(callbackFunc, userData, destroyData); + + if(p is null) + { + throw new ConstructionException("null returned by new"); + } + + this(cast(GCClosure*) p); + } + + /** + * A variant of this() which uses object as userData and + * calls ObjectG.watchClosure() on object and the created + * closure. This function is useful when you have a callback closely + * associated with a gobject.ObjectG, and want the callback to no longer run + * after the object is is freed. + * + * Params: + * callbackFunc = the function to invoke + * object = a gobject.ObjectG.ObjectG to pass to callbackFunc + * swap = if true invoce with usrData as the first parameter + * + * Throws: ConstructionException GTK+ fails to create the object. + */ + public this(GCallback callbackFunc, ObjectG object, bool swap) + { + GClosure* p; + + if ( swap ) + p = g_cclosure_new_object_swap(callbackFunc, (object is null) ? null : object.getObjectGStruct()); + else + p = g_cclosure_new_object(callbackFunc, (object is null) ? null : object.getObjectGStruct()); + + if(p is null) + { + throw new ConstructionException("null returned by new_object"); + } + + this(cast(GCClosure*) p); + } +code: end + +struct: Object +class: ObjectG +import: core.memory +import: gobject.Signals +merge: InitiallyUnowned +noSignal: notify +move: clear_object Object +inout: clear_object object_ptr + +code: start + protected bool isGcRoot; + + /** + * Sets our main struct and passes store it on the gobject. + * Add a gabage collector root to the gtk+ struct so it doesn't get collect + */ + public this (GObject* gObject, bool ownedRef = false) + { + this.gObject = gObject; + if ( gObject !is null ) + { + setDataFull("GObject", cast(void*)this, cast(GDestroyNotify)&destroyNotify); + addToggleRef(cast(GToggleNotify)&toggleNotify, cast(void*)this); + + //If the refCount is larger then 1 toggleNotify isn't called + if (gObject.refCount > 1 && !isGcRoot) + { + GC.addRoot(cast(void*)this); + isGcRoot = true; + } + + //Remove the floating reference if there is one. + if ( isFloating() ) + { + refSink(); + unref(); + } + //If we already owned this reference remove the one added by addToggleRef. + else if ( ownedRef ) + { + unref(); + } + + //When constructed via GtkBuilder set the structs. + if ( getStruct() is null) + { + setStruct(gObject); + } + } + } + + extern(C) + { + static void destroyNotify(ObjectG obj) + { + if ( obj.isGcRoot ) + { + GC.removeRoot(cast(void*)obj); + obj.isGcRoot = false; + } + + obj.gObject = null; + } + + static void toggleNotify(ObjectG obj, GObject* object, int isLastRef) + { + if ( isLastRef && obj.isGcRoot ) + { + GC.removeRoot(cast(void*)obj); + obj.isGcRoot = false; + } + else if ( !obj.isGcRoot ) + { + GC.addRoot(cast(void*)obj); + obj.isGcRoot = true; + } + } + } + + ~this() + { + if ( gObject !is null ) + { + // Remove the GDestroyNotify callback, + // for when the D object is destroyed before the C one. + g_object_steal_data(gObject, cast(char*)"GObject"); + + if ( isGcRoot ) + { + GC.removeRoot(cast(void*)this); + isGcRoot = false; + } + + unref(); + } + } + + /** + * Gets a D Object from the objects table of associations. + * Params: + * obj = GObject containing the associations. + * Returns: the D Object if found, or a newly constructed object if no such Object exists. + */ + public static RT getDObject(T, RT=T, U)(U obj, bool ownedRef = false) + { + if ( obj is null ) + { + return null; + } + + static if ( is(T : ObjectG) ) + { + auto p = g_object_get_data(cast(GObject*)obj, Str.toStringz("GObject")); + + if ( p !is null ) + { + static if ( is(RT == interface ) ) + { + return cast(RT)cast(ObjectG)p; + } + else + { + return cast(RT)p; + } + } + else + { + return new T(obj, ownedRef); + } + } + else + { + return new T(obj); + } + } + + protected void setStruct(GObject* obj) + { + gObject = cast(GObject*)obj; + } + + /** */ + public void setProperty(string propertyName, int value) + { + setProperty(propertyName, new Value(value)); + } + + /** */ + public void setProperty(string propertyName, string value) + { + setProperty(propertyName, new Value(value)); + } + + /** */ + public void setProperty(string propertyName, long value) + { + //We use g_object_set instead of g_object_set_property, because Value doesn't like longs and ulongs for some reason. + g_object_set( gObject, Str.toStringz(propertyName), value, null); + } + + /** */ + public void setProperty(string propertyName, ulong value) + { + g_object_set( gObject, Str.toStringz(propertyName), value, null); + } + + deprecated("Use the member function") + public static void unref(ObjectG obj) + { + obj.unref(); + } + + deprecated("Use the member function") + public static ObjectG doref(ObjectG obj) + { + return obj.doref(); + } + + int[string] connectedSignals; + + void delegate(ParamSpec, ObjectG)[] onNotifyListeners; + /** + * The notify signal is emitted on an object when one of its + * properties has been changed. Note that getting this signal + * doesn't guarantee that the value of the property has actually + * changed, it may also be emitted when the setter for the property + * is called to reinstate the previous value. + * + * This signal is typically used to obtain change notification for a + * single property. + * + * It is important to note that you must use + * canonical parameter names for the property. + * + * Params: + * dlg = The callback. + * property = Set this if you only want to receive the signal for a specific property. + * connectFlags = The behavior of the signal's connection. + */ + void addOnNotify(void delegate(ParamSpec, ObjectG) dlg, string property = "", ConnectFlags connectFlags=cast(ConnectFlags)0) + { + string signalName; + + if ( property == "" ) + signalName = "notify"; + else + signalName = "notify::"~ property; + + if ( !(signalName in connectedSignals) ) + { + Signals.connectData( + this, + signalName, + cast(GCallback)&callBackNotify, + cast(void*)this, + null, + connectFlags); + connectedSignals[signalName] = 1; + } + onNotifyListeners ~= dlg; + } + extern(C) static void callBackNotify(GObject* gobjectStruct, GParamSpec* pspec, ObjectG _objectG) + { + foreach ( void delegate(ParamSpec, ObjectG) dlg ; _objectG.onNotifyListeners ) + { + dlg(ObjectG.getDObject!(ParamSpec)(pspec), _objectG); + } + } +code: end + +struct: ObjectClass +merge: InitiallyUnownedClass + +struct: ParamSpecBoolean +noCode: true + +struct: ParamSpecBoxed +noCode: true + +struct: ParamSpecChar +noCode: true + +struct: ParamSpecDouble +noCode: true + +struct: ParamSpecEnum +noCode: true + +struct: ParamSpecFlags +noCode: true + +struct: ParamSpecFloat +noCode: true + +struct: ParamSpecGType +noCode: true + +struct: ParamSpecInt +noCode: true + +struct: ParamSpecInt64 +noCode: true + +struct: ParamSpecLong +noCode: true + +struct: ParamSpecObject +noCode: true + +struct: ParamSpecOverride +noCode: true + +struct: ParamSpecParam +noCode: true + +struct: ParamSpecPointer +noCode: true + +struct: ParamSpecString +noCode: true + +struct: ParamSpecUChar +noCode: true + +struct: ParamSpecUInt +noCode: true + +struct: ParamSpecUInt64 +noCode: true + +struct: ParamSpecULong +noCode: true + +struct: ParamSpecUnichar +noCode: true + +struct: ParamSpecValueArray +noCode: true + +struct: ParamSpecVariant +noCode: true + +struct: Signals +code: start + /** */ + public static gulong connectData(void* instanc, string detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags) + { + return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, cast(void*)data, destroyData, connectFlags); + } +code: end + +struct: Type +import: gobject.ObjectG +code: start + public static T* getInstanceClass(T)(ObjectG obj) + { + return cast(T*) (cast(GTypeInstance*)obj.getObjectGStruct()).gClass; + } + + /** + * Get the unique name that is assigned to the Objects type. + * Returns: Static type name or NULL. + */ + public static string name(ObjectG obj) + { + GType type = (cast(GTypeInstance*)obj.getObjectGStruct()).gClass.gType; + + return name(type); + } +code: end + +struct: +class: TypePlugin +extend: Object +implements: TypePlugin + +struct: Value +code: start + /** */ + public this() + { + this(new GValue); + } + + /** */ + this(string value) + { + this(); + init(GType.STRING); + setString(value); + } + + /** */ + this(int value) + { + this(); + init(GType.INT); + setInt(value); + } + + /** */ + this(float value) + { + this(); + init(GType.FLOAT); + setFloat(value); + } + + /** */ + this(double value) + { + this(); + init(GType.DOUBLE); + setDouble(value); + } +code: end + +struct: WeakRef +code: start + /** */ + this(void* object) + { + g_weak_ref_init(gWeakRef, object); + } +code: end + +# +# Move functions defined as global into there respective classes +# + +move: boxed_copy Boxed copy +move: boxed_free Boxed free +move: boxed_type_register_static Boxed type_register_static +move: pointer_type_register_static Boxed + +move: enum_complete_type_info Enums complete_type_info +move: enum_get_value Enums get_value +move: enum_get_value_by_name Enums get_value_by_name +move: enum_get_value_by_nick Enums get_value_by_nick +move: enum_register_static Enums register_static + +move: flags_complete_type_info Flags complete_type_info +move: flags_get_first_value Flags get_first_value +move: flags_get_value_by_name Flags get_value_by_name +move: flags_get_value_by_nick Flags get_value_by_nick +move: flags_register_static Flags register_static + +# ParamSpec Constructors? +move: param_spec_boolean Value +move: param_spec_boxed Value +move: param_spec_char Value +move: param_spec_double Value +move: param_spec_enum Value +move: param_spec_flags Value +move: param_spec_float Value +move: param_spec_gtype Value +move: param_spec_int Value +move: param_spec_int64 Value +move: param_spec_long Value +move: param_spec_object Value +move: param_spec_override Value +move: param_spec_param Value +move: param_spec_pointer Value +move: param_spec_string Value +move: param_spec_uchar Value +move: param_spec_uint Value +move: param_spec_uint64 Value +move: param_spec_ulong Value +move: param_spec_unichar Value +move: param_spec_value_array Value +move: param_spec_variant Value + +move: param_type_register_static ParamSpec +move: param_value_convert ParamSpec +move: param_value_defaults ParamSpec +move: param_value_set_default ParamSpec +move: param_value_validate ParamSpec +move: param_values_cmp ParamSpec + +move: signal_accumulator_first_wins Signals accumulator_first_wins +move: signal_accumulator_true_handled Signals accumulator_true_handled +move: signal_add_emission_hook Signals add_emission_hook +move: signal_chain_from_overridden Signals chain_from_overridden +move: signal_chain_from_overridden_handler Signals chain_from_overridden_handler +move: signal_connect_closure Signals connect_closure +move: signal_connect_closure_by_id Signals connect_closure_by_id +move: signal_connect_data Signals connect_data +move: signal_connect_object Signals connect_object +move: signal_emit Signals emit +move: signal_emit_by_name Signals emit_by_name +move: signal_emit_valist Signals emit_valist +move: signal_emitv Signals emitv +move: signal_get_invocation_hint Signals get_invocation_hint +move: signal_handler_block Signals handler_block +move: signal_handler_disconnect Signals handler_disconnect +move: signal_handler_find Signals handler_find +move: signal_handler_is_connected Signals handler_is_connected +move: signal_handler_unblock Signals handler_unblock +move: signal_handlers_block_matched Signals handlers_block_matched +move: signal_handlers_destroy Signals handlers_destroy +move: signal_handlers_disconnect_matched Signals handlers_disconnect_matched +move: signal_handlers_unblock_matched Signals handlers_unblock_matched +move: signal_has_handler_pending Signals has_handler_pending +move: signal_list_ids Signals list_ids +move: signal_lookup Signals lookup +move: signal_name Signals name +move: signal_new Signals new +move: signal_new_class_handler Signals new_class_handler +move: signal_new_valist Signals new_valist +move: signal_newv Signals newv +move: signal_override_class_closure Signals override_class_closure +move: signal_override_class_handler Signals override_class_handler +move: signal_parse_name Signals parse_name +move: signal_query Signals query +move: signal_remove_emission_hook Signals remove_emission_ +move: signal_set_va_marshaller Signals set_va_marshaller +move: signal_stop_emission Signals stop_emission +move: signal_stop_emission_by_name Signals stop_emission_by_name +move: signal_type_cclosure_new Signals type_cclosure_new + +move: source_set_closure Closure +move: source_set_dummy_callback Closure + +move: strdup_value_contents Value + +move: type_add_class_cache_func Type add_class_cache_func +move: type_add_class_private Type add_class_private +move: type_add_instance_private Type add_instance_private +move: type_add_interface_check Type add_interface_check +move: type_add_interface_dynamic Type add_interface_dynamic +move: type_add_interface_static Type add_interface_static +move: type_check_class_cast Type check_class_cast +move: type_check_class_is_a Type check_class_is_a +move: type_check_instance Type check_instance +move: type_check_instance_cast Type check_instance_cast +move: type_check_instance_is_a Type check_instance_is_a +move: type_check_instance_is_fundamentally_a Type check_instance_is_fundamentally_a +move: type_check_is_value_type Type check_is_value_type +move: type_check_value Type check_value +move: type_check_value_holds Type check_value_holds +move: type_children Type children +move: type_create_instance Type create_instance +move: type_default_interface_peek Type default_interface_peek +move: type_default_interface_ref Type default_interface_ref +move: type_default_interface_unref Type default_interface_unref +move: type_depth Type depth +move: type_ensure Type ensure +move: type_free_instance Type free_instance +move: type_from_name Type from_name +move: type_fundamental Type fundamental +move: type_fundamental_next Type fundamental_next +move: type_get_plugin Type get_plugin +move: type_get_qdata Type get_qdata +move: type_get_type_registration_serial Type get_type_registration_serial +move: type_init Type init +move: type_init_with_debug_flags Type init_with_debug_flags +move: type_interfaces Type interfaces +move: type_is_a Type is_a +move: type_name Type name +move: type_name_from_class Type name_from_class +move: type_name_from_instance Type name_from_instance +move: type_next_base Type next_base +move: type_parent Type parent +move: type_qname Type qname +move: type_query Type query +move: type_register_dynamic Type register_dynamic +move: type_register_fundamental Type register_fundamental +move: type_register_static Type register_static +move: type_register_static_simple Type register_static_simple +move: type_remove_class_cache_func Type remove_class_cache_func +move: type_remove_interface_check Type remove_interface_check +move: type_set_qdata Type set_qdata +move: type_test_flags Type test_flags +#move: type_value_table_peek Type value_table_peek diff --git a/contrib/girwrap/APILookupGio.txt b/contrib/girwrap/APILookupGio.txt new file mode 100644 index 0000000..c741980 --- /dev/null +++ b/contrib/girwrap/APILookupGio.txt @@ -0,0 +1,650 @@ +# +# Licensed under the GNU Lesser General Public License Version 3 +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the license, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +############################################# +### Definitions for wrapping Gtk+ ########### +############################################# + +# must start with wrap +wrap: gio +file: /usr/share/gir-1.0/Gio-2.0.gir + +addAliases: start + public import gi.glibtypes; + public import gi.gobjecttypes; +addAliases: end + +struct: +class: Action +extend: GObject.Object +implements: Action + +struct: +class: ActionGroup +extend: GObject.Object +implements: ActionGroup + +struct: +class: AppInfo +extend: GObject.Object +implements: AppInfo + +struct: Application +code: start + protected class ScopedOnCommandLineDelegateWrapper + { + static ScopedOnCommandLineDelegateWrapper[] listeners; + int delegate(Scoped!ApplicationCommandLine, Application) dlg; + gulong handlerId; + + this(int delegate(Scoped!ApplicationCommandLine, Application) dlg) + { + this.dlg = dlg; + this.listeners ~= this; + } + + void remove(ScopedOnCommandLineDelegateWrapper source) + { + foreach(index, wrapper; listeners) + { + if (wrapper.handlerId == source.handlerId) + { + listeners[index] = null; + listeners = std.algorithm.remove(listeners, index); + break; + } + } + } + } + + /** + * The ::command-line signal is emitted on the primary instance when + * a commandline is not handled locally. See g_application_run() and + * the #GApplicationCommandLine documentation for more information. + * + * Params: + * commandLine = a #GApplicationCommandLine representing the + * passed commandline + * + * Return: An integer that is set as the exit status for the calling + * process. See g_application_command_line_set_exit_status(). + */ + gulong addOnCommandLine(int delegate(Scoped!ApplicationCommandLine, Application) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) + { + auto wrapper = new ScopedOnCommandLineDelegateWrapper(dlg); + wrapper.handlerId = Signals.connectData( + this, + "command-line", + cast(GCallback)&callBackScopedCommandLine, + cast(void*)wrapper, + cast(GClosureNotify)&callBackScopedCommandLineDestroy, + connectFlags); + return wrapper.handlerId; + } + + extern(C) static int callBackScopedCommandLine(GApplication* applicationStruct, GApplicationCommandLine* commandLine, ScopedOnCommandLineDelegateWrapper wrapper) + { + return wrapper.dlg(scoped!ApplicationCommandLine(commandLine), wrapper.outer); + } + + extern(C) static void callBackScopedCommandLineDestroy(ScopedOnCommandLineDelegateWrapper wrapper, GClosure* closure) + { + wrapper.remove(wrapper); + } +code: end + +struct: BufferedInputStream +noCode: peek_buffer +code: start + /** + * Returns the buffer with the currently available bytes. The returned + * buffer must not be modified and will become invalid when reading from + * the stream or filling the buffer. + * + * Params: + * count = a #gsize to get the number of bytes available in the buffer + * + * Return: read-only buffer + */ + public ubyte[] peekBuffer() + { + size_t count; + + auto p = g_buffered_input_stream_peek_buffer(gBufferedInputStream, &count); + + return (cast(ubyte*)p)[0 .. count]; + } +code: end + +struct: +class: Converter +extend: GObject.Object +implements: Converter + +struct: DataInputStream +noCode: read_byte + +struct: DBusActionGroup +import: glib.ConstructionException +code: start + /** + * See_Also: get(). + */ + this(DBusConnection connection, string busName, string objectPath) + { + auto p = g_dbus_action_group_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath)); + + if(p is null) + { + throw new ConstructionException("null returned by g_dbus_action_group_get"); + } + this(cast(GDBusActionGroup*) p, true); + } +code: end + +struct: DBusAnnotationInfo +import: glib.Str +noCode: lookup +code: start + /** + * Looks up the value of an annotation. + * + * The cost of this function is O(n) in number of annotations. + * + * Params: + * annotations = A %NULL-terminated array of annotations or %NULL. + * name = The name of the annotation to look up. + * + * Return: The value or %NULL if not found. Do not free, it is owned by @annotations. + * + * Since: 2.26 + */ + public static string lookup(DBusAnnotationInfo[] annotations, string name) + { + GDBusAnnotationInfo*[] annotationsArray = new GDBusAnnotationInfo*[annotations.length+1]; + for ( int i = 0; i < annotations.length ; i++ ) + { + annotationsArray[i] = annotations[i].getDBusAnnotationInfoStruct(); + } + annotationsArray[$-1] = null; + + return Str.toString(g_dbus_annotation_info_lookup(annotationsArray.ptr, Str.toStringz(name))); + } +code: end + +struct: DBusConnection +alias: new newConnection +noCode: new_finish +noCode: new_for_address_finish +code: start + /** + * Finishes an operation started with g_dbus_connection_new(). + * + * Params: + * res = A GAsyncResult obtained from the GAsyncReadyCallback + * passed to g_dbus_connection_new(). + * address = If true finish an address. + * + * Throws: GException on failure. + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.26 + */ + public this (AsyncResultIF res, bool address = false) + { + GError* err = null; + GDBusConnection* p; + + if ( address ) + { + p = g_dbus_connection_new_for_address_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + else + { + p = g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + + if (err !is null) + { + throw new GException( new ErrorG(err) ); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)"); + } + this(p, true); + } +code: end + +struct: DBusMenuModel +import: glib.ConstructionException +code: start + /** + * See_Also: get(). + */ + this(DBusConnection connection, string busName, string objectPath) + { + auto p = g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath)); + + if(p is null) + { + throw new ConstructionException("null returned by g_dbus_menu_model_get"); + } + + this(cast(GDBusMenuModel*) p, true); + } +code: end + +struct: +class: DBusObject +extend: GObject.Object +implements: DBusObject + +struct: DBusObjectManagerClient +alias: new newObjectManagerClient +noCode: new_finish +noCode: new_for_bus_finish +code: start + /** + * Finishes an operation started with g_dbus_object_manager_client_new(). + * + * Params: + * res = A GAsyncResult obtained from the GAsyncReadyCallback passed to the DBusObjectManager constructor. + * forBus = If true finish an address. + * + * Throws: GException on failure. + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.30 + */ + public this (AsyncResultIF res, bool forBus = false) + { + GError* err = null; + GDBusObjectManager* p; + + if ( forBus ) + { + p = g_dbus_object_manager_client_new_for_bus_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + else + { + p = g_dbus_object_manager_client_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + + if (err !is null) + { + throw new GException( new ErrorG(err) ); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_dbus_object_manager_client_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)"); + } + this(cast(GDBusObjectManagerClient*) p, true); + } +code: end + +struct: +class: DBusInterface +extend: GObject.Object +implements: DBusInterface + +struct: DBusProxy +alias: new newProxy +noCode: new_finish +noCode: new_for_bus_finish +code: start + /** + * Finishes creating a GDBusProxy. + * + * Params: + * res = A GAsyncResult obtained from the GAsyncReadyCallback + * function passed to g_dbus_proxy_new(). + * forBus = If true finish an address. + * + * Throws: GException on failure. + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.26 + */ + public this (AsyncResultIF res, bool forBus = false) + { + GError* err = null; + GDBusProxy* p; + + if ( forBus ) + { + p = g_dbus_proxy_new_for_bus_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + else + { + p = g_dbus_proxy_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err); + } + + if (err !is null) + { + throw new GException( new ErrorG(err) ); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_dbus_proxy_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)"); + } + this(p, true); + } +code: end + +struct: DesktopAppInfo +noCode: new_from_filename +code: start + /** + * Creates a new #GDesktopAppInfo. + * + * Params: + * filename = the path of a desktop file, in the GLib filename encoding + * + * Return: a new #GDesktopAppInfo or %NULL on error. + * + * Throws: ConstructionException GTK+ fails to create the object. + */ + public static DesktopAppInfo createFromFilename(string filename) + { + auto p = g_desktop_app_info_new_from_filename(Str.toStringz(filename)); + + if(p is null) + { + throw new ConstructionException("null returned by g_desktop_app_info_new_from_filename"); + } + + return new DesktopAppInfo(p, true); + } +code: end + +struct: +class: Drive +extend: GObject.Object +implements: Drive + +struct: +class: File +extend: GObject.Object +implements: File + +struct: +class: Icon +extend: GObject.Object +implements: Icon + +struct: InetAddress +noCode: new_any +noCode: new_loopback +code: start + /** + * Creates a InetAddress for the "any" address (unassigned/"don't + * care") for family. + * + * Params: + * family = the address family + * loopback = If true create an InetAddress for the loopback address. + * + * Throws: ConstructionException GTK+ fails to create the object. + * + * Since: 2.22 + */ + public this (GSocketFamily family, bool loopback = false) + { + GInetAddress* p; + + if ( loopback ) + { + p = g_inet_address_new_loopback(family); + } + else + { + p = g_inet_address_new_any(family); + } + + if(p is null) + { + throw new ConstructionException("null returned by g_inet_address_new_any(family)"); + } + this(p, true); + } +code: end + +struct: NoExternal +noCode: true +noExternal: true + +struct: IOModule +move: load NoExternal +move: unload NoExternal +move: query NoExternal + +struct: IOModuleScope + +struct: MenuItem +noCode: new_section +noCode: new_submenu + +struct: +class: Mount +extend: GObject.Object +implements: Mount + +struct: +class: NetworkMonitor +extend: GObject.Object +implements: NetworkMonitor + +struct: OutputStream +out: vprintf error + +struct: PollableUtils +namespace: + +struct: +class: Proxy +extend: GObject.Object +implements: Proxy + +struct: +class: ProxyResolver +extend: GObject.Object +implements: ProxyResolver + +struct: Resource +alias: _register register +alias: _unregister unregister + +struct: SettingsSchema + +struct: SettingsSchemaSource + +struct: SimpleAsyncResult +noCode: new_take_error + +struct: SimpleProxyResolver +array: new ignore_hosts +array: set_ignore_hosts ignore_hosts + +struct: Socket +ref: receive buffer +ref: receive_from buffer +out: receive_message messages +out: receive_message num_messages + +struct: +class: SocketConnectable +extend: GObject.Object +implements: SocketConnectable + +struct: SubprocessLauncher +array: set_environ env + +struct: ThemedIcon +noCode: new + +struct: +class: TlsBackend +extend: GObject.Object +implements: TlsBackend + +struct: TlsPassword +out: get_value length +array: get_value Return length +array: set_value value length +array: set_value_full value length + +struct: UnixSocketAddress +noCode: new_abstract + +struct: +class: Volume +extend: GObject.Object +implements: Volume + +struct: VolumeMonitor +import: glib.ConstructionException +noCode: get +code: start + /** + * Gets the volume monitor used by gio. + * + * Return: a reference to the #GVolumeMonitor used by gio. Call + * g_object_unref() when done with it. + */ + public this() + { + auto p = g_volume_monitor_get(); + + if(p is null) + { + throw new ConstructionException("g_volume_monitor_get()"); + } + + this(cast(GVolumeMonitor*) p, true); + } +code: end + +struct: + +move: bus_get DBusConnection get +move: bus_get_finish DBusConnection get_finish +move: bus_get_sync DBusConnection get_sync + +move: bus_own_name DBusNames own_name +move: bus_own_name_on_connection DBusNames own_name_on_connection +move: bus_own_name_on_connection_with_closures DBusNames own_name_on_connection_with_closures +move: bus_own_name_with_closures DBusNames own_name_with_closures +move: bus_unown_name DBusNames unown_name +move: bus_unwatch_name DBusNames unwatch_name +move: bus_watch_name DBusNames watch_name +move: bus_watch_name_on_connection DBusNames watch_name_on_connection +move: bus_watch_name_on_connection_with_closures DBusNames watch_name_on_connection_with_closures +move: bus_watch_name_with_closures DBusNames watch_name_with_closures + +move: content_type_can_be_executable ContentType can_be_executable +move: content_type_equals ContentType equals +move: content_type_from_mime_type ContentType from_mime_type +move: content_type_get_description ContentType get_description +move: content_type_get_generic_icon_name ContentType get_generic_icon_name +move: content_type_get_icon ContentType get_icon +move: content_type_get_mime_type ContentType get_mime_type +move: content_type_get_symbolic_icon ContentType get_symbolic_icon +move: content_type_guess ContentType type_guess +move: content_type_guess_for_tree ContentType guess_for_tree +move: content_type_is_a ContentType is_a +move: content_type_is_unknown ContentType is_unknown +move: content_types_get_registered ContentType + +move: dbus_error_encode_gerror DBusError encode_gerror +move: dbus_error_get_remote_error DBusError get_remote_error +move: dbus_error_is_remote_error DBusError is_remote_error +move: dbus_error_new_for_dbus_error DBusError new_for_dbus_error +move: dbus_error_quark DBusError quark +move: dbus_error_register_error DBusError register_error +move: dbus_error_register_error_domain DBusError register_error_domain +move: dbus_error_strip_remote_error DBusError strip_remote_error +move: dbus_error_unregister_error DBusError unregister_error + +move: dbus_address_escape_value DBusUtilities address_escape_value +move: dbus_address_get_for_bus_sync DBusUtilities address_get_for_bus_sync +move: dbus_address_get_stream DBusUtilities address_get_stream +move: dbus_address_get_stream_finish DBusUtilities address_get_stream_finish +move: dbus_address_get_stream_sync DBusUtilities address_get_stream_sync +move: dbus_generate_guid DBusUtilities generate_guid +move: dbus_gvalue_to_gvariant DBusUtilities gvalue_to_gvariant +move: dbus_gvariant_to_gvalue DBusUtilities gvariant_to_gvalue +move: dbus_is_address DBusUtilities is_address +move: dbus_is_guid DBusUtilities is_guid +move: dbus_is_interface_name DBusUtilities is_interface_name +move: dbus_is_member_name DBusUtilities is_member_name +move: dbus_is_name DBusUtilities is_name +move: dbus_is_supported_address DBusUtilities is_supported_address +move: dbus_is_unique_name DBusUtilities is_unique_name + +struct: DBusUtilities +out: address_get_stream_finish out_guid +out: address_get_stream_sync out_guid + +move: io_error_from_errno ErrorGIO +move: io_error_quark ErrorGIO + +move: io_modules_load_all_in_directory IOModule load_all_in_directory +move: io_modules_load_all_in_directory_with_scope IOModule load_all_in_directory_with_scope +move: io_modules_scan_all_in_directory IOModule scan_all_in_directory +move: io_modules_scan_all_in_directory_with_scope IOModule scan_all_in_directory_with_scope + +move: io_scheduler_cancel_all_jobs IOSchedulerJob cancel_all_jobs +move: io_scheduler_push_job IOSchedulerJob push_job + +move: pollable_source_new PollableUtils +move: pollable_source_new_full PollableUtils +move: pollable_stream_read PollableUtils +move: pollable_stream_write PollableUtils +move: pollable_stream_write_all PollableUtils + +move: resources_enumerate_children Resource +move: resources_get_info Resource +move: resources_lookup_data Resource +move: resources_open_stream Resource +move: resources_register Resource _register +move: resources_unregister Resource _unregister + +move: simple_async_report_error_in_idle SimpleAsyncResult +move: simple_async_report_gerror_in_idle SimpleAsyncResult +move: simple_async_report_take_gerror_in_idle SimpleAsyncResult + +move: unix_is_mount_path_system_internal UnixMountEntry is_mount_path_system_internal +move: unix_mount_at UnixMountEntry at +move: unix_mount_compare UnixMountEntry compare +move: unix_mount_free UnixMountEntry free +move: unix_mount_get_device_path UnixMountEntry get_device_path +move: unix_mount_get_fs_type UnixMountEntry get_fs_type +move: unix_mount_get_mount_path UnixMountEntry get_mount_path +move: unix_mount_guess_can_eject UnixMountEntry guess_can_eject +move: unix_mount_guess_icon UnixMountEntry guess_icon +move: unix_mount_guess_name UnixMountEntry guess_name +move: unix_mount_guess_should_display UnixMountEntry guess_should_display +move: unix_mount_guess_symbolic_icon UnixMountEntry guess_symbolic_icon +move: unix_mount_is_readonly UnixMountEntry is_readonly +move: unix_mount_is_system_internal UnixMountEntry is_system_internal +move: unix_mount_points_changed_since UnixMountEntry points_changed_since +move: unix_mount_points_get UnixMountEntry mount_points_get +move: unix_mounts_changed_since UnixMountEntry mounts_changed_since +move: unix_mounts_get UnixMountEntry mounts_get diff --git a/contrib/girwrap/find-d-intf-files.sh b/contrib/girwrap/find-d-intf-files.sh new file mode 100755 index 0000000..ae0d46e --- /dev/null +++ b/contrib/girwrap/find-d-intf-files.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -z ${MESON_BUILD_ROOT+x} ]; then + echo "This script should only be run by the Meson build system." + exit 1 +fi + +find $MESON_BUILD_ROOT/girepo -name "*.d" | sort diff --git a/meson.build b/meson.build index dadb95b..dd0a8ca 100644 --- a/meson.build +++ b/meson.build @@ -66,321 +66,10 @@ backend_sources = [ 'src/asgen/backends/rpmmd/rpmpkgindex.d', ] -gir_binding_sources = [ - 'src/girepo/appstream/Bundle.d', - 'src/girepo/appstream/Category.d', - 'src/girepo/appstream/Checksum.d', - 'src/girepo/appstream/Component.d', - 'src/girepo/appstream/Pool.d', - 'src/girepo/appstream/DistroDetails.d', - 'src/girepo/appstream/Icon.d', - 'src/girepo/appstream/Image.d', - 'src/girepo/appstream/Metadata.d', - 'src/girepo/appstream/Provided.d', - 'src/girepo/appstream/Release.d', - 'src/girepo/appstream/Screenshot.d', - 'src/girepo/appstream/Translation.d', - 'src/girepo/appstream/Validator.d', - 'src/girepo/appstream/ValidatorIssue.d', - 'src/girepo/appstream/Suggested.d', - 'src/girepo/gi/appstream.d', - 'src/girepo/gi/appstreamtypes.d', - 'src/girepo/gi/gio.d', - 'src/girepo/gi/giotypes.d', - 'src/girepo/gi/glib.d', - 'src/girepo/gi/glibtypes.d', - 'src/girepo/gi/gobject.d', - 'src/girepo/gi/gobjecttypes.d', - 'src/girepo/gio/Action.d', - 'src/girepo/gio/ActionGroup.d', - 'src/girepo/gio/ActionGroupIF.d', - 'src/girepo/gio/ActionGroupT.d', - 'src/girepo/gio/ActionIF.d', - 'src/girepo/gio/ActionMapIF.d', - 'src/girepo/gio/ActionMapT.d', - 'src/girepo/gio/ActionT.d', - 'src/girepo/gio/AppInfo.d', - 'src/girepo/gio/AppInfoIF.d', - 'src/girepo/gio/AppInfoMonitor.d', - 'src/girepo/gio/AppInfoT.d', - 'src/girepo/gio/AppLaunchContext.d', - 'src/girepo/gio/ApplicationCommandLine.d', - 'src/girepo/gio/Application.d', - 'src/girepo/gio/AsyncInitableIF.d', - 'src/girepo/gio/AsyncInitableT.d', - 'src/girepo/gio/AsyncResultIF.d', - 'src/girepo/gio/AsyncResultT.d', - 'src/girepo/gio/BufferedInputStream.d', - 'src/girepo/gio/BufferedOutputStream.d', - 'src/girepo/gio/BytesIcon.d', - 'src/girepo/gio/Cancellable.d', - 'src/girepo/gio/CharsetConverter.d', - 'src/girepo/gio/ContentType.d', - 'src/girepo/gio/Converter.d', - 'src/girepo/gio/ConverterIF.d', - 'src/girepo/gio/ConverterInputStream.d', - 'src/girepo/gio/ConverterOutputStream.d', - 'src/girepo/gio/ConverterT.d', - 'src/girepo/gio/Credentials.d', - 'src/girepo/gio/DatagramBasedIF.d', - 'src/girepo/gio/DataOutputStream.d', - 'src/girepo/gio/DBusActionGroup.d', - 'src/girepo/gio/DBusAnnotationInfo.d', - 'src/girepo/gio/DBusArgInfo.d', - 'src/girepo/gio/DBusAuthObserver.d', - 'src/girepo/gio/DBusConnection.d', - 'src/girepo/gio/DBusError.d', - 'src/girepo/gio/DBusInterface.d', - 'src/girepo/gio/DBusInterfaceIF.d', - 'src/girepo/gio/DBusInterfaceInfo.d', - 'src/girepo/gio/DBusInterfaceSkeleton.d', - 'src/girepo/gio/DBusInterfaceT.d', - 'src/girepo/gio/DBusMenuModel.d', - 'src/girepo/gio/DBusMessage.d', - 'src/girepo/gio/DBusMethodInfo.d', - 'src/girepo/gio/DBusMethodInvocation.d', - 'src/girepo/gio/DBusNames.d', - 'src/girepo/gio/DBusNodeInfo.d', - 'src/girepo/gio/DBusObject.d', - 'src/girepo/gio/DBusObjectIF.d', - 'src/girepo/gio/DBusObjectManagerClient.d', - 'src/girepo/gio/DBusObjectManagerIF.d', - 'src/girepo/gio/DBusObjectManagerServer.d', - 'src/girepo/gio/DBusObjectManagerT.d', - 'src/girepo/gio/DBusObjectProxy.d', - 'src/girepo/gio/DBusObjectSkeleton.d', - 'src/girepo/gio/DBusObjectT.d', - 'src/girepo/gio/DBusPropertyInfo.d', - 'src/girepo/gio/DBusProxy.d', - 'src/girepo/gio/DBusServer.d', - 'src/girepo/gio/DBusSignalInfo.d', - 'src/girepo/gio/DBusUtilities.d', - 'src/girepo/gio/DesktopAppInfo.d', - 'src/girepo/gio/DesktopAppInfoLookupIF.d', - 'src/girepo/gio/DesktopAppInfoLookupT.d', - 'src/girepo/gio/Drive.d', - 'src/girepo/gio/DriveIF.d', - 'src/girepo/gio/DriveT.d', - 'src/girepo/gio/Emblem.d', - 'src/girepo/gio/EmblemedIcon.d', - 'src/girepo/gio/ErrorGIO.d', - 'src/girepo/gio/FileAttributeInfoList.d', - 'src/girepo/gio/FileAttributeMatcher.d', - 'src/girepo/gio/File.d', - 'src/girepo/gio/FileDescriptorBasedIF.d', - 'src/girepo/gio/FileDescriptorBasedT.d', - 'src/girepo/gio/FileEnumerator.d', - 'src/girepo/gio/FileIcon.d', - 'src/girepo/gio/FileIF.d', - 'src/girepo/gio/FileInfo.d', - 'src/girepo/gio/FileInputStream.d', - 'src/girepo/gio/FileIOStream.d', - 'src/girepo/gio/FileMonitor.d', - 'src/girepo/gio/FilenameCompleter.d', - 'src/girepo/gio/FileOutputStream.d', - 'src/girepo/gio/FileT.d', - 'src/girepo/gio/FilterInputStream.d', - 'src/girepo/gio/FilterOutputStream.d', - 'src/girepo/gio/Icon.d', - 'src/girepo/gio/IconIF.d', - 'src/girepo/gio/IconT.d', - 'src/girepo/gio/InitableIF.d', - 'src/girepo/gio/InitableT.d', - 'src/girepo/gio/InputStream.d', - 'src/girepo/gio/IOExtension.d', - 'src/girepo/gio/IOExtensionPoint.d', - 'src/girepo/gio/IOSchedulerJob.d', - 'src/girepo/gio/IOStream.d', - 'src/girepo/gio/ListModelIF.d', - 'src/girepo/gio/ListModelT.d', - 'src/girepo/gio/ListStore.d', - 'src/girepo/gio/LoadableIconIF.d', - 'src/girepo/gio/LoadableIconT.d', - 'src/girepo/gio/MemoryInputStream.d', - 'src/girepo/gio/MemoryOutputStream.d', - 'src/girepo/gio/MenuAttributeIter.d', - 'src/girepo/gio/Menu.d', - 'src/girepo/gio/MenuItem.d', - 'src/girepo/gio/MenuLinkIter.d', - 'src/girepo/gio/MenuModel.d', - 'src/girepo/gio/Mount.d', - 'src/girepo/gio/MountIF.d', - 'src/girepo/gio/MountOperation.d', - 'src/girepo/gio/MountT.d', - 'src/girepo/gio/NativeVolumeMonitor.d', - 'src/girepo/gio/Notification.d', - 'src/girepo/gio/OutputStream.d', - 'src/girepo/gio/Permission.d', - 'src/girepo/gio/PollableInputStreamIF.d', - 'src/girepo/gio/PollableInputStreamT.d', - 'src/girepo/gio/PollableOutputStreamIF.d', - 'src/girepo/gio/PollableOutputStreamT.d', - 'src/girepo/gio/PollableUtils.d', - 'src/girepo/gio/PropertyAction.d', - 'src/girepo/gio/ProxyResolver.d', - 'src/girepo/gio/ProxyResolverIF.d', - 'src/girepo/gio/ProxyResolverT.d', - 'src/girepo/gio/RemoteActionGroupIF.d', - 'src/girepo/gio/RemoteActionGroupT.d', - 'src/girepo/gio/Resource.d', - 'src/girepo/gio/SeekableIF.d', - 'src/girepo/gio/SeekableT.d', - 'src/girepo/gio/Settings.d', - 'src/girepo/gio/SettingsSchema.d', - 'src/girepo/gio/SettingsSchemaKey.d', - 'src/girepo/gio/SettingsSchemaSource.d', - 'src/girepo/gio/SimpleAction.d', - 'src/girepo/gio/SimpleActionGroup.d', - 'src/girepo/gio/SimpleAsyncResult.d', - 'src/girepo/gio/SimpleIOStream.d', - 'src/girepo/gio/SimplePermission.d', - 'src/girepo/gio/SimpleProxyResolver.d', - 'src/girepo/gio/SocketControlMessage.d', - 'src/girepo/gio/SrvTarget.d', - 'src/girepo/gio/StaticResource.d', - 'src/girepo/gio/Subprocess.d', - 'src/girepo/gio/SubprocessLauncher.d', - 'src/girepo/gio/Task.d', - 'src/girepo/gio/TestDBus.d', - 'src/girepo/gio/ThemedIcon.d', - 'src/girepo/gio/TlsFileDatabaseIF.d', - 'src/girepo/gio/TlsFileDatabaseT.d', - 'src/girepo/gio/TlsPassword.d', - 'src/girepo/gio/UnixCredentialsMessage.d', - 'src/girepo/gio/UnixFDList.d', - 'src/girepo/gio/UnixFDMessage.d', - 'src/girepo/gio/UnixInputStream.d', - 'src/girepo/gio/UnixMountEntry.d', - 'src/girepo/gio/UnixMountMonitor.d', - 'src/girepo/gio/UnixMountPoint.d', - 'src/girepo/gio/UnixOutputStream.d', - 'src/girepo/gio/Vfs.d', - 'src/girepo/gio/Volume.d', - 'src/girepo/gio/VolumeIF.d', - 'src/girepo/gio/VolumeMonitor.d', - 'src/girepo/gio/VolumeT.d', - 'src/girepo/gio/ZlibCompressor.d', - 'src/girepo/gio/ZlibDecompressor.d', - 'src/girepo/glib/ArrayG.d', - 'src/girepo/glib/AsyncQueue.d', - 'src/girepo/glib/Atomic.d', - 'src/girepo/glib/Base64.d', - 'src/girepo/glib/BBTree.d', - 'src/girepo/glib/BookmarkFile.d', - 'src/girepo/glib/ByteArray.d', - 'src/girepo/glib/Bytes.d', - 'src/girepo/glib/CharacterSet.d', - 'src/girepo/glib/Checksum.d', - 'src/girepo/glib/Child.d', - 'src/girepo/glib/Cond.d', - 'src/girepo/glib/ConstructionException.d', - 'src/girepo/glib/DataList.d', - 'src/girepo/glib/DataSet.d', - 'src/girepo/glib/Date.d', - 'src/girepo/glib/DateTime.d', - 'src/girepo/glib/Directory.d', - 'src/girepo/glib/ErrorG.d', - 'src/girepo/glib/FileUtils.d', - 'src/girepo/glib/GException.d', - 'src/girepo/glib/GLib.d', - 'src/girepo/glib/HashTable.d', - 'src/girepo/glib/HashTableIter.d', - 'src/girepo/glib/Hmac.d', - 'src/girepo/glib/Hook.d', - 'src/girepo/glib/HookList.d', - 'src/girepo/glib/Hostname.d', - 'src/girepo/glib/IConv.d', - 'src/girepo/glib/Idle.d', - 'src/girepo/glib/Internationalization.d', - 'src/girepo/glib/IOChannel.d', - 'src/girepo/glib/KeyFile.d', - 'src/girepo/glib/ListG.d', - 'src/girepo/glib/ListSG.d', - 'src/girepo/glib/MainContext.d', - 'src/girepo/glib/MainLoop.d', - 'src/girepo/glib/MappedFile.d', - 'src/girepo/glib/MatchInfo.d', - 'src/girepo/glib/Memory.d', - 'src/girepo/glib/MemorySlice.d', - 'src/girepo/glib/MessageLog.d', - 'src/girepo/glib/Messages.d', - 'src/girepo/glib/Mutex.d', - 'src/girepo/glib/Node.d', - 'src/girepo/glib/Once.d', - 'src/girepo/glib/OptionContext.d', - 'src/girepo/glib/OptionGroup.d', - 'src/girepo/glib/Pattern.d', - 'src/girepo/glib/Private.d', - 'src/girepo/glib/PtrArray.d', - 'src/girepo/glib/Quark.d', - 'src/girepo/glib/QueueG.d', - 'src/girepo/glib/RandG.d', - 'src/girepo/glib/RecMutex.d', - 'src/girepo/glib/Regex.d', - 'src/girepo/glib/RWLock.d', - 'src/girepo/glib/ScannerG.d', - 'src/girepo/glib/Sequence.d', - 'src/girepo/glib/SequenceIter.d', - 'src/girepo/glib/ShellUtils.d', - 'src/girepo/glib/SimpleXML.d', - 'src/girepo/glib/Source.d', - 'src/girepo/glib/Spawn.d', - 'src/girepo/glib/Str.d', - 'src/girepo/glib/StringChunk.d', - 'src/girepo/glib/StringG.d', - 'src/girepo/glib/TestLogBuffer.d', - 'src/girepo/glib/TestLogMsg.d', - 'src/girepo/glib/TestSuite.d', - 'src/girepo/glib/Thread.d', - 'src/girepo/glib/ThreadPool.d', - 'src/girepo/glib/Timeout.d', - 'src/girepo/glib/Timer.d', - 'src/girepo/glib/TimeVal.d', - 'src/girepo/glib/TimeZone.d', - 'src/girepo/glib/TrashStack.d', - 'src/girepo/glib/Unicode.d', - 'src/girepo/glib/UnixUtils.d', - 'src/girepo/glib/URI.d', - 'src/girepo/glib/Util.d', - 'src/girepo/glib/VariantBuilder.d', - 'src/girepo/glib/Variant.d', - 'src/girepo/glib/VariantDict.d', - 'src/girepo/glib/VariantIter.d', - 'src/girepo/glib/VariantType.d', - 'src/girepo/glib/Version.d', - 'src/girepo/gobject/Binding.d', - 'src/girepo/gobject/Boxed.d', - 'src/girepo/gobject/CClosure.d', - 'src/girepo/gobject/Closure.d', - 'src/girepo/gobject/Enums.d', - 'src/girepo/gobject/Flags.d', - 'src/girepo/gobject/ObjectClass.d', - 'src/girepo/gobject/ObjectG.d', - 'src/girepo/gobject/ParamSpec.d', - 'src/girepo/gobject/ParamSpecPool.d', - 'src/girepo/gobject/Signals.d', - 'src/girepo/gobject/TypeClass.d', - 'src/girepo/gobject/Type.d', - 'src/girepo/gobject/TypeInstance.d', - 'src/girepo/gobject/TypeInterface.d', - 'src/girepo/gobject/TypeModule.d', - 'src/girepo/gobject/TypePlugin.d', - 'src/girepo/gobject/TypePluginIF.d', - 'src/girepo/gobject/TypePluginT.d', - 'src/girepo/gobject/TypeValueTable.d', - 'src/girepo/gobject/ValueArray.d', - 'src/girepo/gobject/Value.d', - 'src/girepo/gobject/WeakRef.d' -] - -# FIXME: including 'src/girepo/gio/DataInputStream.d' in the -# build process results in linker errors. Investigate why. - # # Dependencies # src_dir = include_directories('src/') -gir_bind_dir = include_directories('src/girepo/') glib_dep = dependency('glib-2.0') gobject_dep = dependency('gobject-2.0') @@ -396,6 +85,30 @@ freetype_dep = dependency('freetype2') pango_dep = dependency('pango') fontconfig_dep = dependency('fontconfig') +# +# Build interfaces from GIR +# +gir_to_d_prog = find_program('girtod') +gir_wrap_dir = source_root + '/contrib/girwrap/' +gir_d_intf_dir = build_root + '/girepo/' + +message('Generating D interfaces from GIR...') +girtod_gen = run_command(gir_to_d_prog.path(), + '-i', gir_wrap_dir, + '-o', gir_d_intf_dir) +if girtod_gen.returncode() != 0 + error('Unable to build D intefaces from GIR:\n' + girtod_gen.stderr() + girtod_gen.stdout()) +endif +gir_bind_dir = include_directories('girepo') + +# Enlist D GIR interface sources +dgir_glob_script = run_command(source_root + '/contrib/girwrap/find-d-intf-files.sh') +gir_binding_sources = dgir_glob_script.stdout().strip().split('\n') + +# +# Download JS stuff and additional sources if we couldn't find them +# + # A couple of hacks to use the right copy of mustache-d mustache_d_file = '/usr/include/d/mustache-d/mustache.d' mustache_dir = include_directories('/usr/include/d/mustache-d') @@ -403,9 +116,9 @@ if run_command('[', '-e', mustache_d_file, ']').returncode() != 0 mustached_src_dir = build_root + '/3rd-party/mustache-d' if run_command('[', '-d', mustached_src_dir, ']').returncode() != 0 message('Fetching Mustache-D from Github...') - git_get_requests = run_command(['git', 'clone', 'https://github.com/repeatedly/mustache-d.git', mustached_src_dir]) - if git_get_requests.returncode() != 0 - error('Unable to fetch Mustache-D:\n' + git_get_requests.stderr()) + git_get_mustache = run_command(['git', 'clone', 'https://github.com/repeatedly/mustache-d.git', mustached_src_dir]) + if git_get_mustache.returncode() != 0 + error('Unable to fetch Mustache-D:\n' + git_get_mustache.stderr()) endif endif mustache_d_file = mustached_src_dir + '/src/mustache.d' @@ -445,10 +158,11 @@ endif # # Build and test # +girbind_lib = static_library('girbindings', [gir_binding_sources], include_directories: [gir_bind_dir]) + asgen_exe = executable('appstream-generator', [asgen_sources, backend_sources, - gir_binding_sources, mustache_sources], include_directories: [src_dir, gir_bind_dir, @@ -466,13 +180,13 @@ asgen_exe = executable('appstream-generator', freetype_dep, fontconfig_dep, pango_dep], + link_with: [girbind_lib], install: true ) asgen_test_exe = executable('asgen_test', [asgen_sources, backend_sources, - gir_binding_sources, mustache_sources], include_directories: [src_dir, gir_bind_dir, @@ -490,6 +204,7 @@ asgen_test_exe = executable('asgen_test', freetype_dep, fontconfig_dep, pango_dep], + link_with: [girbind_lib], d_args: meson.get_compiler('d').unittest_args() ) test('asgen_tests', asgen_test_exe) diff --git a/src/girepo b/src/girepo deleted file mode 160000 index 6c3331b..0000000 --- a/src/girepo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c3331b8a165093b6173292b5131f6303ecb90d4