From: Christian Dywan Date: Tue, 27 Apr 2010 21:49:45 +0000 (+0200) Subject: Provide midori.vapi for App, Browser, Extension and WebSettings X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a7f4c6a44b610a8d69e48c410f9b167fed6f602;p=midori Provide midori.vapi for App, Browser, Extension and WebSettings With this API description extensions can be written in Vala. Mind it is not complete yet, missing interfaces can be added later. --- diff --git a/extensions/wscript_build b/extensions/wscript_build index d3d3d9ca..668bb6de 100644 --- a/extensions/wscript_build +++ b/extensions/wscript_build @@ -33,6 +33,8 @@ for extension in extensions: obj.includes = '..' obj.source = source obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON' + obj.vapi_dirs = '../midori' + obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori' obj.install_path = '${LIBDIR}/midori' if bld.env['platform'] == 'win32': obj.uselib_local = 'midori' diff --git a/midori/midori.vapi b/midori/midori.vapi new file mode 100644 index 00000000..ecd629fc --- /dev/null +++ b/midori/midori.vapi @@ -0,0 +1,112 @@ +/* Copyright (C) 2010 Christian Dywan + This file is licensed under the terms of the expat license, see the file EXPAT. */ + +[CCode (cprefix = "Midori", lower_case_cprefix = "midori_")] +namespace Midori { + [CCode (cheader_filename = "midori/midori.h")] + public class App : GLib.Object { + public App (); + public Browser create_browser (); + public GLib.List get_browsers (); + + [NoAccessorMethod] + public string name { get; set; } + [NoAccessorMethod] + public Midori.WebSettings settings { get; set; } + [NoAccessorMethod] + public GLib.Object bookmarks { get; set; } + [NoAccessorMethod] + public GLib.Object trash { get; set; } + [NoAccessorMethod] + public GLib.Object search_engines { get; set; } + [NoAccessorMethod] + public GLib.Object history { get; set; } + [NoAccessorMethod] + public GLib.Object extensions { get; set; } + [NoAccessorMethod] + public GLib.Object browsers { get; } + public Browser? browser { get; } + + [HasEmitter] + public signal void add_browser (Browser browser); + public signal void remove_browser (Browser browser); + [HasEmitter] + public signal void quit (); + } + public class Browser : Gtk.Window { + public Browser (); + public int add_item (GLib.Object item); + public int add_uri (string uri); + public unowned Gtk.Widget get_nth_tab (int n); + public GLib.List get_tabs (); + public unowned Gtk.ActionGroup get_action_group (); + public unowned Browser get_for_widget (Gtk.Widget widget); + public unowned string[] get_toolbar_actions (); + public unowned GLib.Object get_proxy_items (); + + [NoAccessorMethod] + public Gtk.MenuBar menubar { get; } + [NoAccessorMethod] + public Gtk.Toolbar navigationbar { get; } + [NoAccessorMethod] + public Gtk.Notebook notebook { get; } + [NoAccessorMethod] + public Gtk.Widget panel { get; } + [NoAccessorMethod] + public string uri { get; set; } + [NoAccessorMethod] + public Gtk.Widget tab { get; set; } + [NoAccessorMethod] + public uint load_status { get; } + [NoAccessorMethod] + public Gtk.Statusbar statusbar { get; } + [NoAccessorMethod] + public string statusbar_text { get; set; } + public Midori.WebSettings settings { get; set; } + [NoAccessorMethod] + public GLib.Object bookmarks { get; set; } + [NoAccessorMethod] + public GLib.Object trash { get; set; } + [NoAccessorMethod] + public GLib.Object search_engines { get; set; } + [NoAccessorMethod] + public GLib.Object history { get; set; } + [NoAccessorMethod] + public bool show_tabs { get; set; } + + public signal Browser new_window (Browser? browser); + [HasEmitter] + public signal void add_tab (Gtk.Widget tab); + [HasEmitter] + public signal void remove_tab (Gtk.Widget tab); + [HasEmitter] + public signal void activate_action (string name); + public signal void add_download (GLib.Object download); + public signal void populate_tool_menu (Gtk.Menu menu); + [HasEmitter] + public signal void quit (); + } + + public class Extension : GLib.Object { + [CCode (has_construct_function = false)] + public Extension (); + public unowned Midori.App get_app (); + + [NoAccessorMethod] + public string name { get; set; } + [NoAccessorMethod] + public string description { get; set; } + [NoAccessorMethod] + public string version { get; set; } + [NoAccessorMethod] + public string authors { get; set; } + + public signal void activate (Midori.App app); + public signal void deactivate (); + } + + public class WebSettings : WebKit.WebSettings { + public WebSettings (); + } +} + diff --git a/tests/wscript_build b/tests/wscript_build index 34825ad6..58b2d8ef 100644 --- a/tests/wscript_build +++ b/tests/wscript_build @@ -33,6 +33,8 @@ for test in tests: obj.includes = '.. ../midori ../panels' obj.cflags = ['-DEXTENSION_PATH="' + os.path.abspath ('_build_/default/extensions') + '"'] obj.source = source + obj.vapi_dirs = '../midori' + obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori' obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML' obj.uselib_local = 'midori-core' obj.unit_test = 1