mouse: use a smiley face instead of old ugly lightbulb to test click

This commit is contained in:
William Jon McCann 2010-11-14 12:34:37 -05:00
parent f00488476f
commit 2f4e88b4a3
5 changed files with 9 additions and 182 deletions

View file

@ -22,9 +22,7 @@ libmouse_properties_la_SOURCES = \
gnome-mouse-properties.c \
gnome-mouse-properties.h \
gnome-mouse-accessibility.c \
gnome-mouse-accessibility.h \
capplet-stock-icons.c \
capplet-stock-icons.h
gnome-mouse-accessibility.h
libmouse_properties_la_LIBADD = $(PANEL_LIBS) $(GSD_DBUS_LIBS)
libmouse_properties_la_LDFLAGS = $(PANEL_LDFLAGS)

View file

@ -1,101 +0,0 @@
/*
* capplet-stock-icons.c
*
* Copyright (C) 2002 Sun Microsystems, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Rajkumar Sivasamy <rajkumar.siva@wipro.com>
* Taken bits of code from panel-stock-icons.c, Thanks Mark <mark@skynet.ie>
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "capplet-stock-icons.h"
static GtkIconSize mouse_capplet_dblclck_icon_size = 0;
GtkIconSize
mouse_capplet_dblclck_icon_get_size (void)
{
return mouse_capplet_dblclck_icon_size;
}
typedef struct
{
char *stock_id;
char *name;
} CappletStockIcon;
static CappletStockIcon items [] = {
{ MOUSE_DBLCLCK_MAYBE, "double-click-maybe.png"},
{ MOUSE_DBLCLCK_ON, "double-click-on.png"},
{ MOUSE_DBLCLCK_OFF, "double-click-off.png"}
};
static void
capplet_register_stock_icons (GtkIconFactory *factory)
{
gint i;
GtkIconSource *source;
source = gtk_icon_source_new ();
for (i = 0; i < G_N_ELEMENTS (items); ++i) {
GtkIconSet *icon_set;
char *filename;
filename = g_build_filename (PIXMAP_DIR, items[i].name, NULL);
if (!filename) {
g_warning (_("Unable to load stock icon '%s'\n"), items[i].name);
icon_set = gtk_icon_factory_lookup_default (GTK_STOCK_MISSING_IMAGE);
gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
continue;
}
gtk_icon_source_set_filename (source, filename);
g_free (filename);
icon_set = gtk_icon_set_new ();
gtk_icon_set_add_source (icon_set, source);
gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
gtk_icon_set_unref (icon_set);
}
gtk_icon_source_free (source);
}
void
capplet_init_stock_icons (void)
{
GtkIconFactory *factory;
static gboolean initialized = FALSE;
if (initialized)
return;
initialized = TRUE;
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
capplet_register_stock_icons (factory);
mouse_capplet_dblclck_icon_size = gtk_icon_size_register ("mouse-capplet-dblclck-icon",
MOUSE_CAPPLET_DBLCLCK_ICON_SIZE,
MOUSE_CAPPLET_DBLCLCK_ICON_SIZE);
g_object_unref (factory);
}

View file

@ -1,62 +0,0 @@
/*
* capplet-stock-icons.h
*
* Copyright (C) 2002 Sun Microsystems, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Rajkumar Sivasamy <rajkumar.siva@wipro.com>
* Taken bits of code from panel-stock-icons.h, Thanks Mark <mark@skynet.ie>
*/
#ifndef __CAPPLET_STOCK_ICONS_H__
#define __CAPPLET_STOCK_ICONS_H__
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define KEYBOARD_CAPPLET_DEFAULT_ICON_SIZE 48
#define MOUSE_CAPPLET_DEFAULT_WIDTH 120
#define MOUSE_CAPPLET_DEFAULT_HEIGHT 100
#define MOUSE_CAPPLET_DBLCLCK_ICON_SIZE 100
/* stock icons */
#define KEYBOARD_REPEAT "keyboard-repeat"
#define KEYBOARD_CURSOR "keyboard-cursor"
#define KEYBOARD_VOLUME "keyboard-volume"
#define KEYBOARD_BELL "keyboard-bell"
#define ACCESSX_KEYBOARD_BOUNCE "accessibility-keyboard-bouncekey"
#define ACCESSX_KEYBOARD_SLOW "accessibility-keyboard-slowkey"
#define ACCESSX_KEYBOARD_MOUSE "accessibility-keyboard-mousekey"
#define ACCESSX_KEYBOARD_STICK "accessibility-keyboard-stickykey"
#define ACCESSX_KEYBOARD_TOGGLE "accessibility-keyboard-togglekey"
#define MOUSE_DBLCLCK_MAYBE "mouse-dblclck-maybe"
#define MOUSE_DBLCLCK_ON "mouse-dblclck-on"
#define MOUSE_DBLCLCK_OFF "mouse-dblclck-off"
#define MOUSE_RIGHT_HANDED "mouse-right-handed"
#define MOUSE_LEFT_HANDED "mouse-left-handed"
void capplet_init_stock_icons (void);
GtkIconSize keyboard_capplet_icon_get_size (void);
GtkIconSize mouse_capplet_icon_get_size (void);
GtkIconSize mouse_capplet_dblclck_icon_get_size (void);
G_END_DECLS
#endif /* __CAPPLET_STOCK_ICONS_H__ */

