Glib

 view release on metacpan or  search on metacpan

GBookmarkFile.xs  view on Meta::CPAN

Parses a bookmark file, searching for it inside the data directories.
If a file is found, it returns the full path.
=cut
void
g_bookmark_file_load_from_data_dirs (bookmark_file, file)
	GBookmarkFile *bookmark_file
	GPerlFilename_const file
    PREINIT:
        GError *err = NULL;
	gchar *full_path;
    PPCODE:
        g_bookmark_file_load_from_data_dirs (bookmark_file, file,
					     &full_path,
					     &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (full_path) {
		XPUSHs (sv_2mortal (newSVGChar (full_path)));
		g_free (full_path);
	}

GBookmarkFile.xs  view on Meta::CPAN

=for apidoc
=signature list = $bookmark_file->get_uris
Returns the URI of all the bookmarks in the bookmark file.
=cut
void
g_bookmark_file_get_uris (bookmark_file)
	GBookmarkFile *bookmark_file
    PREINIT:
    	gchar **uris;
	gsize len, i;
    PPCODE:
    	uris = g_bookmark_file_get_uris (bookmark_file, &len);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (uris[i])
				XPUSHs (sv_2mortal (newSVGChar (uris[i])));
		}
	}
	g_strfreev (uris);

=for apidoc

GBookmarkFile.xs  view on Meta::CPAN


=for apidoc __gerror__
Retrieves the list of group names of the bookmark for $uri.
=cut
void
g_bookmark_file_get_groups (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        GError *err = NULL;
	gchar **groups;
	gsize len, i;
    PPCODE:
        groups = g_bookmark_file_get_groups (bookmark_file, uri, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (groups[i])
				XPUSHs (sv_2mortal (newSVGChar (groups[i])));
		}
	}
	g_strfreev (groups);

GBookmarkFile.xs  view on Meta::CPAN

bookmark for $uri.
=cut
void
g_bookmark_file_get_applications (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    PREINIT:
    	gchar **apps;
	gsize len, i;
	GError *err = NULL;
    PPCODE:
    	apps = g_bookmark_file_get_applications (bookmark_file, uri, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (apps[i])
				XPUSHs (sv_2mortal (newSVGChar (apps[i])));
		}
	}
	g_strfreev (apps);

GBookmarkFile.xs  view on Meta::CPAN

