your first xulrunner-based application

14

Click here to load reader

Upload: daniel-glazman

Post on 22-May-2015

7.581 views

Category:

Technology


4 download

DESCRIPTION

Your First Xulrunner-based application, D.Glazman's slides at MAOW Berlin 09

TRANSCRIPT

Page 1: Your First Xulrunner-based application

Your first XULrunner-based applicationDaniel Glazman

Disruptive Innovations

MAOW Berlin 28-mar-2009

Page 2: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

What is XULrunner

• in short, Firefox without all its chrome

• more correctly, a runtime for Gecko and the toolkit

2

Page 3: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Downloads

• You don’t need to build XULrunner if you already have Firefox 3 and limit yourself to chromefirefox -app path/to/application.ini

• or download and unzip XULrunner from ftp://ftp.mozilla.org/pub/xulrunner/releases/

3

Page 4: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Structure

4

Top dir

chrome

defaults

main.xul

chrome.manifest

prefs.js

application.ini

content

preferences

Page 5: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

application.ini• very simple file declaring your app’s

metadata

5

[App]Name=MyFirstAppVendor=My Own OrganizationVersion=0.1BuildID=20090328ID=myfirstapp@myownorg.orgCopyright= Copyright 2009 My Own Organization

[Gecko]MinVersion=1.9MaxVersion=1.9.0.*

Page 6: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Basic chrome.manifest

6

content myfirstapp file:content/

• basically a mapping between chrome:// URLs and the filesystem

• you can also package and compress the files creating a jar

content myfirstapp jar:myfirstapp.jar!/content/

Page 7: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

More chrome.manifest

• add a skinskin myfirstapp classic/1.0 jar:myfirstapp.jar!/skin/

• add a localelocale myfirstapp en-US jar:myfirstapp.jar!/locale/en-US/

7

Page 8: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

app’s preferences

• prefs for debugging

• prefs for user-agent or cache

• prefs for extension manager and XPInstall

• prefs for protocol handlers

• prefs for preferences window :-)

8

pref("toolkit.defaultChromeURL", "chrome://myfirstapp/content/main.xul");

Page 9: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Your main window

9

<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><?xml-stylesheet href="chrome://myfirstapp/skin/main.css" type="text/css"?>

<!DOCTYPE window SYSTEM "chrome://myfirstapp/locale/main.dtd">

<window id="main" title="&window.title;" width="600" height="400" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <label value="Guten Tag Berlin !"/> <button label="Danke" oncommand="window.close();"/></window>

Page 10: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Running your app

• Windowsxulrunner.exe application.ini

• Mac (with restrictions)/Library/Frameworks/XUL.framework/xulrunner-bin `pwd`/application.ini

• Linuxxulrunner application.ini

10

Page 11: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Package your app

• Zip it into a *.app file

• callxulrunner -install-app `pwd`/myfirstapp.zip

• Installs inside c:\Program Files or /Library on Mac

11

Page 12: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

More complex stuff• Add jsm modules

• Add icon to application.ini

• Add Venkman and Document Inspector

• Build a single executable with xulrunner...

• Update your app like Firefox...

• Extensions management

12

Page 13: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

Links

• https://developer.mozilla.org/en/XULRunner

• https://developer.mozilla.org/en/XULRunner_tips

• https://developer.mozilla.org/en/XULRunner/Deploying_XULRunner_1.8

• http://zenit.senecac.on.ca/wiki/index.php/XULRunner_Guide_Outline

13

Page 14: Your First Xulrunner-based application

MAOW Berlin 28-mar-2009 -- Daniel Glazman

Your first XULrunner-based application

• Questions ?

14