Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
midori:tutorial [2014/03/03 14:53] – [Unit testing] axlrosemidori:tutorial [2014/06/06 20:08] (current) – [Add a new extension] axlrose
Line 45: Line 45:
 After any modifiction in "sandcat.vala" you just run: After any modifiction in "sandcat.vala" you just run:
 <code bash>user@host:~/midori/build$ make </code> <code bash>user@host:~/midori/build$ make </code>
-If you add a new extentioon you run :+If you add a new extention you will run :
 <code bash>user@host:~/midori/build$ make clean <code bash>user@host:~/midori/build$ make clean
 user@host:~/midori/build$ cd .. ; rm -rf build</code> user@host:~/midori/build$ cd .. ; rm -rf build</code>
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: _("Furry example extension"),
 +                         description: _("Take care of petting cats"),
 +                         version: "0.1" + Midori.VERSION_SUFFIX,
 +                         authors: "Jane Doe <email@domain.tld>");
 +            activate.connect (this.activated);
 +            deactivate.connect (this.deactivated);
 +        }
 +        void tool_menu_populated (Gtk.Menu menu) {
 +            var item = new Gtk.MenuItem.with_label("i am here");
 +            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 (); 
 +
 +</code>
  
 +Here you are enjoy, it is easy, isn't it ? :-)
 ====== Modify resources or webpages loaded ====== ====== Modify resources or webpages loaded ======
  
Line 289: Line 326:
 } }
 </code> </code>
-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 368: Line 405:
 }</code> }</code>
 The output could look like this. The output could look like this.
- +<code bash
- +/extensions/furry/purr: OK
-Let's try something with an extension, because Midori creator recomends to use it in every test. +
-<vala code> +
 </code> </code>