popovermenu: Add default sliding flag

Also add missing annotation.

Continuation of https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6298
This commit is contained in:
Maximiliano Sandoval 2024-01-13 01:22:44 +01:00
parent 11dc15207e
commit d05f47a695
No known key found for this signature in database
GPG Key ID: D64A8D747F6FE706
2 changed files with 10 additions and 10 deletions

View File

@ -1803,16 +1803,19 @@ typedef enum { /*< prefix=GTK_ACCESSIBLE_SORT >*/
/**
* GtkPopoverMenuFlags:
* @GTK_POPOVER_MENU_NESTED: Create submenus as nested
* popovers. Without this flag, submenus are created as
* sliding pages that replace the main menu.
* @GTK_POPOVER_MENU_SLIDING: Submenus are presented as sliding submenus that
* replace the main menu.
* @GTK_POPOVER_MENU_NESTED: Submenus are presented as traditional, nested
* popovers.
*
* Flags that affect how [class@Gtk.PopoverMenu] widgets built from
* a [class@Gio.MenuModel] are created and displayed.
*
* Since: 4.14
*/
typedef enum { /*< prefix=GTK_POPOVER_MENU >*/
GTK_POPOVER_MENU_SLIDING = 0,
GTK_POPOVER_MENU_NESTED = 1 << 0
} GtkPopoverMenuFlags;
G_END_DECLS

View File

@ -637,7 +637,8 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
g_object_class_install_property (object_class,
PROP_FLAGS,
g_param_spec_flags ("flags", NULL, NULL,
GTK_TYPE_POPOVER_MENU_FLAGS, 0,
GTK_TYPE_POPOVER_MENU_FLAGS,
GTK_POPOVER_MENU_SLIDING,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_EXPLICIT_NOTIFY));
@ -783,7 +784,7 @@ GtkWidget *
gtk_popover_menu_new_from_model (GMenuModel *model)
{
return gtk_popover_menu_new_from_model_full (model, 0);
return gtk_popover_menu_new_from_model_full (model, GTK_POPOVER_MENU_SLIDING);
}
/**
@ -799,10 +800,6 @@ gtk_popover_menu_new_from_model (GMenuModel *model)
* belongs. Actions can also be added using [method@Gtk.Widget.insert_action_group]
* on the parent widget or on any of its parent widgets.
*
* The only flag that is supported currently is
* %GTK_POPOVER_MENU_NESTED, which makes GTK create traditional,
* nested submenus instead of the default sliding submenus.
*
* Returns: the new `GtkPopoverMenu`
*/
GtkWidget *