gpointing-device-settings r132 - in trunk/modules: . common gnome-settings-daemon-plugins
- From: hiikezoe svn gnome org
- To: svn-commits-list gnome org
- Subject: gpointing-device-settings r132 - in trunk/modules: . common gnome-settings-daemon-plugins
- Date: Fri, 6 Mar 2009 14:47:53 +0000 (UTC)
Author: hiikezoe
Date: Fri Mar 6 14:47:53 2009
New Revision: 132
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=132&view=rev
Log:
change trackpoint -> mouse partially done.
Added:
trunk/modules/common/gpds-mouse-definitions.h
trunk/modules/common/gpds-mouse-xinput.c
- copied, changed from r131, /trunk/modules/common/gpds-trackpoint-xinput.c
trunk/modules/common/gpds-mouse-xinput.h
- copied, changed from r131, /trunk/modules/common/gpds-trackpoint-xinput.h
Removed:
trunk/modules/common/gpds-trackpoint-definitions.h
trunk/modules/common/gpds-trackpoint-xinput.c
trunk/modules/common/gpds-trackpoint-xinput.h
Modified:
trunk/modules/Makefile.am
trunk/modules/common/Makefile.am
trunk/modules/gnome-settings-daemon-plugins/Makefile.am
trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c
trunk/modules/gpds-trackpoint-ui.c
Modified: trunk/modules/Makefile.am
==============================================================================
--- trunk/modules/Makefile.am (original)
+++ trunk/modules/Makefile.am Fri Mar 6 14:47:53 2009
@@ -29,7 +29,7 @@
trackpoint_la_SOURCES = \
gpds-trackpoint-ui.c
-trackpoint_la_LIBADD = $(top_builddir)/modules/common/libtrackpoint_common.la
+trackpoint_la_LIBADD = $(top_builddir)/modules/common/libmouse_common.la
touchpad_la_SOURCES = \
gpds-touchpad-ui.c
Modified: trunk/modules/common/Makefile.am
==============================================================================
--- trunk/modules/common/Makefile.am (original)
+++ trunk/modules/common/Makefile.am Fri Mar 6 14:47:53 2009
@@ -9,7 +9,7 @@
$(COVERAGE_CFLAGS)
noinst_LTLIBRARIES = \
- libtrackpoint_common.la \
+ libmouse_common.la \
libtouchpad_common.la
LIBADD = \
@@ -18,10 +18,10 @@
$(GCONF2_LIBS) \
$(GNOME_SETTINGS_DAEMON_LIBS)
-libtrackpoint_common_la_SOURCES = \
- gpds-trackpoint-xinput.c \
- gpds-trackpoint-xinput.h \
- gpds-trackpoint-definitions.h
+libmouse_common_la_SOURCES = \
+ gpds-mouse-xinput.c \
+ gpds-mouse-xinput.h \
+ gpds-mouse-definitions.h
libtouchpad_common_la_SOURCES = \
gpds-touchpad-xinput.c \
Added: trunk/modules/common/gpds-mouse-definitions.h
==============================================================================
--- (empty file)
+++ trunk/modules/common/gpds-mouse-definitions.h Fri Mar 6 14:47:53 2009
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2009 Hiroyuki Ikezoe <poincare ikezoe net>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __GPDS_MOUSE_GCONF_H__
+#define __GPDS_MOUSE_GCONF_H__
+
+#define GPDS_MOUSE_GCONF_DIR "/desktop/gnome/peripherals"
+#define GPDS_MOUSE_MIDDLE_BUTTON_EMULATION_KEY "middle_button_emulation"
+#define GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY "middle_button_timeoue"
+#define GPDS_MOUSE_WHEEL_EMULATION_KEY "wheel_emulation"
+#define GPDS_MOUSE_WHEEL_EMULATION_INERTIA_KEY "wheel_emulation_inetia"
+#define GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY "wheel_emulation_x_axis"
+#define GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY "wheel_emulation_y_axis"
+#define GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT_KEY "wheel_emulation_timeout"
+#define GPDS_MOUSE_WHEEL_EMULATION_BUTTON_KEY "wheel_emulation_button"
+#define GPDS_MOUSE_DRAG_LOCK_BUTTONS_KEY "drag_lock_buttons"
+
+#endif /* __GPDS_MOUSE_GCONF_H__ */
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
Copied: trunk/modules/common/gpds-mouse-xinput.c (from r131, /trunk/modules/common/gpds-trackpoint-xinput.c)
==============================================================================
--- /trunk/modules/common/gpds-trackpoint-xinput.c (original)
+++ trunk/modules/common/gpds-mouse-xinput.c Fri Mar 6 14:47:53 2009
@@ -21,33 +21,33 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include "gpds-trackpoint-xinput.h"
+#include "gpds-mouse-xinput.h"
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include <gpds-xinput.h>
#include <gpds-xinput-utils.h>
-static const gchar *track_point_device_names[] = {
+static const gchar *mouse_device_names[] = {
"TPPS/2 IBM TrackPoint"
};
-static const gint n_track_point_device_names = G_N_ELEMENTS(track_point_device_names);
+static const gint n_mouse_device_names = G_N_ELEMENTS(mouse_device_names);
-static GpdsTrackPointXInputProperty properties[] = {
- {GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION, "Evdev Middle Button Emulation", 8, 1},
- {GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT, "Evdev Middle Button Timeout", 32, 1},
- {GPDS_TRACK_POINT_WHEEL_EMULATION, "Evdev Wheel Emulation", 8, 1},
- {GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA, "Evdev Wheel Emulation Inertia", 16, 1},
- {GPDS_TRACK_POINT_WHEEL_EMULATION_AXES, "Evdev Wheel Emulation Axes", 8, 4},
- {GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT, "Evdev Wheel Emulation Timeout", 16, 1},
- {GPDS_TRACK_POINT_WHEEL_EMULATION_BUTTON, "Evdev Wheel Emulation Button", 8, 1},
- {GPDS_TRACK_POINT_DRAG_LOCK_BUTTONS, "Evdev Drag Lock Buttons", 8, 2}
+static GpdsMouseXInputProperty properties[] = {
+ {GPDS_MOUSE_MIDDLE_BUTTON_EMULATION, "Evdev Middle Button Emulation", 8, 1},
+ {GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT, "Evdev Middle Button Timeout", 32, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION, "Evdev Wheel Emulation", 8, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_INERTIA, "Evdev Wheel Emulation Inertia", 16, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_AXES, "Evdev Wheel Emulation Axes", 8, 4},
+ {GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT, "Evdev Wheel Emulation Timeout", 16, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_BUTTON, "Evdev Wheel Emulation Button", 8, 1},
+ {GPDS_MOUSE_DRAG_LOCK_BUTTONS, "Evdev Drag Lock Buttons", 8, 2}
};
static const gint n_properties = G_N_ELEMENTS(properties);
const gchar *
-gpds_track_point_xinput_get_name (GpdsTrackPointProperty property)
+gpds_mouse_xinput_get_name (GpdsMouseProperty property)
{
gint i;
@@ -60,7 +60,7 @@
}
gint
-gpds_track_point_xinput_get_format_type (GpdsTrackPointProperty property)
+gpds_mouse_xinput_get_format_type (GpdsMouseProperty property)
{
gint i;
@@ -73,7 +73,7 @@
}
gint
-gpds_track_point_xinput_get_max_value_count (GpdsTrackPointProperty property)
+gpds_mouse_xinput_get_max_value_count (GpdsMouseProperty property)
{
gint i;
@@ -86,13 +86,13 @@
}
const gchar *
-gpds_track_point_xinput_find_device_name (void)
+gpds_mouse_xinput_find_device_name (void)
{
gint i;
- for (i = 0; i < n_track_point_device_names; i++) {
- if (gpds_xinput_utils_exist_device(track_point_device_names[i]))
- return track_point_device_names[i];
+ for (i = 0; i < n_mouse_device_names; i++) {
+ if (gpds_xinput_utils_exist_device(mouse_device_names[i]))
+ return mouse_device_names[i];
}
return NULL;
}
Copied: trunk/modules/common/gpds-mouse-xinput.h (from r131, /trunk/modules/common/gpds-trackpoint-xinput.h)
==============================================================================
--- /trunk/modules/common/gpds-trackpoint-xinput.h (original)
+++ trunk/modules/common/gpds-mouse-xinput.h Fri Mar 6 14:47:53 2009
@@ -17,38 +17,38 @@
*
*/
-#ifndef __GPDS_TRACK_POINT_XINPUT_H__
-#define __GPDS_TRACK_POINT_XINPUT_H__
+#ifndef __GPDS_MOUSE_XINPUT_H__
+#define __GPDS_MOUSE_XINPUT_H__
#include <glib.h>
typedef enum {
- GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION,
- GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT,
- GPDS_TRACK_POINT_WHEEL_EMULATION,
- GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA,
- GPDS_TRACK_POINT_WHEEL_EMULATION_AXES,
- GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT,
- GPDS_TRACK_POINT_WHEEL_EMULATION_BUTTON,
- GPDS_TRACK_POINT_DRAG_LOCK_BUTTONS,
-} GpdsTrackPointProperty;
+ GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
+ GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
+ GPDS_MOUSE_WHEEL_EMULATION,
+ GPDS_MOUSE_WHEEL_EMULATION_INERTIA,
+ GPDS_MOUSE_WHEEL_EMULATION_AXES,
+ GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT,
+ GPDS_MOUSE_WHEEL_EMULATION_BUTTON,
+ GPDS_MOUSE_DRAG_LOCK_BUTTONS,
+} GpdsMouseProperty;
-typedef struct _GpdsTrackPointXInputProperty GpdsTrackPointXInputProperty;
-struct _GpdsTrackPointXInputProperty
+typedef struct _GpdsMouseXInputProperty GpdsMouseXInputProperty;
+struct _GpdsMouseXInputProperty
{
- GpdsTrackPointProperty property;
+ GpdsMouseProperty property;
const gchar *name;
gint format_type;
gint max_value_count;
};
-const gchar *gpds_track_point_xinput_get_name (GpdsTrackPointProperty property);
-gint gpds_track_point_xinput_get_format_type (GpdsTrackPointProperty property);
-gint gpds_track_point_xinput_get_max_value_count (GpdsTrackPointProperty property);
-const gchar *gpds_track_point_xinput_find_device_name (void);
+const gchar *gpds_mouse_xinput_get_name (GpdsMouseProperty property);
+gint gpds_mouse_xinput_get_format_type (GpdsMouseProperty property);
+gint gpds_mouse_xinput_get_max_value_count (GpdsMouseProperty property);
+const gchar *gpds_mouse_xinput_find_device_name (void);
-#endif /* __GPDS_TRACK_POINT_XINPUT_H__ */
+#endif /* __GPDS_MOUSE_XINPUT_H__ */
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
Modified: trunk/modules/gnome-settings-daemon-plugins/Makefile.am
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/Makefile.am (original)
+++ trunk/modules/gnome-settings-daemon-plugins/Makefile.am Fri Mar 6 14:47:53 2009
@@ -37,7 +37,7 @@
gsd-trackpoint-manager.h \
gsd-trackpoint-manager.c
-libtrackpoint_la_LIBADD = $(top_builddir)/modules/common/libtrackpoint_common.la
+libtrackpoint_la_LIBADD = $(top_builddir)/modules/common/libmouse_common.la
libtouchpad_la_CFLAGS = $(gsd_plugin_CFLAGS)
libtouchpad_la_SOURCES = \
Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c (original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c Fri Mar 6 14:47:53 2009
@@ -27,8 +27,8 @@
#include <gpds-xinput.h>
#include <gpds-xinput-utils.h>
-#include "gpds-trackpoint-definitions.h"
-#include "gpds-trackpoint-xinput.h"
+#include "gpds-mouse-definitions.h"
+#include "gpds-mouse-xinput.h"
#define GSD_TRACK_POINT_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GSD_TYPE_TRACK_POINT_MANAGER, GsdTrackPointManagerPrivate))
@@ -87,7 +87,7 @@
gint properties[4];
const gchar *device_name;
- device_name = gpds_track_point_xinput_find_device_name();
+ device_name = gpds_mouse_xinput_find_device_name();
if (!device_name)
return;
@@ -101,27 +101,27 @@
switch (value->type) {
case GCONF_VALUE_BOOL:
- if (!strcmp(key, GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION_KEY)) {
+ if (!strcmp(key, GPDS_MOUSE_MIDDLE_BUTTON_EMULATION_KEY)) {
properties[0] = gconf_value_get_bool(value) ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_MIDDLE_BUTTON_EMULATION),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_MIDDLE_BUTTON_EMULATION),
NULL,
properties,
1);
- } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_KEY)) {
+ } else if (!strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_KEY)) {
properties[0] = gconf_value_get_bool(value) ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION),
NULL,
properties,
1);
- } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY) ||
- !strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY)) {
+ } else if (!strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY) ||
+ !strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY)) {
gboolean enable;
enable = gconf_client_get_bool(client,
- GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY,
+ GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY,
NULL);
if (enable) {
properties[0] = 6;
@@ -132,7 +132,7 @@
}
enable = gconf_client_get_bool(client,
- GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY,
+ GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY,
NULL);
if (enable) {
properties[2] = 4;
@@ -142,8 +142,8 @@
properties[3] = 0;
}
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_AXES),
NULL,
properties,
4);
@@ -151,24 +151,24 @@
break;
case GCONF_VALUE_INT:
properties[0] = gconf_value_get_int(value);
- if (!strcmp(key, GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT_KEY)) {
+ if (!strcmp(key, GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY)) {
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT),
NULL,
properties,
1);
- } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT_KEY)) {
+ } else if (!strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT_KEY)) {
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT),
NULL,
properties,
1);
- } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA_KEY)) {
+ } else if (!strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_INERTIA_KEY)) {
gpds_xinput_set_int_properties(xinput,
- gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
- gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
+ gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_INERTIA),
+ gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_INERTIA),
NULL,
properties,
1);
@@ -186,19 +186,32 @@
GError **error)
{
GsdTrackPointManagerPrivate *priv;
+ gchar *gconf_dir;
+ const gchar *device_name;
+ gchar *escaped_device_name;
priv = GSD_TRACK_POINT_MANAGER_GET_PRIVATE(manager);
priv->gconf = gconf_client_get_default();
+ device_name = gpds_mouse_xinput_find_device_name();
+ if (!device_name)
+ return FALSE;
+
+ escaped_device_name = gconf_escape_key(device_name, -1);
+ gconf_dir = g_strdup_printf("%s/%s",
+ GPDS_MOUSE_GCONF_DIR,
+ escaped_device_name);
gconf_client_add_dir(priv->gconf,
- GPDS_TRACK_POINT_GCONF_DIR,
+ gconf_dir,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
priv->notify_id = gconf_client_notify_add(priv->gconf,
- GPDS_TRACK_POINT_GCONF_DIR,
+ gconf_dir,
cb_gconf_client_notify,
manager,
NULL,
NULL);
+ g_free(escaped_device_name);
+ g_free(gconf_dir);
return TRUE;
}
@@ -212,7 +225,7 @@
if (priv->notify_id) {
gconf_client_remove_dir(priv->gconf,
- GPDS_TRACK_POINT_GCONF_DIR,
+ GPDS_MOUSE_GCONF_DIR,
NULL);
gconf_client_notify_remove(priv->gconf, priv->notify_id);
priv->notify_id = 0;
Modified: trunk/modules/gpds-trackpoint-ui.c
==============================================================================
--- trunk/modules/gpds-trackpoint-ui.c (original)
+++ trunk/modules/gpds-trackpoint-ui.c Fri Mar 6 14:47:53 2009
@@ -27,8 +27,8 @@
#include <gpds-xinput.h>
#include <gconf/gconf-client.h>
-#include "gpds-trackpoint-definitions.h"
-#include "gpds-trackpoint-xinput.h"
+#include "gpds-mouse-definitions.h"
+#include "gpds-mouse-xinput.h"
#define GPDS_TYPE_TRACK_POINT_UI (gpds_track_point_ui_get_type())
#define GPDS_TRACK_POINT_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPDS_TYPE_TRACK_POINT_UI, GpdsTrackPointUI))
@@ -142,6 +142,22 @@
G_OBJECT_CLASS(gpds_track_point_ui_parent_class)->dispose(object);
}
+static gchar *
+build_gconf_key (GpdsTrackPointUI *ui, const gchar *key)
+{
+ gchar *gconf_key;
+ gchar *device_name;
+
+ device_name = gconf_escape_key(gpds_xinput_get_device_name(ui->xinput), -1);
+ gconf_key = g_strdup_printf("%s/%s/%s",
+ GPDS_MOUSE_GCONF_DIR,
+ device_name,
+ key);
+ g_free(device_name);
+
+ return gconf_key;
+}
+
static void
show_error (GError *error)
{
@@ -152,7 +168,7 @@
}
static void
-set_toggle_property (GpdsXInput *xinput, GtkToggleButton *button, GpdsTrackPointProperty property)
+set_toggle_property (GpdsXInput *xinput, GtkToggleButton *button, GpdsMouseProperty property)
{
GError *error = NULL;
gboolean active;
@@ -161,8 +177,8 @@
gint properties[1];
active = gtk_toggle_button_get_active(button);
- property_name = gpds_track_point_xinput_get_name(property);
- format_type = gpds_track_point_xinput_get_format_type(property);
+ property_name = gpds_mouse_xinput_get_name(property);
+ format_type = gpds_mouse_xinput_get_format_type(property);
properties[0] = active ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
@@ -178,7 +194,7 @@
}
static void
-set_spin_property (GpdsXInput *xinput, GtkSpinButton *button, GpdsTrackPointProperty property)
+set_spin_property (GpdsXInput *xinput, GtkSpinButton *button, GpdsMouseProperty property)
{
GError *error = NULL;
gdouble value;
@@ -187,8 +203,8 @@
gint properties[1];
value = gtk_spin_button_get_value(button);
- property_name = gpds_track_point_xinput_get_name(property);
- format_type = gpds_track_point_xinput_get_format_type(property);
+ property_name = gpds_mouse_xinput_get_name(property);
+ format_type = gpds_mouse_xinput_get_format_type(property);
properties[0] = (gint)value;
gpds_xinput_set_int_properties(xinput,
@@ -216,6 +232,50 @@
}
static void
+set_gconf_bool (GpdsTrackPointUI *ui, const gchar *key, gboolean value)
+{
+ gchar *gconf_key;
+
+ gconf_key = build_gconf_key(ui, key);
+ gconf_client_set_bool(ui->gconf, gconf_key, value, NULL);
+ g_free(gconf_key);
+}
+
+static gboolean
+get_gconf_bool (GpdsTrackPointUI *ui, const gchar *key)
+{
+ gchar *gconf_key;
+ gboolean value;
+
+ gconf_key = build_gconf_key(ui, key);
+ value = gconf_client_get_bool(ui->gconf, gconf_key, NULL);
+ g_free(gconf_key);
+ return value;
+}
+
+static void
+set_gconf_int (GpdsTrackPointUI *ui, const gchar *key, gint value)
+{
+ gchar *gconf_key;
+
+ gconf_key = build_gconf_key(ui, key);
+ gconf_client_set_int(ui->gconf, gconf_key, value, NULL);
+ g_free(gconf_key);
+}
+
+static gint
+get_gconf_int (GpdsTrackPointUI *ui, const gchar *key)
+{
+ gchar *gconf_key;
+ gint value;
+
+ gconf_key = build_gconf_key(ui, key);
+ value = gconf_client_get_int(ui->gconf, gconf_key, NULL);
+ g_free(gconf_key);
+ return value;
+}
+
+static void
cb_middle_button_emulation_toggled (GtkToggleButton *button, gpointer user_data)
{
GpdsTrackPointUI *ui = GPDS_TRACK_POINT_UI(user_data);
@@ -224,10 +284,10 @@
builder = gpds_ui_get_builder(GPDS_UI(user_data));
- set_toggle_property(ui->xinput, button, GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION);
+ set_toggle_property(ui->xinput, button, GPDS_MOUSE_MIDDLE_BUTTON_EMULATION);
enable = gtk_toggle_button_get_active(button);
- gconf_client_set_bool(ui->gconf, GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION_KEY, enable, NULL);
+ set_gconf_bool(ui, GPDS_MOUSE_MIDDLE_BUTTON_EMULATION_KEY, enable);
set_widget_sensitivity(builder, "middle_button_emulation_box", button);
}
@@ -240,10 +300,10 @@
builder = gpds_ui_get_builder(GPDS_UI(user_data));
- set_toggle_property(ui->xinput, button, GPDS_TRACK_POINT_WHEEL_EMULATION);
+ set_toggle_property(ui->xinput, button, GPDS_MOUSE_WHEEL_EMULATION);
enable = gtk_toggle_button_get_active(button);
- gconf_client_set_bool(ui->gconf, GPDS_TRACK_POINT_WHEEL_EMULATION_KEY, enable, NULL);
+ set_gconf_bool(ui, GPDS_MOUSE_WHEEL_EMULATION_KEY, enable);
set_widget_sensitivity(builder, "wheel_emulation_box", button);
}
@@ -280,8 +340,8 @@
properties[3] = 0;
}
- property_name = gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES);
- format_type = gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES);
+ property_name = gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES);
+ format_type = gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_AXES);
gpds_xinput_set_int_properties(ui->xinput,
property_name,
@@ -303,7 +363,7 @@
set_scroll_axes_property(ui);
enable = gtk_toggle_button_get_active(button);
- gconf_client_set_bool(ui->gconf, GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY, enable, NULL);
+ set_gconf_bool(ui, GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY, enable);
}
static void
@@ -314,7 +374,7 @@
set_scroll_axes_property(ui);
enable = gtk_toggle_button_get_active(button);
- gconf_client_set_bool(ui->gconf, GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY, enable, NULL);
+ set_gconf_bool(ui, GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY, enable);
}
static void
@@ -322,10 +382,10 @@
{
gdouble time;
GpdsTrackPointUI *ui = GPDS_TRACK_POINT_UI(user_data);
- set_spin_property(ui->xinput, button, GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT);
+ set_spin_property(ui->xinput, button, GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT);
time = gtk_spin_button_get_value(button);
- gconf_client_set_int(ui->gconf, GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT_KEY, (gint)time, NULL);
+ set_gconf_int(ui, GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT_KEY, (gint)time);
}
static void
@@ -333,10 +393,10 @@
{
gdouble inertia;
GpdsTrackPointUI *ui = GPDS_TRACK_POINT_UI(user_data);
- set_spin_property(ui->xinput, button, GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA);
+ set_spin_property(ui->xinput, button, GPDS_MOUSE_WHEEL_EMULATION_INERTIA);
inertia = gtk_spin_button_get_value(button);
- gconf_client_set_int(ui->gconf, GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA_KEY, (gint)inertia, NULL);
+ set_gconf_int(ui, GPDS_MOUSE_WHEEL_EMULATION_INERTIA_KEY, (gint)inertia);
}
static void
@@ -344,10 +404,10 @@
{
gdouble time;
GpdsTrackPointUI *ui = GPDS_TRACK_POINT_UI(user_data);
- set_spin_property(ui->xinput, button, GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT);
+ set_spin_property(ui->xinput, button, GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT);
time = gtk_spin_button_get_value(button);
- gconf_client_set_int(ui->gconf, GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT_KEY, (gint)time, NULL);
+ set_gconf_int(ui, GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY, (gint)time);
}
static void
@@ -395,7 +455,7 @@
static void
set_integer_property_from_preference (GpdsTrackPointUI *ui,
- GpdsTrackPointProperty property,
+ GpdsMouseProperty property,
const gchar *gconf_key_name,
GtkBuilder *builder,
const gchar *object_name)
@@ -407,16 +467,16 @@
gboolean dir_exists;
const gchar *property_name;
- property_name = gpds_track_point_xinput_get_name(property);
+ property_name = gpds_mouse_xinput_get_name(property);
if (!get_integer_properties(ui->xinput, property_name,
&values, &n_values)) {
return;
}
- dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_TRACK_POINT_GCONF_DIR, NULL);
+ dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_MOUSE_GCONF_DIR, NULL);
if (dir_exists)
- value = gconf_client_get_int(ui->gconf, gconf_key_name, NULL);
+ value = get_gconf_int(ui, gconf_key_name);
else
value = values[0];
@@ -427,7 +487,7 @@
static void
set_boolean_property_from_preference (GpdsTrackPointUI *ui,
- GpdsTrackPointProperty property,
+ GpdsMouseProperty property,
const gchar *gconf_key_name,
GtkBuilder *builder,
const gchar *object_name)
@@ -439,16 +499,16 @@
const gchar *property_name;
gchar *box_name;
- property_name = gpds_track_point_xinput_get_name(property);
+ property_name = gpds_mouse_xinput_get_name(property);
if (!get_integer_properties(ui->xinput, property_name,
&values, &n_values)) {
return;
}
- dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_TRACK_POINT_GCONF_DIR, NULL);
+ dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_MOUSE_GCONF_DIR, NULL);
if (dir_exists)
- enable = gconf_client_get_bool(ui->gconf, gconf_key_name, NULL);
+ enable = get_gconf_bool(ui, gconf_key_name);
else
enable = (values[0] == 1);
@@ -471,21 +531,17 @@
gboolean horizontal_enable = FALSE, vertical_enable = FALSE, dir_exists;
const gchar *property_name;
- property_name = gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES);
+ property_name = gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES);
if (!get_integer_properties(ui->xinput, property_name,
&values, &n_values)) {
return;
}
- dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_TRACK_POINT_GCONF_DIR, NULL);
+ dir_exists = gconf_client_dir_exists(ui->gconf, GPDS_MOUSE_GCONF_DIR, NULL);
if (dir_exists) {
- horizontal_enable = gconf_client_get_bool(ui->gconf,
- GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY,
- NULL);
- vertical_enable = gconf_client_get_bool(ui->gconf,
- GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY,
- NULL);
+ horizontal_enable = get_gconf_bool(ui, GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY);
+ vertical_enable = get_gconf_bool(ui, GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY);
} else {
if (n_values >= 2)
horizontal_enable = (values[0] != 0 && values[1] != 0);
@@ -507,28 +563,28 @@
GpdsTrackPointUI *track_point_ui = GPDS_TRACK_POINT_UI(ui);
set_boolean_property_from_preference(track_point_ui,
- GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION,
- GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION_KEY,
+ GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
+ GPDS_MOUSE_MIDDLE_BUTTON_EMULATION_KEY,
builder,
"middle_button_emulation");
set_boolean_property_from_preference(track_point_ui,
- GPDS_TRACK_POINT_WHEEL_EMULATION,
- GPDS_TRACK_POINT_WHEEL_EMULATION_KEY,
+ GPDS_MOUSE_WHEEL_EMULATION,
+ GPDS_MOUSE_WHEEL_EMULATION_KEY,
builder,
"wheel_emulation");
set_integer_property_from_preference(track_point_ui,
- GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT,
- GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT_KEY,
+ GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
+ GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY,
builder,
"middle_button_timeout");
set_integer_property_from_preference(track_point_ui,
- GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT,
- GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT_KEY,
+ GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT,
+ GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT_KEY,
builder,
"wheel_emulation_timeout");
set_integer_property_from_preference(track_point_ui,
- GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA,
- GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA_KEY,
+ GPDS_MOUSE_WHEEL_EMULATION_INERTIA,
+ GPDS_MOUSE_WHEEL_EMULATION_INERTIA_KEY,
builder,
"wheel_emulation_inertia");
@@ -540,7 +596,7 @@
is_available (GpdsUI *ui, GError **error)
{
const gchar *device_name;
- device_name = gpds_track_point_xinput_find_device_name();
+ device_name = gpds_mouse_xinput_find_device_name();
if (!device_name) {
g_set_error(error,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]