aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 14:24:00 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 14:24:00 +0200
commit3e827b80bd301e0795d7d91b918c622fd3e00915 (patch)
treeebc1b790237e006f6a7370dd504f0ad8489f302f
parentf9dcff7b3a42082ad3ba6076991ed8aa7df9b6a8 (diff)
parent9ca4205f80e490245f800705c7ac4103582192c1 (diff)
downloadayatana-indicator-bluetooth-3e827b80bd301e0795d7d91b918c622fd3e00915.tar.gz
ayatana-indicator-bluetooth-3e827b80bd301e0795d7d91b918c622fd3e00915.tar.bz2
ayatana-indicator-bluetooth-3e827b80bd301e0795d7d91b918c622fd3e00915.zip
Merge branch 'tari01-pr/use-libayatana-common'
Attributes GH PR #28: https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/pull/28
-rw-r--r--.build.yml14
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/desktop.vala45
-rw-r--r--src/phone.vala12
-rw-r--r--vapi/lomiri-url-dispatcher.vapi9
6 files changed, 32 insertions, 51 deletions
diff --git a/.build.yml b/.build.yml
index bade10b..707a82e 100644
--- a/.build.yml
+++ b/.build.yml
@@ -17,6 +17,8 @@ requires:
- glib2
- systemd
- vala
+ # For building libayatana-common
+ - gobject-introspection
debian:
# Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-indicator-bluetooth
@@ -34,6 +36,9 @@ requires:
- liblomiri-url-dispatcher-dev
- systemd
- valac
+ # For building libayatana-common
+ - gobject-introspection
+ - libgirepository1.0-dev
debian:stable:
- autopoint
@@ -49,6 +54,9 @@ requires:
- libglib2.0-dev
- systemd
- valac
+ # For building libayatana-common
+ - gobject-introspection
+ - libgirepository1.0-dev
ubuntu:
- autopoint
@@ -64,6 +72,9 @@ requires:
- liblomiri-url-dispatcher-dev
- systemd
- valac
+ # For building libayatana-common
+ - gobject-introspection
+ - libgirepository1.0-dev
ubuntu:focal:
- autopoint
@@ -78,6 +89,9 @@ requires:
- libglib2.0-dev
- systemd
- valac
+ # For building libayatana-common
+ - gobject-introspection
+ - libgirepository1.0-dev
variables:
- 'CHECKERS="
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b680c1..8b526a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@ pkg_check_modules(
BLUETOOTHSERVICE REQUIRED
glib-2.0>=${GLIB_2_0_REQUIRED_VERSION}
gio-unix-2.0>=${GIO_2_0_REQUIRED_VERSION}
+ libayatana-common>=0.9.3
)
include_directories(${BLUETOOTHSERVICE_INCLUDE_DIRS})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 90a4732..cb2e717 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,7 +19,7 @@ vala_init(ayatana-indicator-bluetooth-service
posix
gio-2.0
gio-unix-2.0
- ${VALA_PKG_URLDISPATCHER}
+ AyatanaCommon
OPTIONS
--ccode
--target-glib=${GLIB_2_0_REQUIRED_VERSION}
diff --git a/src/desktop.vala b/src/desktop.vala
index 7102a21..56b61cb 100644
--- a/src/desktop.vala
+++ b/src/desktop.vala
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
class Desktop: Profile
@@ -64,7 +66,7 @@ class Desktop: Profile
build_menu ();
// know when to show the indicator & when to hide it
- if (Environment.get_variable("MIR_SOCKET") != null)
+ if (AyatanaCommon.utils_is_lomiri())
{
settings.changed["visible"].connect (()=> update_visibility());
bluetooth.notify["supported"].connect (() => update_visibility());
@@ -180,7 +182,7 @@ class Desktop: Profile
item = new MenuItem (device.name, null);
item.set_attribute_value ("icon", device.icon.serialize());
- if (Environment.get_variable("MIR_SOCKET") != null)
+ if (AyatanaCommon.utils_is_lomiri())
{
item.set_submenu (submenu);
}
@@ -224,44 +226,23 @@ class Desktop: Profile
/// Actions
///
- private bool is_desktop (string name)
- {
- var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP");
- if (desktop_name_list == null)
- return false;
-
- foreach (var n in desktop_name_list.split (":"))
- if (n == name)
- return true;
-
- return false;
- }
-
void show_settings (string panel)
{
-
-#if HAS_URLDISPATCHER
-
- if (Environment.get_variable ("MIR_SOCKET") != null)
- {
- LomiriUrlDispatch.send ("settings:///system/bluetooth");
-
- return;
- }
-
-#endif
-
- if (is_desktop ("Unity") && Environment.find_program_in_path ("unity-control-center") != null)
+ if (AyatanaCommon.utils_is_lomiri())
+ {
+ AyatanaCommon.utils_open_url("settings:///system/bluetooth");
+ }
+ else if (AyatanaCommon.utils_is_unity() && AyatanaCommon.utils_have_program("unity-control-center"))
{
- spawn_command_line_async ("unity-control-center " + panel);
+ AyatanaCommon.utils_execute_command("unity-control-center " + panel);
}
- else if (is_desktop ("MATE") && Environment.find_program_in_path ("blueman-manager") != null)
+ else if (AyatanaCommon.utils_is_mate() && AyatanaCommon.utils_have_program("blueman-manager"))
{
- spawn_command_line_async ("blueman-manager");
+ AyatanaCommon.utils_execute_command("blueman-manager");
}
else
{
- spawn_command_line_async ("gnome-control-center " + panel);
+ AyatanaCommon.utils_execute_command("gnome-control-center " + panel);
}
}
diff --git a/src/phone.vala b/src/phone.vala
index 3490768..075096f 100644
--- a/src/phone.vala
+++ b/src/phone.vala
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
class Phone: Profile
@@ -62,15 +64,7 @@ class Phone: Profile
void show_settings (string panel)
{
-
-#if HAS_URLDISPATCHER
-
- LomiriUrlDispatch.send ("settings:///system/bluetooth");
-
-#endif
-
- return;
-
+ AyatanaCommon.utils_open_url("settings:///system/bluetooth");
}
Action create_settings_action ()
diff --git a/vapi/lomiri-url-dispatcher.vapi b/vapi/lomiri-url-dispatcher.vapi
deleted file mode 100644
index 9e9e925..0000000
--- a/vapi/lomiri-url-dispatcher.vapi
+++ /dev/null
@@ -1,9 +0,0 @@
-[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "liblomiri-url-dispatcher/lomiri-url-dispatcher.h")]
-
-namespace LomiriUrlDispatch
-{
- public delegate void DispatchCallback ();
-
- [CCode (cname = "lomiri_url_dispatch_send")]
- public static void send (string url, DispatchCallback? func = null);
-}