g-panels: fix setting initial state for index, selected; make selected fallback to using index.