### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/Builder.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 3
2>),
    :button-click( $y, :o3<o3>, :o4<o4>)
  );

  # Register all signals
  $builder.connect-signals-full($handlers);


=end pod

method connect-signals-full ( Hash $handlers ) {
  my $builder = self._get-native-object-no-reffing;
  gtk_builder_connect_signals_full(
    $builder,
    sub (
      N-GObject $builder, N-GObject $object, Str $signal-name,
      Str $handler-name, N-GObject $ignore-d0, int32 $ignore-d1,
      OpaquePointer $ignore-d2
    ) {
      my Str $oname = Gnome::GObject::Type.name-from-instance($object);
      if $oname ~~ /^ Gtk / and $handlers{$handler-name}:exists {
        $oname ~~ s/^ Gtk /Gnome::Gtk3::/;
        my $handler-object = $handlers{$handler-name}[0];
        my %options = %(|$handlers{$handler-name}[1..*-1]);

        require ::($oname);
        my $gtk-object = ::($oname).new(:native-object($object));
        note "Connect $oname, $handler-name for signal $signal-name"
          if $Gnome::N::x-debug;

        if $handler-object.^can("$handler-name") {
          $gtk-object.register-signal(
            $handler-object, $handler-name, $signal-name, |%options
          );
        }

        else {
          note "Signalhandler $handler-name for signal $signal-name not available" if $Gnome::N::x-debug;
        }
      }

      else {
        note "Cannot handle $oname typed objects. Signalhandler for signal $signal-name not activated" if $Gnome::N::x-debug;
      }
    },
    OpaquePointer
  )
}

