From aabdcffea6b311cda25ad2937466d65fc4e36381 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:23:27 -0600 Subject: Moving the GValues over to GVariant --- tests/test-glib-events-client.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tests/test-glib-events-client.c') diff --git a/tests/test-glib-events-client.c b/tests/test-glib-events-client.c index 97d5caf..ee0b821 100644 --- a/tests/test-glib-events-client.c +++ b/tests/test-glib-events-client.c @@ -35,7 +35,7 @@ static gboolean passed = TRUE; static gboolean first = TRUE; static void -event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GValue * data, guint timestamp, GError * error, gpointer user_data) +event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GVariant * data, guint timestamp, GError * error, gpointer user_data) { g_debug("Event status: %s", error == NULL ? "Sent" : "Error"); @@ -46,8 +46,8 @@ event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GV return; } - if (g_value_get_int(data) != DATA_VALUE) { - g_debug("Data value pass fail got: %d", g_value_get_int(data)); + if (g_variant_get_int32(data) != DATA_VALUE) { + g_debug("Data value pass fail got: %d", g_variant_get_int32(data)); passed = FALSE; g_main_loop_quit(mainloop); return; @@ -96,11 +96,9 @@ layout_updated (DbusmenuClient * client, gpointer user_data) return; } - GValue data = {0}; - g_value_init(&data, G_TYPE_INT); - g_value_set_int(&data, DATA_VALUE); - - dbusmenu_menuitem_handle_event(menuroot, "clicked", &data, TIMESTAMP_VALUE); + GVariant * data = g_variant_new("i", DATA_VALUE); + dbusmenu_menuitem_handle_event(menuroot, "clicked", data, TIMESTAMP_VALUE); + g_variant_unref(data); return; } -- cgit v1.2.3 From 7380d970e2187af5e153250565d784abbe469bc8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:42:25 -0600 Subject: Don't unref the variant we send and fix up debugging messages. --- tests/test-glib-events-client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test-glib-events-client.c') diff --git a/tests/test-glib-events-client.c b/tests/test-glib-events-client.c index ee0b821..2cc5439 100644 --- a/tests/test-glib-events-client.c +++ b/tests/test-glib-events-client.c @@ -47,7 +47,7 @@ event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GV } if (g_variant_get_int32(data) != DATA_VALUE) { - g_debug("Data value pass fail got: %d", g_variant_get_int32(data)); + g_debug("Data value pass fail got: %d", g_variant_get_int32(g_variant_get_child_value(data, 0))); passed = FALSE; g_main_loop_quit(mainloop); return; @@ -96,9 +96,8 @@ layout_updated (DbusmenuClient * client, gpointer user_data) return; } - GVariant * data = g_variant_new("i", DATA_VALUE); + GVariant * data = g_variant_new_int32(DATA_VALUE); dbusmenu_menuitem_handle_event(menuroot, "clicked", data, TIMESTAMP_VALUE); - g_variant_unref(data); return; } @@ -126,6 +125,7 @@ main (int argc, char ** argv) mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + g_debug("Main loop complete"); g_object_unref(G_OBJECT(client)); if (passed) { -- cgit v1.2.3