## AmtkUtils AmtkUtils — Utility functions |

## Functions

gchar * | amtk_utils_recent_chooser_menu_get_item_uri ()
void | amtk_utils_bind_g_action_to_gtk_action ()

## Includes

    #include <amtk/amtk.h>

## Description

Utility functions.

## Functions

### amtk_utils_recent_chooser_menu_get_item_uri ()

    gchar *
    amtk_utils_recent_chooser_menu_get_item_uri
                                   (GtkRecentChooserMenu *menu,
                                    GtkMenuItem *item);

Gets the URI of `item` . `item` must be a child of `menu` . `menu` must be a GtkRecentChooserMenu.

This function has been written because the value returned by `gtk_recent_chooser_get_current_uri()` is not updated when GtkMenuItem's of a GtkRecentChooserMenu are selected/deselected.

#### Parameters

menu | a GtkRecentChooserMenu. |
item | a GtkMenuItem. |

#### Returns

the URI of `item` . Free with `g_free()` when no longer needed.

Since: 2.0

### amtk_utils_bind_g_action_to_gtk_action ()

    void
    amtk_utils_bind_g_action_to_gtk_action
                                   (GActionMap *g_action_map,
                                    const gchar *g_action_name,
                                    GtkActionGroup *gtk_action_group,
                                    const gchar *gtk_action_name);

Utility function to be able to port an application gradually to GAction, when GtkUIManager and GtkAction are still used. Porting to GAction should be the first step.

This function:

- Calls `g_action_activate()` (with a `NULL` GVariant parameter) when the GtkAction “activate” signal is emitted.

- Binds the GAction “enabled” property to the GtkAction “sensitive” property. The binding is done with the `G_BINDING_BIDIRECTIONAL` and `G_BINDING_SYNC_CREATE` flags, the source is the GAction and the target is the GtkAction.

When using this function, you should set the callback to `NULL` in the corresponding GtkActionEntry.

#### Parameters

g_action_map | a GActionMap. |
g_action_name | a GAction name present in `g_action_map` . |
gtk_action_group | a GtkActionGroup. |
gtk_action_name | a GtkAction name present in `gtk_action_group` . |

Since: 3.0

## Types and Values