aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2025-02-28 19:13:09 +0100
committerRobert Tari <robert@tari.in>2025-02-28 19:13:09 +0100
commitc869bdb06bc74c446f518dec00b0eda3d621147e (patch)
tree66acec4d15a4e9e1e4ab0ea686f1d3e7b1f640b7 /src
parent8608bd833d3452879ebe3aec74646a5fd17e76ee (diff)
parentdc299daf148950f20153b7156dc6de5120bf5df7 (diff)
downloadlibayatana-common-c869bdb06bc74c446f518dec00b0eda3d621147e.tar.gz
libayatana-common-c869bdb06bc74c446f518dec00b0eda3d621147e.tar.bz2
libayatana-common-c869bdb06bc74c446f518dec00b0eda3d621147e.zip
Merge branch 'sunweaver-pr/support-differentiating-lomiri-and-ut'
Attributes GH PR #65: https://github.com/AyatanaIndicators/libayatana-common/pull/65
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt26
-rw-r--r--src/utils.c14
-rw-r--r--src/utils.h5
3 files changed, 29 insertions, 16 deletions
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()
diff --git a/src/utils.c b/src/utils.c
index 0a33a74..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;
@@ -74,6 +78,12 @@ ayatana_common_utils_is_lomiri ()
}
gboolean
+ayatana_common_utils_is_ubuntutouch ()
+{
+ return is_xdg_current_desktop(DESKTOP_UBUNTUTOUCH, SESSION_UBUNTUTOUCH);
+}
+
+gboolean
ayatana_common_utils_is_gnome ()
{
return is_xdg_current_desktop(DESKTOP_GNOME, SESSION_GNOME);
diff --git a/src/utils.h b/src/utils.h
index 9d3e641..efb3ec7 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -23,13 +23,15 @@
#include <gio/gio.h>
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";
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";
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();