void
g_bookmark_file_get_app_info (bookmark_file, uri, name)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *name
    PREINIT:
    	gchar *exec;
	guint count;
	time_t stamp;
        GError *err = NULL;
    PPCODE:
        g_bookmark_file_get_app_info (bookmark_file, uri, name,
				      &exec,
				      &count,
				      &stamp,
				      &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	EXTEND (SP, 3);
	PUSHs (sv_2mortal (newSVGChar (exec)));
	PUSHs (sv_2mortal (newSViv (count)));

GBookmarkFile.xs  view on Meta::CPAN


=for apidoc __gerror__
=signature ($href, $mime_type) = $bookmark_file->get_icon ($uri)
Gets the icon of the bookmark for $uri.
=cut
void
g_bookmark_file_get_icon (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        gchar *href, *mime_type;
        GError *err = NULL;
    PPCODE:
        g_bookmark_file_get_icon (bookmark_file, uri,
				  &href,
				  &mime_type,
				  &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	EXTEND (SP, 2);
	PUSHs (sv_2mortal (newSVGChar (href)));
	PUSHs (sv_2mortal (newSVGChar (mime_type)));
	g_free (href);

GKeyFile.xs  view on Meta::CPAN

g_key_file_load_from_dirs (key_file, file, flags, ...)
	GKeyFile *key_file
	const gchar *file
	GKeyFileFlags flags
    PREINIT:
	int n_dirs, i;
	gchar **search_dirs;
	gchar *full_path = NULL;
	GError *error = NULL;
	gboolean retval;
    PPCODE:
	n_dirs = items - 3;
	search_dirs = g_new0 (gchar*, n_dirs + 1);
	for (i = 0; i < n_dirs; i++) {
		search_dirs[i] = SvGChar (ST (3 + i));
	}
	search_dirs[n_dirs] = NULL;

	retval = g_key_file_load_from_dirs (
			key_file,
			file,

GKeyFile.xs  view on Meta::CPAN

=cut
void
g_key_file_load_from_data_dirs (key_file, file, flags)
	GKeyFile * key_file
	const gchar * file
	GKeyFileFlags flags
    PREINIT:
    	GError *err = NULL;
	gchar *full_path = NULL;
	gboolean retval;
    PPCODE:
    	retval = g_key_file_load_from_data_dirs (key_file,
			file,
			GIMME_V == G_ARRAY ? &full_path : NULL,
			flags,
			&err);
	if (err)
		gperl_croak_gerror (NULL, err);
	PUSHs (sv_2mortal (newSViv (retval)));
	if (GIMME_V == G_ARRAY && full_path)
		XPUSHs (sv_2mortal (newSVGChar (full_path)));

GKeyFile.xs  view on Meta::CPAN

=for apidoc
=signature list = $key_file->get_groups
Returns the list of groups inside the key_file.
=cut
void
g_key_file_get_groups (key_file)
	GKeyFile * key_file
    PREINIT:
    	gchar **groups;
	gsize len, i;
    PPCODE:
    	groups = g_key_file_get_groups (key_file, &len);
	if (len != 0) {
		EXTEND(SP, (long) len);
		for (i = 0; i < len; i++)
			PUSHs (sv_2mortal (newSVGChar (groups[i])));
	}
	g_strfreev (groups); /* otherwise, we leak */

=for apidoc __gerror__
=signature list = $key_file->get_keys ($group_name)
Returns the list of keys inside a group of the key file.
=cut
void
g_key_file_get_keys (key_file, group_name)
	GKeyFile * key_file
	const gchar * group_name
    PREINIT:
    	GError *err = NULL;
    	gchar **keys;
	gsize len, i;
    PPCODE:
    	keys = g_key_file_get_keys (key_file, group_name, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (len != 0) {
		for (i = 0; i < len; i++)
			if (keys[i])
				XPUSHs (sv_2mortal (newSVGChar (keys[i])));
	}
	g_strfreev (keys); /* otherwise, we leak */

GKeyFile.xs  view on Meta::CPAN

void
g_key_file_get_locale_string_list (key_file, group_name, key, locale);
	GKeyFile * key_file
	const gchar * group_name
	const gchar * key
	const gchar * locale
    PREINIT:
	gchar **retlist;
    	GError *err = NULL;
	gsize retlen, i;
    PPCODE:
	retlist = g_key_file_get_locale_string_list (key_file,
			group_name, key,
			locale,
			&retlen,
			&err);
	if (err)
		gperl_croak_gerror (NULL, err);
	for (i = 0; i < retlen; i++)
		XPUSHs (sv_2mortal (newSVGChar (retlist[i])));
	g_strfreev (retlist);

GKeyFile.xs  view on Meta::CPAN

g_key_file_get_string_list (key_file, group_name, key)
	GKeyFile * key_file
	const gchar * group_name
	const gchar * key
    ALIAS:
    	Glib::KeyFile::get_boolean_list = 1
	Glib::KeyFile::get_integer_list = 2
    PREINIT:
    	GError *err = NULL;
	gsize retlen, i;
    PPCODE:
    	switch (ix) {
#define CROAK_ON_GERROR(error)	if (error) gperl_croak_gerror (NULL, error)
		case 0:
		{
			gchar **retlist;
			retlist = g_key_file_get_string_list (key_file,
					group_name, key,
					&retlen,
					&err);
			CROAK_ON_GERROR (err);

GKeyFile.xs  view on Meta::CPAN

=cut
void
g_key_file_get_double_list (key_file, group_name, key)
	GKeyFile * key_file
	const gchar * group_name
	const gchar * key
    PREINIT:
    	GError *err = NULL;
	gsize retlen, i;
	gdouble *retlist;
    PPCODE:
	retlist = g_key_file_get_double_list (key_file,
			group_name, key,
			&retlen,
			&err);
	if (err)
		gperl_croak_gerror (NULL, err);
	EXTEND (sp, (long) retlen);
	for (i = 0; i < retlen; i++)
		PUSHs (sv_2mortal (newSVnv (retlist[i])));
	g_free (retlist);

GObject.xs  view on Meta::CPAN

void
g_object_get (object, ...)
	GObject * object
    ALIAS:
	Glib::Object::get = 0
	Glib::Object::get_property = 1
    PREINIT:
	GValue value = {0,};
	int i;
    CODE:
	/* Use CODE: instead of PPCODE: so we can handle the stack ourselves in
	 * order to avoid that xsubs called by g_object_get_property or
	 * _gperl_sv_from_value_internal overwrite what we put on the stack. */
	PERL_UNUSED_VAR (ix);
	for (i = 1; i < items; i++) {
		char *name = SvPV_nolen (ST (i));
		init_property_value (object, name, &value);
		g_object_get_property (object, name, &value);
		ST (i - 1) =
			sv_2mortal (
				_gperl_sv_from_value_internal (&value, TRUE));

GObject.xs  view on Meta::CPAN

the returned data see L<Glib::Object::list_properties>.
=cut
void
g_object_find_property (object_or_class_name, ...)
	SV * object_or_class_name
    ALIAS:
        Glib::Object::list_properties = 1
    PREINIT:
	GType type = G_TYPE_INVALID;
	gchar *name = NULL;
    PPCODE:
	if (gperl_sv_is_ref (object_or_class_name)) {
		GObject * object = SvGObject (object_or_class_name);
		if (!object)
			croak ("wha?  NULL object in list_properties");
		type = G_OBJECT_TYPE (object);
	} else {
		type = gperl_object_type_from_package
		                          (SvPV_nolen (object_or_class_name));
		if (!type)
			croak ("package %s is not registered with GPerl",

GSignal.xs  view on Meta::CPAN

=cut
void
g_signal_emit (instance, name, ...)
	GObject * instance
	char * name
    PREINIT:
	guint signal_id, i;
	GQuark detail;
	GSignalQuery query;
	GValue * params;
    PPCODE:
#define ARGOFFSET 2
	signal_id = parse_signal_name_or_croak
				(name, G_OBJECT_TYPE (instance), &detail);

	g_signal_query (signal_id, &query);

	if (((guint)(items-ARGOFFSET)) != query.n_params) 
		croak ("Incorrect number of arguments for emission of signal %s in class %s; need %d but got %d",
		       name, G_OBJECT_TYPE_NAME (instance),
		       query.n_params, (gint) items-ARGOFFSET);

GSignal.xs  view on Meta::CPAN


=cut
void
g_signal_chain_from_overridden (GObject * instance, ...)
    PREINIT:
	GSignalInvocationHint * ihint;
	GSignalQuery query;
	GValue * instance_and_params = NULL,
	         return_value = {0,};
	guint i;
    PPCODE:

	ihint = g_signal_get_invocation_hint (instance);
	if (!ihint)
		croak ("could not find signal invocation hint for %s(0x%p)",
		       G_OBJECT_TYPE_NAME (instance), instance);

	g_signal_query (ihint->signal_id, &query);

	if ((guint)items != 1 + query.n_params)
		croak ("incorrect number of parameters for signal %s, "

GType.xs  view on Meta::CPAN

See also L<list_interfaces ()|/"list = Glib::Type-E<gt>B<list_interfaces> ($package)">.

=cut
void
list_ancestors (class, package)
	gchar * package
    PREINIT:
	GType        package_gtype;
	GType        parent_gtype;
	const char * pkg;
    PPCODE:
	package_gtype = gperl_type_from_package (package);
	XPUSHs (sv_2mortal (newSVpv (package, 0)));
	if (!package_gtype)
		croak ("%s is not registered with either GPerl or GLib",
		       package);
	parent_gtype = g_type_parent (package_gtype);
	while (parent_gtype)
	{
		pkg = gperl_package_from_type (parent_gtype);
		if (!pkg)

GType.xs  view on Meta::CPAN

The interfaces are returned as package names.

=cut
void
list_interfaces (class, package)
	gchar * package
    PREINIT:
	int     i;
	GType   package_gtype;
	GType * interfaces;
    PPCODE:
	package_gtype = gperl_type_from_package (package);
	if (!package_gtype)
		croak ("%s is not registered with either GPerl or GLib",
		       package);
	interfaces = g_type_interfaces (package_gtype, NULL);
	if (!interfaces)
		XSRETURN_EMPTY;
	for (i = 0; interfaces[i] != 0; i++) {
		const char * name = gperl_package_from_type (interfaces[i]);
		if (!name) {

GType.xs  view on Meta::CPAN

=cut
void
list_signals (class, package)
	gchar * package
    PREINIT:
	guint          i, num;
	guint        * sigids;
	GType          package_type;
	GSignalQuery   siginfo;
	GObjectClass * oclass = NULL;
    PPCODE:
	package_type = gperl_type_from_package (package);
	if (!package_type)
		croak ("%s is not registered with either GPerl or GLib",
		       package);

	if (!G_TYPE_IS_INSTANTIATABLE(package_type) &&
	    !G_TYPE_IS_INTERFACE (package_type))
		XSRETURN_EMPTY;
	if (G_TYPE_IS_CLASSED (package_type)) {
		/* ref the class to ensure that the signals get created. */

GType.xs  view on Meta::CPAN

    { value => 8,
      name  => 'G_SIGNAL_NO_RECURSE',
      nick  => 'no-recurse'
    }

=cut
void
list_values (class, const char * package)
    PREINIT:
	GType type;
    PPCODE:
	type = gperl_fundamental_type_from_package (package);
	if (!type)
		type = g_type_from_name (package);
	if (!type)
		croak ("%s is not registered with either GPerl or GLib",
		       package);
	/*
	 * GFlagsValue and GEnumValue are nearly the same, but differ in
	 * that GFlagsValue is a guint for the value, but GEnumValue is gint
	 * (and some enums do indeed use negatives, eg. GtkResponseType).

GUtils.xs  view on Meta::CPAN

application data.
=cut
void
g_get_system_data_dirs ()
    ALIAS:
	Glib::get_system_config_dirs = 1
	Glib::get_language_names     = 2
    PREINIT:
	const gchar * const * strings;
	int i;
    PPCODE:
	switch (ix) {
	    case 0: strings = g_get_system_data_dirs ();   break;
	    case 1: strings = g_get_system_config_dirs (); break;
	    case 2: strings = g_get_language_names ();     break;
	    default:
		strings = NULL;
		g_assert_not_reached ();
	}

	for (i = 0; strings[i]; i++)

GUtils.xs  view on Meta::CPAN

    OUTPUT:
	RETVAL

=for apidoc
=for signature (MAJOR, MINOR, MICRO) = Glib->GET_VERSION_INFO
Shorthand to fetch as a list the glib version for which Glib was compiled.
See C<Glib::MAJOR_VERSION>, etc.
=cut
void
GET_VERSION_INFO (class)
    PPCODE:
	EXTEND (SP, 3);
	PUSHs (sv_2mortal (newSViv (GLIB_MAJOR_VERSION)));
	PUSHs (sv_2mortal (newSViv (GLIB_MINOR_VERSION)));
	PUSHs (sv_2mortal (newSViv (GLIB_MICRO_VERSION)));
	PERL_UNUSED_VAR (ax);

=for apidoc
Provides a mechanism for checking the version information that Glib was
compiled against. Essentially equvilent to the macro GLIB_CHECK_VERSION.
=cut

GVariant.xs  view on Meta::CPAN

=for signature (type_string, rest) = Glib::VariantType::string_scan ($string)
Scans the start of C<$string> for a complete type string and extracts it.  If
no type string can be found, an exception is thrown.
=cut
# gboolean g_variant_type_string_scan (const gchar *string, const gchar *limit, const gchar **endptr);
void
g_variant_type_string_scan (const char *string)
    PREINIT:
	const char *limit = NULL;
	const char *endptr = NULL;
    PPCODE:
	if (!g_variant_type_string_scan (string, limit, &endptr))
		croak ("Could not find type string at the start of '%s'",
		       string);
	PUSHs (sv_2mortal (newSVpvn (string, endptr-string)));
        if (endptr && *endptr)
        	XPUSHs (sv_2mortal (newSVpv (endptr, 0)));

GVariantType_own * g_variant_type_new (class, const gchar *type_string);
    C_ARGS:
	type_string

Glib.xs  view on Meta::CPAN

=for apidoc __hide__
=cut
void
filename_from_uri (...)
    PROTOTYPE: $
    PREINIT:
	gchar * filename = NULL;
	const char * uri;
	char * hostname = NULL;
	GError * error = NULL;
    PPCODE:
	/* support multiple call syntaxes. */
	uri = items < 2 ? SvPVutf8_nolen (ST (0)) : SvPVutf8_nolen (ST (1));
	filename = g_filename_from_uri (uri,
	                                GIMME_V == G_ARRAY ? &hostname : NULL, 
	                                &error);
	if (!filename)
		gperl_croak_gerror (NULL, error);
	PUSHs (sv_2mortal (newSVpv (filename, 0)));
	if (GIMME_V == G_ARRAY && hostname) {
		/* The g_filename_from_uri() docs say hostname is utf8,

lib/Glib/GenPod.pm  view on Meta::CPAN


 =signature ($thing, @other) = $object->foo ($it, $something)

 Text in here is included in the generated documentation.
 You can actually include signature and arg directives
 at any point in this pod -- they are stripped after.
 In fact, any pod is valid in here, until the =cut.

 =cut
 void foo (...)
     PPCODE:
        /* crazy code follows */

=item =for arg name (type) description

=item =for arg name description

The arg directive adds or overrides an argument description.  The
description text is optional, as is the type specification (the part
in parentheses).  If you want to hide an argument, specify C<__hide__>
as its type.  The arg name does I<not> need to include a sigil,

lib/Glib/GenPod.pm  view on Meta::CPAN

		my @retnames = map { convert_return_type_to_name ($_) }
				@{ $xsub->{return_type} };
		unshift @outlist, @retnames;
	}
	my $retstr = @outlist
	           ? (@outlist > 1
		      ? "(".join (", ", @outlist).")"
		      : $outlist[0]
		     )." = "
		   : (defined $xsub->{codetype} and
		      $xsub->{codetype} eq 'PPCODE'
		      ? 'list = '
		      : ''
		     );
	
	"$retstr$call ".($argstr ? "($argstr)" : "");
}

=item $string = fixup_arg_name ($name)

Prepend a $ to anything that's not the literal ellipsis string '...'.

lib/Glib/ParseXSDoc.pm  view on Meta::CPAN

=item $xsub = $parser->parse_xsub (\@lines)

=item $xsub = $parser->parse_xsub (@lines)

Parse an xsub header, in the form of a list of lines,
into a data structure describing the xsub.  That includes
pulling out the argument types, aliases, and code type.

Without artificial intelligence, we cannot reliably 
determine anything about the types or number of parameters
returned from xsubs with PPCODE bodies.

OUTLIST parameters are pulled from the args list and put
into an "outlist" key.  IN_OUTLIST parameters are put into
both.

Data type names are not mangled at all.

Note that the method can take either a list of lines or a reference to a
list of lines.  The flat list form is provided for compatibility; the
reference form is preferred, to avoid duplicating a potentially large list

lib/Glib/ParseXSDoc.pm  view on Meta::CPAN

	}

	

	my $xstate = 'args';
	while ($_ = shift @thisxsub) {
		if (/^\s*ALIAS:/) {
			$xstate = 'alias';
		} elsif (/\s*(PREINIT|CLEANUP|OUTPUT|C_ARGS):/) {
			$xstate = 'code';
		} elsif (/\s*(PPCODE|CODE):/) {
			$xsub{codetype} = $1;
			last;
		} elsif ($xstate eq 'alias') {
			/^\s*([:\w]+)\s*=\s*(\d+)\s*$/;
			if (defined $2) {
				$xsub{alias}{$1} = $2;
			} else {
				warn "$filename:$lineno: WTF : seeking alias on line $_\n";
			}
		} elsif ($xstate eq 'args') {



( run in 1.121 second using v1.01-cache-2.11-cpan-5511b514fd6 )