You need to render a javascript for the populate command that you specified in your XML on the same page. You can render it with custom webpart or delegate control for example.
UPDATE:
Although there is a bunch of methods to get all the folders from the library here's the one I've quickly tested for you in the Site Pages library:
SPList list = SPContext.Current.Web.Lists.TryGetList("Site Pages");
List<SPFolder> allFolders = list.Folders.OfType<SPListItem>().Select(li => li.Folder).ToList();
And so all you need is to provide a function to PopulateQueryCommand
See the example from Chris O'Brien here. Note the getDropdownItemsXml
function used as the source of the data for PopulateQueryCommand. My additional advice for you is to not use a page component like in this example - this technique useful for really big Ribbon modifications. For your simple task the simple JS function is enough.
And finally - this is the one way to render population function on the page from the server side - I've created a web part code for this:
public class JSRenderWebPart : WebPart
{
protected override void CreateChildControls()
{
Page.RegisterClientScriptBlock("DropDownPopulateFunction", @"
function PopulateDropDowm()
{
// render your population logic here
}
");
}
}