際際滷

際際滷Share a Scribd company logo
Your 鍖rst XULrunner-based
        application
        Daniel Glazman
     Disruptive Innovations




    MAOW Berlin 28-mar-2009
Your 鍖rst XULrunner-based application




  What is XULrunner

 in short, Firefox without all its chrome
 more correctly, a runtime for Gecko and
  the toolkit



        MAOW Berlin 28-mar-2009 -- Daniel Glazman
                             2
Your 鍖rst XULrunner-based application




            Downloads
 You dont need to build XULrunner if you
  already have Firefox 3 and limit yourself to
  chrome
  firefox -app path/to/application.ini


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




         MAOW Berlin 28-mar-2009 -- Daniel Glazman
                              3
Your 鍖rst XULrunner-based application




      Structure
       Top dir
               chrome
                    content
                          main.xul
                     chrome.manifest

               defaults
                     preferences
                          prefs.js

               application.ini



MAOW Berlin 28-mar-2009 -- Daniel Glazman
                     4
Your 鍖rst XULrunner-based application




          application.ini
 very simple 鍖le declaring your apps
  metadata
   [App]
   Name=MyFirstApp
   Vendor=My Own Organization
   Version=0.1
   BuildID=20090328
   ID=myfirstapp@myownorg.org
   Copyright= Copyright 2009 My Own Organization

   [Gecko]
   MinVersion=1.9
   MaxVersion=1.9.0.*



          MAOW Berlin 28-mar-2009 -- Daniel Glazman
                               5
Your 鍖rst XULrunner-based application




 Basic chrome.manifest
 basically a mapping between chrome:// URLs
  and the 鍖lesystem
    content myfirstapp file:content/


 you can also package and compress the 鍖les
  creating a jar
    content myfirstapp jar:myfirstapp.jar!/content/




           MAOW Berlin 28-mar-2009 -- Daniel Glazman
                                6
Your 鍖rst XULrunner-based application




 More chrome.manifest

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


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




            MAOW Berlin 28-mar-2009 -- Daniel Glazman
                                 7
Your 鍖rst XULrunner-based application




        apps preferences
pref(quot;toolkit.defaultChromeURLquot;,
     quot;chrome://myfirstapp/content/main.xulquot;);



    prefs for debugging

    prefs for user-agent or cache

    prefs for extension manager and XPInstall

    prefs for protocol handlers

    prefs for preferences window :-)

            MAOW Berlin 28-mar-2009 -- Daniel Glazman
                                 8
Your 鍖rst XULrunner-based application




       Your main window
<?xml version=quot;1.0quot;?>
<?xml-stylesheet href=quot;chrome://global/skin/quot;
                 type=quot;text/cssquot;?>
<?xml-stylesheet href=quot;chrome://myfirstapp/skin/main.cssquot;
                 type=quot;text/cssquot;?>

<!DOCTYPE window SYSTEM quot;chrome://myfirstapp/locale/main.dtdquot;>

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


              MAOW Berlin 28-mar-2009 -- Daniel Glazman
                                   9
Your 鍖rst XULrunner-based application




    Running your app
 Windows
  xulrunner.exe application.ini


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


 Linux
  xulrunner application.ini




          MAOW Berlin 28-mar-2009 -- Daniel Glazman
                               10
Your 鍖rst XULrunner-based application




     Package your app
 Zip it into a *.app 鍖le
 call
  xulrunner -install-app `pwd`/my鍖rstapp.zip
 Installs inside c:Program Files or /Library
  on Mac


         MAOW Berlin 28-mar-2009 -- Daniel Glazman
                              11
Your 鍖rst 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
         MAOW Berlin 28-mar-2009 -- Daniel Glazman
                              12
Your 鍖rst 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




              MAOW Berlin 28-mar-2009 -- Daniel Glazman
                                   13
Your 鍖rst XULrunner-based application




 Questions ?


        MAOW Berlin 28-mar-2009 -- Daniel Glazman
                             14

More Related Content