sub gtk_builder_connect_signals_full (
  N-GObject $builder,
  Callable $func (
    N-GObject $b, N-GObject $object,
    Str $signal_name, Str $handler_name,
    N-GObject $connect_object, int32 $flags,
    OpaquePointer $d
  ),
  Pointer $user_data
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:error-quark:
=begin pod
=head2 error-quark

Return the domain code of the builder error domain.

  method error-quark ( --> UInt )

The following example shows the fields of a returned error when a faulty string is provided in the call.

  my Gnome::Glib::Quark $quark .= new;
  my Gnome::Glib::Error $e = $builder.add-from-string($text);
  is $e.domain, $builder.gtk_builder_error_quark(),
     "domain code: $e.domain()";
  is $quark.to-string($e.domain), 'gtk-builder-error-quark',
     "error domain: $quark.to-string($e.domain())";

=end pod

method error-quark ( --> UInt ) {
  gtk_builder_error_quark()
}

sub gtk_builder_error_quark (
   --> GQuark
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:expose-object:
=begin pod
=head2 expose-object

Add I<object> to the I<builder> object pool so it can be referenced just like any other object built by builder.

  method expose-object ( Str $name, N-GObject() $object )

=item $name; the name of the object exposed to the builder
=item $object; the object to expose
=end pod

method expose-object ( Str $name, N-GObject() $object ) {
  gtk_builder_expose_object(
    self._get-native-object-no-reffing, $name, $object
  );
}

sub gtk_builder_expose_object (
  N-GObject $builder, gchar-ptr $name, N-GObject $object
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:extend-with-template:
=begin pod
=head2 extend-with-template

Main private entry point for building composite container components from template XML.

This is exported purely to let gtk-builder-tool validate templates, applications have no need to call this function.

Returns: A positive value on success, 0 if an error occurred

  method extend-with-template (
    N-GObject() $widget, N-GObject() $template_type,
    Str $buffer, UInt $length, N-GError $error
    --> UInt
  )

=item $widget; the widget that is being extended
=item $template_type; the type that the template is for
=item $buffer; the string to parse
=item $length; the length of I<buffer> (may be -1 if I<buffer> is nul-terminated)
=item $error; return location for an error, or C<undefined>
=end pod

method extend-with-template (
  N-GObject() $widget, N-GObject() $template_type, Str $buffer, UInt $length,
  $error is copy --> UInt
) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  gtk_builder_extend_with_template(
    self._get-native-object-no-reffing, $widget, $template_type, $buffer,
    $length, $error
  )
}

sub gtk_builder_extend_with_template (
  N-GObject $builder, N-GObject $widget, N-GObject $template_type, gchar-ptr $buffer, gsize $length, N-GError $error --> guint
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:get-application:
=begin pod
=head2 get-application

Gets the B<Gnome::Gtk3::Application> associated with the builder.

The B<Gnome::Gtk3::Application> is used for creating action proxies as requested from XML that the builder is loading.

By default, the builder uses the default application: the one from C<g-application-get-default()>. If you want to use another application for constructing proxies, use C<set-application()>.

Returns: the application being used by the builder, or C<undefined>

  method get-application ( --> N-GObject )

=end pod

method get-application ( --> N-GObject ) {
  gtk_builder_get_application(self._get-native-object-no-reffing)
}

method get-application-rk ( --> Gnome::Gtk3::Application ) {
  Gnome::N::deprecate(
    'get-application-rk', 'coercing from get-application',
    '0.47.2', '0.50.0'
  );

  Gnome::Gtk3::Application.new(
    :native-object(
      gtk_builder_get_application(self._get-native-object-no-reffing)
    )
  )
}

sub gtk_builder_get_application (
  N-GObject $builder --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-object:
=begin pod
=head2 get-object

Gets the object named I<$name>. Note that this function does not increment the reference count of the returned object.

Returns: the object named I<$name> or C<undefined> if it could not be found in the object tree.

  method get-object ( Str $name --> N-GObject )

=item $name; name of object to get
=end pod

method get-object ( Str $name --> N-GObject ) {
  gtk_builder_get_object( self._get-native-object-no-reffing, $name)
}

method get-object-rk ( Str $name --> Any ) {
  Gnome::N::deprecate(
    'get-object-rk', 'coercing from get-object',
    '0.47.2', '0.50.0'
  );

  my N-GObject $no = gtk_builder_get_object(
    self._get-native-object-no-reffing, $name
  );

  self._wrap-native-type-from-no($no)
}

sub gtk_builder_get_object (
  N-GObject $builder, gchar-ptr $name --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:4:get-objects:
=begin pod
=head2 get-objects

Gets all objects that have been constructed by I<builder>. Note that this function does not increment the reference counts of the returned objects.

Returns: (element-type GObject) (transfer container): a newly-allocated B<Gnome::Gtk3::SList> containing all the objects constructed by the B<Gnome::Gtk3::Builder> instance. It should be freed by C<g-slist-free()>

  method get-objects ( --> Gnome::Glib::SList )

=end pod

method get-objects ( --> Gnome::Glib::SList ) {
  Gnome::Glib::SList.new(:native-object(
      gtk_builder_get_objects(self._get-native-object-no-reffing)
    )
  )
}

sub gtk_builder_get_objects (
  N-GObject $builder --> N-GSList
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:get-translation-domain:
=begin pod
=head2 get-translation-domain

Gets the translation domain of I<builder>.

Returns: the translation domain. This string is owned by the builder object and must not be modified or freed.

  method get-translation-domain ( --> Str )

=end pod

method get-translation-domain ( --> Str ) {

  gtk_builder_get_translation_domain(
    self._get-native-object-no-reffing,
  )
}

sub gtk_builder_get_translation_domain (
  N-GObject $builder --> gchar-ptr
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:0:get-type-from-name:
=begin pod
=head2 get-type-from-name

Looks up a type by name, using the virtual function that B<Gnome::Gtk3::Builder> has for that purpose. This is mainly used when implementing the B<Gnome::Gtk3::Buildable> interface on a type.

Returns: the B<Gnome::Gtk3::Type> found for I<$type-name> or B<Gnome::Gtk3::-TYPE-INVALID> if no type was found

  method get-type-from-name ( Str $type-name --> UInt )

=item $type_name; type name to lookup
=end pod

method get-type-from-name ( Str $type-name --> UInt ) {
  gtk_builder_get_type_from_name(
    self._get-native-object-no-reffing, $type-name
  )
}

sub gtk_builder_get_type_from_name (
  N-GObject $builder, gchar-ptr $type-name --> GType
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:lookup-callback-symbol:
=begin pod
=head2 lookup-callback-symbol

Fetches a symbol previously added to I<builder> with C<add-callback-symbols()>

This function is intended for possible use in language bindings or for any case that one might be cusomizing signal connections using C<gtk-builder-connect-signals-full()>

Returns: The callback symbol in I<builder> for I<callback-name>, or C<undefined>

  method lookup-callback-symbol ( Str $callback_name --> GCallback )

=item $callback_name; The name of the callback
=end pod

method lookup-callback-symbol ( Str $callback_name --> GCallback ) {

  gtk_builder_lookup_callback_symbol(
    self._get-native-object-no-reffing, $callback_name
  )
}

sub gtk_builder_lookup_callback_symbol (
  N-GObject $builder, gchar-ptr $callback_name --> GCallback
) is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
#`{{ A piece of C code to add id to objects
static inline void
object_set_name (GObject     *object,
                 const gchar *name)
{
  if (GTK_IS_BUILDABLE (object))
    gtk_buildable_set_name (GTK_BUILDABLE (object), name);
  else
    g_object_set_data_full (object, "gtk-builder-name", g_strdup (name), g_free);
}
}}

method object-set-name ( $object is copy, Str:D $name ) {

  my $rk-object;
  if $object ~~ N-GObject {
    $rk-object = self._wrap-native-type-from-no($object);
  }

  else {
    $rk-object = $object;
    $object .= _get-native-object-no-reffing;
  }

  my Gnome::GObject::Type $t .= new;
  my Int $buildable-type = $t.from-name('GtkBuildable');
  if $t.check-instance-is-a( $object, $buildable-type) {
    $rk-object.buildable-set-name($name);
  }

  else {
    my $rk-object = self._wrap-native-type-from-no($object);
    $rk-object.set-data( 'gtk-builder-name', $name);
  }
#  _gtk_builder_add_object( self._get-native-object-no-reffing, $name, $object);
}
#`{{
sub _gtk_builder_add_object (
  N-GObject $builder, Str $id, N-GObject $object
) is native(&gtk-lib)
  { * }
}}
}}

#-------------------------------------------------------------------------------
#TM:0:set-application:
=begin pod
=head2 set-application

Sets the application associated with I<builder>.

You only need this function if there is more than one B<Gnome::Gtk3::Application> in your process. I<$application> cannot be C<undefined>.

  method set-application ( N-GObject() $application )

=item $application; a B<Gnome::Gtk3::Application>
=end pod

method set-application ( N-GObject() $application ) {
  gtk_builder_set_application(
    self._get-native-object-no-reffing, $application
  );
}

sub gtk_builder_set_application (
  N-GObject $builder, N-GObject $application
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:set-translation-domain:
=begin pod
=head2 set-translation-domain

Sets the translation domain of I<builder>. See  I<translation-domain>.

  method set-translation-domain ( Str $domain )

=item $domain; the translation domain or C<undefined>
=end pod

method set-translation-domain ( Str $domain ) {
  gtk_builder_set_translation_domain(
    self._get-native-object-no-reffing, $domain
  );
}

sub gtk_builder_set_translation_domain (
  N-GObject $builder, gchar-ptr $domain
) is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:value-from-string:
=begin pod
=head2 value-from-string

This function demarshals a value from a string. This function calls C<g-value-init()> on the I<value> argument, so it need not be initialised beforehand.

This function can handle char, uchar, boolean, int, uint, long, ulong, enum, flags, float, double, string, B<Gnome::Gtk3::Color>, B<Gnome::Gtk3::RGBA> and B<Gnome::Gtk3::Adjustment> type values. Support for B<Gnome::Gtk3::Widget> type values is still to come.

Upon errors C<False> will be returned and I<error> will be assigned a B<Gnome::Gtk3::Error> from the B<Gnome::Gtk3::TK-BUILDER-ERROR> domain.

Returns: C<True> on success

  method value-from-string ( GParamSpec $pspec, Str $string, N-GObject $value, N-GError $error --> Bool )

=item $pspec; the B<Gnome::Gtk3::ParamSpec> for the property
=item $string; the string representation of the value
=item $value; the B<Gnome::Gtk3::Value> to store the result in
=item $error; return location for an error, or C<undefined>
=end pod

method value-from-string ( GParamSpec $pspec, Str $string, $value is copy, $error is copy --> Bool ) {
  $value .= _get-native-object-no-reffing unless $value ~~ N-GObject;
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  gtk_builder_value_from_string(
    self._get-native-object-no-reffing, $pspec, $string, $value, $error
  ).Bool
}

sub gtk_builder_value_from_string (
  N-GObject $builder, GParamSpec $pspec, gchar-ptr $string, N-GObject $value, N-GError $error --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:value-from-string-type:
=begin pod
=head2 value-from-string-type

Like C<value-from-string()>, this function demarshals a value from a string, but takes a B<Gnome::Gtk3::Type> instead of B<Gnome::Gtk3::ParamSpec>. This function calls C<g-value-init()> on the I<value> argument, so it need not be initialised beforehand.

Upon errors C<False> will be returned and I<error> will be assigned a B<Gnome::Gtk3::Error> from the B<Gnome::Gtk3::TK-BUILDER-ERROR> domain.

Returns: C<True> on success

  method value-from-string-type ( N-GObject $type, Str $string, N-GObject $value, N-GError $error --> Bool )

=item $type; the B<Gnome::Gtk3::Type> of the value
=item $string; the string representation of the value
=item $value; the B<Gnome::Gtk3::Value> to store the result in
=item $error; return location for an error, or C<undefined>
=end pod

method value-from-string-type ( $type is copy, Str $string, $value is copy, $error is copy --> Bool ) {
  $type .= _get-native-object-no-reffing unless $type ~~ N-GObject;
  $value .= _get-native-object-no-reffing unless $value ~~ N-GObject;
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  gtk_builder_value_from_string_type(
    self._get-native-object-no-reffing, $type, $string, $value, $error
  ).Bool
}

sub gtk_builder_value_from_string_type (
  N-GObject $builder, N-GObject $type, gchar-ptr $string, N-GObject $value, N-GError $error --> gboolean
) is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_gtk_builder_new:
#`{{
=begin pod
=head2 _gtk_builder_new

Creates a new empty builder object.

This function is only useful if you intend to make multiple calls to C<add-from-file()>, C<gtk-builder-add-from-resource()> or C<gtk-builder-add-from-string()> in order to merge multiple UI descriptions into a single builder.

Most users will probably want to use C<gtk-builder-new-from-file()>, C<gtk-builder-new-from-resource()> or C<gtk-builder-new-from-string()>.

Returns: a new (empty) B<Gnome::Gtk3::Builder> object

  method _gtk_builder_new ( --> N-GObject )

=end pod
}}

sub _gtk_builder_new ( --> N-GObject )
  is native(&gtk-lib)
  is symbol('gtk_builder_new')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_gtk_builder_new_from_file:
#`{{
=begin pod
=head2 _gtk_builder_new_from_file

Builds the [GtkBuilder UI definition][BUILDER-UI] in the file I<filename>.

If there is an error opening the file or parsing the description then the program will be aborted. You should only ever attempt to parse user interface descriptions that are shipped as part of your program.

Returns: a B<Gnome::Gtk3::Builder> containing the described interface

  method _gtk_builder_new_from_file ( Str $filename --> N-GObject )

=item $filename; filename of user interface description file
=end pod
}}

