aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/desktop.vala45
-rw-r--r--src/phone.vala12
3 files changed, 17 insertions, 42 deletions
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 ()