summaryrefslogtreecommitdiff
path: root/fmrx-ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fmrx-ctl.c')
-rw-r--r--fmrx-ctl.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/fmrx-ctl.c b/fmrx-ctl.c
index 408dadd..5738c99 100644
--- a/fmrx-ctl.c
+++ b/fmrx-ctl.c
@@ -35,10 +35,15 @@ static void tune(double f)
dbus_message_append_args(msg, DBUS_TYPE_DOUBLE, &f, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &err);
- g_assert(reply != NULL);
- g_assert(!dbus_error_is_set(&err));
dbus_message_unref(msg);
+ if (!reply) {
+ g_assert(dbus_error_is_set(&err));
+ g_printerr("Tune error: %s", err.message);
+ dbus_error_free(&err);
+ return;
+ }
+
dbus_message_unref(reply);
}
@@ -53,10 +58,15 @@ static void next()
dbus_error_init(&err);
reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &err);
- g_assert(reply != NULL);
- g_assert(!dbus_error_is_set(&err));
dbus_message_unref(msg);
+ if (!reply) {
+ g_assert(dbus_error_is_set(&err));
+ g_printerr("Tune error: %s", err.message);
+ dbus_error_free(&err);
+ return;
+ }
+
dbus_message_unref(reply);
}
@@ -71,17 +81,22 @@ static void prev()
dbus_error_init(&err);
reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &err);
- g_assert(reply != NULL);
- g_assert(!dbus_error_is_set(&err));
dbus_message_unref(msg);
+ if (!reply) {
+ g_assert(dbus_error_is_set(&err));
+ g_printerr("Tune error: %s", err.message);
+ dbus_error_free(&err);
+ return;
+ }
+
dbus_message_unref(reply);
}
static void dbus_init()
{
DBusError err; dbus_error_init(&err);
- bus = dbus_bus_get(DBUS_BUS_SESSION, &err);
+ bus = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
g_assert(bus != NULL);
g_assert(!dbus_error_is_set(&err));
dbus_connection_setup_with_g_main(bus, g_main_loop_get_context(main_loop));