sub _gtk_builder_new_from_file ( gchar-ptr $filename --> N-GObject )
  is native(&gtk-lib)
  is symbol('gtk_builder_new_from_file')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_gtk_builder_new_from_resource:
#`{{
=begin pod
=head2 _gtk_builder_new_from_resource

Builds the [GtkBuilder UI definition][BUILDER-UI] at I<resource-path>.

If there is an error locating the resource or parsing the description, then the program will be aborted.

Returns: a B<Gnome::Gtk3::Builder> containing the described interface

  method _gtk_builder_new_from_resource ( Str $resource_path --> N-GObject )

=item $resource_path; a B<Gnome::Gtk3::Resource> resource path
=end pod
}}

sub _gtk_builder_new_from_resource ( gchar-ptr $resource_path --> N-GObject )
  is native(&gtk-lib)
  is symbol('gtk_builder_new_from_resource')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_gtk_builder_new_from_string:
#`{{
=begin pod
=head2 _gtk_builder_new_from_string

Builds the user interface described by I<string> (in the [GtkBuilder UI definition][BUILDER-UI] format).

If I<string> is C<undefined>-terminated, then I<length> should be -1. If I<length> is not -1, then it is the length of I<string>.

If there is an error parsing I<string> then the program will be aborted. You should not attempt to parse user interface description from untrusted sources.

