diff options
author | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-12-01 14:55:33 +0100 |
---|---|---|
committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-12-01 16:40:00 +0100 |
commit | b808fc36602756d1c1495179331a4e92a7b094dc (patch) | |
tree | 62aaf4e810d24b7d0d43452fbf15f36132a86449 /src/lib/abrt_dbus.h | |
parent | f69941320b1a09b0322c811fbc885861f406bc0e (diff) | |
download | abrt-b808fc36602756d1c1495179331a4e92a7b094dc.tar.gz abrt-b808fc36602756d1c1495179331a4e92a7b094dc.tar.xz abrt-b808fc36602756d1c1495179331a4e92a7b094dc.zip |
get_reporter_plugin_settings() returns GHashTable
static void get_reporter_plugin_settings(const vector_string_t&
reporters, map_map_string_t &settings)
a new interface is
static GHashTable *get_reporter_plugin_settings(const vector_string_t&
reporters)
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'src/lib/abrt_dbus.h')
-rw-r--r-- | src/lib/abrt_dbus.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/abrt_dbus.h b/src/lib/abrt_dbus.h index cdc963ca..16b91d5b 100644 --- a/src/lib/abrt_dbus.h +++ b/src/lib/abrt_dbus.h @@ -20,6 +20,7 @@ #define ABRT_DBUS_H #include <dbus/dbus.h> +#include <glib.h> #include "abrtlib.h" @@ -200,6 +201,34 @@ static inline void store_val(DBusMessageIter* iter, const std::vector<E>& val) { template<typename K, typename V> static inline void store_val(DBusMessageIter* iter, const std::map<K,V>& val) { store_map(iter, val); } +/* next patch will rewrite this into c */ +static inline void store_hash_table_map_string_t(DBusMessageIter* iter, GHashTable *ht) +{ + DBusMessageIter sub_iter; + if (!dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "{sa{ss}}", &sub_iter)) + die_out_of_memory(); + + GHashTableIter ht_iter; + gpointer key, value; + + g_hash_table_iter_init(&ht_iter, ht); + while (g_hash_table_iter_next(&ht_iter, &key, &value)) + { + DBusMessageIter sub_sub_iter; + if (!dbus_message_iter_open_container(&sub_iter, DBUS_TYPE_DICT_ENTRY, NULL, &sub_sub_iter)) + die_out_of_memory(); + + store_val(&sub_sub_iter, (char *)key); + store_val(&sub_sub_iter, *(map_string_t *)value); + + if (!dbus_message_iter_close_container(&sub_iter, &sub_sub_iter)) + die_out_of_memory(); + } + + if (!dbus_message_iter_close_container(iter, &sub_iter)) + die_out_of_memory(); +} + /* * Helpers for parsing DBus messages |