}
menu_frame_render(self);
-
- /* make the menu fit on the screen. at most we call render twice, at least
- not like n times or sometime */
-
- a = screen_physical_area_monitor(self->monitor);
- h = self->area.height;
-
- if (h > a->height) {
- GList *flast, *tmp;
- gboolean last_entry = TRUE;
-
- /* take the height of our More... entry into account */
- h += menu_entry_frame_get_height(NULL, FALSE, TRUE);
-
- /* start at the end of the entries */
- flast = g_list_last(self->entries);
-
- /* pull out all the entries from the frame that don't
- fit on the screen, leaving at least 1 though */
- while (h > a->height && g_list_previous(flast) != NULL) {
- /* update the height, without this entry */
- h -= menu_entry_frame_get_height(flast->data, FALSE, last_entry);
-
- /* destroy the entry we're not displaying */
- tmp = flast;
- flast = g_list_previous(flast);
- menu_entry_frame_free(tmp->data);
- self->entries = g_list_delete_link(self->entries, tmp);
-
- menu_frame_render(self);
-
- /* only the first one that we see is the last entry in the menu */
- last_entry = FALSE;
- };
-
- {
- ObMenuEntry *more_entry;
- ObMenuEntryFrame *more_frame;
- /* make the More... menu entry frame which will display in this
- frame.
- if self->menu->more_menu is NULL that means that this is already
- More... menu, so just use ourself.
- */
- more_entry = menu_get_more((self->menu->more_menu ?
- self->menu->more_menu :
- self->menu),
- /* continue where we left off */
- self->show_from +
- g_list_length(self->entries));
- more_frame = menu_entry_frame_new(more_entry, self);
- /* make it get deleted when the menu frame goes away */
- menu_entry_unref(more_entry);
-
- /* add our More... entry to the frame */
- self->entries = g_list_append(self->entries, more_frame);
- }
-
- /* render again */
- menu_frame_render(self);
- }
}
static gboolean menu_frame_is_visible(ObMenuFrame *self)