Returns: a B<Gnome::Gtk3::Builder> containing the interface described by I<string>

  method _gtk_builder_new_from_string ( Str $string, Int() $length --> N-GObject )

=item $string; a user interface (XML) description
=item $length; the length of I<string>, or -1
=end pod
}}

sub _gtk_builder_new_from_string ( gchar-ptr $string, gssize $length --> N-GObject )
  is native(&gtk-lib)
  is symbol('gtk_builder_new_from_string')
  { * }

#-------------------------------------------------------------------------------
=begin pod
=head1 Properties

=comment -----------------------------------------------------------------------
=comment #TP:0:translation-domain:
=head2 translation-domain

The translation domain used by gettext

The B<Gnome::GObject::Value> type of property I<translation-domain> is C<G_TYPE_STRING>.

=item Parameter is readable and writable.
=item Default value is undefined.

=end pod












=finish
#-------------------------------------------------------------------------------
=begin pod
=head1 Properties

An example of using a string type property of a B<Gnome::Gtk3::Label> object. This is just showing how to set/read a property, not that it is the best way to do it. This is because a) The class initialization often provides some options to set some of the properties and b) the classes provide many methods to modify just those properties. In the case below one can use B<new(:label('my text label'))> or B<.set-text('my text label')>.

  my Gnome::Gtk3::Label $label .= new;
  my Gnome::GObject::Value $gv .= new(:init(G_TYPE_STRING));
  $label.get-property( 'label', $gv);
  $gv.set-string('my text label');

