Filling hbox (or anything) from places, broken in FF >3.6 ?

<<

matssvensson

Posts: 12

Joined: Tue Mar 30, 2010 6:22 am

Post Mon Jan 09, 2012 4:06 am

Filling hbox (or anything) from places, broken in FF >3.6 ?

Im making an attempt to migrate away from Firefox 3.6, its not much fun :?

I have several extensions for personal use that fills menus and toolbars from bookmarksfolders.
None of them work if i upgrade over 3.6.

From the info on this page:
https://developer.mozilla.org/en/Displa ... #Menu_view
..it seems the problem is that the method: type="places" and place="some_place_reference", that i use to populate things with content from places, has been killed >3.6 for some reason.

I have managed to get it working again for menus, using the new method:
placespopup="true"> onpopupshowing="...etc

BUT how do i fix it for toolbars also?
<hbox type="places" /> ...etc, doesnt seem to work either, even though it says it should on that page.

What do i use for hbox, like i use placespopup="true" for menupopup?
<<

iann

Posts: 857

Joined: Thu Sep 16, 2010 12:56 pm

Post Mon Jan 09, 2012 5:24 am

Re: Filling hbox (or anything) from places, broken in FF >3.

Places is completely rewritten after 3.6 and I'm not even sure you can create places toolbar content that easily any more. You should be able to create a new places toolbar using something like:
  Code:
new PlacesToolbar("place:folder=TOOLBAR");


Unfortunately, PlacesToolbar is hardcoded to only create places content in the Firefox Bookmarks toolbar, so I think you'll have to copy it and create your own version of that object. It has the following properties defining the elements for the toolbar:
  Code:
"_viewElt",              "PlacesToolbar"
"_rootElt",              "PlacesToolbarItems"
"_dropIndicator",        "PlacesToolbarDropIndicator"
"_chevron",              "PlacesChevron"
"_chevronPopup",         "PlacesChevronPopup"
<<

matssvensson

Posts: 12

Joined: Tue Mar 30, 2010 6:22 am

Post Mon Jan 09, 2012 9:19 am

Re: Filling hbox (or anything) from places, broken in FF >3.

Ok.

So this info, on this page, is officially wrong?

https://developer.mozilla.org/en/Displa ... #Menu_view

Create a built-in toolbar view by setting the type attribute to "places" on an empty hbox element (which would be a child of some parent toolbaritem element, itself the child of a toolbar element):

<toolbar>
<toolbaritem>
<hbox type="places" />
</toolbaritem>
</toolbar>

The place attribute or property should be set on the hbox as well.
<<

iann

Posts: 857

Joined: Thu Sep 16, 2010 12:56 pm

Post Mon Jan 09, 2012 10:09 am

Re: Filling hbox (or anything) from places, broken in FF >3.

I'm not official :)
<<

iann

Posts: 857

Joined: Thu Sep 16, 2010 12:56 pm

Post Mon Jan 09, 2012 10:20 am

Re: Filling hbox (or anything) from places, broken in FF >3.

Here is what an actual bookmarks toolbar now looks like:
  Code:
<toolbar id="PersonalToolbar"
             mode="icons" iconsize="small" defaulticonsize="small"
             lockiconsize="true"
             class="chromeclass-directories"
             context="toolbar-context-menu"
             defaultset="personal-bookmarks"
             toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"
             collapsed="true"
             customizable="true">
      <toolbaritem flex="1" id="personal-bookmarks" title="&bookmarksItem.title;"
                   removable="true">
        <hbox flex="1"
              id="PlacesToolbar"
              context="placesContext"
              onclick="BookmarksEventHandler.onClick(event, this._placesView);"
              oncommand="BookmarksEventHandler.onCommand(event, this._placesView);"
              tooltip="bhTooltip"
              popupsinherittooltip="true">
          <toolbarbutton class="bookmark-item bookmarks-toolbar-customize"
                         mousethrough="never"
                         label="&bookmarksToolbarItem.label;"/>
          <hbox flex="1">
            <hbox align="center">
              <image id="PlacesToolbarDropIndicator"
                     mousethrough="always"
                     collapsed="true"/>
            </hbox>
            <scrollbox orient="horizontal"
                       id="PlacesToolbarItems"
                       flex="1"/>
            <toolbarbutton type="menu"
                           id="PlacesChevron"
                           class="chevron"
                           mousethrough="never"
                           collapsed="true"
                           tooltiptext="&bookmarksToolbarChevron.tooltip;"
                           onpopupshowing="document.getElementById('PlacesToolbar')
                                                   ._placesView._onChevronPopupShowing(event);">
              <menupopup id="PlacesChevronPopup"
                         placespopup="true"
                         tooltip="bhTooltip" popupsinherittooltip="true"
                         context="placesContext"/>
            </toolbarbutton>
          </hbox>
        </hbox>
      </toolbaritem>
    </toolbar>


