summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-29 18:35:10 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-29 18:36:25 +0200
commit190700621f95160d364f8ec1d3e360246c41ce75 (patch)
tree783c3b43bd6fd93892fada76f5c20112a4e73d7c /src/locale
parentb53c3c2d24ed1398ee427139cd880b07bc35fa24 (diff)
sd-bus: drop bus parameter from message callback prototype
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/localed.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/locale/localed.c b/src/locale/localed.c
index fd0eb2db55..0e59350e98 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -869,7 +869,7 @@ static int property_get_locale(
return sd_bus_message_append_strv(reply, l);
}
-static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
+static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *error) {
Context *c = userdata;
_cleanup_strv_free_ char **l = NULL;
char **i;
@@ -880,6 +880,9 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
int p;
int r;
+ assert(m);
+ assert(c);
+
r = bus_message_read_strv_extend(m, &l);
if (r < 0)
return r;
@@ -989,7 +992,7 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
return sd_bus_error_set_errnof(error, r, "Failed to set locale: %s", strerror(-r));
}
- locale_update_system_manager(c, bus);
+ locale_update_system_manager(c, sd_bus_message_get_bus(m));
if (settings) {
_cleanup_free_ char *line;
@@ -999,7 +1002,8 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
} else
log_info("Changed locale to unset.");
- sd_bus_emit_properties_changed(bus,
+ (void) sd_bus_emit_properties_changed(
+ sd_bus_message_get_bus(m),
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
"Locale", NULL);
@@ -1010,12 +1014,15 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
return sd_bus_reply_method_return(m, NULL);
}
-static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
+static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_error *error) {
Context *c = userdata;
const char *keymap, *keymap_toggle;
int convert, interactive;
int r;
+ assert(m);
+ assert(c);
+
r = sd_bus_message_read(m, "ssbb", &keymap, &keymap_toggle, &convert, &interactive);
if (r < 0)
return r;
@@ -1059,17 +1066,18 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata
log_info("Changed virtual console keymap to '%s' toggle '%s'",
strempty(c->vc_keymap), strempty(c->vc_keymap_toggle));
- r = vconsole_reload(bus);
+ r = vconsole_reload(sd_bus_message_get_bus(m));
if (r < 0)
log_error_errno(r, "Failed to request keymap reload: %m");
- sd_bus_emit_properties_changed(bus,
+ (void) sd_bus_emit_properties_changed(
+ sd_bus_message_get_bus(m),
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
"VConsoleKeymap", "VConsoleKeymapToggle", NULL);
if (convert) {
- r = vconsole_convert_to_x11(c, bus);
+ r = vconsole_convert_to_x11(c, sd_bus_message_get_bus(m));
if (r < 0)
log_error_errno(r, "Failed to convert keymap data: %m");
}
@@ -1126,12 +1134,15 @@ static int verify_xkb_rmlvo(const char *model, const char *layout, const char *v
}
#endif
-static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
+static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_error *error) {
Context *c = userdata;
const char *layout, *model, *variant, *options;
int convert, interactive;
int r;
+ assert(m);
+ assert(c);
+
r = sd_bus_message_read(m, "ssssbb", &layout, &model, &variant, &options, &convert, &interactive);
if (r < 0)
return r;
@@ -1197,13 +1208,14 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat
strempty(c->x11_variant),
strempty(c->x11_options));
- sd_bus_emit_properties_changed(bus,
+ (void) sd_bus_emit_properties_changed(
+ sd_bus_message_get_bus(m),
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
"X11Layout", "X11Model", "X11Variant", "X11Options", NULL);
if (convert) {
- r = x11_convert_to_vconsole(c, bus);
+ r = x11_convert_to_vconsole(c, sd_bus_message_get_bus(m));
if (r < 0)
log_error_errno(r, "Failed to convert keymap data: %m");
}