View file

@ -1,6 +1,5 @@
/* -*- mode: c; style: linux -*- */
/* mouse-properties-capplet.c
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2001 Red Hat, Inc.
* Copyright (C) 2001 Ximian, Inc.
*
@ -32,7 +31,6 @@
#include <math.h>
#include "gnome-mouse-accessibility.h"
#include "capplet-stock-icons.h"
#include "gnome-mouse-properties.h"
#include <sys/types.h>
@ -98,8 +96,7 @@ test_maybe_timeout (struct test_data_t *data)
{
double_click_state = DOUBLE_CLICK_TEST_OFF;
gtk_image_set_from_stock (GTK_IMAGE (data->image),
MOUSE_DBLCLCK_OFF, mouse_capplet_dblclck_icon_get_size());
gtk_image_set_from_icon_name (GTK_IMAGE (data->image), "face-plain", GTK_ICON_SIZE_DIALOG);
*data->timeout_id = 0;
@ -156,16 +153,13 @@ event_box_button_press_event (GtkWidget *widget,
switch (double_click_state) {
case DOUBLE_CLICK_TEST_ON:
gtk_image_set_from_stock (GTK_IMAGE (image),
MOUSE_DBLCLCK_ON, mouse_capplet_dblclck_icon_get_size());
gtk_image_set_from_icon_name (GTK_IMAGE (image), "face-laugh", GTK_ICON_SIZE_DIALOG);
break;
case DOUBLE_CLICK_TEST_MAYBE:
gtk_image_set_from_stock (GTK_IMAGE (image),
MOUSE_DBLCLCK_MAYBE, mouse_capplet_dblclck_icon_get_size());
gtk_image_set_from_icon_name (GTK_IMAGE (image), "face-smile", GTK_ICON_SIZE_DIALOG);
break;
case DOUBLE_CLICK_TEST_OFF:
gtk_image_set_from_stock (GTK_IMAGE (image),
MOUSE_DBLCLCK_OFF, mouse_capplet_dblclck_icon_get_size());
gtk_image_set_from_icon_name (GTK_IMAGE (image), "face-plain", GTK_ICON_SIZE_DIALOG);
break;
}
@ -329,7 +323,7 @@ setup_dialog (GtkBuilder *dialog)
g_settings_bind (mouse_settings, "double-click",
gtk_range_get_adjustment (GTK_RANGE (WID ("delay_scale"))), "value",
G_SETTINGS_BIND_DEFAULT);
gtk_image_set_from_stock (GTK_IMAGE (WID ("double_click_image")), MOUSE_DBLCLCK_OFF, mouse_capplet_dblclck_icon_get_size ());
gtk_image_set_from_icon_name (GTK_IMAGE (WID ("double_click_image")), "face-plain", GTK_ICON_SIZE_DIALOG);
g_object_set_data (G_OBJECT (WID ("double_click_eventbox")), "image", WID ("double_click_image"));
g_signal_connect (WID ("double_click_eventbox"), "button_press_event",
G_CALLBACK (event_box_button_press_event), dialog);
@ -442,8 +436,6 @@ gnome_mouse_properties_init (GtkBuilder *dialog)
GtkWidget *dialog_win, *w;
gchar *start_page = NULL;
capplet_init_stock_icons ();
mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
touchpad_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.touchpad");

View file

@ -634,7 +634,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">To test your double-click settings, try to double-click on the light bulb.</property>
<property name="label" translatable="yes">To test your settings, try to double-click on the face.</property>
<property name="wrap">True</property>
<attributes>
<attribute name="style" value="italic"/>