AmtkUtils

AmtkUtils — Utility functions

Includes

#include <amtk/amtk.h>

Description

Utility functions.

Functions

amtk_utils_remove_mnemonic ()

gchar *
amtk_utils_remove_mnemonic (const gchar *str);

Removes the mnemonics from str . Single underscores are removed, and two consecutive underscores are replaced by one underscore (see the documentation of gtk_label_new_with_mnemonic()).

Parameters

str

a string.

 

Returns

the new string with the mnemonics removed. Free with g_free() when no longer needed.

[transfer full]

Since: 5.0


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 *detailed_g_action_name_without_prefix,
                                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.

For detailed_g_action_name_without_prefix , see the g_action_parse_detailed_name() function. The "app." or "win." prefix (or any other GActionMap prefix) must not be included in detailed_g_action_name_without_prefix . For example a valid detailed_g_action_name_without_prefix is "open" or "insert-command::foobar".

The same GAction can be bound to several GtkAction's (with different parameter values for the GAction), but the reverse is not true, one GtkAction cannot be bound to several GAction's.

This function:

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

Parameters

g_action_map

a GActionMap.

 

detailed_g_action_name_without_prefix

a detailed GAction name without the GActionMap prefix; the GAction must be present in g_action_map .

 

gtk_action_group

a GtkActionGroup.

 

gtk_action_name

a GtkAction name present in gtk_action_group .

 

Since: 4.0


amtk_utils_create_gtk_action ()

void
amtk_utils_create_gtk_action (GActionMap *g_action_map,
                              const gchar *detailed_g_action_name_with_prefix,
                              GtkActionGroup *gtk_action_group,
                              const gchar *gtk_action_name);

Utility function to be able to port an application gradually to GAction and AmtkActionInfo, when GtkUIManager is still used. This function goes one step further compared to amtk_utils_bind_g_action_to_gtk_action(). With amtk_utils_bind_g_action_to_gtk_action(), only the GAction must exist. With amtk_utils_create_gtk_action(), both the GAction and AmtkActionInfo must exist (so typically you need to convert the GtkActionEntry's into AmtkActionInfoEntry's).

This function creates a GtkAction from a GAction plus its corresponding AmtkActionInfo.

The GtkAction is created with the information provided by the AmtkActionInfo (retrieved with amtk_action_info_central_store_lookup() with detailed_g_action_name_with_prefix as argument). Only the first accelerator is taken into account.

Once the GtkAction is created, it is added to the gtk_action_group , and amtk_utils_bind_g_action_to_gtk_action() is called.

Parameters

g_action_map

a GActionMap.

 

detailed_g_action_name_with_prefix

a detailed GAction name with the GActionMap prefix; the GAction must be present in g_action_map .

 

gtk_action_group

a GtkActionGroup.

 

gtk_action_name

the name of the GtkAction to create and add to gtk_action_group .

 

Since: 4.0

Types and Values