Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| midori:tutorial [2014/03/03 13:25] – [Unit testing] axlrose | midori:tutorial [2014/06/06 20:08] (current) – [Add a new extension] axlrose | ||
|---|---|---|---|
| Line 45: | Line 45: | ||
| After any modifiction in " | After any modifiction in " | ||
| <code bash> | <code bash> | ||
| - | If you add a new extentioon | + | If you add a new extention |
| <code bash> | <code bash> | ||
| user@host: | user@host: | ||
| Line 240: | Line 240: | ||
| In the Web page try to select a word or a sentence right click and you are going to see three menu item which were added, click on one of them and you will see the magic in the terminal :) . | In the Web page try to select a word or a sentence right click and you are going to see three menu item which were added, click on one of them and you will see the magic in the terminal :) . | ||
| ====== Add an app menu item ====== | ====== Add an app menu item ====== | ||
| + | <code vala> | ||
| + | namespace Sandcat { | ||
| + | private class Manager : Midori.Extension { | ||
| + | internal Manager () { | ||
| + | GLib.Object (name: _(" | ||
| + | | ||
| + | | ||
| + | | ||
| + | activate.connect (this.activated); | ||
| + | deactivate.connect (this.deactivated); | ||
| + | } | ||
| + | void tool_menu_populated (Gtk.Menu menu) { | ||
| + | var item = new Gtk.MenuItem.with_label(" | ||
| + | menu.add(item); | ||
| + | item.show(); | ||
| + | } | ||
| - | whatever | + | void browser_added (Midori.Browser browser) { |
| + | browser.populate_tool_menu.connect(tool_menu_populated); | ||
| + | } | ||
| + | |||
| + | void activated (Midori.App app) { | ||
| + | foreach (var browser in app.get_browsers ()) | ||
| + | browser_added (browser); | ||
| + | app.add_browser.connect (browser_added); | ||
| + | } | ||
| + | |||
| + | void deactivated () { | ||
| + | var app = get_app (); | ||
| + | app.add_browser.disconnect (browser_added); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | public Midori.Extension extension_init () { | ||
| + | return new Sandcat.Manager (); | ||
| + | } | ||
| + | </ | ||
| + | Here you are enjoy, it is easy, isn't it ? :-) | ||
| ====== Modify resources or webpages loaded ====== | ====== Modify resources or webpages loaded ====== | ||
| Line 289: | Line 326: | ||
| } | } | ||
| </ | </ | ||
| - | Enjoy How much time you click :-), you can add any Gtk widget in this button. | + | Enjoy How much time you click :-), you can add any Gtk widget in this StatusBar. |
| ====== Add a panel ====== | ====== Add a panel ====== | ||
| Line 352: | Line 389: | ||
| </ | </ | ||
| - | With a simple example it will be like that: | + | With a simple example it will be like this: |
| <code vala> | <code vala> | ||
| void test_furry_purr () { | void test_furry_purr () { | ||
| Line 367: | Line 404: | ||
| Test.run (); | Test.run (); | ||
| }</ | }</ | ||
| - | the result of thi code is **"/ | + | The output could look like this. |
| + | <code bash> | ||
| + | / | ||
| + | </ | ||