Your First Xulrunner-based application

  • 1. Your 鍖rst XULrunner-based application Daniel Glazman Disruptive Innovations MAOW Berlin 28-mar-2009
  • 2. Your 鍖rst XULrunner-based application What is XULrunner in short, Firefox without all its chrome more correctly, a runtime for Gecko and the toolkit MAOW Berlin 28-mar-2009 -- Daniel Glazman 2
  • 3. Your 鍖rst XULrunner-based application Downloads You dont need to build XULrunner if you already have Firefox 3 and limit yourself to chrome firefox -app path/to/application.ini or download and unzip XULrunner from ftp://ftp.mozilla.org/pub/xulrunner/releases/ MAOW Berlin 28-mar-2009 -- Daniel Glazman 3
  • 4. Your 鍖rst XULrunner-based application Structure Top dir chrome content main.xul chrome.manifest defaults preferences prefs.js application.ini MAOW Berlin 28-mar-2009 -- Daniel Glazman 4
  • 5. Your 鍖rst XULrunner-based application application.ini very simple 鍖le declaring your apps metadata [App] Name=MyFirstApp Vendor=My Own Organization Version=0.1 BuildID=20090328 ID=myfirstapp@myownorg.org Copyright= Copyright 2009 My Own Organization [Gecko] MinVersion=1.9 MaxVersion=1.9.0.* MAOW Berlin 28-mar-2009 -- Daniel Glazman 5
  • 6. Your 鍖rst XULrunner-based application Basic chrome.manifest basically a mapping between chrome:// URLs and the 鍖lesystem content myfirstapp file:content/ you can also package and compress the 鍖les creating a jar content myfirstapp jar:myfirstapp.jar!/content/ MAOW Berlin 28-mar-2009 -- Daniel Glazman 6
  • 7. Your 鍖rst XULrunner-based application More chrome.manifest add a skin skin myfirstapp classic/1.0 jar:myfirstapp.jar!/skin/ add a locale locale myfirstapp en-US jar:myfirstapp.jar!/locale/en-US/ MAOW Berlin 28-mar-2009 -- Daniel Glazman 7
  • 8. Your 鍖rst XULrunner-based application apps preferences pref(quot;toolkit.defaultChromeURLquot;, quot;chrome://myfirstapp/content/main.xulquot;); prefs for debugging prefs for user-agent or cache prefs for extension manager and XPInstall prefs for protocol handlers prefs for preferences window :-) MAOW Berlin 28-mar-2009 -- Daniel Glazman 8
  • 9. Your 鍖rst XULrunner-based application Your main window <?xml version=quot;1.0quot;?> <?xml-stylesheet href=quot;chrome://global/skin/quot; type=quot;text/cssquot;?> <?xml-stylesheet href=quot;chrome://myfirstapp/skin/main.cssquot; type=quot;text/cssquot;?> <!DOCTYPE window SYSTEM quot;chrome://myfirstapp/locale/main.dtdquot;> <window id=quot;mainquot; title=quot;&window.title;quot; width=quot;600quot; height=quot;400quot; xmlns=quot;http://www.mozilla.org/keymaster/gatekeeper/ there.is.only.xulquot;> <label value=quot;Guten Tag Berlin !quot;/> <button label=quot;Dankequot; oncommand=quot;window.close();quot;/> </window> MAOW Berlin 28-mar-2009 -- Daniel Glazman 9
  • 10. Your 鍖rst XULrunner-based application Running your app Windows xulrunner.exe application.ini Mac (with restrictions) /Library/Frameworks/XUL.framework/xulrunner-bin `pwd`/application.ini Linux xulrunner application.ini MAOW Berlin 28-mar-2009 -- Daniel Glazman 10
  • 11. Your 鍖rst XULrunner-based application Package your app Zip it into a *.app 鍖le call xulrunner -install-app `pwd`/my鍖rstapp.zip Installs inside c:Program Files or /Library on Mac MAOW Berlin 28-mar-2009 -- Daniel Glazman 11
  • 12. Your 鍖rst 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 MAOW Berlin 28-mar-2009 -- Daniel Glazman 12
  • 13. Your 鍖rst 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 MAOW Berlin 28-mar-2009 -- Daniel Glazman 13
  • 14. Your 鍖rst XULrunner-based application Questions ? MAOW Berlin 28-mar-2009 -- Daniel Glazman 14