Blame docs/reference/gio/html/GMenuModel.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GMenuModel: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="application.html" title="Application support">
Packit ae235b
<link rel="prev" href="GDBusActionGroup.html" title="GDBusActionGroup">
Packit ae235b
<link rel="next" href="GMenu.html" title="GMenu">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Signals
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GMenuModel

Packit ae235b

GMenuModel — An abstract class representing the contents of a menu

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_is_mutable ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_get_n_items ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GVariant *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_get_item_attribute_value ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_get_item_attribute ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GMenuModel *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_get_item_link ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GMenuAttributeIter *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_iterate_item_attributes ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GMenuLinkIter *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_iterate_item_links ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_model_items_changed ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_attribute_iter_get_next ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_attribute_iter_get_name ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GVariant *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_attribute_iter_get_value ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_attribute_iter_next ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_link_iter_get_name ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_link_iter_get_next ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GMenuModel *
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_link_iter_get_value ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_menu_link_iter_next ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Signals

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
items-changed
Packit ae235b
Run Last
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GMenuModel
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_ATTRIBUTE_ACTION
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_ATTRIBUTE_ACTION_NAMESPACE
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_ATTRIBUTE_TARGET
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_ATTRIBUTE_LABEL
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_ATTRIBUTE_ICON
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_LINK_SECTION
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_MENU_LINK_SUBMENU
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GMenuAttributeIter
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GMenuLinkIter
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GObject
Packit ae235b
    ├── GMenuAttributeIter
Packit ae235b
    ├── GMenuLinkIter
Packit ae235b
    ╰── GMenuModel
Packit ae235b
        ├── GDBusMenuModel
Packit ae235b
        ╰── GMenu
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

GMenuModel represents the contents of a menu -- an ordered list of

Packit ae235b
menu items. The items are associated with actions, which can be
Packit ae235b
activated through them. Items can be grouped in sections, and may
Packit ae235b
have submenus associated with them. Both items and sections usually
Packit ae235b
have some representation data, such as labels or icons. The type of
Packit ae235b
the associated action (ie whether it is stateful, and what kind of
Packit ae235b
state it has) can influence the representation of the item.

Packit ae235b

The conceptual model of menus in GMenuModel is hierarchical:

Packit ae235b
sections and submenus are again represented by GMenuModels.
Packit ae235b
Menus themselves do not define their own roles. Rather, the role
Packit ae235b
of a particular GMenuModel is defined by the item that references
Packit ae235b
it (or, in the case of the 'root' menu, is defined by the context
Packit ae235b
in which it is used).

Packit ae235b

As an example, consider the visible portions of this menu:

Packit ae235b
Packit ae235b

An example menu

Packit ae235b

Packit ae235b

There are 8 "menus" visible in the screenshot: one menubar, two

Packit ae235b
submenus and 5 sections:

