gpointing-device-settings r91 - in trunk: src test



Author: hiikezoe
Date: Mon Mar  2 04:21:01 2009
New Revision: 91
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=91&view=rev

Log:
remove gpds_xinput_set_property.

Modified:
   trunk/src/gpds-xinput.c
   trunk/src/gpds-xinput.h
   trunk/test/test-xinput.c

Modified: trunk/src/gpds-xinput.c
==============================================================================
--- trunk/src/gpds-xinput.c	(original)
+++ trunk/src/gpds-xinput.c	Mon Mar  2 04:21:01 2009
@@ -220,99 +220,6 @@
     return priv->device;
 }
 
-static gboolean
-set_property_va_list (GpdsXInput *xinput,
-                      const gchar *property_name,
-                      gint format_type,
-                      GError **error,
-                      gint first_value, va_list var_args)
-{
-    XDevice *device;
-    Atom property_atom;
-    gint i, n_values = 1;
-    gint *values;
-    gchar *property_data;
-    va_list copy_var_args;
-
-    device = get_device(xinput, error);
-    if (!device)
-        return FALSE;
-
-    property_atom = XInternAtom(GDK_DISPLAY(), property_name, False);
-
-    G_VA_COPY(copy_var_args, var_args);
-    while (va_arg(var_args, gint))
-        n_values++;
-
-    values = g_new(gint, n_values);
-    values[0] = first_value;
-
-    for (i = 1; i < n_values; i++) {
-        values[i] = va_arg(copy_var_args, gint);
-    }
-
-    switch (format_type) {
-    case 8:
-        property_data = (gchar*)g_new(int8_t*, n_values);
-        break;
-    case 16:
-        property_data = (gchar*)g_new(int16_t*, n_values);
-        break;
-    case 32:
-    default:
-        property_data = (gchar*)g_new(int32_t*, n_values);
-        break;
-    }
-
-    for (i = 0; i < n_values; i++) {
-        switch (format_type) {
-        case 8:
-            *(((int8_t*)property_data) + i) = values[i];
-            break;
-        case 16:
-            *(((int16_t*)property_data) + i) = values[i];
-            break;
-        case 32:
-        default:
-            *(((int32_t*)property_data) + i) = values[i];
-            break;
-        }
-    }
-
-    va_end(copy_var_args);
-    g_free(values);
-
-    gdk_error_trap_push();
-    XChangeDeviceProperty(GDK_DISPLAY(),
-                          device, property_atom,
-                          XA_INTEGER, format_type, PropModeReplace,
-                          (unsigned char*)property_data, n_values);
-    gdk_error_trap_pop();
-
-    g_free(property_data);
-
-    return TRUE;
-}
-
-gboolean
-gpds_xinput_set_property (GpdsXInput *xinput,
-                          const gchar *property_name,
-                          gint format_type,
-                          GError **error,
-                          gint first_value, ...)
-{
-    gboolean success;
-    va_list var_args;
-
-    g_return_val_if_fail(GPDS_IS_XINPUT(xinput), FALSE);
-
-    va_start(var_args, first_value);
-    success = set_property_va_list(xinput, property_name, format_type, error, first_value, var_args);
-    va_end(var_args);
-
-    return success;
-}
-
 gboolean
 gpds_xinput_set_int_properties (GpdsXInput *xinput,
                                 const gchar *property_name,
@@ -326,6 +233,8 @@
     gint i;
     gchar *property_data;
 
+    g_return_val_if_fail(GPDS_IS_XINPUT(xinput), FALSE);
+
     device = get_device(xinput, error);
     if (!device)
         return FALSE;

Modified: trunk/src/gpds-xinput.h
==============================================================================
--- trunk/src/gpds-xinput.h	(original)
+++ trunk/src/gpds-xinput.h	Mon Mar  2 04:21:01 2009
@@ -57,12 +57,6 @@
 gboolean    gpds_xinput_exist_device       (const gchar *device_name);
 
 GpdsXInput *gpds_xinput_new                (const gchar *device_name);
-gboolean    gpds_xinput_set_property       (GpdsXInput *xinput,
-                                            const gchar *property_name,
-                                            gint format_type,
-                                            GError **error,
-                                            gint first_property_value,
-                                            ...) G_GNUC_NULL_TERMINATED;
 gboolean    gpds_xinput_set_int_properties (GpdsXInput *xinput,
                                             const gchar *property_name,
                                             gint format_type,

Modified: trunk/test/test-xinput.c
==============================================================================
--- trunk/test/test-xinput.c	(original)
+++ trunk/test/test-xinput.c	Mon Mar  2 04:21:01 2009
@@ -3,7 +3,6 @@
 #include <gcutter.h>
 
 void test_new (void);
-void test_property (void);
 void test_set_int_properties (void);
 
 static GpdsXInput *xinput;
@@ -37,52 +36,6 @@
 }
 
 void
-test_property (void)
-{
-    gint original_value;
-    cut_trace(test_new());
-
-    cut_assert_true(gpds_xinput_get_property(xinput,
-                                             "Evdev Middle Button Emulation",
-                                             &error,
-                                             &values, &n_values));
-    gcut_assert_error(error);
-    cut_assert_equal_int(1, n_values);
-    original_value = values[0];
-
-    cut_assert_true(gpds_xinput_set_property(xinput,
-                                             "Evdev Middle Button Emulation",
-                                             8,
-                                             &error,
-                                             1, NULL));
-    gcut_assert_error(error);
-    g_free(values);
-    cut_assert_true(gpds_xinput_get_property(xinput,
-                                             "Evdev Middle Button Emulation",
-                                             &error,
-                                             &values, &n_values));
-    gcut_assert_error(error);
-    cut_assert_equal_int(1, n_values);
-    cut_assert_equal_int(1, values[0]);
-
-    cut_assert_true(gpds_xinput_set_property(xinput,
-                                             "Evdev Middle Button Emulation",
-                                             8,
-                                             &error,
-                                             original_value, NULL));
-    gcut_assert_error(error);
-
-    g_free(values);
-    cut_assert_true(gpds_xinput_get_property(xinput,
-                                             "Evdev Middle Button Emulation",
-                                             &error,
-                                             &values, &n_values));
-    gcut_assert_error(error);
-    cut_assert_equal_int(1, n_values);
-    cut_assert_equal_int(original_value, values[0]);
-}
-
-void
 test_set_int_properties (void)
 {
     cut_trace(test_new());



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