On 02/01/2020 20:31, Torsten Schönfeld wrote:
> If setting $0 does not achieve what you need, I see no problem in adding
> the bindings. Patches welcome. Otherwise I'll add it to my list, but I
> don't know when I'll be able to get to it.
How about this?
Regards
Jeff
From 34257e2c4e766938b6202025a08e9bb8c63b0742 Mon Sep 17 00:00:00 2001
From: Jeffrey Ratcliffe
Date: Wed, 29 Jan 2020 00:00:00 +
Subject: [PATCH] + Glib::[gs]et_prgname
---
GUtils.xs | 22 +++---
t/1.t | 6 +-
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/GUtils.xs b/GUtils.xs
index 4403a01..c9c1b23 100644
--- a/GUtils.xs
+++ b/GUtils.xs
@@ -195,17 +195,17 @@ const gchar* g_get_user_special_dir (GUserDirectory directory);
#endif
-##=for apidoc __function__
-##Set GLib's global program name. Glib will set this to the value of $0 for
-##you when it loads; this function is provided to give you a way to set the
-##internal variable used by the GLib C library, since it knows nothing about
-##$0.
-##=cut
-##gchar_own * g_get_prgname ();
-##
-##=for apidoc __function__
-##=cut
-##void g_set_prgname (const gchar *prgname);
+=for apidoc __function__
+Set GLib's global program name. Glib will set this to the value of $0 for
+you when it loads; this function is provided to give you a way to set the
+internal variable used by the GLib C library, since it knows nothing about
+$0.
+=cut
+gchar_own * g_get_prgname ();
+
+=for apidoc __function__
+=cut
+void g_set_prgname (const gchar *prgname);
#if GLIB_CHECK_VERSION(2, 2, 0)
diff --git a/t/1.t b/t/1.t
index 17d8822..302cd00 100644
--- a/t/1.t
+++ b/t/1.t
@@ -13,7 +13,7 @@ use warnings;
#
-use Test::More tests => 26;
+use Test::More tests => 28;
BEGIN { use_ok('Glib') };
#
@@ -52,6 +52,10 @@ SKIP: {
is (Glib::get_application_name (), $appname);
}
+is (Glib::get_prgname (), undef, 'before any calls to anything');
+Glib::set_prgname ('my_prgname');
+is (Glib::get_prgname (), 'my_prgname');
+
SKIP: {
skip "new 2.6 stuff", 6
unless Glib->CHECK_VERSION (2,6,0);
--
2.24.1
signature.asc
Description: OpenPGP digital signature
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list