[gnumeric] GUI: Help desktop environments' icon discovery.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Help desktop environments' icon discovery.
- Date: Sat, 8 Oct 2022 18:25:45 +0000 (UTC)
commit ca8e6a35a7fc3b5a082572f2423a63153e0f7d8a
Author: Morten Welinder <terra gnome org>
Date: Sat Oct 8 14:24:43 2022 -0400
GUI: Help desktop environments' icon discovery.
Call g_set_prgname without path, except when help is requested.
See #677.
ChangeLog | 5 +++++
NEWS | 3 +++
src/libgnumeric.c | 27 ++++++++++++++++++++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 59ebbd81d..b2854407e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-08 Morten Welinder <terra gnome org>
+
+ * src/libgnumeric.c (gnm_pre_parse_init): Use basename of argv[0],
+ except when help is requested. See #677 for details.
+
2022-09-17 Morten Welinder <terra gnome org>
* configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index 3d211e184..16ce72c52 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ Gnumeric 1.12.54
John Denker:
* Improve whitespace handling in html import. [#671]
+Morten:
+ * Improve various desktop environments' icon discovery. [#677]
+
--------------------------------------------------------------------------
Gnumeric 1.12.53
diff --git a/src/libgnumeric.c b/src/libgnumeric.c
index d3a5cec1d..ba9ae1664 100644
--- a/src/libgnumeric.c
+++ b/src/libgnumeric.c
@@ -200,6 +200,20 @@ gnm_get_option_group (void)
return group;
}
+// Determine whether help is requested.
+static gboolean
+help_requested (gchar const **argv)
+{
+ for (int i = 1; argv[i]; i++) {
+ const char *a = argv[i];
+ if (g_str_equal (a, "-h") ||
+ g_str_has_prefix (a, "--help"))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
/**
* gnm_pre_parse_init:
* @argc:
@@ -252,7 +266,18 @@ gnm_pre_parse_init (int argc, gchar const **argv)
* pull in the real versions and convert them to utf-8 */
argv = go_shell_argv_to_glib_encoding (argc, argv);
- g_set_prgname (argv[0]);
+ // This is a mess, see #677. Basically there are conflicting uses
+ // for the program name set with g_set_prgname.
+ if (help_requested (argv)) {
+ // We want the full path in help messages
+ g_set_prgname (argv[0]);
+ } else {
+ // We want "gnumeric" or "ssconvert" because it, someone, is
+ // used for icon discovery in some cases.
+ char *basename = g_path_get_basename (argv[0]);
+ g_set_prgname (basename);
+ g_free (basename);
+ }
/* Make stdout line buffered - we only use it for debug info */
setvbuf (stdout, NULL, _IOLBF, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]