Packit ae235b
    Packit ae235b
  • the toplevel menubar (containing 4 items)

  • Packit ae235b
  • the View submenu (containing 3 sections)

  • Packit ae235b
  • the first section of the View submenu (containing 2 items)

  • Packit ae235b
  • the second section of the View submenu (containing 1 item)

  • Packit ae235b
  • the final section of the View submenu (containing 1 item)

  • Packit ae235b
  • the Highlight Mode submenu (containing 2 sections)

  • Packit ae235b
  • the Sources section (containing 2 items)

  • Packit ae235b
  • the Markup section (containing 2 items)

  • Packit ae235b
    Packit ae235b

    The example illustrates the conceptual connection between

    Packit ae235b
    these 8 menus. Each large block in the figure represents a menu and the
    Packit ae235b
    smaller blocks within the large block represent items in that menu. Some
    Packit ae235b
    items contain references to other menus.

    Packit ae235b
    Packit ae235b
    Packit ae235b

    A menu example

    Packit ae235b

    Packit ae235b

    Notice that the separators visible in the example

    Packit ae235b
    appear nowhere in the menu model. This is because
    Packit ae235b
    separators are not explicitly represented in the menu model. Instead,
    Packit ae235b
    a separator is inserted between any two non-empty sections of a menu.
    Packit ae235b
    Section items can have labels just like any other item. In that case,
    Packit ae235b
    a display system may show a section header instead of a separator.

    Packit ae235b

    The motivation for this abstract model of application controls is

    Packit ae235b
    that modern user interfaces tend to make these controls available
    Packit ae235b
    outside the application. Examples include global menus, jumplists,
    Packit ae235b
    dash boards, etc. To support such uses, it is necessary to 'export'
    Packit ae235b
    information about actions and their representation in menus, which
    Packit ae235b
    is exactly what the GActionGroup exporter
    Packit ae235b
    and the GMenuModel exporter do for
    Packit ae235b
    GActionGroup and GMenuModel. The client-side counterparts to
    Packit ae235b
    make use of the exported information are GDBusActionGroup and
    Packit ae235b
    GDBusMenuModel.

    Packit ae235b

    The API of GMenuModel is very generic, with iterators for the

    Packit ae235b
    attributes and links of an item, see g_menu_model_iterate_item_attributes()
    Packit ae235b
    and g_menu_model_iterate_item_links(). The 'standard' attributes and
    Packit ae235b
    link types have predefined names: G_MENU_ATTRIBUTE_LABEL,
    Packit ae235b
    G_MENU_ATTRIBUTE_ACTION, G_MENU_ATTRIBUTE_TARGET, G_MENU_LINK_SECTION
    Packit ae235b
    and G_MENU_LINK_SUBMENU.

    Packit ae235b

    Items in a GMenuModel represent active controls if they refer to

    Packit ae235b
    an action that can get activated when the user interacts with the
    Packit ae235b
    menu item. The reference to the action is encoded by the string id
    Packit ae235b
    in the G_MENU_ATTRIBUTE_ACTION attribute. An action id uniquely
    Packit ae235b
    identifies an action in an action group. Which action group(s) provide
    Packit ae235b
    actions depends on the context in which the menu model is used.
    Packit ae235b
    E.g. when the model is exported as the application menu of a
    Packit ae235b
    GtkApplication, actions can be application-wide or window-specific
    Packit ae235b
    (and thus come from two different action groups). By convention, the
    Packit ae235b
    application-wide actions have names that start with "app.", while the
    Packit ae235b
    names of window-specific actions start with "win.".

    Packit ae235b

    While a wide variety of stateful actions is possible, the following

    Packit ae235b
    is the minimum that is expected to be supported by all users of exported
    Packit ae235b
    menu information:

    Packit ae235b
      Packit ae235b
    • an action with no parameter type and no state

    • Packit ae235b
    • an action with no parameter type and boolean state

    • Packit ae235b
    • an action with string parameter type and string state

    • Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Stateless

      Packit ae235b

      A stateless action typically corresponds to an ordinary menu item.

      Packit ae235b

      Selecting such a menu item will activate the action (with no parameter).

      Packit ae235b
      Packit ae235b
      Packit ae235b

      Boolean State

      Packit ae235b

      An action with a boolean state will most typically be used with a "toggle"

      Packit ae235b
      or "switch" menu item. The state can be set directly, but activating the
      Packit ae235b
      action (with no parameter) results in the state being toggled.

      Packit ae235b

      Selecting a toggle menu item will activate the action. The menu item should

      Packit ae235b
      be rendered as "checked" when the state is true.

      Packit ae235b
      Packit ae235b
      Packit ae235b

      String Parameter and State

      Packit ae235b

      Actions with string parameters and state will most typically be used to

      Packit ae235b
      represent an enumerated choice over the items available for a group of
      Packit ae235b
      radio menu items. Activating the action with a string parameter is
      Packit ae235b
      equivalent to setting that parameter as the state.

      Packit ae235b

      Radio menu items, in addition to being associated with the action, will

      Packit ae235b
      have a target value. Selecting that menu item will result in activation
      Packit ae235b
      of the action with the target value as the parameter. The menu item should
      Packit ae235b
      be rendered as "selected" when the state of the action is equal to the
      Packit ae235b
      target value of the menu item.

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Functions

      Packit ae235b
      Packit ae235b

      g_menu_model_is_mutable ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_model_is_mutable (GMenuModel *model);
      Packit ae235b

      Queries if model

      Packit ae235b
       is mutable.

      Packit ae235b

      An immutable GMenuModel will never emit the “items-changed”

      Packit ae235b
      signal. Consumers of the model may make optimisations accordingly.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE if the model is mutable (ie: "items-changed" may be

      Packit ae235b
      emitted).

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_get_n_items ()

      Packit ae235b
      gint
      Packit ae235b
      g_menu_model_get_n_items (GMenuModel *model);
      Packit ae235b

      Query the number of items in model

      Packit ae235b
      .

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the number of items

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_get_item_attribute_value ()

      Packit ae235b
      GVariant *
      Packit ae235b
      g_menu_model_get_item_attribute_value (GMenuModel *model,
      Packit ae235b
                                             gint item_index,
      Packit ae235b
                                             const gchar *attribute,
      Packit ae235b
                                             const GVariantType *expected_type);
      Packit ae235b

      Queries the item at position item_index

      Packit ae235b
       in model
      Packit ae235b
       for the attribute
      Packit ae235b
      specified by attribute
      Packit ae235b
      .

      Packit ae235b

      If expected_type

      Packit ae235b
       is non-NULL then it specifies the expected type of
      Packit ae235b
      the attribute.  If it is NULL then any type will be accepted.

      Packit ae235b

      If the attribute exists and matches expected_type

      Packit ae235b
       (or if the
      Packit ae235b
      expected type is unspecified) then the value is returned.

      Packit ae235b

      If the attribute does not exist, or does not match the expected type

      Packit ae235b
      then NULL is returned.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      item_index

      Packit ae235b

      the index of the item

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      attribute

      Packit ae235b

      the attribute to query

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      expected_type

      Packit ae235b

      the expected type of the attribute, or

      Packit ae235b
      NULL. 

      Packit ae235b
      [nullable]
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the value of the attribute.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_get_item_attribute ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_model_get_item_attribute (GMenuModel *model,
      Packit ae235b
                                       gint item_index,
      Packit ae235b
                                       const gchar *attribute,
      Packit ae235b
                                       const gchar *format_string,
      Packit ae235b
                                       ...);
      Packit ae235b

      Queries item at position item_index

      Packit ae235b
       in model
      Packit ae235b
       for the attribute
      Packit ae235b
      specified by attribute
      Packit ae235b
      .

      Packit ae235b

      If the attribute exists and matches the GVariantType corresponding

      Packit ae235b
      to format_string
      Packit ae235b
       then format_string
      Packit ae235b
       is used to deconstruct the
      Packit ae235b
      value into the positional parameters and TRUE is returned.

      Packit ae235b

      If the attribute does not exist, or it does exist but has the wrong

      Packit ae235b
      type, then the positional parameters are ignored and FALSE is
      Packit ae235b
      returned.

      Packit ae235b

      This function is a mix of g_menu_model_get_item_attribute_value() and

      Packit ae235b
      g_variant_get(), followed by a g_variant_unref().  As such,
      Packit ae235b
      format_string
      Packit ae235b
       must make a complete copy of the data (since the
      Packit ae235b
      GVariant may go away after the call to g_variant_unref()).  In
      Packit ae235b
      particular, no '&' characters are allowed in format_string
      Packit ae235b
      .

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      item_index

      Packit ae235b

      the index of the item

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      attribute

      Packit ae235b

      the attribute to query

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      format_string

      Packit ae235b

      a GVariant format string

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      ...

      Packit ae235b

      positional parameters, as per format_string

      Packit ae235b

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE if the named attribute was found with the expected

      Packit ae235b
      type

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_get_item_link ()

      Packit ae235b
      GMenuModel *
      Packit ae235b
      g_menu_model_get_item_link (GMenuModel *model,
      Packit ae235b
                                  gint item_index,
      Packit ae235b
                                  const gchar *link);
      Packit ae235b

      Queries the item at position item_index

      Packit ae235b
       in model
      Packit ae235b
       for the link
      Packit ae235b
      specified by link
      Packit ae235b
      .

      Packit ae235b

      If the link exists, the linked GMenuModel is returned. If the link

      Packit ae235b
      does not exist, NULL is returned.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      item_index

      Packit ae235b

      the index of the item

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      link

      Packit ae235b

      the link to query

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the linked GMenuModel, or NULL.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_iterate_item_attributes ()

      Packit ae235b
      GMenuAttributeIter *
      Packit ae235b
      g_menu_model_iterate_item_attributes (GMenuModel *model,
      Packit ae235b
                                            gint item_index);
      Packit ae235b

      Creates a GMenuAttributeIter to iterate over the attributes of

      Packit ae235b
      the item at position item_index
      Packit ae235b
       in model
      Packit ae235b
      .

      Packit ae235b

      You must free the iterator with g_object_unref() when you are done.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      item_index

      Packit ae235b

      the index of the item

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      a new GMenuAttributeIter.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_iterate_item_links ()

      Packit ae235b
      GMenuLinkIter *
      Packit ae235b
      g_menu_model_iterate_item_links (GMenuModel *model,
      Packit ae235b
                                       gint item_index);
      Packit ae235b

      Creates a GMenuLinkIter to iterate over the links of the item at

      Packit ae235b
      position item_index
      Packit ae235b
       in model
      Packit ae235b
      .

      Packit ae235b

      You must free the iterator with g_object_unref() when you are done.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      item_index

      Packit ae235b

      the index of the item

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      a new GMenuLinkIter.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_model_items_changed ()

      Packit ae235b
      void
      Packit ae235b
      g_menu_model_items_changed (GMenuModel *model,
      Packit ae235b
                                  gint position,
      Packit ae235b
                                  gint removed,
      Packit ae235b
                                  gint added);
      Packit ae235b

      Requests emission of the “items-changed” signal on model

      Packit ae235b
      .

      Packit ae235b

      This function should never be called except by GMenuModel

      Packit ae235b
      subclasses.  Any other calls to this function will very likely lead
      Packit ae235b
      to a violation of the interface of the model.

      Packit ae235b

      The implementation should update its internal representation of the

      Packit ae235b
      menu before emitting the signal.  The implementation should further
      Packit ae235b
      expect to receive queries about the new state of the menu (and
      Packit ae235b
      particularly added menu items) while signal handlers are running.

      Packit ae235b

      The implementation must dispatch this call directly from a mainloop

      Packit ae235b
      entry and not in response to calls -- particularly those from the
      Packit ae235b
      GMenuModel API.  Said another way: the menu must not change while
      Packit ae235b
      user code is running without returning to the mainloop.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      a GMenuModel

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      position

      Packit ae235b

      the position of the change

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      removed

      Packit ae235b

      the number of items removed

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      added

      Packit ae235b

      the number of items added

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_attribute_iter_get_next ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_attribute_iter_get_next (GMenuAttributeIter *iter,
      Packit ae235b
                                      const gchar **out_name,
      Packit ae235b
                                      GVariant **value);
      Packit ae235b

      This function combines g_menu_attribute_iter_next() with

      Packit ae235b
      g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value().

      Packit ae235b

      First the iterator is advanced to the next (possibly first) attribute.

      Packit ae235b
      If that fails, then FALSE is returned and there are no other
      Packit ae235b
      effects.

      Packit ae235b

      If successful, name

      Packit ae235b
       and value
      Packit ae235b
       are set to the name and value of the
      Packit ae235b
      attribute that has just been advanced to.  At this point,
      Packit ae235b
      g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() will
      Packit ae235b
      return the same values again.

      Packit ae235b

      The value returned in name

      Packit ae235b
       remains valid for as long as the iterator
      Packit ae235b
      remains at the current position.  The value returned in value
      Packit ae235b
       must
      Packit ae235b
      be unreffed using g_variant_unref() when it is no longer in use.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuAttributeIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      out_name

      Packit ae235b

      the type of the attribute.

      Packit ae235b
      [out][optional][transfer none]
      Packit ae235b
      Packit ae235b
      Packit ae235b

      value

      Packit ae235b

      the attribute value.

      Packit ae235b
      [out][optional][transfer full]
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE on success, or FALSE if there is no additional

      Packit ae235b
      attribute

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_attribute_iter_get_name ()

      Packit ae235b
      const gchar *
      Packit ae235b
      g_menu_attribute_iter_get_name (GMenuAttributeIter *iter);
      Packit ae235b

      Gets the name of the attribute at the current iterator position, as

      Packit ae235b
      a string.

      Packit ae235b

      The iterator is not advanced.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuAttributeIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the name of the attribute

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_attribute_iter_get_value ()

      Packit ae235b
      GVariant *
      Packit ae235b
      g_menu_attribute_iter_get_value (GMenuAttributeIter *iter);
      Packit ae235b

      Gets the value of the attribute at the current iterator position.

      Packit ae235b

      The iterator is not advanced.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuAttributeIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the value of the current attribute.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_attribute_iter_next ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_attribute_iter_next (GMenuAttributeIter *iter);
      Packit ae235b

      Attempts to advance the iterator to the next (possibly first)

      Packit ae235b
      attribute.

      Packit ae235b

      TRUE is returned on success, or FALSE if there are no more

      Packit ae235b
      attributes.

      Packit ae235b

      You must call this function when you first acquire the iterator

      Packit ae235b
      to advance it to the first attribute (and determine if the first
      Packit ae235b
      attribute exists at all).

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuAttributeIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE on success, or FALSE when there are no more attributes

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_link_iter_get_name ()

      Packit ae235b
      const gchar *
      Packit ae235b
      g_menu_link_iter_get_name (GMenuLinkIter *iter);
      Packit ae235b

      Gets the name of the link at the current iterator position.

      Packit ae235b

      The iterator is not advanced.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuLinkIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the type of the link

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_link_iter_get_next ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_link_iter_get_next (GMenuLinkIter *iter,
      Packit ae235b
                                 const gchar **out_link,
      Packit ae235b
                                 GMenuModel **value);
      Packit ae235b

      This function combines g_menu_link_iter_next() with

      Packit ae235b
      g_menu_link_iter_get_name() and g_menu_link_iter_get_value().

      Packit ae235b

      First the iterator is advanced to the next (possibly first) link.

      Packit ae235b
      If that fails, then FALSE is returned and there are no other effects.

      Packit ae235b

      If successful, out_link

      Packit ae235b
       and value
      Packit ae235b
       are set to the name and GMenuModel
      Packit ae235b
      of the link that has just been advanced to.  At this point,
      Packit ae235b
      g_menu_link_iter_get_name() and g_menu_link_iter_get_value() will return the
      Packit ae235b
      same values again.

      Packit ae235b

      The value returned in out_link

      Packit ae235b
       remains valid for as long as the iterator
      Packit ae235b
      remains at the current position.  The value returned in value
      Packit ae235b
       must
      Packit ae235b
      be unreffed using g_object_unref() when it is no longer in use.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuLinkIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      out_link

      Packit ae235b

      the name of the link.

      Packit ae235b
      [out][optional][transfer none]
      Packit ae235b
      Packit ae235b
      Packit ae235b

      value

      Packit ae235b

      the linked GMenuModel.

      Packit ae235b
      [out][optional][transfer full]
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE on success, or FALSE if there is no additional link

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_link_iter_get_value ()

      Packit ae235b
      GMenuModel *
      Packit ae235b
      g_menu_link_iter_get_value (GMenuLinkIter *iter);
      Packit ae235b

      Gets the linked GMenuModel at the current iterator position.

      Packit ae235b

      The iterator is not advanced.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuLinkIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      the GMenuModel that is linked to.

      Packit ae235b

      [transfer full]

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      g_menu_link_iter_next ()

      Packit ae235b
      gboolean
      Packit ae235b
      g_menu_link_iter_next (GMenuLinkIter *iter);
      Packit ae235b

      Attempts to advance the iterator to the next (possibly first)

      Packit ae235b
      link.

      Packit ae235b

      TRUE is returned on success, or FALSE if there are no more links.

      Packit ae235b

      You must call this function when you first acquire the iterator to

      Packit ae235b
      advance it to the first link (and determine if the first link exists
      Packit ae235b
      at all).

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      iter

      Packit ae235b

      a GMenuLinkIter

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Returns

      Packit ae235b

      TRUE on success, or FALSE when there are no more links

      Packit ae235b
      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Types and Values

      Packit ae235b
      Packit ae235b

      GMenuModel

      Packit ae235b
      typedef struct _GMenuModel GMenuModel;
      Packit ae235b

      GMenuModel is an opaque structure type. You must access it using the

      Packit ae235b
      functions below.

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_ATTRIBUTE_ACTION

      Packit ae235b
      #define G_MENU_ATTRIBUTE_ACTION "action"
      Packit ae235b
      Packit ae235b

      The menu item attribute which holds the action name of the item. Action

      Packit ae235b
      names are namespaced with an identifier for the action group in which the
      Packit ae235b
      action resides. For example, "win." for window-specific actions and "app."
      Packit ae235b
      for application-wide actions.

      Packit ae235b

      See also g_menu_model_get_item_attribute() and g_menu_item_set_attribute().

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_ATTRIBUTE_ACTION_NAMESPACE

      Packit ae235b
      #define G_MENU_ATTRIBUTE_ACTION_NAMESPACE "action-namespace"
      Packit ae235b
      Packit ae235b

      The menu item attribute that holds the namespace for all action names in

      Packit ae235b
      menus that are linked from this item.

      Packit ae235b

      Since: 2.36

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_ATTRIBUTE_TARGET

      Packit ae235b
      #define G_MENU_ATTRIBUTE_TARGET "target"
      Packit ae235b
      Packit ae235b

      The menu item attribute which holds the target with which the item's action

      Packit ae235b
      will be activated.

      Packit ae235b

      See also g_menu_item_set_action_and_target()

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_ATTRIBUTE_LABEL

      Packit ae235b
      #define G_MENU_ATTRIBUTE_LABEL "label"
      Packit ae235b
      Packit ae235b

      The menu item attribute which holds the label of the item.

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_ATTRIBUTE_ICON

      Packit ae235b
      #define G_MENU_ATTRIBUTE_ICON "icon"
      Packit ae235b
      Packit ae235b

      The menu item attribute which holds the icon of the item.

      Packit ae235b

      The icon is stored in the format returned by g_icon_serialize().

      Packit ae235b

      This attribute is intended only to represent 'noun' icons such as

      Packit ae235b
      favicons for a webpage, or application icons.  It should not be used
      Packit ae235b
      for 'verbs' (ie: stock icons).

      Packit ae235b

      Since: 2.38

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_LINK_SECTION

      Packit ae235b
      #define G_MENU_LINK_SECTION "section"
      Packit ae235b
      Packit ae235b

      The name of the link that associates a menu item with a section. The linked

      Packit ae235b
      menu will usually be shown in place of the menu item, using the item's label
      Packit ae235b
      as a header.

      Packit ae235b

      See also g_menu_item_set_link().

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      G_MENU_LINK_SUBMENU

      Packit ae235b
      #define G_MENU_LINK_SUBMENU "submenu"
      Packit ae235b
      Packit ae235b

      The name of the link that associates a menu item with a submenu.

      Packit ae235b

      See also g_menu_item_set_link().

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      struct GMenuAttributeIter

      Packit ae235b
      struct GMenuAttributeIter;
      Packit ae235b

      GMenuAttributeIter is an opaque structure type. You must access it

      Packit ae235b
      using the functions below.

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b

      Packit ae235b
      Packit ae235b

      struct GMenuLinkIter

      Packit ae235b
      struct GMenuLinkIter;
      Packit ae235b

      GMenuLinkIter is an opaque structure type. You must access it using

      Packit ae235b
      the functions below.

      Packit ae235b

      Since: 2.32

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Signal Details

      Packit ae235b
      Packit ae235b

      The “items-changed” signal

      Packit ae235b
      void
      Packit ae235b
      user_function (GMenuModel *model,
      Packit ae235b
                     gint        position,
      Packit ae235b
                     gint        removed,
      Packit ae235b
                     gint        added,
      Packit ae235b
                     gpointer    user_data)
      Packit ae235b

      Emitted when a change has occured to the menu.

      Packit ae235b

      The only changes that can occur to a menu is that items are removed

      Packit ae235b
      or added.  Items may not change (except by being removed and added
      Packit ae235b
      back in the same location).  This signal is capable of describing
      Packit ae235b
      both of those changes (at the same time).

      Packit ae235b

      The signal means that starting at the index position

      Packit ae235b
      , removed
      Packit ae235b
      Packit ae235b
      items were removed and added
      Packit ae235b
       items were added in their place.  If
      Packit ae235b
      removed
      Packit ae235b
       is zero then only items were added.  If added
      Packit ae235b
       is zero
      Packit ae235b
      then only items were removed.

      Packit ae235b

      As an example, if the menu contains items a, b, c, d (in that

      Packit ae235b
      order) and the signal (2, 1, 3) occurs then the new composition of
      Packit ae235b
      the menu will be a, b, _, _, _, d (with each _ representing some
      Packit ae235b
      new item).

      Packit ae235b

      Signal handlers may query the model (particularly the added items)

      Packit ae235b
      and expect to see the results of the modification that is being
      Packit ae235b
      reported.  The signal is emitted after the modification.

      Packit ae235b
      Packit ae235b

      Parameters

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      model

      Packit ae235b

      the GMenuModel that is changing

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      position

      Packit ae235b

      the position of the change

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      removed

      Packit ae235b

      the number of items removed

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      added

      Packit ae235b

      the number of items added

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b

      user_data

      Packit ae235b

      user data set when the signal handler was connected.

      Packit ae235b
       
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Flags: Run Last

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      See Also

      Packit ae235b

      GActionGroup

      Packit ae235b
      Packit ae235b
      Packit ae235b
      Packit ae235b

      Generated by GTK-Doc V1.27
      Packit ae235b
      </body>
      Packit ae235b
      </html>