=head2 Supported properties

=comment -----------------------------------------------------------------------
=comment #TP:0:translation-domain:
=head3 Translation Domain: translation-domain

The translation domain used when translating property values that have been marked as translatable in interface descriptions. If the translation domain is C<undefined>, B<Gnome::Gtk3::Builder> uses C<gettext()>, otherwise C<g-dgettext()>.

The B<Gnome::GObject::Value> type of property I<translation-domain> is C<G_TYPE_STRING>.
=end pod








=finish
#-------------------------------------------------------------------------------
#TM:1:gtk_builder_error_quark:
=begin pod
=head2 [[gtk_] builder_] error_quark

Return the domain code of the builder error domain.

  method gtk_builder_error_quark ( --> Int )

The following example shows the fields of a returned error when a faulty string is provided in the call.

  my Gnome::Glib::Quark $quark .= new;
  my Gnome::Glib::Error $e = $builder.add-from-string($text);
  is $e.domain, $builder.gtk_builder_error_quark(),
     "domain code: $e.domain()";
  is $quark.to-string($e.domain), 'gtk-builder-error-quark',
     "error domain: $quark.to-string($e.domain())";

=end pod

sub gtk_builder_error_quark (  )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:2:_gtk_builder_new:new()
#`{{
=begin pod
=head2 [gtk_] builder_new

Creates a new empty builder object.

This function is only useful if you intend to make multiple calls to C<gtk_builder_add_from_file()>, C<gtk_builder_add_from_resource()> or C<gtk_builder_add_from_string()> in order to merge multiple UI descriptions into a single builder.

Most users will probably want to use C<gtk_builder_new_from_file()>, C<gtk_builder_new_from_resource()> or C<gtk_builder_new_from_string()>.

Returns: a new (empty) B<Gnome::Gtk3::Builder> object

  method gtk_builder_new ( --> N-GObject  )

=end pod
}}
sub _gtk_builder_new (  )
  returns N-GObject
  is native(&gtk-lib)
  is symbol('gtk_builder_new')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_builder_add_from_file:
=begin pod
=head2 [[gtk_] builder_] add_from_file

Parses a file containing a UI definition and merges it with the current contents of I<builder>.

Most users will probably want to use C<.new(:file)>.

If an error occurs, a valid Gnome::Glib::Error object is returned with an error domain of C<GTK_BUILDER_ERROR>, C<G_MARKUP_ERROR> or C<G_FILE_ERROR>.

You should not use this function with untrusted files (ie: files that are not part of your application). Broken B<Gnome::Gtk3::Builder> files can easily crash your program, and it’s possible that memory was leaked leading up to the reported failure. The only reasonable thing to do when an error is detected is to throw an Exception when necessary.

Returns: Gnome::Glib::Error. Test C<.is-valid()> of that object to see if there was an error.

  method gtk_builder_add_from_file (
    Str $filename, N-GObject $error
    --> Gnome::Glib::Error
  )

=item $filename; the name of the file to parse

=end pod

sub gtk_builder_add_from_file (
  N-GObject $builder, Str $filename
  --> Gnome::Glib::Error
) {
  my CArray[N-GError] $ga .= new(N-GError);
  _gtk_builder_add_from_file( $builder, $filename, $ga);
  Gnome::Glib::Error.new(:native-object($ga[0]))
}

