diff options
Diffstat (limited to 'fedora-setup-keyboard.c')
-rw-r--r-- | fedora-setup-keyboard.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/fedora-setup-keyboard.c b/fedora-setup-keyboard.c index 0c4f217..212c12a 100644 --- a/fedora-setup-keyboard.c +++ b/fedora-setup-keyboard.c @@ -1,5 +1,6 @@ /* * Copyright © 2009 Adel Gadllah + * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +24,6 @@ * */ -#include <libhal.h> #include <glib.h> #include <string.h> #include <stdlib.h> @@ -53,34 +53,6 @@ gchar* remove_quotes(gchar *str) { return tmp; } -/** - * Append the given value to the current value of matching key. - * Memory for the returned string must be freed by the caller. - * - * Only merges input.xkb.options ATM - */ -gchar *merge_key(LibHalContext *hal_ctx, gchar *udi, gchar* key, gchar *value) { - gchar *xkb_opts; - gchar *merged = NULL; - - /* We only need to merge xkb.options */ - if (strcmp(key, KEY_OPTIONS) != 0) - return g_strdup(value); - xkb_opts = libhal_device_get_property_string(hal_ctx, udi, - KEY_OPTIONS, NULL); - if (!xkb_opts || strlen(xkb_opts) == 0) - merged = g_strdup(value); - else if (!value || strlen(value) == 0) - merged = g_strdup(xkb_opts); - else - merged = g_strdup_printf("%s,%s", xkb_opts, value); - - if (xkb_opts) - libhal_free_string(xkb_opts); - - return merged; -} - int main() { GKeyFile *cfg_file; gchar *buffer, *conf; @@ -93,24 +65,6 @@ int main() { gchar **list; gchar *key, *udi, *tmp; - /* connect to HAL */ - LibHalContext *hal_ctx; - - if((udi = getenv("UDI")) == NULL) - return 1; - - if((hal_ctx = libhal_ctx_init_direct(NULL)) == NULL) { - if((hal_ctx = libhal_ctx_new()) == NULL) - return 1; - - if(!libhal_ctx_set_dbus_connection(hal_ctx, dbus_bus_get(DBUS_BUS_SYSTEM, NULL))) - return 1; - - if(!libhal_ctx_init(hal_ctx, NULL)) - return 1; - } - - /* Parse the config file */ cfg_file = g_key_file_new(); g_file_get_contents(KBDCONFIG, &buffer, NULL, NULL); @@ -140,10 +94,6 @@ int main() { key = g_strdup_printf("input.xkb.%s", map[i]); - value = merge_key(hal_ctx, udi, key, - (property != NULL) ? property : list[i]); - libhal_device_set_property_string(hal_ctx, udi, key, value, NULL); - if(property != NULL) g_free(property); g_free(value); @@ -154,7 +104,6 @@ int main() { /* cleanup */ g_free(conf); g_free(list); - libhal_ctx_free(hal_ctx); g_hash_table_destroy(kbd_models); return 0; |