Rewrote mouse-properties capplet.
|
@ -1,54 +1,26 @@
|
||||||
cappletname = mouse
|
bin_PROGRAMS = gnome-mouse-properties
|
||||||
cappletgroup =
|
|
||||||
bin_PROGRAMS = mouse-properties-control
|
|
||||||
bin_SCRIPTS = mouse-properties-capplet
|
|
||||||
|
|
||||||
mouse_properties_control_LDADD = $(GNOMECC_CAPPLETS_LIBS)
|
gnome_mouse_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS)
|
||||||
|
|
||||||
mouse_properties_control_SOURCES = \
|
gnome_mouse_properties_SOURCES = \
|
||||||
mouse-properties-capplet.c
|
mouse-properties-capplet.c
|
||||||
|
|
||||||
DESKTOP_EXEC_LINE = gnomecc --run-capplet mouse-properties
|
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
|
||||||
|
pixmap_DATA = \
|
||||||
pixmap_DATA = mouse-left.png mouse-right.png
|
double-click-on.png \
|
||||||
|
double-click-off.png \
|
||||||
defaultsdir= $(datadir)/control-center/defaults
|
double-click-maybe.png \
|
||||||
defaults_DATA = mouse-properties.xml
|
mouse-left-2.png \
|
||||||
|
mouse-right-2.png
|
||||||
oafdir = $(datadir)/oaf
|
Gladedir = $(GNOMECC_GLADE_DIR)
|
||||||
oaf_DATA = Bonobo_Control_Capplet_mouse_properties.oaf
|
Glade_DATA = gnome-mouse-properties.glade
|
||||||
|
|
||||||
##
|
##
|
||||||
## You should not need to modify anything below this line
|
## You should not need to modify anything below this line
|
||||||
##
|
##
|
||||||
@INTLTOOL_DESKTOP_RULE@
|
@INTLTOOL_DESKTOP_RULE@
|
||||||
|
|
||||||
$(bin_SCRIPTS): $(top_srcdir)/capplets/common/wrapper-script.in
|
|
||||||
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@CAPPLET_NAME@#$(cappletname)-properties#" < $< > $@
|
|
||||||
chmod a+x $@
|
|
||||||
|
|
||||||
$(oaf_DATA): %.oaf: $(top_srcdir)/capplets/common/Bonobo_Control_Capplet_generic.oaf.in
|
|
||||||
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@SHORT_CAPPLET_NAME@#$(cappletname)#" -e "s#@CAPPLET_BINARY_NAME@#$(bin_PROGRAMS)#" < $< > $@
|
|
||||||
|
|
||||||
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
|
|
||||||
$(desktop).in: %.desktop.in: %.desktop.in.in
|
|
||||||
sed -e "s#@DESKTOP_EXEC_LINE@#$(DESKTOP_EXEC_LINE)#" -e "s#Icon=.*#Icon=$(GNOMECC_ICONS_DIR)/${cappletname}-capplet.png#" < $< > ${cappletname}.desktop.in
|
|
||||||
|
|
||||||
install-data-local:
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)
|
|
||||||
$(INSTALL_DATA) $(desktop) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)$(desktop)
|
|
||||||
|
|
||||||
install-data-am: install-data-local
|
install-data-am: install-data-local
|
||||||
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
|
|
||||||
|
|
||||||
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)
|
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)
|
||||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
|
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
|
||||||
EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) $(oaf_DATA).in $(defaults_DATA) $(pixmap_DATA)
|
|
||||||
iconsdir = $(GNOMECC_ICONS_DIR)
|
|
||||||
Gladedir = $(GNOMECC_GLADE_DIR)
|
|
||||||
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
|
|
||||||
Glade_DATA = $(cappletname)-properties.glade
|
|
||||||
icons_DATA = $(cappletname)-capplet.png
|
|
||||||
desktop = $(cappletname).desktop
|
|
||||||
oaffile = $(oaf_DATA)
|
|
||||||
all-local: $(desktop)
|
|
||||||
|
|
BIN
capplets/mouse/double-click-maybe.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
capplets/mouse/double-click-off.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
capplets/mouse/double-click-on.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
|
@ -1,287 +1,443 @@
|
||||||
/* -*- mode: c; style: linux -*- */
|
#include <gnome.h>
|
||||||
|
#include <gconf/gconf-client.h>
|
||||||
/* mouse-properties-capplet.c
|
|
||||||
* Copyright (C) 2001 Ximian, Inc.
|
|
||||||
*
|
|
||||||
* Written by Bradford Hovinen <hovinen@ximian.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
* 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "capplet-util.h"
|
|
||||||
#include "bonobo-property-editor-range.h"
|
|
||||||
|
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/* Needed only for the mouse capplet */
|
enum
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <gdk/gdkx.h>
|
|
||||||
|
|
||||||
/* Maximum number of mouse buttons we handle. */
|
|
||||||
#define MAX_BUTTONS 10
|
|
||||||
|
|
||||||
/* Half the number of acceleration levels we support. */
|
|
||||||
#define MAX_ACCEL 3
|
|
||||||
|
|
||||||
/* Maximum threshold we support. */
|
|
||||||
#define MAX_THRESH 7
|
|
||||||
|
|
||||||
/* apply_settings
|
|
||||||
*
|
|
||||||
* Apply the settings of the property bag. This function is per-capplet, though
|
|
||||||
* there are some cases where it does not do anything.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
apply_settings (Bonobo_ConfigDatabase db)
|
|
||||||
{
|
{
|
||||||
unsigned char buttons[MAX_BUTTONS], i;
|
DOUBLE_CLICK_TEST_OFF,
|
||||||
int nbuttons, num, den, idx_1 = 0, idx_3 = 1;
|
DOUBLE_CLICK_TEST_MAYBE,
|
||||||
ulong accel, threshold;
|
DOUBLE_CLICK_TEST_ON,
|
||||||
gboolean rtol;
|
};
|
||||||
CORBA_Environment ev;
|
|
||||||
|
|
||||||
CORBA_exception_init (&ev);
|
GladeXML *xml;
|
||||||
|
GdkPixbuf *left_handed_pixbuf;
|
||||||
|
GdkPixbuf *right_handed_pixbuf;
|
||||||
|
GdkPixbuf *double_click_on_pixbuf;
|
||||||
|
GdkPixbuf *double_click_maybe_pixbuf;
|
||||||
|
GdkPixbuf *double_click_off_pixbuf;
|
||||||
|
GConfClient *client;
|
||||||
|
|
||||||
rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev);
|
gint double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
|
guint32 double_click_timestamp = 0;
|
||||||
|
guint test_maybe_timeout_id = 0;
|
||||||
|
guint test_on_timeout_id = 0;
|
||||||
|
|
||||||
nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS);
|
#define LEFT_HANDED_KEY "/desktop/gnome/peripherals/mouse/left_handed"
|
||||||
|
#define DOUBLE_CLICK_KEY "/desktop/gnome/peripherals/mouse/double_click"
|
||||||
|
#define MOTION_ACCELERATION_KEY "/desktop/gnome/peripherals/mouse/motion_acceleration"
|
||||||
|
#define MOTION_THRESHOLD_KEY "/desktop/gnome/peripherals/mouse/motion_threshold"
|
||||||
|
#define DRAG_THRESHOLD_KEY "/desktop/gnome/peripherals/mouse/drag_threshold"
|
||||||
|
|
||||||
for (i = 0; i < nbuttons; i++) {
|
|
||||||
if (buttons[i] == 1)
|
|
||||||
idx_1 = i;
|
|
||||||
else if (buttons[i] == ((nbuttons < 3) ? 2 : 3))
|
|
||||||
idx_3 = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rtol && idx_1 < idx_3) || (!rtol && idx_1 > idx_3)) {
|
|
||||||
buttons[idx_1] = ((nbuttons < 3) ? 2 : 3);
|
|
||||||
buttons[idx_3] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons);
|
/* normalilzation routines */
|
||||||
|
/* All of our scales but double_click are on the range 1->10 as a result, we
|
||||||
CORBA_exception_init (&ev);
|
* have a few routines to convert from whatever the gconf key is to our range.
|
||||||
|
*/
|
||||||
accel = bonobo_config_get_ulong (db, "/main/acceleration", &ev);
|
static gint
|
||||||
|
double_click_from_gconf (gint double_click)
|
||||||
if (accel < MAX_ACCEL) {
|
{
|
||||||
num = 1;
|
/* watch me be lazy */
|
||||||
den = MAX_ACCEL - accel;
|
if (double_click < 150)
|
||||||
} else {
|
return 100;
|
||||||
num = accel - MAX_ACCEL + 1;
|
else if (double_click < 250)
|
||||||
den = 1;
|
return 200;
|
||||||
}
|
else if (double_click < 350)
|
||||||
|
return 300;
|
||||||
CORBA_exception_init (&ev);
|
else if (double_click < 450)
|
||||||
|
return 400;
|
||||||
threshold = MAX_THRESH - bonobo_config_get_ulong (db, "/main/threshold", &ev);
|
else if (double_click < 550)
|
||||||
|
return 500;
|
||||||
XChangePointerControl (GDK_DISPLAY (), True, True,
|
else if (double_click < 650)
|
||||||
num, den, threshold);
|
return 600;
|
||||||
|
else if (double_click < 750)
|
||||||
CORBA_exception_free (&ev);
|
return 700;
|
||||||
|
else if (double_click < 850)
|
||||||
|
return 800;
|
||||||
|
else if (double_click < 950)
|
||||||
|
return 900;
|
||||||
|
else
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set_pixmap_file
|
static gfloat
|
||||||
*
|
motion_acceleration_from_gconf (gfloat motion_acceleration)
|
||||||
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
motion_acceleration = CLAMP (motion_acceleration, 0.2, 6.0);
|
||||||
GdkPixmap *pixmap;
|
if (motion_acceleration >=1)
|
||||||
GdkBitmap *mask;
|
return motion_acceleration + 4;
|
||||||
|
return motion_acceleration * 5;
|
||||||
|
}
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
static gfloat
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
motion_acceleration_to_gconf (gfloat motion_acceleration)
|
||||||
g_return_if_fail (filename != NULL);
|
{
|
||||||
|
motion_acceleration = CLAMP (motion_acceleration, 1.0, 10.0);
|
||||||
pixbuf = gdk_pixbuf_new_from_file (filename);
|
if (motion_acceleration < 5)
|
||||||
|
return motion_acceleration / 5.0;
|
||||||
if (pixbuf) {
|
return motion_acceleration - 4;
|
||||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 100);
|
}
|
||||||
gtk_pixmap_set (GTK_PIXMAP (widget),
|
static gfloat
|
||||||
pixmap, mask);
|
threshold_from_gconf (gfloat drag_threshold)
|
||||||
gdk_pixbuf_unref (pixbuf);
|
{
|
||||||
}
|
return CLAMP (drag_threshold, 1, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
/* Double Click handling */
|
||||||
mouse_capplet_create_image_widget_canvas (gchar *filename)
|
|
||||||
|
static gboolean
|
||||||
|
test_maybe_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *canvas;
|
GtkWidget *darea;
|
||||||
GdkPixbuf *pixbuf;
|
darea = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
double width, height;
|
double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
gchar *filename_dup;
|
gtk_widget_queue_draw (darea);
|
||||||
|
|
||||||
filename_dup = g_strdup (filename);
|
*((gint *)data) = 0;
|
||||||
pixbuf = gdk_pixbuf_new_from_file (filename_dup);
|
|
||||||
|
|
||||||
if (!pixbuf) {
|
return FALSE;
|
||||||
g_warning ("Pixmap %s not found.", filename_dup);
|
}
|
||||||
g_free (filename_dup);
|
|
||||||
return NULL;
|
static gint
|
||||||
|
drawing_area_button_press_event (GtkWidget *widget,
|
||||||
|
GdkEventButton *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GtkWidget *scale;
|
||||||
|
GtkWidget *darea;
|
||||||
|
gint double_click_time;
|
||||||
|
|
||||||
|
if (event->type != GDK_BUTTON_PRESS)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
scale = glade_xml_get_widget (xml, "delay_scale");
|
||||||
|
double_click_time = 1000 * gtk_range_get_value (GTK_RANGE (scale));
|
||||||
|
darea = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
|
|
||||||
|
if (test_maybe_timeout_id != 0)
|
||||||
|
gtk_timeout_remove (test_maybe_timeout_id);
|
||||||
|
if (test_on_timeout_id != 0)
|
||||||
|
gtk_timeout_remove (test_on_timeout_id);
|
||||||
|
|
||||||
|
switch (double_click_state) {
|
||||||
|
case DOUBLE_CLICK_TEST_OFF:
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_MAYBE;
|
||||||
|
test_maybe_timeout_id = gtk_timeout_add (double_click_time, test_maybe_timeout, &test_maybe_timeout_id);
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_MAYBE:
|
||||||
|
if (event->time - double_click_timestamp < double_click_time) {
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_ON;
|
||||||
|
test_on_timeout_id = gtk_timeout_add (2500, test_maybe_timeout, &test_on_timeout_id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_ON:
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = gdk_pixbuf_get_width (pixbuf);
|
double_click_timestamp = event->time;
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
gtk_widget_queue_draw (darea);
|
||||||
|
|
||||||
canvas = gnome_canvas_new_aa();
|
return TRUE;
|
||||||
GTK_OBJECT_UNSET_FLAGS (GTK_WIDGET (canvas), GTK_CAN_FOCUS);
|
}
|
||||||
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS(canvas)),
|
|
||||||
gnome_canvas_pixbuf_get_type (),
|
static gint
|
||||||
"pixbuf", pixbuf,
|
drawing_area_expose_event (GtkWidget *widget,
|
||||||
|
GdkEventExpose *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
static gboolean first_time = 1;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
if (first_time) {
|
||||||
|
gdk_window_set_events (widget->window, gdk_window_get_events (widget->window) | GDK_BUTTON_PRESS_MASK);
|
||||||
|
g_signal_connect (widget, "button_press_event", (GCallback) drawing_area_button_press_event, NULL);
|
||||||
|
first_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_draw_rectangle (widget->window,
|
||||||
|
widget->style->white_gc,
|
||||||
|
TRUE, 0, 0,
|
||||||
|
widget->allocation.width,
|
||||||
|
widget->allocation.height);
|
||||||
|
|
||||||
|
switch (double_click_state) {
|
||||||
|
case DOUBLE_CLICK_TEST_ON:
|
||||||
|
pixbuf = double_click_on_pixbuf;
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_MAYBE:
|
||||||
|
pixbuf = double_click_maybe_pixbuf;
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_OFF:
|
||||||
|
pixbuf = double_click_off_pixbuf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_pixbuf_render_to_drawable_alpha (pixbuf,
|
||||||
|
widget->window,
|
||||||
|
0, 0,
|
||||||
|
(widget->allocation.width - gdk_pixbuf_get_width (pixbuf))/2,
|
||||||
|
(widget->allocation.height - gdk_pixbuf_get_height (pixbuf))/2,
|
||||||
|
-1, -1,
|
||||||
|
GDK_PIXBUF_ALPHA_FULL,
|
||||||
|
0,
|
||||||
|
GDK_RGB_DITHER_NORMAL,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* capplet->gconf settings */
|
||||||
|
|
||||||
|
static void
|
||||||
|
left_handed_toggle_callback (GtkWidget *toggle, gpointer data)
|
||||||
|
{
|
||||||
|
GtkWidget *image;
|
||||||
|
image = glade_xml_get_widget (xml, "orientation_image");
|
||||||
|
if (GTK_TOGGLE_BUTTON (toggle)->active)
|
||||||
|
g_object_set (G_OBJECT (image),
|
||||||
|
"pixbuf", left_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
g_object_set (G_OBJECT (image),
|
||||||
|
"pixbuf", right_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
gconf_client_set_bool (client, LEFT_HANDED_KEY,
|
||||||
|
GTK_TOGGLE_BUTTON (toggle)->active,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_set_usize (canvas, width, height);
|
|
||||||
|
|
||||||
gdk_pixbuf_unref (pixbuf);
|
|
||||||
gtk_widget_show (canvas);
|
|
||||||
g_free (filename_dup);
|
|
||||||
|
|
||||||
return canvas;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static void
|
||||||
mouse_capplet_create_image_widget (gchar *name,
|
double_click_callback (GtkAdjustment *adjustment, gpointer data)
|
||||||
gchar *string1, gchar *string2,
|
|
||||||
gint int1, gint int2)
|
|
||||||
{
|
{
|
||||||
GtkWidget *canvas, *alignment;
|
gint double_click;
|
||||||
gchar *full_path;
|
|
||||||
|
|
||||||
if (!string1)
|
double_click = gtk_adjustment_get_value (adjustment) * 1000;
|
||||||
return NULL;
|
/* we normalize this to avoid loops */
|
||||||
|
if (double_click != double_click_from_gconf (double_click)) {
|
||||||
|
gtk_adjustment_set_value (adjustment, (double_click_from_gconf (double_click))/1000.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
full_path = g_strdup_printf ("%s/%s", GNOMECC_PIXMAPS_DIR, string1);
|
gconf_client_set_int (client, DOUBLE_CLICK_KEY,
|
||||||
canvas = mouse_capplet_create_image_widget_canvas (full_path);
|
double_click,
|
||||||
g_free (full_path);
|
NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (canvas != NULL, NULL);
|
|
||||||
|
|
||||||
alignment = gtk_widget_new (gtk_alignment_get_type(),
|
|
||||||
"child", canvas,
|
|
||||||
"xalign", (double) 0,
|
|
||||||
"yalign", (double) 0,
|
|
||||||
"xscale", (double) 0,
|
|
||||||
"yscale", (double) 0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_widget_show (alignment);
|
|
||||||
|
|
||||||
return alignment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
/**
|
threshold_callback (GtkAdjustment *adjustment, gpointer key)
|
||||||
* xst_fool_the_linker:
|
|
||||||
* @void:
|
|
||||||
*
|
|
||||||
* We need to keep the symbol for the create image widget function
|
|
||||||
* so that libglade can find it to create the icons.
|
|
||||||
**/
|
|
||||||
void capplet_fool_the_linker (void);
|
|
||||||
void
|
|
||||||
capplet_fool_the_linker (void)
|
|
||||||
{
|
{
|
||||||
mouse_capplet_create_image_widget (NULL, NULL, NULL, 0, 0);
|
gint threshold;
|
||||||
|
|
||||||
|
threshold = (gint) rint (gtk_adjustment_get_value (adjustment));
|
||||||
|
|
||||||
|
gconf_client_set_int (client, (char *) key,
|
||||||
|
threshold,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create_dialog
|
static void
|
||||||
*
|
acceleration_callback (GtkAdjustment *adjustment, gpointer data)
|
||||||
* Create the dialog box and return it as a GtkWidget
|
{
|
||||||
*/
|
gfloat acceleration;
|
||||||
|
|
||||||
static GtkWidget *
|
acceleration = gtk_adjustment_get_value (adjustment);
|
||||||
create_dialog (void)
|
gconf_client_set_float (client, MOTION_ACCELERATION_KEY,
|
||||||
|
motion_acceleration_to_gconf (acceleration),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gconf->capplet */
|
||||||
|
static void
|
||||||
|
gconf_changed_callback (GConfClient *client,
|
||||||
|
guint cnxn_id,
|
||||||
|
GConfEntry *entry,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GladeXML *dialog;
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
const gchar *key = gconf_entry_get_key (entry);
|
||||||
|
|
||||||
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/mouse-properties.glade", "prefs_widget");
|
if (! strcmp (key, LEFT_HANDED_KEY)) {
|
||||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
gboolean left_handed;
|
||||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
|
||||||
|
|
||||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
left_handed = gconf_value_get_bool (gconf_entry_get_value (entry));
|
||||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
widget = glade_xml_get_widget (xml, "left_handed_toggle");
|
||||||
GTK_OBJECT (dialog));
|
if (left_handed != GTK_TOGGLE_BUTTON (widget)->active)
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), left_handed);
|
||||||
|
} else if (! strcmp (key, DOUBLE_CLICK_KEY)) {
|
||||||
|
int double_click;
|
||||||
|
|
||||||
return widget;
|
double_click = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
double_click = double_click_from_gconf (double_click);
|
||||||
|
widget = glade_xml_get_widget (xml, "delay_scale");
|
||||||
|
if (double_click != (gint) 1000*gtk_range_get_value (GTK_RANGE (widget)))
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)double_click/1000.0);
|
||||||
|
} else if (! strcmp (key, MOTION_ACCELERATION_KEY)) {
|
||||||
|
gfloat acceleration;
|
||||||
|
|
||||||
|
acceleration = gconf_value_get_float (gconf_entry_get_value (entry));
|
||||||
|
acceleration = motion_acceleration_from_gconf (acceleration);
|
||||||
|
widget = glade_xml_get_widget (xml, "accel_scale");
|
||||||
|
if (ABS (acceleration - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), acceleration);
|
||||||
|
} else if (! strcmp (key, MOTION_THRESHOLD_KEY)) {
|
||||||
|
int threshold;
|
||||||
|
|
||||||
|
threshold = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
widget = glade_xml_get_widget (xml, "sensitivity_scale");
|
||||||
|
if (ABS (threshold - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)threshold);
|
||||||
|
} else if (! strcmp (key, DRAG_THRESHOLD_KEY)) {
|
||||||
|
int threshold;
|
||||||
|
|
||||||
|
threshold = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
widget = glade_xml_get_widget (xml, "drag_threshold_scale");
|
||||||
|
if (ABS (threshold - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)threshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup_dialog
|
|
||||||
*
|
|
||||||
* Set up the property editors for our dialog
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_dialog (GtkWidget *widget, Bonobo_PropertyBag bag)
|
setup_dialog (void)
|
||||||
{
|
{
|
||||||
GladeXML *dialog;
|
GtkSizeGroup *size_group;
|
||||||
BonoboPEditor *ed;
|
GtkWidget *widget;
|
||||||
GtkWidget *rbs[3];
|
int double_click;
|
||||||
|
int threshold;
|
||||||
|
gfloat acceleration;
|
||||||
|
|
||||||
dialog = gtk_object_get_data (GTK_OBJECT (widget), "glade-data");
|
client = gconf_client_get_default ();
|
||||||
|
gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
gconf_client_notify_add (client, "/desktop/gnome/peripherals/mouse",
|
||||||
|
gconf_changed_callback,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
rbs[0] = WID ("right_handed_select");
|
/* Buttons page
|
||||||
rbs[1] = WID ("left_handed_select");
|
*/
|
||||||
rbs[2] = NULL;
|
/* Left-handed toggle */
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_option_radio_construct (rbs));
|
left_handed_pixbuf = gdk_pixbuf_new_from_file ("mouse-left.png", NULL);
|
||||||
bonobo_peditor_set_property (ed, bag, "right-to-left", TC_ulong, NULL);
|
right_handed_pixbuf = gdk_pixbuf_new_from_file ("mouse-right.png", NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "left_handed_toggle");
|
||||||
|
if (gconf_client_get_bool (client, LEFT_HANDED_KEY, NULL))
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
||||||
|
else
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||||
|
g_signal_connect (widget, "toggled", (GCallback) left_handed_toggle_callback, NULL);
|
||||||
|
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("acceleration_entry")));
|
widget = glade_xml_get_widget (xml, "orientation_image");
|
||||||
bonobo_peditor_set_property (ed, bag, "acceleration", TC_ulong, NULL);
|
if (gconf_client_get_bool (client, LEFT_HANDED_KEY, NULL))
|
||||||
|
g_object_set (G_OBJECT (widget),
|
||||||
|
"pixbuf", left_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
g_object_set (G_OBJECT (widget),
|
||||||
|
"pixbuf", right_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("sensitivity_entry")));
|
/* Double-click time */
|
||||||
bonobo_peditor_set_property (ed, bag, "threshold", TC_ulong, NULL);
|
double_click_on_pixbuf = gdk_pixbuf_new_from_file ("double-click-on.png", NULL);
|
||||||
}
|
double_click_maybe_pixbuf = gdk_pixbuf_new_from_file ("double-click-maybe.png", NULL);
|
||||||
|
double_click_off_pixbuf = gdk_pixbuf_new_from_file ("double-click-off.png", NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
|
g_signal_connect (widget, "expose_event", (GCallback) drawing_area_expose_event, NULL);
|
||||||
|
|
||||||
/* get_legacy_settings
|
double_click = gconf_client_get_int (client, DOUBLE_CLICK_KEY, NULL);
|
||||||
*
|
double_click = double_click_from_gconf (double_click);
|
||||||
* Retrieve older gnome_config -style settings and store them in the
|
widget = glade_xml_get_widget (xml, "delay_scale");
|
||||||
* configuration database.
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)double_click/1000.0);
|
||||||
*
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
* In most cases, it's best to use the COPY_FROM_LEGACY macro defined in
|
"value_changed",
|
||||||
* capplets/common/capplet-util.h.
|
(GCallback) double_click_callback,
|
||||||
*/
|
NULL);
|
||||||
|
|
||||||
static void
|
/* Cursors page */
|
||||||
get_legacy_settings (Bonobo_ConfigDatabase db)
|
widget = glade_xml_get_widget (xml, "main_notebook");
|
||||||
{
|
gtk_notebook_remove_page (GTK_NOTEBOOK (widget), 1);
|
||||||
gboolean val_boolean, def;
|
|
||||||
gulong val_ulong;
|
|
||||||
|
|
||||||
COPY_FROM_LEGACY (boolean, "/main/right-to-left", bool, "/Desktop/Mouse/right-to-left");
|
/* Motion page */
|
||||||
COPY_FROM_LEGACY (ulong, "/main/acceleration", int, "/Desktop/Mouse/aceleration=4");
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
COPY_FROM_LEGACY (ulong, "/main/threshold", int, "/Desktop/Mouse/threshold=4");
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "acceleration_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "sensitivity_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "threshold_label"));
|
||||||
|
|
||||||
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "high_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "fast_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "large_label"));
|
||||||
|
|
||||||
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "low_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "slow_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "small_label"));
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "accel_scale");
|
||||||
|
acceleration = gconf_client_get_float (client, MOTION_ACCELERATION_KEY, NULL);
|
||||||
|
acceleration = motion_acceleration_from_gconf (acceleration);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), acceleration);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) acceleration_callback,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "sensitivity_scale");
|
||||||
|
threshold = gconf_client_get_int (client, MOTION_THRESHOLD_KEY, NULL);
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), threshold);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) threshold_callback,
|
||||||
|
MOTION_THRESHOLD_KEY);
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "drag_threshold_scale");
|
||||||
|
threshold = gconf_client_get_int (client, DRAG_THRESHOLD_KEY, NULL);
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), threshold);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) threshold_callback,
|
||||||
|
DRAG_THRESHOLD_KEY);
|
||||||
|
|
||||||
|
/* main dialog */
|
||||||
|
widget = glade_xml_get_widget (xml, "mouse_properties_dialog");
|
||||||
|
g_signal_connect (G_OBJECT (widget),
|
||||||
|
"destroy",
|
||||||
|
gtk_main_quit, NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "close_button");
|
||||||
|
g_signal_connect (G_OBJECT (widget),
|
||||||
|
"clicked",
|
||||||
|
gtk_main_quit, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const gchar *legacy_files[] = { "Desktop", NULL };
|
gnome_program_init ("mouse-properties",
|
||||||
|
"0.1",
|
||||||
|
gnome_gtk_module_info_get (),
|
||||||
|
argc, argv,
|
||||||
|
NULL);
|
||||||
|
|
||||||
glade_gnome_init ();
|
xml = glade_xml_new ("gnome-mouse-properties.glade", NULL, NULL);
|
||||||
capplet_init (argc, argv, legacy_files, apply_settings, create_dialog, setup_dialog, get_legacy_settings);
|
setup_dialog ();
|
||||||
|
gtk_widget_show_all (glade_xml_get_widget (xml, "mouse_properties_dialog"));
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (client));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
790
capplets/mouse/gnome-mouse-properties.glade
Normal file
|
@ -0,0 +1,790 @@
|
||||||
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||||
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd" >
|
||||||
|
|
||||||
|
<glade-interface>
|
||||||
|
<widget class="GtkDialog" id="mouse_properties_dialog">
|
||||||
|
<property name="title" translatable="yes">Mouse Properties</property>
|
||||||
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
<property name="modal">no</property>
|
||||||
|
<property name="allow_shrink">no</property>
|
||||||
|
<property name="allow_grow">no</property>
|
||||||
|
<property name="visible">no</property>
|
||||||
|
<property name="window-position">GTK_WIN_POS_NONE</property>
|
||||||
|
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<widget class="GtkVBox" id="dialog-vbox1">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="help_button">
|
||||||
|
<property name="can_default">yes</property>
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="label" translatable="yes">gtk-help</property>
|
||||||
|
<property name="use_stock">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="close_button">
|
||||||
|
<property name="can_default">yes</property>
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="label" translatable="yes">gtk-close</property>
|
||||||
|
<property name="use_stock">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkNotebook" id="main_notebook">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="show_tabs">yes</property>
|
||||||
|
<property name="show_border">yes</property>
|
||||||
|
<property name="tab_pos">GTK_POS_TOP</property>
|
||||||
|
<property name="scrollable">no</property>
|
||||||
|
<property name="tab_hborder">2</property>
|
||||||
|
<property name="tab_vborder">2</property>
|
||||||
|
<property name="enable-popup">no</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox1">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame1">
|
||||||
|
<property name="label" translatable="yes">Mouse Orientation</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox1">
|
||||||
|
<property name="border_width">8</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox2">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="left_handed_toggle">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="label" translatable="yes">_Left-handed mouse</property>
|
||||||
|
<property name="active">no</property>
|
||||||
|
<property name="draw_indicator">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label4">
|
||||||
|
<property name="label" translatable="yes">Left-handed mouse mode switches the left and right buttons on the mouse.</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">yes</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="orientation_image">
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame2">
|
||||||
|
<property name="label" translatable="yes">Double-click Delay</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="border_width">8</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox3">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox3">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label5">
|
||||||
|
<property name="label" translatable="yes">_Delay (sec):</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">1</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="mnemonic_widget">delay_scale</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHScale" id="delay_scale">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="draw_value">yes</property>
|
||||||
|
<property name="value_pos">GTK_POS_TOP</property>
|
||||||
|
<property name="digits">1</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="adjustment">0.4 0.1 1.1 0.1 0.1 0.1</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label7">
|
||||||
|
<property name="label" translatable="yes">Maximum time allowed between clicks when double-clicking. Use the box on the right to test.</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">yes</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xscale">0</property>
|
||||||
|
<property name="yscale">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame4">
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_OUT</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkDrawingArea" id="double_click_darea">
|
||||||
|
<property name="width-request">100</property>
|
||||||
|
<property name="height-request">100</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label1">
|
||||||
|
<property name="label" translatable="yes">_Buttons</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame6">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="label" translatable="yes">Mouse Cursor</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox6">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="placeholderlabel">
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label19">
|
||||||
|
<property name="label" translatable="yes">You will need to restart your login session for this setting to take effect.</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">yes</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label2">
|
||||||
|
<property name="label" translatable="yes">_Cursors</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox4">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame3">
|
||||||
|
<property name="label" translatable="yes">Speed</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox4">
|
||||||
|
<property name="border_width">8</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTable" id="table1">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="row_spacing">4</property>
|
||||||
|
<property name="column_spacing">4</property>
|
||||||
|
<property name="n-rows">2</property>
|
||||||
|
<property name="n-columns">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="acceleration_label">
|
||||||
|
<property name="label" translatable="yes">_Acceleration:</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="mnemonic_widget">accel_scale</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="right_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="sensitivity_label">
|
||||||
|
<property name="label" translatable="yes">_Sensitivity:</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="mnemonic_widget">sensitivity_scale</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="right_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="fast_label">
|
||||||
|
<property name="label" translatable="yes"><i>Fast</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="right_attach">4</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="high_label">
|
||||||
|
<property name="label" translatable="yes"><i>High</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="right_attach">4</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHScale" id="sensitivity_scale">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
|
||||||
|
<property name="draw_value">no</property>
|
||||||
|
<property name="value_pos">GTK_POS_TOP</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="adjustment">1 1 10 1 1 1</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="right_attach">3</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">expand|fill</property>
|
||||||
|
<property name="y_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHScale" id="accel_scale">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
|
||||||
|
<property name="draw_value">no</property>
|
||||||
|
<property name="value_pos">GTK_POS_RIGHT</property>
|
||||||
|
<property name="digits">1</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="adjustment">1 1 10 1 1 1</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="right_attach">3</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="slow_label">
|
||||||
|
<property name="label" translatable="yes"><i>Slow</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="low_label">
|
||||||
|
<property name="label" translatable="yes"><i>Low</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_padding">0</property>
|
||||||
|
<property name="y_padding">0</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label12">
|
||||||
|
<property name="label" translatable="yes">Set the speed of your pointing device.</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">yes</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame5">
|
||||||
|
<property name="label" translatable="yes">Drag and Drop</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox5">
|
||||||
|
<property name="border_width">8</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox5">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="threshold_label">
|
||||||
|
<property name="label" translatable="yes">_Threshold:</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="mnemonic_widget">drag_threshold_scale</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="small_label">
|
||||||
|
<property name="label" translatable="yes"><i>Small</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHScale" id="drag_threshold_scale">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="draw_value">no</property>
|
||||||
|
<property name="value_pos">GTK_POS_TOP</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
|
||||||
|
<property name="adjustment">1 1 10 1 1 1</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="large_label">
|
||||||
|
<property name="label" translatable="yes"><i>Large</i></property>
|
||||||
|
<property name="use_markup">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label18">
|
||||||
|
<property name="label" translatable="yes">Set the distance you need to move your cursor before dragging an item.</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">yes</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label3">
|
||||||
|
<property name="label" translatable="yes">_Motion</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">4</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</glade-interface>
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.4 KiB |
|
@ -1,287 +1,443 @@
|
||||||
/* -*- mode: c; style: linux -*- */
|
#include <gnome.h>
|
||||||
|
#include <gconf/gconf-client.h>
|
||||||
/* mouse-properties-capplet.c
|
|
||||||
* Copyright (C) 2001 Ximian, Inc.
|
|
||||||
*
|
|
||||||
* Written by Bradford Hovinen <hovinen@ximian.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
* 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "capplet-util.h"
|
|
||||||
#include "bonobo-property-editor-range.h"
|
|
||||||
|
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/* Needed only for the mouse capplet */
|
enum
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <gdk/gdkx.h>
|
|
||||||
|
|
||||||
/* Maximum number of mouse buttons we handle. */
|
|
||||||
#define MAX_BUTTONS 10
|
|
||||||
|
|
||||||
/* Half the number of acceleration levels we support. */
|
|
||||||
#define MAX_ACCEL 3
|
|
||||||
|
|
||||||
/* Maximum threshold we support. */
|
|
||||||
#define MAX_THRESH 7
|
|
||||||
|
|
||||||
/* apply_settings
|
|
||||||
*
|
|
||||||
* Apply the settings of the property bag. This function is per-capplet, though
|
|
||||||
* there are some cases where it does not do anything.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
apply_settings (Bonobo_ConfigDatabase db)
|
|
||||||
{
|
{
|
||||||
unsigned char buttons[MAX_BUTTONS], i;
|
DOUBLE_CLICK_TEST_OFF,
|
||||||
int nbuttons, num, den, idx_1 = 0, idx_3 = 1;
|
DOUBLE_CLICK_TEST_MAYBE,
|
||||||
ulong accel, threshold;
|
DOUBLE_CLICK_TEST_ON,
|
||||||
gboolean rtol;
|
};
|
||||||
CORBA_Environment ev;
|
|
||||||
|
|
||||||
CORBA_exception_init (&ev);
|
GladeXML *xml;
|
||||||
|
GdkPixbuf *left_handed_pixbuf;
|
||||||
|
GdkPixbuf *right_handed_pixbuf;
|
||||||
|
GdkPixbuf *double_click_on_pixbuf;
|
||||||
|
GdkPixbuf *double_click_maybe_pixbuf;
|
||||||
|
GdkPixbuf *double_click_off_pixbuf;
|
||||||
|
GConfClient *client;
|
||||||
|
|
||||||
rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev);
|
gint double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
|
guint32 double_click_timestamp = 0;
|
||||||
|
guint test_maybe_timeout_id = 0;
|
||||||
|
guint test_on_timeout_id = 0;
|
||||||
|
|
||||||
nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS);
|
#define LEFT_HANDED_KEY "/desktop/gnome/peripherals/mouse/left_handed"
|
||||||
|
#define DOUBLE_CLICK_KEY "/desktop/gnome/peripherals/mouse/double_click"
|
||||||
|
#define MOTION_ACCELERATION_KEY "/desktop/gnome/peripherals/mouse/motion_acceleration"
|
||||||
|
#define MOTION_THRESHOLD_KEY "/desktop/gnome/peripherals/mouse/motion_threshold"
|
||||||
|
#define DRAG_THRESHOLD_KEY "/desktop/gnome/peripherals/mouse/drag_threshold"
|
||||||
|
|
||||||
for (i = 0; i < nbuttons; i++) {
|
|
||||||
if (buttons[i] == 1)
|
|
||||||
idx_1 = i;
|
|
||||||
else if (buttons[i] == ((nbuttons < 3) ? 2 : 3))
|
|
||||||
idx_3 = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rtol && idx_1 < idx_3) || (!rtol && idx_1 > idx_3)) {
|
|
||||||
buttons[idx_1] = ((nbuttons < 3) ? 2 : 3);
|
|
||||||
buttons[idx_3] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons);
|
/* normalilzation routines */
|
||||||
|
/* All of our scales but double_click are on the range 1->10 as a result, we
|
||||||
CORBA_exception_init (&ev);
|
* have a few routines to convert from whatever the gconf key is to our range.
|
||||||
|
*/
|
||||||
accel = bonobo_config_get_ulong (db, "/main/acceleration", &ev);
|
static gint
|
||||||
|
double_click_from_gconf (gint double_click)
|
||||||
if (accel < MAX_ACCEL) {
|
{
|
||||||
num = 1;
|
/* watch me be lazy */
|
||||||
den = MAX_ACCEL - accel;
|
if (double_click < 150)
|
||||||
} else {
|
return 100;
|
||||||
num = accel - MAX_ACCEL + 1;
|
else if (double_click < 250)
|
||||||
den = 1;
|
return 200;
|
||||||
}
|
else if (double_click < 350)
|
||||||
|
return 300;
|
||||||
CORBA_exception_init (&ev);
|
else if (double_click < 450)
|
||||||
|
return 400;
|
||||||
threshold = MAX_THRESH - bonobo_config_get_ulong (db, "/main/threshold", &ev);
|
else if (double_click < 550)
|
||||||
|
return 500;
|
||||||
XChangePointerControl (GDK_DISPLAY (), True, True,
|
else if (double_click < 650)
|
||||||
num, den, threshold);
|
return 600;
|
||||||
|
else if (double_click < 750)
|
||||||
CORBA_exception_free (&ev);
|
return 700;
|
||||||
|
else if (double_click < 850)
|
||||||
|
return 800;
|
||||||
|
else if (double_click < 950)
|
||||||
|
return 900;
|
||||||
|
else
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set_pixmap_file
|
static gfloat
|
||||||
*
|
motion_acceleration_from_gconf (gfloat motion_acceleration)
|
||||||
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
motion_acceleration = CLAMP (motion_acceleration, 0.2, 6.0);
|
||||||
GdkPixmap *pixmap;
|
if (motion_acceleration >=1)
|
||||||
GdkBitmap *mask;
|
return motion_acceleration + 4;
|
||||||
|
return motion_acceleration * 5;
|
||||||
|
}
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
static gfloat
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
motion_acceleration_to_gconf (gfloat motion_acceleration)
|
||||||
g_return_if_fail (filename != NULL);
|
{
|
||||||
|
motion_acceleration = CLAMP (motion_acceleration, 1.0, 10.0);
|
||||||
pixbuf = gdk_pixbuf_new_from_file (filename);
|
if (motion_acceleration < 5)
|
||||||
|
return motion_acceleration / 5.0;
|
||||||
if (pixbuf) {
|
return motion_acceleration - 4;
|
||||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 100);
|
}
|
||||||
gtk_pixmap_set (GTK_PIXMAP (widget),
|
static gfloat
|
||||||
pixmap, mask);
|
threshold_from_gconf (gfloat drag_threshold)
|
||||||
gdk_pixbuf_unref (pixbuf);
|
{
|
||||||
}
|
return CLAMP (drag_threshold, 1, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
/* Double Click handling */
|
||||||
mouse_capplet_create_image_widget_canvas (gchar *filename)
|
|
||||||
|
static gboolean
|
||||||
|
test_maybe_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *canvas;
|
GtkWidget *darea;
|
||||||
GdkPixbuf *pixbuf;
|
darea = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
double width, height;
|
double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
gchar *filename_dup;
|
gtk_widget_queue_draw (darea);
|
||||||
|
|
||||||
filename_dup = g_strdup (filename);
|
*((gint *)data) = 0;
|
||||||
pixbuf = gdk_pixbuf_new_from_file (filename_dup);
|
|
||||||
|
|
||||||
if (!pixbuf) {
|
return FALSE;
|
||||||
g_warning ("Pixmap %s not found.", filename_dup);
|
}
|
||||||
g_free (filename_dup);
|
|
||||||
return NULL;
|
static gint
|
||||||
|
drawing_area_button_press_event (GtkWidget *widget,
|
||||||
|
GdkEventButton *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GtkWidget *scale;
|
||||||
|
GtkWidget *darea;
|
||||||
|
gint double_click_time;
|
||||||
|
|
||||||
|
if (event->type != GDK_BUTTON_PRESS)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
scale = glade_xml_get_widget (xml, "delay_scale");
|
||||||
|
double_click_time = 1000 * gtk_range_get_value (GTK_RANGE (scale));
|
||||||
|
darea = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
|
|
||||||
|
if (test_maybe_timeout_id != 0)
|
||||||
|
gtk_timeout_remove (test_maybe_timeout_id);
|
||||||
|
if (test_on_timeout_id != 0)
|
||||||
|
gtk_timeout_remove (test_on_timeout_id);
|
||||||
|
|
||||||
|
switch (double_click_state) {
|
||||||
|
case DOUBLE_CLICK_TEST_OFF:
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_MAYBE;
|
||||||
|
test_maybe_timeout_id = gtk_timeout_add (double_click_time, test_maybe_timeout, &test_maybe_timeout_id);
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_MAYBE:
|
||||||
|
if (event->time - double_click_timestamp < double_click_time) {
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_ON;
|
||||||
|
test_on_timeout_id = gtk_timeout_add (2500, test_maybe_timeout, &test_on_timeout_id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_ON:
|
||||||
|
double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = gdk_pixbuf_get_width (pixbuf);
|
double_click_timestamp = event->time;
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
gtk_widget_queue_draw (darea);
|
||||||
|
|
||||||
canvas = gnome_canvas_new_aa();
|
return TRUE;
|
||||||
GTK_OBJECT_UNSET_FLAGS (GTK_WIDGET (canvas), GTK_CAN_FOCUS);
|
}
|
||||||
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS(canvas)),
|
|
||||||
gnome_canvas_pixbuf_get_type (),
|
static gint
|
||||||
"pixbuf", pixbuf,
|
drawing_area_expose_event (GtkWidget *widget,
|
||||||
|
GdkEventExpose *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
static gboolean first_time = 1;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
if (first_time) {
|
||||||
|
gdk_window_set_events (widget->window, gdk_window_get_events (widget->window) | GDK_BUTTON_PRESS_MASK);
|
||||||
|
g_signal_connect (widget, "button_press_event", (GCallback) drawing_area_button_press_event, NULL);
|
||||||
|
first_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_draw_rectangle (widget->window,
|
||||||
|
widget->style->white_gc,
|
||||||
|
TRUE, 0, 0,
|
||||||
|
widget->allocation.width,
|
||||||
|
widget->allocation.height);
|
||||||
|
|
||||||
|
switch (double_click_state) {
|
||||||
|
case DOUBLE_CLICK_TEST_ON:
|
||||||
|
pixbuf = double_click_on_pixbuf;
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_MAYBE:
|
||||||
|
pixbuf = double_click_maybe_pixbuf;
|
||||||
|
break;
|
||||||
|
case DOUBLE_CLICK_TEST_OFF:
|
||||||
|
pixbuf = double_click_off_pixbuf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_pixbuf_render_to_drawable_alpha (pixbuf,
|
||||||
|
widget->window,
|
||||||
|
0, 0,
|
||||||
|
(widget->allocation.width - gdk_pixbuf_get_width (pixbuf))/2,
|
||||||
|
(widget->allocation.height - gdk_pixbuf_get_height (pixbuf))/2,
|
||||||
|
-1, -1,
|
||||||
|
GDK_PIXBUF_ALPHA_FULL,
|
||||||
|
0,
|
||||||
|
GDK_RGB_DITHER_NORMAL,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* capplet->gconf settings */
|
||||||
|
|
||||||
|
static void
|
||||||
|
left_handed_toggle_callback (GtkWidget *toggle, gpointer data)
|
||||||
|
{
|
||||||
|
GtkWidget *image;
|
||||||
|
image = glade_xml_get_widget (xml, "orientation_image");
|
||||||
|
if (GTK_TOGGLE_BUTTON (toggle)->active)
|
||||||
|
g_object_set (G_OBJECT (image),
|
||||||
|
"pixbuf", left_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
g_object_set (G_OBJECT (image),
|
||||||
|
"pixbuf", right_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
gconf_client_set_bool (client, LEFT_HANDED_KEY,
|
||||||
|
GTK_TOGGLE_BUTTON (toggle)->active,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_set_usize (canvas, width, height);
|
|
||||||
|
|
||||||
gdk_pixbuf_unref (pixbuf);
|
|
||||||
gtk_widget_show (canvas);
|
|
||||||
g_free (filename_dup);
|
|
||||||
|
|
||||||
return canvas;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static void
|
||||||
mouse_capplet_create_image_widget (gchar *name,
|
double_click_callback (GtkAdjustment *adjustment, gpointer data)
|
||||||
gchar *string1, gchar *string2,
|
|
||||||
gint int1, gint int2)
|
|
||||||
{
|
{
|
||||||
GtkWidget *canvas, *alignment;
|
gint double_click;
|
||||||
gchar *full_path;
|
|
||||||
|
|
||||||
if (!string1)
|
double_click = gtk_adjustment_get_value (adjustment) * 1000;
|
||||||
return NULL;
|
/* we normalize this to avoid loops */
|
||||||
|
if (double_click != double_click_from_gconf (double_click)) {
|
||||||
|
gtk_adjustment_set_value (adjustment, (double_click_from_gconf (double_click))/1000.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
full_path = g_strdup_printf ("%s/%s", GNOMECC_PIXMAPS_DIR, string1);
|
gconf_client_set_int (client, DOUBLE_CLICK_KEY,
|
||||||
canvas = mouse_capplet_create_image_widget_canvas (full_path);
|
double_click,
|
||||||
g_free (full_path);
|
NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (canvas != NULL, NULL);
|
|
||||||
|
|
||||||
alignment = gtk_widget_new (gtk_alignment_get_type(),
|
|
||||||
"child", canvas,
|
|
||||||
"xalign", (double) 0,
|
|
||||||
"yalign", (double) 0,
|
|
||||||
"xscale", (double) 0,
|
|
||||||
"yscale", (double) 0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_widget_show (alignment);
|
|
||||||
|
|
||||||
return alignment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
/**
|
threshold_callback (GtkAdjustment *adjustment, gpointer key)
|
||||||
* xst_fool_the_linker:
|
|
||||||
* @void:
|
|
||||||
*
|
|
||||||
* We need to keep the symbol for the create image widget function
|
|
||||||
* so that libglade can find it to create the icons.
|
|
||||||
**/
|
|
||||||
void capplet_fool_the_linker (void);
|
|
||||||
void
|
|
||||||
capplet_fool_the_linker (void)
|
|
||||||
{
|
{
|
||||||
mouse_capplet_create_image_widget (NULL, NULL, NULL, 0, 0);
|
gint threshold;
|
||||||
|
|
||||||
|
threshold = (gint) rint (gtk_adjustment_get_value (adjustment));
|
||||||
|
|
||||||
|
gconf_client_set_int (client, (char *) key,
|
||||||
|
threshold,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create_dialog
|
static void
|
||||||
*
|
acceleration_callback (GtkAdjustment *adjustment, gpointer data)
|
||||||
* Create the dialog box and return it as a GtkWidget
|
{
|
||||||
*/
|
gfloat acceleration;
|
||||||
|
|
||||||
static GtkWidget *
|
acceleration = gtk_adjustment_get_value (adjustment);
|
||||||
create_dialog (void)
|
gconf_client_set_float (client, MOTION_ACCELERATION_KEY,
|
||||||
|
motion_acceleration_to_gconf (acceleration),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gconf->capplet */
|
||||||
|
static void
|
||||||
|
gconf_changed_callback (GConfClient *client,
|
||||||
|
guint cnxn_id,
|
||||||
|
GConfEntry *entry,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GladeXML *dialog;
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
const gchar *key = gconf_entry_get_key (entry);
|
||||||
|
|
||||||
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/mouse-properties.glade", "prefs_widget");
|
if (! strcmp (key, LEFT_HANDED_KEY)) {
|
||||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
gboolean left_handed;
|
||||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
|
||||||
|
|
||||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
left_handed = gconf_value_get_bool (gconf_entry_get_value (entry));
|
||||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
widget = glade_xml_get_widget (xml, "left_handed_toggle");
|
||||||
GTK_OBJECT (dialog));
|
if (left_handed != GTK_TOGGLE_BUTTON (widget)->active)
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), left_handed);
|
||||||
|
} else if (! strcmp (key, DOUBLE_CLICK_KEY)) {
|
||||||
|
int double_click;
|
||||||
|
|
||||||
return widget;
|
double_click = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
double_click = double_click_from_gconf (double_click);
|
||||||
|
widget = glade_xml_get_widget (xml, "delay_scale");
|
||||||
|
if (double_click != (gint) 1000*gtk_range_get_value (GTK_RANGE (widget)))
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)double_click/1000.0);
|
||||||
|
} else if (! strcmp (key, MOTION_ACCELERATION_KEY)) {
|
||||||
|
gfloat acceleration;
|
||||||
|
|
||||||
|
acceleration = gconf_value_get_float (gconf_entry_get_value (entry));
|
||||||
|
acceleration = motion_acceleration_from_gconf (acceleration);
|
||||||
|
widget = glade_xml_get_widget (xml, "accel_scale");
|
||||||
|
if (ABS (acceleration - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), acceleration);
|
||||||
|
} else if (! strcmp (key, MOTION_THRESHOLD_KEY)) {
|
||||||
|
int threshold;
|
||||||
|
|
||||||
|
threshold = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
widget = glade_xml_get_widget (xml, "sensitivity_scale");
|
||||||
|
if (ABS (threshold - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)threshold);
|
||||||
|
} else if (! strcmp (key, DRAG_THRESHOLD_KEY)) {
|
||||||
|
int threshold;
|
||||||
|
|
||||||
|
threshold = gconf_value_get_int (gconf_entry_get_value (entry));
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
widget = glade_xml_get_widget (xml, "drag_threshold_scale");
|
||||||
|
if (ABS (threshold - gtk_range_get_value (GTK_RANGE (widget))) > 0.001)
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)threshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup_dialog
|
|
||||||
*
|
|
||||||
* Set up the property editors for our dialog
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_dialog (GtkWidget *widget, Bonobo_PropertyBag bag)
|
setup_dialog (void)
|
||||||
{
|
{
|
||||||
GladeXML *dialog;
|
GtkSizeGroup *size_group;
|
||||||
BonoboPEditor *ed;
|
GtkWidget *widget;
|
||||||
GtkWidget *rbs[3];
|
int double_click;
|
||||||
|
int threshold;
|
||||||
|
gfloat acceleration;
|
||||||
|
|
||||||
dialog = gtk_object_get_data (GTK_OBJECT (widget), "glade-data");
|
client = gconf_client_get_default ();
|
||||||
|
gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
gconf_client_notify_add (client, "/desktop/gnome/peripherals/mouse",
|
||||||
|
gconf_changed_callback,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
rbs[0] = WID ("right_handed_select");
|
/* Buttons page
|
||||||
rbs[1] = WID ("left_handed_select");
|
*/
|
||||||
rbs[2] = NULL;
|
/* Left-handed toggle */
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_option_radio_construct (rbs));
|
left_handed_pixbuf = gdk_pixbuf_new_from_file ("mouse-left.png", NULL);
|
||||||
bonobo_peditor_set_property (ed, bag, "right-to-left", TC_ulong, NULL);
|
right_handed_pixbuf = gdk_pixbuf_new_from_file ("mouse-right.png", NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "left_handed_toggle");
|
||||||
|
if (gconf_client_get_bool (client, LEFT_HANDED_KEY, NULL))
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
||||||
|
else
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||||
|
g_signal_connect (widget, "toggled", (GCallback) left_handed_toggle_callback, NULL);
|
||||||
|
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("acceleration_entry")));
|
widget = glade_xml_get_widget (xml, "orientation_image");
|
||||||
bonobo_peditor_set_property (ed, bag, "acceleration", TC_ulong, NULL);
|
if (gconf_client_get_bool (client, LEFT_HANDED_KEY, NULL))
|
||||||
|
g_object_set (G_OBJECT (widget),
|
||||||
|
"pixbuf", left_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
g_object_set (G_OBJECT (widget),
|
||||||
|
"pixbuf", right_handed_pixbuf,
|
||||||
|
NULL);
|
||||||
|
|
||||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("sensitivity_entry")));
|
/* Double-click time */
|
||||||
bonobo_peditor_set_property (ed, bag, "threshold", TC_ulong, NULL);
|
double_click_on_pixbuf = gdk_pixbuf_new_from_file ("double-click-on.png", NULL);
|
||||||
}
|
double_click_maybe_pixbuf = gdk_pixbuf_new_from_file ("double-click-maybe.png", NULL);
|
||||||
|
double_click_off_pixbuf = gdk_pixbuf_new_from_file ("double-click-off.png", NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "double_click_darea");
|
||||||
|
g_signal_connect (widget, "expose_event", (GCallback) drawing_area_expose_event, NULL);
|
||||||
|
|
||||||
/* get_legacy_settings
|
double_click = gconf_client_get_int (client, DOUBLE_CLICK_KEY, NULL);
|
||||||
*
|
double_click = double_click_from_gconf (double_click);
|
||||||
* Retrieve older gnome_config -style settings and store them in the
|
widget = glade_xml_get_widget (xml, "delay_scale");
|
||||||
* configuration database.
|
gtk_range_set_value (GTK_RANGE (widget), (gfloat)double_click/1000.0);
|
||||||
*
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
* In most cases, it's best to use the COPY_FROM_LEGACY macro defined in
|
"value_changed",
|
||||||
* capplets/common/capplet-util.h.
|
(GCallback) double_click_callback,
|
||||||
*/
|
NULL);
|
||||||
|
|
||||||
static void
|
/* Cursors page */
|
||||||
get_legacy_settings (Bonobo_ConfigDatabase db)
|
widget = glade_xml_get_widget (xml, "main_notebook");
|
||||||
{
|
gtk_notebook_remove_page (GTK_NOTEBOOK (widget), 1);
|
||||||
gboolean val_boolean, def;
|
|
||||||
gulong val_ulong;
|
|
||||||
|
|
||||||
COPY_FROM_LEGACY (boolean, "/main/right-to-left", bool, "/Desktop/Mouse/right-to-left");
|
/* Motion page */
|
||||||
COPY_FROM_LEGACY (ulong, "/main/acceleration", int, "/Desktop/Mouse/aceleration=4");
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
COPY_FROM_LEGACY (ulong, "/main/threshold", int, "/Desktop/Mouse/threshold=4");
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "acceleration_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "sensitivity_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "threshold_label"));
|
||||||
|
|
||||||
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "high_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "fast_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "large_label"));
|
||||||
|
|
||||||
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "low_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "slow_label"));
|
||||||
|
gtk_size_group_add_widget (size_group,
|
||||||
|
glade_xml_get_widget (xml, "small_label"));
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "accel_scale");
|
||||||
|
acceleration = gconf_client_get_float (client, MOTION_ACCELERATION_KEY, NULL);
|
||||||
|
acceleration = motion_acceleration_from_gconf (acceleration);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), acceleration);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) acceleration_callback,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "sensitivity_scale");
|
||||||
|
threshold = gconf_client_get_int (client, MOTION_THRESHOLD_KEY, NULL);
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), threshold);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) threshold_callback,
|
||||||
|
MOTION_THRESHOLD_KEY);
|
||||||
|
|
||||||
|
widget = glade_xml_get_widget (xml, "drag_threshold_scale");
|
||||||
|
threshold = gconf_client_get_int (client, DRAG_THRESHOLD_KEY, NULL);
|
||||||
|
threshold = threshold_from_gconf (threshold);
|
||||||
|
gtk_range_set_value (GTK_RANGE (widget), threshold);
|
||||||
|
g_signal_connect (G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (widget))),
|
||||||
|
"value_changed",
|
||||||
|
(GCallback) threshold_callback,
|
||||||
|
DRAG_THRESHOLD_KEY);
|
||||||
|
|
||||||
|
/* main dialog */
|
||||||
|
widget = glade_xml_get_widget (xml, "mouse_properties_dialog");
|
||||||
|
g_signal_connect (G_OBJECT (widget),
|
||||||
|
"destroy",
|
||||||
|
gtk_main_quit, NULL);
|
||||||
|
widget = glade_xml_get_widget (xml, "close_button");
|
||||||
|
g_signal_connect (G_OBJECT (widget),
|
||||||
|
"clicked",
|
||||||
|
gtk_main_quit, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const gchar *legacy_files[] = { "Desktop", NULL };
|
gnome_program_init ("mouse-properties",
|
||||||
|
"0.1",
|
||||||
|
gnome_gtk_module_info_get (),
|
||||||
|
argc, argv,
|
||||||
|
NULL);
|
||||||
|
|
||||||
glade_gnome_init ();
|
xml = glade_xml_new ("gnome-mouse-properties.glade", NULL, NULL);
|
||||||
capplet_init (argc, argv, legacy_files, apply_settings, create_dialog, setup_dialog, get_legacy_settings);
|
setup_dialog ();
|
||||||
|
gtk_widget_show_all (glade_xml_get_widget (xml, "mouse_properties_dialog"));
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (client));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.3 KiB |