sub _gtk_builder_add_from_file (
  N-GObject $builder, Str $filename, CArray[N-GError] $error
) returns uint32
  is native(&gtk-lib)
  is symbol('gtk_builder_add_from_file')
  { * }

#-------------------------------------------------------------------------------
#TM:4:gtk_builder_add_from_resource:ex-application.pl6
=begin pod
=head2 [[gtk_] builder_] add_from_resource

Parses a resource file containing a UI definition and merges it with the current contents of I<builder>.

Most users will probably want to use C<.new(:resource)>.

If an error occurs, a valid Gnome::Glib::Error object is returned with an error domain of C<GTK_BUILDER_ERROR>, C<G_MARKUP_ERROR> or C<G_FILE_ERROR>. The only reasonable thing to do when an error is detected is to throw an Exception when necessary.

Returns: Gnome::Glib::Error. Test C<.is-valid()> to see if there was an error.

  method gtk_builder_add_from_resource (
    Str $resource_path
    --> Gnome::Glib::Error
  )

=item $resource_path; the path of the resource file to parse
=item $error; (allow-none): return location for an error, or C<Any>

=end pod

sub gtk_builder_add_from_resource (
  N-GObject $builder, Str $path
  --> Gnome::Glib::Error
) {
  my CArray[N-GError] $ga .= new(N-GError);
  _gtk_builder_add_from_resource( $builder, $path, $ga);
  Gnome::Glib::Error.new(:native-object($ga[0]))
}

sub _gtk_builder_add_from_resource (
  N-GObject $builder, Str $resource_path, CArray[N-GError] $error
  --> int32
) is native(&gtk-lib)
  is symbol('gtk_builder_add_from_resource')
  { * }


#-------------------------------------------------------------------------------
#TM:1:gtk_builder_add_from_string:
=begin pod
=head2 [[gtk_] builder_] add_from_string

Parses a string containing a UI definition and merges it with the current contents of I<builder>.

Most users will probably want to use C<.new(:string)>.

If an error occurs, a valid Gnome::Glib::Error object is returned with an error domain of C<GTK_BUILDER_ERROR>, C<G_MARKUP_ERROR> or C<G_FILE_ERROR>. The only reasonable thing to do when an error is detected is to throw an Exception when necessary.

Returns: Gnome::Glib::Error. Test C<.is-valid()> to see if there was an error.

  method gtk_builder_add_from_string ( Str $buffer --> N-GObject $error )

=item $buffer; the string to parse

=end pod

sub gtk_builder_add_from_string (
  N-GObject $builder, Str $buffer
  --> Gnome::Glib::Error
) {
  my CArray[N-GError] $ga .= new(N-GError);
  _gtk_builder_add_from_string(
    $builder, $buffer, $buffer.encode.bytes #`{{$buffer.chars}}, $ga
  );
  Gnome::Glib::Error.new(:native-object($ga[0]));
}

sub _gtk_builder_add_from_string (
  N-GObject $builder, Str $buffer, int64 $length, CArray[N-GError] $error
) returns uint32
  is native(&gtk-lib)
  is symbol('gtk_builder_add_from_string')
  { * }

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] add_objects_from_file

Parses a file containing a [B<Gnome::Gtk3::Builder> UI definition]
building only the requested objects and merges
them with the current contents of I<builder>.

If you are adding an object that depends on an object that is not
its child (for instance a B<Gnome::Gtk3::TreeView> that depends on its
B<Gnome::Gtk3::TreeModel>), you have to explicitly list all of them in I<object_ids>.

If an error occurs, a valid Gnome::Glib::Error object is returned with an error domain of C<GTK_BUILDER_ERROR>, C<G_MARKUP_ERROR> or C<G_FILE_ERROR>. The only reasonable thing to do when an error is detected is to throw an Exception when necessary.

Returns: Gnome::Glib::Error. Test C<.is-valid()> flag to see if there was an error.

  method gtk_builder_add_objects_from_file ( Str $filename, CArray[Str] $object_ids, N-GObject $error --> UInt  )

=item $filename; the name of the file to parse
=item $object_ids; (array zero-terminated=1) (element-type utf8): nul-terminated array of objects to build
=item $error; (allow-none): return location for an error, or C<Any>

=end pod

sub gtk_builder_add_objects_from_file ( N-GObject $builder, Str $filename, CArray[Str] $object_ids, N-GObject $error )
  returns uint32
  is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] add_objects_from_resource

