[gnome-mag/bonobo-less] [mag-test] Do not use cached properties



commit 8300c23944e8f994103fd56bafa70a836b1b801e
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Tue Jul 6 14:47:28 2010 +0200

    [mag-test] Do not use cached properties

 test/mag-test.c |   54 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 39 insertions(+), 15 deletions(-)
---
diff --git a/test/mag-test.c b/test/mag-test.c
index a06c602..8f1b049 100644
--- a/test/mag-test.c
+++ b/test/mag-test.c
@@ -69,6 +69,30 @@ get_rectbounds (int x1, int y1, int x2, int y2)
 }
 
 static void
+set_property (GDBusProxy     *proxy,
+	      const gchar    *property_name,
+	      const GVariant *value)
+{
+	GVariant *result;
+	GError   *error = NULL;
+
+	result = g_dbus_proxy_call_sync (proxy,
+					 "org.freedesktop.DBus.Properties.Set",
+					 g_variant_new ("(ssv)",
+							g_dbus_proxy_get_interface_name (proxy),
+							property_name,
+							value),
+					 G_DBUS_CALL_FLAGS_NO_AUTO_START,
+					 -1, NULL, &error);
+	if (error) {
+		g_printerr ("Error calling method org.freedesktop.DBus.Properties.Set: %s\n", error->message);
+		g_error_free (error);
+	}
+
+	g_variant_unref (result);
+}
+
+static void
 test_new_region (GDBusProxy *magnifier,
 		 float xscale,
 		 float yscale,
@@ -103,7 +127,7 @@ test_new_region (GDBusProxy *magnifier,
 
 	g_variant_get (result, "(&o)", &zoomer_object_path);
 	zoomer = g_dbus_proxy_new_sync (g_dbus_proxy_get_connection (magnifier),
-					G_DBUS_PROXY_FLAGS_NONE,
+					G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
 					NULL,
 					"org.gnome.Magnifier.ZoomRegion",
 					zoomer_object_path,
@@ -132,22 +156,22 @@ test_new_region (GDBusProxy *magnifier,
 	}
 	g_variant_unref (result);
 
-	g_dbus_proxy_set_cached_property (zoomer, "Smoothscroll",
-					  g_variant_new_uint32 (scroll_policy));
-	g_dbus_proxy_set_cached_property (zoomer, "Xalign",
-					  g_variant_new_int32 (align));
-	g_dbus_proxy_set_cached_property (zoomer, "Yalign",
-					  g_variant_new_int32 (align));
+	set_property (zoomer, "Smoothscroll",
+		      g_variant_new_uint32 (scroll_policy));
+	set_property (zoomer, "Xalign",
+		      g_variant_new_int32 (align));
+	set_property (zoomer, "Yalign",
+		      g_variant_new_int32 (align));
 
 	if (smoothing_type)
 	{
-		g_dbus_proxy_set_cached_property (zoomer, "Smoothing",
-						  g_variant_new_string (smoothing_type));
+		set_property (zoomer, "Smoothing",
+			      g_variant_new_string (smoothing_type));
 	}
 
 	if (is_inverse)
-		g_dbus_proxy_set_cached_property (zoomer, "Invert",
-						  g_variant_new_boolean (is_inverse));
+		set_property (zoomer, "Invert",
+			      g_variant_new_boolean (is_inverse));
 	g_object_unref (zoomer);
 }
 
@@ -160,7 +184,7 @@ int main(int argc, char ** argv)
 	gtk_init (&argc, &argv);
 
 	magnifier = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
-						   G_DBUS_PROXY_FLAGS_NONE,
+						   G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
 						   NULL,
 						   "org.gnome.Magnifier",
 						   "/org/gnome/Magnifier",
@@ -177,9 +201,9 @@ int main(int argc, char ** argv)
 	height = gdk_screen_get_height (gdk_screen_get_default ());
 	x = width / 2;
 	y = 0;
-	g_dbus_proxy_set_cached_property (magnifier,
-					  "TargetSize",
-					  get_rectbounds (x, y, width - x, height));
+	set_property (magnifier,
+		      "TargetSize",
+		      get_rectbounds (x, y, width - x, height));
 
 	g_dbus_proxy_call_sync (magnifier,
 				"clearAllZoomRegions",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]