From cf42441b43aec2e0457ec6e4dfdf2af8e58ac716 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 28 Feb 2025 16:11:01 +0100 Subject: src/utils.(c|h): Add ayatana_common_utils_is_ubuntutouch() function. --- src/utils.c | 6 ++++++ src/utils.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 0a33a74..712b060 100644 --- a/src/utils.c +++ b/src/utils.c @@ -73,6 +73,12 @@ ayatana_common_utils_is_lomiri () return is_xdg_current_desktop(DESKTOP_LOMIRI, SESSION_LOMIRI); } +gboolean +ayatana_common_utils_is_ubuntutouch () +{ + return is_xdg_current_desktop(DESKTOP_UBUNTUTOUCH, SESSION_UBUNTUTOUCH); +} + gboolean ayatana_common_utils_is_gnome () { diff --git a/src/utils.h b/src/utils.h index 9d3e641..c7c658e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -23,6 +23,7 @@ #include static const char * const DESKTOP_LOMIRI = "Lomiri"; +static const char * const DESKTOP_UBUNTUTOUCH = NULL; static const char * const DESKTOP_UNITY = "Unity"; static const char * const DESKTOP_MATE = "MATE"; static const char * const DESKTOP_GNOME = "GNOME"; @@ -30,6 +31,7 @@ static const char * const DESKTOP_XFCE = "XFCE"; static const char * const DESKTOP_PANTHEON = "PANTHEON"; static const char * const DESKTOP_BUDGIE = "Budgie"; static const char * const SESSION_LOMIRI = "ubuntu-touch"; +static const char * const SESSION_UBUNTUTOUCH = "ubuntu-touch"; static const char * const SESSION_UNITY = NULL; static const char * const SESSION_MATE = "mate"; static const char * const SESSION_GNOME = "gnome"; @@ -38,6 +40,7 @@ static const char * const SESSION_PANTHEON = NULL; static const char * const SESSION_BUDGIE = "budgie-desktop"; gboolean ayatana_common_utils_is_lomiri(); +gboolean ayatana_common_utils_is_ubuntutouch(); gboolean ayatana_common_utils_is_unity(); gboolean ayatana_common_utils_is_gnome(); gboolean ayatana_common_utils_is_mate(); -- cgit v1.2.3 From 27fdf5af170bf355b6da32e11e3135e99a5e675a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 28 Feb 2025 16:11:55 +0100 Subject: src/utils.h: On Linux Desktop, if Lomiri is running, but not Ubuntu Touch, then DESKTOP_SESSION is set to 'lomiri'. --- src/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.h b/src/utils.h index c7c658e..efb3ec7 100644 --- a/src/utils.h +++ b/src/utils.h @@ -30,7 +30,7 @@ static const char * const DESKTOP_GNOME = "GNOME"; static const char * const DESKTOP_XFCE = "XFCE"; static const char * const DESKTOP_PANTHEON = "PANTHEON"; static const char * const DESKTOP_BUDGIE = "Budgie"; -static const char * const SESSION_LOMIRI = "ubuntu-touch"; +static const char * const SESSION_LOMIRI = "lomiri"; static const char * const SESSION_UBUNTUTOUCH = "ubuntu-touch"; static const char * const SESSION_UNITY = NULL; static const char * const SESSION_MATE = "mate"; -- cgit v1.2.3 From 67f0b729a2be751f2ac95dba310faa9bc7331c3b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 28 Feb 2025 16:12:32 +0100 Subject: src/CMakeLists.txt: Bump SOVERSION_MINOR (due to added symbol 'ayatana_common_utils_is_ubuntutouch'). --- src/CMakeLists.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c7d351d..8da66c0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,7 +19,7 @@ set(PUBLIC_HEADERS set_target_properties(ayatana-common PROPERTIES - VERSION ${API_VERSION}.0.0 + VERSION ${API_VERSION}.1.0 SOVERSION ${ABI_VERSION} ) @@ -33,7 +33,7 @@ install(TARGETS ayatana-common DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) if (INTROSPECTION_FOUND) add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.gir" DEPENDS "ayatana-common" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND @@ -41,44 +41,44 @@ if (INTROSPECTION_FOUND) utils.c utils.h --no-libtool --namespace=AyatanaCommon - --nsversion=0.0 + --nsversion=0.1 --c-include=ayatana/common/utils.h --quiet --warn-all --include=GLib-2.0 --library="ayatana-common" --library-path=${CMAKE_CURRENT_BINARY_DIR} - --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir" + --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.gir" ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") # AyatanaCommon.typelib add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.typelib" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.gir" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir - -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib" + ${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.gir + -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.typelib" ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") # AyatanaCommon.vapi if (VALA_COMPILER) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.typelib" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${VAPI_GEN} --library=AyatanaCommon - AyatanaCommon-0.0.gir + AyatanaCommon-0.1.gir ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi") @@ -87,7 +87,7 @@ if (INTROSPECTION_FOUND) else() - add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib") + add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.1.typelib") endif() -- cgit v1.2.3 From fc90dc2da7979f927b7bcb2b041c0f2f72346cb5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 28 Feb 2025 17:25:29 +0100 Subject: src/utils.c: Prefer XDG_SESSION_DESKTOP over DESKTOP_SESSION. --- src/utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 712b060..3a854a6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -55,13 +55,17 @@ is_xdg_current_desktop (const gchar* desktop, const gchar* session) if (session != NULL) { - const gchar *desktop_session = g_getenv ("DESKTOP_SESSION"); + const gchar *xdg_session_desktop = g_getenv ("XDG_SESSION_DESKTOP"); + if (xdg_session_desktop != NULL && g_str_equal(xdg_session_desktop, session)) + { + return TRUE; + } + const gchar *desktop_session = g_getenv ("DESKTOP_SESSION"); if (desktop_session != NULL && g_str_equal(desktop_session, session)) { return TRUE; } - } return FALSE; -- cgit v1.2.3