aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-11-17 21:23:27 -0600
committerTed Gould <ted@gould.cx>2010-11-17 21:23:27 -0600
commitaabdcffea6b311cda25ad2937466d65fc4e36381 (patch)
treef86b33a60c4eb780057adcd4293b2b36d7fd19f2
parent0dea1bb0779b8cddbf631ee80f76d13aa8920ec5 (diff)
downloadlibdbusmenu-aabdcffea6b311cda25ad2937466d65fc4e36381.tar.gz
libdbusmenu-aabdcffea6b311cda25ad2937466d65fc4e36381.tar.bz2
libdbusmenu-aabdcffea6b311cda25ad2937466d65fc4e36381.zip
Moving the GValues over to GVariant
-rw-r--r--tests/test-glib-events-client.c14
-rw-r--r--tests/test-glib-objects.c24
-rw-r--r--tests/test-glib-proxy-client.c7
-rw-r--r--tests/test-gtk-objects.c4
4 files changed, 23 insertions, 26 deletions
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;
}
diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c
index 1d4f673..c6a8dc9 100644
--- a/tests/test-glib-objects.c
+++ b/tests/test-glib-objects.c
@@ -77,17 +77,17 @@ test_object_menuitem_props_string (void)
{
/* Build a menu item */
DbusmenuMenuitem * item = dbusmenu_menuitem_new();
- const GValue * out = NULL;
+ GVariant * out = NULL;
/* Test to make sure it's a happy object */
g_assert(item != NULL);
/* Setting a string */
dbusmenu_menuitem_property_set(item, "string", "value");
- out = dbusmenu_menuitem_property_get_value(item, "string");
+ out = dbusmenu_menuitem_property_get_variant(item, "string");
g_assert(out != NULL);
- g_assert(G_VALUE_TYPE(out) == G_TYPE_STRING);
- g_assert(!g_strcmp0(g_value_get_string(out), "value"));
+ g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_STRING));
+ g_assert(!g_strcmp0(g_variant_get_string(out, NULL), "value"));
g_assert(!g_strcmp0(dbusmenu_menuitem_property_get(item, "string"), "value"));
g_object_unref(item);
@@ -101,17 +101,17 @@ test_object_menuitem_props_int (void)
{
/* Build a menu item */
DbusmenuMenuitem * item = dbusmenu_menuitem_new();
- const GValue * out = NULL;
+ GVariant * out = NULL;
/* Test to make sure it's a happy object */
g_assert(item != NULL);
/* Setting a string */
dbusmenu_menuitem_property_set_int(item, "int", 12345);
- out = dbusmenu_menuitem_property_get_value(item, "int");
+ out = dbusmenu_menuitem_property_get_variant(item, "int");
g_assert(out != NULL);
- g_assert(G_VALUE_TYPE(out) == G_TYPE_INT);
- g_assert(g_value_get_int(out) == 12345);
+ g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_INT32));
+ g_assert(g_variant_get_int32(out) == 12345);
g_assert(dbusmenu_menuitem_property_get_int(item, "int") == 12345);
g_object_unref(item);
@@ -125,17 +125,17 @@ test_object_menuitem_props_bool (void)
{
/* Build a menu item */
DbusmenuMenuitem * item = dbusmenu_menuitem_new();
- const GValue * out = NULL;
+ GVariant * out = NULL;
/* Test to make sure it's a happy object */
g_assert(item != NULL);
/* Setting a string */
dbusmenu_menuitem_property_set_bool(item, "boolean", TRUE);
- out = dbusmenu_menuitem_property_get_value(item, "boolean");
+ out = dbusmenu_menuitem_property_get_variant(item, "boolean");
g_assert(out != NULL);
- g_assert(G_VALUE_TYPE(out) == G_TYPE_BOOLEAN);
- g_assert(g_value_get_boolean(out));
+ g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_BOOLEAN));
+ g_assert(g_variant_get_boolean(out));
g_assert(dbusmenu_menuitem_property_get_int(item, "boolean"));
g_object_unref(item);
diff --git a/tests/test-glib-proxy-client.c b/tests/test-glib-proxy-client.c
index 0ae2e20..2e1e2d2 100644
--- a/tests/test-glib-proxy-client.c
+++ b/tests/test-glib-proxy-client.c
@@ -150,10 +150,9 @@ layout_verify_timer (gpointer data)
g_main_loop_quit(mainloop);
}
- GValue value = {0};
- g_value_init(&value, G_TYPE_INT);
- g_value_set_int(&value, 0);
- dbusmenu_menuitem_handle_event(menuroot, "clicked", &value, layouton);
+ GVariant * value = g_variant_new("i", 0);
+ dbusmenu_menuitem_handle_event(menuroot, "clicked", value, layouton);
+ g_variant_unref(value);
return FALSE;
}
diff --git a/tests/test-gtk-objects.c b/tests/test-gtk-objects.c
index 726f404..30fc022 100644
--- a/tests/test-gtk-objects.c
+++ b/tests/test-gtk-objects.c
@@ -72,7 +72,7 @@ test_object_prop_pixbuf (void)
g_object_unref(pixbuf);
/* Check to see if it's set */
- const GValue * val = dbusmenu_menuitem_property_get_value(item, prop_name);
+ GVariant * val = dbusmenu_menuitem_property_get_variant(item, prop_name);
g_assert(val != NULL);
/* Get the pixbuf back! */
@@ -105,7 +105,7 @@ test_object_prop_shortcut (void)
g_assert(success);
/* Check for value */
- const GValue * val = dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_SHORTCUT);
+ GVariant * val = dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_SHORTCUT);
g_assert(val != NULL);
/* Check to see if we love it */