Parses a resource file containing a [B<Gnome::Gtk3::Builder> UI definition](https://developer.gnome.org/gtk3/3.24/GtkBuilder.html#BUILDER-UI)
building only the requested objects and merges
them with the current contents of I<builder>.

Upon errors 0 will be returned and I<error> will be assigned a
C<GError> from the C<GTK_BUILDER_ERROR>, C<G_MARKUP_ERROR> or C<G_RESOURCE_ERROR>
domain.

If you are adding an object that depends on an object that is not
its child (for instance a B<Gnome::Gtk3::TreeView> that depends on its
B<Gnome::Gtk3::TreeModel>), you have to explicitly list all of them in I<object_ids>.

Returns: A positive value on success, 0 if an error occurred

  method gtk_builder_add_objects_from_resource ( Str $resource_path, CArray[Str] $object_ids, N-GObject $error --> UInt  )

=item $resource_path; the path of the resource file to parse
=item $object_ids; (array zero-terminated=1) (element-type utf8): nul-terminated array of objects to build
=item $error; (allow-none): return location for an error, or C<Any>

=end pod

sub gtk_builder_add_objects_from_resource ( N-GObject $builder, Str $resource_path, CArray[Str] $object_ids, N-GObject $error )
  returns uint32
  is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] add_objects_from_string

Parses a string containing a [B<Gnome::Gtk3::Builder> UI definition](https://developer.gnome.org/gtk3/3.24/GtkBuilder.html#BUILDER-UI)
building only the requested objects and merges
them with the current contents of I<builder>.

Upon errors 0 will be returned and I<error> will be assigned a
C<GError> from the C<GTK_BUILDER_ERROR> or C<G_MARKUP_ERROR> domain.

If you are adding an object that depends on an object that is not
its child (for instance a B<Gnome::Gtk3::TreeView> that depends on its
B<Gnome::Gtk3::TreeModel>), you have to explicitly list all of them in I<object_ids>.

Returns: A positive value on success, 0 if an error occurred

  method gtk_builder_add_objects_from_string ( Str $buffer, UInt $length, CArray[Str] $object_ids, N-GObject $error --> UInt  )

=item $buffer; the string to parse
=item $length; the length of I<buffer> (may be -1 if I<buffer> is nul-terminated)
=item $object_ids; (array zero-terminated=1) (element-type utf8): nul-terminated array of objects to build
=item $error; (allow-none): return location for an error, or C<Any>

=end pod

sub gtk_builder_add_objects_from_string ( N-GObject $builder, Str $buffer, uint64 $length, CArray[Str] $object_ids, N-GObject $error )
  returns uint32
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:3:gtk_builder_get_object:
=begin pod
=head2 [[gtk_] builder_] get_object

Gets the object named I<$name>. Note that this function does not increment the reference count of the returned object.

Returns: the object named I<$name> or undefined if it could not be found in the object tree.

  method gtk_builder_get_object ( Str $name --> N-GObject  )

=item $name; name of object to get

=end pod

sub gtk_builder_get_object ( N-GObject $builder, Str $name )
  returns N-GObject
  is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] get_objects

Gets all objects that have been constructed by I<builder>. Note that
this function does not increment the reference counts of the returned
objects.

Returns: (element-type GObject) (transfer container): a newly-allocated C<GSList> containing all the objects
constructed by the B<Gnome::Gtk3::Builder> instance. It should be freed by
C<g_slist_free()>

  method gtk_builder_get_objects ( --> N-GObject  )


=end pod

sub gtk_builder_get_objects ( N-GObject $builder )
  returns N-GObject
  is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] expose_object

Add I<object> to the I<builder> object pool so it can be referenced just like any
other object built by builder.

  method gtk_builder_expose_object ( Str $name, N-GObject $object )

=item $name; the name of the object exposed to the builder
=item $object; the object to expose

=end pod

sub gtk_builder_expose_object ( N-GObject $builder, Str $name, N-GObject $object )
  is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
=begin pod
=head2 [[gtk_] builder_] connect_signals

This method is a simpler variation of C<gtk_builder_connect_signals_full()>.
It uses symbols explicitly added to I<builder> with prior calls to
C<gtk_builder_add_callback_symbol()>. In the case that symbols are not
explicitly added; it uses C<GModule>’s introspective features (by opening the module C<Any>)
to look at the application’s symbol table. From here it tries to match
the signal handler names given in the interface description with
symbols