Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
midori:tutorial [2014/03/03 14:55] – [Unit testing] axlrose | midori:tutorial [2014/03/04 18:34] – [Add an app menu item] axlrose | ||
---|---|---|---|
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 ====== | ||
+ | <vala code> | ||
+ | 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 325: | ||
} | } | ||
</ | </ | ||
- | 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 370: | Line 406: | ||
<code bash> | <code bash> | ||
/ | / | ||
- | </ | ||
- | |||
- | Let's try something with an extension, because Midori creator recomends to use it in every test. | ||
- | <vala code> | ||
- | |||
</ | </ |