aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-12 14:03:05 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-12 18:33:03 +0100
commit4d9589837e532df1015f7579439703c0af0164ca (patch)
tree0c13f4e4aaff871cd67967b8178ee7c37f6bbf85
parentaff888fa666cf2c1598d80f1f032cd2d6b9d5a1c (diff)
downloadayatana-indicator-power-4d9589837e532df1015f7579439703c0af0164ca.tar.gz
ayatana-indicator-power-4d9589837e532df1015f7579439703c0af0164ca.tar.bz2
ayatana-indicator-power-4d9589837e532df1015f7579439703c0af0164ca.zip
Revert "Drop unnecessary dependency on Ubuntu's url-dispatcher."
This reverts commit 0a9cc2a474ff583c928e109468f20330aae0603c.
-rw-r--r--CMakeLists.txt3
-rw-r--r--debian/control1
-rw-r--r--src/notifier.c11
-rw-r--r--src/service.c17
4 files changed, 30 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b64b00..db80c6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,8 @@ pkg_check_modules(SERVICE_DEPS REQUIRED
glib-2.0>=2.36
gio-2.0>=2.36
gio-unix-2.0>=2.36
- libnotify>=0.7.6)
+ libnotify>=0.7.6
+ url-dispatcher-1>=1)
include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
diff --git a/debian/control b/debian/control
index 4391580..d5725aa 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Build-Depends: cmake,
libnotify-dev (>= 0.7.6),
libglib2.0-dev (>= 2.36),
+ liburl-dispatcher1-dev,
python:any,
# for packaging
debhelper (>= 9),
diff --git a/src/notifier.c b/src/notifier.c
index 5601825..f51032e 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -21,6 +21,8 @@
#include "dbus-shared.h"
#include "notifier.h"
+#include <url-dispatcher.h>
+
#include <libnotify/notify.h>
#include <glib/gi18n.h>
@@ -166,6 +168,14 @@ notification_clear (IndicatorPowerNotifier * self)
}
static void
+on_battery_settings_clicked(NotifyNotification * nn G_GNUC_UNUSED,
+ char * action G_GNUC_UNUSED,
+ gpointer user_data G_GNUC_UNUSED)
+{
+ url_dispatch_send("settings:///system/battery", NULL, NULL);
+}
+
+static void
on_dismiss_clicked(NotifyNotification * nn G_GNUC_UNUSED,
char * action G_GNUC_UNUSED,
gpointer user_data G_GNUC_UNUSED)
@@ -240,6 +250,7 @@ notification_show(IndicatorPowerNotifier * self)
notify_notification_set_hint(nn, "x-canonical-snap-decisions-timeout", g_variant_new_int32(INT32_MAX));
notify_notification_set_timeout(nn, NOTIFY_EXPIRES_NEVER);
notify_notification_add_action(nn, "dismiss", _("OK"), on_dismiss_clicked, NULL, NULL);
+ notify_notification_add_action(nn, "settings", _("Battery settings"), on_battery_settings_clicked, NULL, NULL);
}
/* if we can show it, keep it */
diff --git a/src/service.c b/src/service.c
index 22b8dfb..cf7d808 100644
--- a/src/service.c
+++ b/src/service.c
@@ -20,6 +20,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <url-dispatcher.h>
#include "brightness.h"
#include "dbus-shared.h"
@@ -815,7 +816,12 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
if (control_center_cmd == NULL)
{
- if ((!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu")) || (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xfce")))
+ if (g_getenv ("MIR_SOCKET") != NULL)
+ {
+ url_dispatch_send("settings:///system/battery", NULL, NULL);
+ return;
+ }
+ else if ((!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu")) || (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xfce")))
{
control_center_cmd = "xfce4-power-manager-settings";
}
@@ -865,6 +871,14 @@ on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED,
}
}
+static void
+on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
+ GVariant * param G_GNUC_UNUSED,
+ gpointer gself G_GNUC_UNUSED)
+{
+ url_dispatch_send("settings:///system/battery", NULL, NULL);
+}
+
/***
****
***/
@@ -901,6 +915,7 @@ init_gactions (IndicatorPowerService * self)
GActionEntry entries[] = {
{ "activate-settings", on_settings_activated },
+ { "activate-phone-settings", on_phone_settings_activated },
{ "activate-statistics", on_statistics_activated, "s" }
};