From 8265a6af696a084b92a32d32d2881d3e6f269c8b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Feb 2023 16:38:20 +0100 Subject: src/dbus-backend/actions.c: Return 'lomiri.com' as Lomiri URL (instead of UBports Forum). Signed-off-by: Mike Gabriel --- src/backend-dbus/actions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c index d735f00..125b849 100644 --- a/src/backend-dbus/actions.c +++ b/src/backend-dbus/actions.c @@ -893,7 +893,7 @@ my_desktop_help (IndicatorSessionActions * self G_GNUC_UNUSED) if (ayatana_common_utils_have_budgie_program ("yelp")) ayatana_common_utils_execute_command ("yelp help:gnome-user-guide"); else if (ayatana_common_utils_is_lomiri()) - ayatana_common_utils_open_url("https://forums.ubports.com"); + ayatana_common_utils_open_url("https://lomiri.com"); else if (ayatana_common_utils_have_gnome_program ("yelp")) ayatana_common_utils_execute_command ("yelp help:gnome-user-guide"); else if (ayatana_common_utils_have_mate_program ("yelp")) -- cgit v1.2.3 From 2f800334533e49c7413a68816bf695db053e97c0 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Feb 2023 16:39:47 +0100 Subject: src/utils.(c|h): Add get_desktop_session() helper function. Signed-off-by: Mike Gabriel --- src/utils.c | 24 ++++++++++++++++++++++++ src/utils.h | 1 + 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 991f4ec..8c69a59 100644 --- a/src/utils.c +++ b/src/utils.c @@ -152,3 +152,27 @@ get_desktop_name (void) return desktop_name; } + +const char* +get_desktop_session (void) +{ + static const char * desktop_session = NULL; + const char * xdg_desktop_session; + + if (desktop_session == NULL) + { + xdg_desktop_session = g_getenv ("XDG_DESKTOP_SESSION"); + + if (xdg_desktop_session == NULL) + { + /* try DESKTOP_SESSION env var if XDG_DESKTOP_SESSION is unset */ + desktop_session = g_getenv ("DESKTOP_SESSION"); + } + else + { + desktop_session = xdg_desktop_session; + } + } + + return desktop_session; +} diff --git a/src/utils.h b/src/utils.h index 149087b..d57eebe 100644 --- a/src/utils.h +++ b/src/utils.h @@ -24,6 +24,7 @@ const char* get_distro_name(); const char* get_distro_url(); const char* get_distro_bts_url(); const char* get_desktop_name(); +const char* get_desktop_session(); GHashTable* get_os_release(); #endif /* __INDICATOR_SESSION_UTILS_H__ */ -- cgit v1.2.3 From 8e57201526a2e2a0a585ebadb498fb26b74edc12 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Feb 2023 16:41:30 +0100 Subject: src/utils.c: Code formatting change (no-op change) in get_desktop_name(). Signed-off-by: Mike Gabriel --- src/utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 8c69a59..9593a46 100644 --- a/src/utils.c +++ b/src/utils.c @@ -145,9 +145,10 @@ get_desktop_name (void) if (desktop_name == NULL) { xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); - if (xdg_current_desktop != NULL) { - desktop_name = g_strsplit (xdg_current_desktop, ":", 0)[0]; - } + if (xdg_current_desktop != NULL) + { + desktop_name = g_strsplit (xdg_current_desktop, ":", 0)[0]; + } } return desktop_name; -- cgit v1.2.3 From 5b53d364c64602c3dee72210b4ed9320e4d0efa3 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Feb 2023 22:22:21 +0100 Subject: src/{service.c,dbus-backends/actions.c}: Special treatment if running in an Ubuntu Touch session for desktop help, distro help and bug reporting URL. Signed-off-by: Mike Gabriel --- src/backend-dbus/actions.c | 4 +++- src/service.c | 14 +++++++++++-- src/utils.c | 51 ++++++++++++++++++++++++++++++---------------- 3 files changed, 48 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c index 125b849..5a2523e 100644 --- a/src/backend-dbus/actions.c +++ b/src/backend-dbus/actions.c @@ -890,7 +890,9 @@ my_power_off (IndicatorSessionActions * actions) static void my_desktop_help (IndicatorSessionActions * self G_GNUC_UNUSED) { - if (ayatana_common_utils_have_budgie_program ("yelp")) + if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0) + ayatana_common_utils_open_url("https://ubuntu-touch.io/"); + else if (ayatana_common_utils_have_budgie_program ("yelp")) ayatana_common_utils_execute_command ("yelp help:gnome-user-guide"); else if (ayatana_common_utils_is_lomiri()) ayatana_common_utils_open_url("https://lomiri.com"); diff --git a/src/service.c b/src/service.c index d467859..159ee80 100644 --- a/src/service.c +++ b/src/service.c @@ -379,8 +379,18 @@ create_admin_section (IndicatorSessionService * self) { GMenu * menu; priv_t * p = self->priv; - gchar * desktop_help_label = g_strdup_printf(_("%s Help"), get_desktop_name()); - gchar * distro_help_label = g_strdup_printf(_("%s Help…"), get_distro_name()); + gchar * desktop_help_label = NULL; + gchar * distro_help_label = NULL; + if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0) + { + desktop_help_label = g_strdup(_("About Ubuntu Touch…")); + distro_help_label = g_strdup(_("About UBports Foundation…")); + } + else + { + desktop_help_label = g_strdup_printf(_("%s Help"), get_desktop_name()); + distro_help_label = g_strdup_printf(_("%s Help…"), get_distro_name()); + } menu = g_menu_new (); if (ayatana_common_utils_is_lomiri()) { diff --git a/src/utils.c b/src/utils.c index 9593a46..cd01edf 100644 --- a/src/utils.c +++ b/src/utils.c @@ -98,21 +98,29 @@ get_distro_url (void) if (distro_url == NULL) { - GHashTable * os_release = get_os_release(); - gpointer value = g_hash_table_lookup(os_release, "SUPPORT_URL"); - - if (value == NULL) - { - value = g_hash_table_lookup(os_release, "HOME_URL"); - - if (value == NULL) + if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0) { - value = "https://www.gnu.org"; /* fallback value */ + distro_url = g_strdup("https://ubports.com"); } - } + else + { - distro_url = g_strdup(value); - g_hash_table_destroy(os_release); + GHashTable * os_release = get_os_release(); + gpointer value = g_hash_table_lookup(os_release, "SUPPORT_URL"); + + if (value == NULL) + { + value = g_hash_table_lookup(os_release, "HOME_URL"); + + if (value == NULL) + { + value = "https://www.gnu.org"; /* fallback value */ + } + } + + distro_url = g_strdup(value); + g_hash_table_destroy(os_release); + } } return distro_url; @@ -125,12 +133,19 @@ get_distro_bts_url (void) if (distro_bts_url == NULL) { - GHashTable * os_release = get_os_release(); - gpointer value = g_hash_table_lookup(os_release, "BUG_REPORT_URL"); - if (value == NULL) - value = "https://github.com/AyatanaIndicators/ayatana-indicator-session/issues"; /* fallback value */ - distro_bts_url = g_strdup(value); - g_hash_table_destroy(os_release); + if (g_strcmp0(get_desktop_session(), "ubuntu-touch") == 0) + { + distro_bts_url = g_strdup("https://gitlab.com/ubports/porting"); + } + else + { + GHashTable * os_release = get_os_release(); + gpointer value = g_hash_table_lookup(os_release, "BUG_REPORT_URL"); + if (value == NULL) + value = "https://github.com/AyatanaIndicators/ayatana-indicator-session/issues"; /* fallback value */ + distro_bts_url = g_strdup(value); + g_hash_table_destroy(os_release); + } } return distro_bts_url; -- cgit v1.2.3 From 4e48436b26e2ac7e088cd378ee103407a46b6298 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Feb 2023 17:12:13 +0100 Subject: src/service.c: Add ellipsis to desktop help. Signed-off-by: Mike Gabriel --- src/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 159ee80..760c64b 100644 --- a/src/service.c +++ b/src/service.c @@ -388,7 +388,7 @@ create_admin_section (IndicatorSessionService * self) } else { - desktop_help_label = g_strdup_printf(_("%s Help"), get_desktop_name()); + desktop_help_label = g_strdup_printf(_("%s Help…"), get_desktop_name()); distro_help_label = g_strdup_printf(_("%s Help…"), get_distro_name()); } menu = g_menu_new (); -- cgit v1.2.3