What's more, just creating the XUL won't give you any bookmarks on the toolbar, you still have to initialise it from javascript.
<<

matssvensson

Posts: 12

Joined: Tue Mar 30, 2010 6:22 am

Post Mon Jan 09, 2012 12:12 pm

Re: Filling hbox (or anything) from places, broken in FF >3.

Let me rephrase.

Is there somewhere that i can find the information that is on this page:

https://developer.mozilla.org/en/Displa ... sing_views

...but in a version that actually works with the current Firefox?

Or can i find something like this code:
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"

...but that gives me a toolbar?
Something like, say: new PlacesToolbar(event, 'place:folder=BOOKMARKS_MENU');" or similar?

I cant even find any documentation at all for the "PlacesMenu"-function.
When i search for it here i just find it on that one code snippet on that one page.
<<

iann

Posts: 857

Joined: Thu Sep 16, 2010 12:56 pm

Post Mon Jan 09, 2012 1:00 pm

Re: Filling hbox (or anything) from places, broken in FF >3.

As I explained already "new PlacesToolbar()" will only give you the Firefox toolbar since the location is hardcoded. In fact you wouldn't even need to do that since there are helper functions that do everything for you, but still it is the same old toolbar. I've looked at the code and can't see any simple interface to a separate places toolbar. This was largely rewritten for FF4, so you can pretty much guarantee that any documentation referring to 3.6 doesn't apply. Asking the question over and over again isn't going to change my answer. Someone else might come up with a "one click" solution, but I seriously doubt it.

The simplest I can think of is to modify the PlacesToolbar prototype to refer to different toolbars, probably just hard-coded to your own toolbar. That would kill the standard Firefox toolbar but yours would appear instead without further work. If you wanted them both, you would have to clone the object (or make more extensive changes to make it configurable) and then also add the appropriate calls to initialise it and update as necessary. Places is destroyed and recreated on every customise dialog, for example, and the split of bookmarks between the bar and the chevron dropdown is continually updated by all sorts of events. If you also clone PlacesToolbarHelper that would take care of most of it.
<<

matssvensson

Posts: 12

Joined: Tue Mar 30, 2010 6:22 am

Post Mon Jan 09, 2012 1:26 pm

Re: Filling hbox (or anything) from places, broken in FF >3.

Ok, thanks.

Looks like migrating will be way more work than i expected.
I guess im stuck with 3.6 until the sun goes nova then...
<<

iann

Posts: 857

Joined: Thu Sep 16, 2010 12:56 pm

Post Tue Jan 10, 2012 4:44 am

Re: Filling hbox (or anything) from places, broken in FF >3.

You may be able to rip off this extension, which creates a places toolbar view on a vertical toolbar. The toolbar itself is created in a different extension, but I'm guessing you know how to do that bit.
<<

matssvensson

Posts: 12

Joined: Tue Mar 30, 2010 6:22 am

Post Wed Jul 11, 2012 6:27 am

Re: Filling hbox (or anything) from places, broken in FF >3.

I have decided to make another attempt to do this, as FF 3.6 is more and more broken for every day.

Unfortunately finding documentation seems to have become MORE difficult than before,
the search functions on addons.mozilla.org etc is now almost unusable.

Is there anywhere i can find documentation about these specific things?

Id really like to move on, and i don't want to give up on FF.

Return to Extension Development

Who is online

Users browsing this forum: No registered users

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
CA Gen2 style designed by Vjacheslav Trushkin.