Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
jonath92 committed Aug 22, 2021
1 parent 1cfdae7 commit 76b9182
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 16 deletions.
27 changes: 27 additions & 0 deletions ByteArray.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
declare namespace imports {

export const byteArray: ByteArray;
class ByteArray {
/**
* Converts the Uint8Array into a literal string. The bytes are interpreted according to the given encoding (or UTF-8 if not given).
The resulting string is guaranteed to round-trip back into an identical ByteArray by passing the result to ByteArray.fromString(), i.e., `b === ByteArray.fromString(ByteArray.toString(b, encoding), encoding)`.
* @param array
* @param encoding
*/
toString(array: Uint8Array, encoding?: string): string;
/**
* Convert a GLib.Bytes instance into a newly constructed Uint8Array. The contents are copied.
* @param text
*/
fromGBytes(text: gi.GLib.Bytes): Uint8Array;
/**
* Convert a String into a newly constructed Uint8Array; this creates a new Uint8Array of the same length as the String, then assigns each Uint8Array entry the corresponding byte value of the String encoded according to the given encoding (or UTF-8 if not given).
* @param text
* @param encoding
*/
fromString(text: string, encoding?: string): Uint8Array;
/** Converts the Uint8Array into a GLib.Bytes instance. The contents are copied. */
toGBytes(array: Uint8Array): gi.GLib.Bytes;
fromArray(array: Uint8Array): any;
}
}
27 changes: 16 additions & 11 deletions Gtk-3.0.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2570,16 +2570,17 @@ declare namespace imports.gi.Gtk {
set_xalign (xalign: number) : void;
set_yalign (yalign: number) : void;
}


var Label: {
new (_str: string) : Widget;
new_with_mnemonic (_str: string) : Widget;

interface LabelOptions {
label: string
}




class Label {
constructor(options?: LabelOptions)
new_with_mnemonic (_str: string) : Widget;
}

interface LabelAccessible extends WidgetAccessible, Atk.Component, Atk.Hypertext, Atk.Text {

}
Expand Down Expand Up @@ -5933,8 +5934,12 @@ declare namespace imports.gi.Gtk {
unstick () : void;
}

var Window: {
new (_type: WindowType) : Widget;
interface WindowOptions {
type: WindowType
}

class Window {
constructor (options?: WindowOptions);
get_default_icon_list () : GLib.List;
get_default_icon_name () : string;
list_toplevels () : GLib.List;
Expand Down Expand Up @@ -13222,8 +13227,8 @@ declare namespace imports.gi.Gtk {


enum WindowType {
toplevel = 0,
popup = 1
TOPLEVEL = 0,
POPUP = 1
}


Expand Down
13 changes: 9 additions & 4 deletions Soup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ declare namespace imports.gi.Soup {
set_priority(priority: MessagePriority): void;
set_redirect(status_code: number, redirect_uri: string): void;
set_request(content_type: string, req_use: MemoryUse, req_body: number[], req_length: number): void;
set_response(content_type: string, resp_use: MemoryUse, resp_body: number[], resp_length: number): void;
set_response(content_type: string, resp_use: MemoryUse, resp_body: string | ByteArray): void;
set_status(status_code: number): void;
set_status_full(status_code: number, reason_phrase: string): void;
set_uri(uri: URI): void;
Expand Down Expand Up @@ -419,7 +419,7 @@ declare namespace imports.gi.Soup {
accept_iostream(stream: Gio.IOStream, local_addr: Gio.SocketAddress, remote_addr: Gio.SocketAddress): boolean;
add_auth_domain(auth_domain: AuthDomain): void;
add_early_handler(path: string, callback: ServerCallback, user_data: any, destroy: GLib.DestroyNotify): void;
add_handler(path: string, callback: ServerCallback, user_data: any, destroy: GLib.DestroyNotify): void;
add_handler(path: string | null, callback: ServerCallback): void;
add_websocket_handler(path: string, origin: string, protocols: string[], callback: ServerWebsocketCallback, user_data: any, destroy: GLib.DestroyNotify): void;
disconnect(): void;
get_async_context(): GLib.MainContext;
Expand All @@ -441,11 +441,16 @@ declare namespace imports.gi.Soup {
run_async(): void;
set_ssl_cert_file(ssl_cert_file: string, ssl_key_file: string): boolean;
unpause_message(msg: Message): void;

connect(signal: 'request-finished' | 'request-aborted' | 'request-read' | 'request-started', callback: (server: this, message: Message, client: ClientContext) => void): number
}

var Server: {
new(optname1: string): Server;
interface ServerOptions {
port: number
}

class Server {
constructor(options ?: ServerOptions);
}


Expand Down
48 changes: 48 additions & 0 deletions WebKit2.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
declare namespace imports.gi.WebKit2 {

interface WebView extends gi.Gtk.Container {

connect(event: 'load-changed', callback: (actor: this, event: LoadEvent) => void): number

/**
* Requests loading of the specified URI string.
* You can monitor the load operation by connecting to
* WebKit2.WebView.load-changed signal.
*
* @param uri an URI string
*/
load_uri(uri: string): void


/**
* The current active URI of the WebKit2.WebView.
* See WebKit2.WebView.get_uri for more details.
*/
readonly uri: string

}

class WebView {
constructor()
}


enum LoadEvent {
/** A new load request has been made.
* No data has been received yet, empty structures have
* been allocated to perform the load; the load may still
* fail due to transport issues such as not being able to
* resolve a name, or connect to a port */
STARTED = 0,
/** A provisional data source received a server redirect */
REDIRECTED = 1,
/** The content started arriving for a page load.
* The necessary transport requirements are established, and the
* load is being performed. */
COMMITED = 2,
/** Load completed. All resources are done loading
* or there was an error during the load operation. */
FINISHED = 3
}

}
6 changes: 5 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference path="./Atk-1.0.d.ts" />
/// <reference path="./ByteArray.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./Caribou.d.ts" />
/// <reference path="./CDesktopEnums.d.ts" />
Expand All @@ -14,4 +15,7 @@
/// <reference path="./Pango-1.0.d.ts" />
/// <reference path="./Soup.d.ts" />
/// <reference path="./St.d.ts" />
/// <reference path="./xlib-2.0.d.ts" />
/// <reference path="./WebKit2.d.ts" />
/// <reference path="./xlib-2.0.d.ts" />

declare function log(arg: any): void

0 comments on commit 76b9182

Please sign in to comment.