Gjsify LogoGjsify Logo

Index

Functions

  • action_map_add_action_entries_check_dups(action_map: ActionMap, entries: Gio.ActionEntry[], user_data: object): void
  • A wrapper function for g_action_map_add_action_entries() that checks duplicates.

    This function first checks - for each entry - that the action_map doesn't already contain a #GAction with the same name. A warning is printed if an old action will be dropped. In any case, it then calls g_action_map_add_action_entries() with the same arguments as passed to this function.

    This function also checks if there are duplicates in the entries array itself.

    Parameters

    • action_map: ActionMap

      a #GActionMap.

    • entries: Gio.ActionEntry[]

      a pointer to the first item in an array of #GActionEntry structs.

    • user_data: object

      the user data for signal connections.

    Returns void

  • finalize(): void
  • Free the resources allocated by Amtk. For example it unrefs the singleton objects.

    It is not mandatory to call this function, it's just to be friendlier to memory debugging tools. This function is meant to be called at the end of main(). It can be called several times.

    Returns void

  • gmenu_append_section(menu: Gio.Menu, label: string, section: Gio.Menu): void
  • Like g_menu_append_section() but with (transfer full) and a different type for the section parameter, and calls g_menu_freeze() on section.

    Parameters

    • menu: Gio.Menu

      a #GMenu.

    • label: string

      the section label, or %NULL.

    • section: Gio.Menu

      a #GMenu with the items of the section.

    Returns void

  • init(): void
  • Initializes the Amtk library (e.g. for the internationalization).

    This function can be called several times, but is meant to be called at the beginning of main(), before any other Amtk function call.

    Returns void

  • menu_item_get_long_description(menu_item: Gtk.MenuItem): string | null
  • menu_item_set_icon_name(item: Gtk.MenuItem, icon_name: string): void
  • Sets an icon to a #GtkMenuItem.

    If the child widget of item is already a #GtkBox, all #GtkImage widgets inside that box are first destroyed. A #GtkImage for icon_name is then inserted to the box.

    If the child widget of item is not a #GtkBox (it's usually the #GtkAccelLabel), it is replaced by a new #GtkBox and the initial child widget is inserted to the #GtkBox, alongside the icon.

    As a consequence, if you want to call functions on the #GtkAccelLabel, it's easier to do it before calling this function.

    Parameters

    • item: Gtk.MenuItem

      a #GtkMenuItem.

    • icon_name: string

      an icon name.

    Returns void

  • menu_item_set_long_description(menu_item: Gtk.MenuItem, long_description: string): void
  • Sets the long description of menu_item. A possible use-case is to display it in a #GtkStatusbar, or as a tooltip.

    Parameters

    • menu_item: Gtk.MenuItem

      a #GtkMenuItem.

    • long_description: string

      the long description, or %NULL to unset it.

    Returns void

  • Creates a new #GtkShortcutsWindow. The #GtkWindow:modal property is set to %TRUE.

    It is on purpose that the return type is #GtkShortcutsWindow, not #GtkWidget or something else, so in C when you declare the variable as #GtkShortcutsWindow it's easier to find it later (searching "GtkShortcuts" will return something in your codebase).

    Parameters

    • parent: Gtk.Window

      the #GtkWindow:transient-for.

    Returns Gtk.ShortcutsWindow

  • utils_bind_g_action_to_gtk_action(g_action_map: ActionMap, detailed_g_action_name_without_prefix: string, gtk_action_group: Gtk.ActionGroup, gtk_action_name: string): void
  • 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:

    • Calls g_action_activate() when the #GtkAction #GtkAction::activate signal is emitted.
    • Binds the #GAction #GAction:enabled property to the #GtkAction #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: ActionMap

      a #GActionMap.

    • detailed_g_action_name_without_prefix: string

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

    • gtk_action_group: Gtk.ActionGroup

      a #GtkActionGroup.

    • gtk_action_name: string

      a #GtkAction name present in gtk_action_group.

    Returns void

  • utils_create_gtk_action(g_action_map: ActionMap, detailed_g_action_name_with_prefix: string, gtk_action_group: Gtk.ActionGroup, gtk_action_name: string): void
  • 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: ActionMap

      a #GActionMap.

    • detailed_g_action_name_with_prefix: string

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

    • gtk_action_group: Gtk.ActionGroup

      a #GtkActionGroup.

    • gtk_action_name: string

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

    Returns void

  • 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

    Returns string

  • utils_remove_mnemonic(str: string): string
  • 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: string

      a string.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method