388 |
388 |
389 |
389 |
390 |
390 |
391 #if GTK_MAJOR_VERSION >= 4 |
391 #if GTK_MAJOR_VERSION >= 4 |
392 |
392 |
393 |
393 GtkWidget *ui_create_menubar(UiObject *obj) { |
|
394 UiMenu *menus_begin = uic_get_menu_list(); |
|
395 if(menus_begin == NULL) { |
|
396 return NULL; |
|
397 } |
|
398 |
|
399 GMenu *menu = g_menu_new(); |
|
400 UiMenu *ls = menus_begin; |
|
401 while(ls) { |
|
402 GMenu *sub_menu = g_menu_new(); |
|
403 ui_gmenu_add_menu_items(sub_menu, 0, ls, obj); |
|
404 g_menu_append_submenu(menu, ls->label, G_MENU_MODEL(sub_menu)); |
|
405 ls = (UiMenu*)ls->item.next; |
|
406 } |
|
407 |
|
408 |
|
409 // Create a menubar from the menu model |
|
410 return gtk_popover_menu_bar_new_from_model(G_MENU_MODEL(menu)); |
|
411 } |
394 |
412 |
395 static ui_gmenu_add_f createMenuItem[] = { |
413 static ui_gmenu_add_f createMenuItem[] = { |
396 /* UI_MENU */ ui_gmenu_add_menu, |
414 /* UI_MENU */ ui_gmenu_add_menu, |
397 /* UI_MENU_ITEM */ ui_gmenu_add_menuitem, |
415 /* UI_MENU_ITEM */ ui_gmenu_add_menuitem, |
398 /* UI_MENU_CHECK_ITEM */ ui_gmenu_add_checkitem, |
416 /* UI_MENU_CHECK_ITEM */ ui_gmenu_add_checkitem, |