Re: Glib::[gs]et_prgname

2020-02-01 Thread Torsten Schoenfeld

On 28.01.20 19:34, Jeff via gtk-perl-list wrote:

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?


I removed the documentation paragraph as it seems to be incorrect, and
pushed as 6d9739.  Thanks for the patch!

-Torsten
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Glib::[gs]et_prgname

2020-01-28 Thread Jeff via gtk-perl-list
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


Re: Glib::[gs]et_prgname

2020-01-02 Thread Torsten Schönfeld

On 02.01.20 12:43, Jeff via gtk-perl-list wrote:

Bitten by a problem that looks as if it requires me to
Glib::set_prgname() to solve[1], I attempted to use it, only to discover
that although the code is in the git repo, it is commented out[2].

Why?


I don't know.  Most likely, no-one saw a use case originally, since you
can always just set $0 in Perl directly.  The comment above
g_get_prgname in GUtils.xs suggests that there at some point was a plan
to call g_set_prgname automatically when Glib.pm is loaded, but that was
never implemented as far as I can tell.

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.

-Torsten
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Glib::[gs]et_prgname

2020-01-02 Thread Jeff via gtk-perl-list
Bitten by a problem that looks as if it requires me to
Glib::set_prgname() to solve[1], I attempted to use it, only to discover
that although the code is in the git repo, it is commented out[2].

Why?

How can I use Glib::set_prgname()?

Regards

Jeff

[1]https://lists.debian.org/debian-devel/2020/01/msg00025.html

[2]https://github.com/GNOME/perl-glib/blob/0cbae78ea50855cec4093d8c8c3350566d286f18/GUtils.xs



signature.asc
Description: OpenPGP digital signature
___
gtk-perl-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list