Add common, background, keyboard, mouse back in

2001-12-20  Bradford Hovinen  <hovinen@ximian.com>

	* capplets/Makefile.am (always_built_SUBDIRS): Add common,
	background, keyboard, mouse back in

	* configure.in (PKG_CHECK_MODULES): Remove lines pertaining to the
	archiver, add line for gnome settings daemon

	* background-properties-capplet.c (dialog_button_clicked_cb):
	Remove call to apply_settings
	(apply_settings): Remove
	(main): Remove apply_only support

	* default-application-properties.c (main): Call gtk_main, not
	capplet_gtk_main

	* interface.c: Don't #include capplet-widget.h

	* main.c: Don't #include capplet-widget.h or the archiver stuff
	(main): Call gtk_main rather than capplet_gtk_main
	Remove archiver stuff
	(setup_capplet_widget): Don't connect to state_changed_cb
	(state_changed_cb): Remove
	(main): Don't pass cap_options

	* gnome-settings-daemon/Makefile.am
	(gnome_settings_daemon_SOURCES): Add
	gnome-settings-{keyboard|background}.[ch]
	(INCLUDES): Add -I$(top_srcdir)/libbackground
	(gnome_settings_daemon_LDADD): Add
	$(top_builddir)/libbackground/libbackground.a

	* gnome-settings-daemon.c (main): Initialize keyboard and
	background subsystems

	* Added gnome-settings-{keyboard|background}.[ch],
	gnome-settings-daemon/ChangeLog
This commit is contained in:
Bradford Hovinen 2001-12-20 14:11:59 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent f812516058
commit b65967ac90
20 changed files with 328 additions and 257 deletions

View file

@ -1,3 +1,11 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* capplets/Makefile.am (always_built_SUBDIRS): Add common,
background, keyboard, mouse back in
* configure.in (PKG_CHECK_MODULES): Remove lines pertaining to the
archiver, add line for gnome settings daemon
Sun Dec 9 19:24:47 2001 Jonathan Blandford <jrb@redhat.com>
* configure.in: use gconf macros.

View file

@ -1,4 +1,5 @@
always_built_SUBDIRS = \
default-applications desktop-links
# common background keyboard mouse sound
default-applications desktop-links \
common background keyboard mouse
SUBDIRS = $(always_built_SUBDIRS) $(SCREENSAVER)

View file

@ -1,3 +1,10 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* background-properties-capplet.c (dialog_button_clicked_cb):
Remove call to apply_settings
(apply_settings): Remove
(main): Remove apply_only support
2001-12-19 Seth Nickell <snickell@stanford.edu>
* background.desktop.in.in:

View file

@ -34,27 +34,6 @@
#include "gconf-property-editor.h"
#include "applier.h"
/* Apply settings to the root window. This will be moved to
* gnome-settings-daemon shortly.
*/
static void
apply_settings ()
{
GObject *prefs;
Applier *applier;
applier = APPLIER (applier_new (APPLIER_ROOT));
prefs = preferences_new ();
preferences_load (PREFERENCES (prefs));
applier_apply_prefs (applier, PREFERENCES (prefs));
g_object_unref (G_OBJECT (prefs));
g_object_unref (G_OBJECT (applier));
}
/* Retrieve legacy gnome_config settings and store them in the GConf
* database. This involves some translation of the settings' meanings.
*/
@ -288,13 +267,10 @@ create_dialog (Applier *applier)
static void
dialog_button_clicked_cb (GnomeDialog *dialog, gint button_number, GConfChangeSet *changeset)
{
if (button_number == 0) {
if (button_number == 0)
gconf_client_commit_change_set (gconf_client_get_default (), changeset, TRUE, NULL);
apply_settings ();
}
else if (button_number == 1) {
else if (button_number == 1)
gnome_dialog_close (dialog);
}
}
int
@ -306,13 +282,8 @@ main (int argc, char **argv)
GtkWidget *dialog_win;
GObject *applier;
static gboolean apply_only;
static gboolean get_legacy;
static struct poptOption cap_options[] = {
{ "apply", '\0', POPT_ARG_NONE, &apply_only, 0,
N_("Just apply settings and quit"), NULL },
{ "init-session-settings", '\0', POPT_ARG_NONE, &apply_only, 0,
N_("Just apply settings and quit"), NULL },
{ "get-legacy", '\0', POPT_ARG_NONE, &get_legacy, 0,
N_("Retrieve and store legacy settings"), NULL },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
@ -331,10 +302,7 @@ main (int argc, char **argv)
client = gconf_client_get_default ();
gconf_client_add_dir (client, "/desktop/gnome/background", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
if (apply_only) {
apply_settings ();
}
else if (get_legacy) {
if (get_legacy) {
get_legacy_settings ();
} else {
changeset = gconf_change_set_new ();

View file

@ -1,3 +1,10 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* default-application-properties.c (main): Call gtk_main, not
capplet_gtk_main
* interface.c: Don't #include capplet-widget.h
2001-12-19 Seth Nickell <snickell@stanford.edu>
* default-applications.desktop.in.in:

View file

@ -356,7 +356,7 @@ main (int argc, char **argv)
ignore_changes = FALSE;
capplet_gtk_main ();
gtk_main ();
return 0;
}

View file

@ -13,7 +13,6 @@
#include <gnome.h>
#include "capplet-widget.h"
#include "callbacks.h"
#include "interface.h"
#include "support.h"

View file

@ -3,7 +3,7 @@ cappletgroup =
bin_PROGRAMS = keyboard-properties-control
bin_SCRIPTS = keyboard-properties
keyboard_properties_control_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(XF86MISC_LIBS)
keyboard_properties_control_LDADD = $(GNOMECC_CAPPLETS_LIBS)
keyboard_properties_control_SOURCES = \
keyboard-properties.c

View file

@ -41,10 +41,6 @@
#include <gdk/gdkx.h>
#include <X11/X.h>
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
# include <X11/extensions/xf86misc.h>
#endif
/* Conversion between GConf values and widget values */
static GConfValue *
@ -119,66 +115,6 @@ delay_from_widget (GConfValue *value)
return new_value;
}
#if 0
static void
apply_settings (void)
{
GConfClient *client;
gboolean repeat, click;
int rate, delay, volume;
int bell_volume, bell_pitch, bell_duration;
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
XF86MiscKbdSettings kbdsettings;
#endif
XKeyboardControl kbdcontrol;
int event_base_return, error_base_return;
client = gconf_client_get_default ();
repeat = gconf_client_get_bool (client, "/gnome/desktop/peripherals/keyboard/repeat", NULL);
click = gconf_client_get_bool (client, "/gnome/desktop/peripherals/keyboard/click", NULL);
rate = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/rate", NULL);
delay = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/delay", NULL);
volume = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/volume", NULL);
bell_volume = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_volume", NULL);
bell_pitch = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_pitch", NULL);
bell_duration = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_duration", NULL);
if (repeat) {
XAutoRepeatOn (GDK_DISPLAY ());
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
if (XF86MiscQueryExtension (GDK_DISPLAY (),
&event_base_return,
&error_base_return) == True)
{
kbdsettings.type = 0;
kbdsettings.rate = rate;
g_message ("Setting rate to %d", kbdsettings.rate);
kbdsettings.delay = delay;
kbdsettings.servnumlock = False;
XF86MiscSetKbdSettings (GDK_DISPLAY (), &kbdsettings);
} else {
XAutoRepeatOff (GDK_DISPLAY ());
}
#endif
} else {
XAutoRepeatOff (GDK_DISPLAY ());
}
kbdcontrol.key_click_percent =
click ? volume : 0;
kbdcontrol.bell_percent = bell_volume;
kbdcontrol.bell_pitch = bell_pitch;
kbdcontrol.bell_duration = bell_duration;
XChangeKeyboardControl (GDK_DISPLAY (), KBKeyClickPercent,
&kbdcontrol);
}
#endif
static void
get_legacy_settings (void)
{

View file

@ -10,8 +10,9 @@ pixmap_DATA = \
double-click-on.png \
double-click-off.png \
double-click-maybe.png \
mouse-left-2.png \
mouse-right-2.png
mouse-left.png \
mouse-right.png
Gladedir = $(GNOMECC_GLADE_DIR)
Glade_DATA = gnome-mouse-properties.glade

View file

@ -1,3 +1,12 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* main.c: Don't #include capplet-widget.h or the archiver stuff
(main): Call gtk_main rather than capplet_gtk_main
Remove archiver stuff
(setup_capplet_widget): Don't connect to state_changed_cb
(state_changed_cb): Remove
(main): Don't pass cap_options
2001-12-19 Seth Nickell <snickell@stanford.edu>
* screensaver.desktop.in.in:

View file

@ -36,13 +36,6 @@
#include <glade/glade.h>
#include <capplet-widget.h>
#ifdef HAVE_XIMIAN_ARCHIVER
# include <bonobo.h>
# include <ximian-archiver/archiver-client.h>
#endif /* HAVE_XIMIAN_ARCHIVER */
#include "preferences.h"
#include "prefs-widget.h"
#include "preview.h"
@ -55,22 +48,6 @@ static PrefsWidget *prefs_widget;
static GtkWidget *capplet;
static gint cap_session_init = 0;
static struct poptOption cap_options[] = {
{"init-session-settings", '\0', POPT_ARG_NONE, &cap_session_init, 0,
N_("Initialize session settings"), NULL},
{NULL, '\0', 0, NULL, 0}
};
static void
state_changed_cb (GtkWidget *widget)
{
#if 0
if (!prefs->frozen)
capplet_widget_state_changed (capplet, TRUE);
#endif
}
static void
try_cb (GtkWidget *widget)
{
@ -78,17 +55,9 @@ try_cb (GtkWidget *widget)
old_sm = prefs->selection_mode;
#ifdef HAVE_XIMIAN_ARCHIVER
if (!outside_location) {
prefs_widget_store_prefs (prefs_widget, prefs);
preferences_save (prefs);
setup_dpms (prefs);
}
#else /* !HAVE_XIMIAN_ARCHIVER */
prefs_widget_store_prefs (prefs_widget, prefs);
preferences_save (prefs);
setup_dpms (prefs);
#endif /* HAVE_XIMIAN_ARCHIVER */
if (old_sm == SM_DISABLE_SCREENSAVER &&
prefs->selection_mode != SM_DISABLE_SCREENSAVER)
@ -105,15 +74,8 @@ revert_cb (GtkWidget *widget)
old_sm = old_prefs->selection_mode;
#ifdef HAVE_XIMIAN_ARCHIVER
if (!outside_location) {
preferences_save (old_prefs);
preferences_destroy (prefs);
}
#else /* !HAVE_XIMIAN_ARCHIVER */
preferences_save (old_prefs);
preferences_destroy (prefs);
#endif /* HAVE_XIMIAN_ARCHIVER */
prefs = preferences_new ();
preferences_load (prefs);
@ -141,23 +103,15 @@ ok_cb (GtkWidget *widget)
close_preview ();
#ifdef HAVE_XIMIAN_ARCHIVER
if (!outside_location) {
#endif /* HAVE_XIMIAN_ARCHIVER */
prefs_widget_store_prefs (prefs_widget, prefs);
preferences_save (prefs);
setup_dpms (prefs);
if (old_sm == SM_DISABLE_SCREENSAVER &&
prefs->selection_mode != SM_DISABLE_SCREENSAVER)
start_xscreensaver ();
else if (old_sm != SM_DISABLE_SCREENSAVER &&
prefs->selection_mode == SM_DISABLE_SCREENSAVER)
stop_xscreensaver ();
#ifdef HAVE_XIMIAN_ARCHIVER
}
store_archive_data ();
#endif /* HAVE_XIMIAN_ARCHIVER */
prefs_widget_store_prefs (prefs_widget, prefs);
preferences_save (prefs);
setup_dpms (prefs);
if (old_sm == SM_DISABLE_SCREENSAVER &&
prefs->selection_mode != SM_DISABLE_SCREENSAVER)
start_xscreensaver ();
else if (old_sm != SM_DISABLE_SCREENSAVER &&
prefs->selection_mode == SM_DISABLE_SCREENSAVER)
stop_xscreensaver ();
}
static void
@ -169,21 +123,15 @@ cancel_cb (GtkWidget *widget)
close_preview ();
#ifdef HAVE_XIMIAN_ARCHIVER
if (!outside_location) {
#endif /* HAVE_XIMIAN_ARCHIVER */
preferences_save (old_prefs);
setup_dpms (old_prefs);
preferences_save (old_prefs);
setup_dpms (old_prefs);
if (old_sm == SM_DISABLE_SCREENSAVER &&
prefs->selection_mode != SM_DISABLE_SCREENSAVER)
start_xscreensaver ();
else if (old_sm != SM_DISABLE_SCREENSAVER &&
prefs->selection_mode == SM_DISABLE_SCREENSAVER)
stop_xscreensaver ();
#ifdef HAVE_XIMIAN_ARCHIVER
}
#endif /* HAVE_XIMIAN_ARCHIVER */
if (old_sm == SM_DISABLE_SCREENSAVER &&
prefs->selection_mode != SM_DISABLE_SCREENSAVER)
start_xscreensaver ();
else if (old_sm != SM_DISABLE_SCREENSAVER &&
prefs->selection_mode == SM_DISABLE_SCREENSAVER)
stop_xscreensaver ();
}
static void
@ -238,8 +186,6 @@ setup_capplet_widget (void)
prefs_widget_get_prefs (prefs_widget, prefs);
gtk_signal_connect (GTK_OBJECT (prefs_widget), "pref-changed",
GTK_SIGNAL_FUNC (state_changed_cb), NULL);
gtk_signal_connect (GTK_OBJECT (prefs_widget), "activate-demo",
GTK_SIGNAL_FUNC (demo_cb), NULL);
@ -248,66 +194,6 @@ setup_capplet_widget (void)
prefs->frozen--;
}
#ifdef HAVE_XIMIAN_ARCHIVER
static void
do_get_xml (void)
{
Preferences *prefs;
xmlDocPtr doc;
prefs = preferences_new ();
preferences_load (prefs);
doc = preferences_write_xml (prefs);
xmlDocDump (stdout, doc);
preferences_destroy (prefs);
}
static void
do_set_xml (gboolean apply_settings)
{
xmlDocPtr doc;
char buffer[16384];
GString *doc_str;
int t = 0;
fflush (stdin);
fcntl (fileno (stdin), F_SETFL, 0);
doc_str = g_string_new ("");
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
buffer[t] = '\0';
g_string_append (doc_str, buffer);
}
if (doc_str->len > 0) {
doc = xmlParseDoc (doc_str->str);
g_string_free (doc_str, TRUE);
if (doc != NULL) {
prefs = preferences_read_xml (doc);
if (prefs && apply_settings) {
preferences_save (prefs);
return;
}
else if (prefs != NULL) {
return;
}
xmlFreeDoc (doc);
}
} else {
g_critical ("No data to apply");
}
return;
}
#endif /* HAVE_XIMIAN_ARCHIVER */
static void
do_restore_from_defaults (void)
{
@ -329,7 +215,6 @@ main (int argc, char **argv)
gnome_program_init ("screensaver-properties", VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_POPT_TABLE, &cap_options,
NULL);
client = gnome_master_client ();
@ -370,12 +255,10 @@ main (int argc, char **argv)
setup_dpms (prefs);
}
if (!cap_session_init) {
old_prefs = preferences_clone (prefs);
setup_capplet_widget ();
old_prefs = preferences_clone (prefs);
setup_capplet_widget ();
capplet_gtk_main ();
}
gtk_main ();
return 0;
}

View file

@ -37,21 +37,12 @@ dnl ==============================================
dnl Check that we meet the dependencies
dnl ==============================================
COMMON_MODULES="gtk+-2.0 gconf-2.0 libgnomeui-2.0 libglade-2.0 libbonobo-2.0 libbonoboui-2.0 libglade-2.0 gconf-2.0"
PKG_CHECK_MODULES(GCONF, gconf-2.0)
PKG_CHECK_MODULES(GTK, gtk+-2.0)
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES bonobo-config-2.0)
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libxml-2.0 gnome-desktop-2.0)
PKG_CHECK_MODULES(ARCHIVER, libbonobo-2.0 bonobo-config-2.0 libxml-2.0)
PKG_CHECK_MODULES(CONFIG_ARCHIVER, libbonobo-2.0 libgnome-2.0 libxml-2.0)
PKG_CHECK_MODULES(MONIKER, libbonobo-2.0 bonobo-config-2.0 libxml-2.0)
PKG_CHECK_MODULES(OLD_CAPPLET, libgnomeui-2.0 libglade-2.0 libcapplet-2.0)
PKG_CHECK_MODULES(GNOME_SETTINGS_DAEMON, gtk+-2.0 gconf-2.0 libgnome-2.0)
PKG_CHECK_MODULES(OLD_CAPPLET, libgnomeui-2.0 libglade-2.0)
PKG_CHECK_MODULES(GNOME, libgnomeui-2.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GCONF_LIBS)
SCREENSAVER=screensaver
AC_PATH_PROG(XSCREENSAVER, xscreensaver, no)
if test "$XSCREENSAVER" = no ; then
@ -112,6 +103,10 @@ AC_SUBST(GNOMECC_CAPPLETS_EXTRA_DIST)
AC_SUBST(GNOMECC_CAPPLETS_CLEANFILES)
AC_SUBST(GNOMECC_CAPPLETS_CFLAGS)
AC_SUBST(GNOMECC_CAPPLETS_LIBS)
AC_SUBST(GNOME_SETTINGS_DAEMON_CFLAGS)
AC_SUBST(GNOME_SETTINGS_DAEMON_LIBS)
dnl ==============================================
dnl End: Define the main variables
dnl ==============================================

View file

@ -0,0 +1,11 @@
2001-12-19 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am
(gnome_settings_daemon_SOURCES): Add
gnome-settings-{keyboard|background}.[ch]
(INCLUDES): Add -I$(top_srcdir)/libbackground
(gnome_settings_daemon_LDADD): Add
$(top_builddir)/libbackground/libbackground.a
* gnome-settings-daemon.c (main): Initialize keyboard and
background subsystems

View file

@ -1,10 +1,14 @@
INCLUDES=$(GTK_CFLAGS) $(GCONF_CFLAGS)
INCLUDES=$(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground
gnome_settings_daemon_SOURCES = \
gnome-settings-daemon.h \
gnome-settings-daemon.c \
gnome-settings-mouse.h \
gnome-settings-mouse.c \
gnome-settings-keyboard.h \
gnome-settings-keyboard.c \
gnome-settings-background.h \
gnome-settings-background.c \
gnome-settings-xsettings.c \
gnome-settings-xsettings.h \
xsettings-common.c \
@ -14,4 +18,8 @@ gnome_settings_daemon_SOURCES = \
bin_PROGRAMS=gnome-settings-daemon
gnome_settings_daemon_LDADD = $(GTK_LIBS) $(GCONF_LIBS)
gnome_settings_daemon_LDADD = \
$(GNOME_SETTINGS_DAEMON_LIBS) \
$(top_builddir)/libbackground/libbackground.a \
$(XF86MISC_LIBS)

View file

@ -0,0 +1,64 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-background.c
*
* Copyright © 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 <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gconf/gconf.h>
#include "gnome-settings-keyboard.h"
#include "gnome-settings-daemon.h"
#include "preferences.h"
#include "applier.h"
static Applier *applier;
static Preferences *prefs;
static void
background_callback (GConfEntry *entry)
{
preferences_merge_entry (prefs, entry);
applier_apply_prefs (applier, PREFERENCES (prefs));
}
void
gnome_settings_background_init (GConfEngine *engine)
{
applier = APPLIER (applier_new (APPLIER_ROOT));
prefs = preferences_new ();
preferences_load (PREFERENCES (prefs));
gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", background_callback);
}
void
gnome_settings_background_load (GConfEngine *engine)
{
applier_apply_prefs (applier, PREFERENCES (prefs));
}

View file

@ -0,0 +1,33 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-background.h
*
* Copyright © 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.
*/
#ifndef __GNOME_SETTINGS_BACKGROUND_H
#define __GNOME_SETTINGS_BACKGROUND_H
#include <gconf/gconf.h>
void gnome_settings_background_init (GConfEngine *engine);
void gnome_settings_background_load (GConfEngine *engine);
#endif

View file

@ -154,6 +154,8 @@ main (int argc, char **argv)
engine = gconf_engine_get_default ();
gnome_settings_xsettings_init (engine);
gnome_settings_mouse_init (engine);
gnome_settings_keyboard_init (engine);
gnome_settings_background_init (engine);
for (list = directories; list; list = list->next)
{

View file

@ -0,0 +1,106 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-keyboard.c
*
* Copyright © 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 <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gconf/gconf-client.h>
#include "gnome-settings-keyboard.h"
#include "gnome-settings-daemon.h"
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
# include <X11/extensions/xf86misc.h>
#endif
static void
apply_settings (void)
{
GConfClient *client;
gboolean repeat, click;
int rate, delay, volume;
int bell_volume, bell_pitch, bell_duration;
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
XF86MiscKbdSettings kbdsettings;
#endif
XKeyboardControl kbdcontrol;
int event_base_return, error_base_return;
client = gconf_client_get_default ();
repeat = gconf_client_get_bool (client, "/gnome/desktop/peripherals/keyboard/repeat", NULL);
click = gconf_client_get_bool (client, "/gnome/desktop/peripherals/keyboard/click", NULL);
rate = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/rate", NULL);
delay = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/delay", NULL);
volume = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/volume", NULL);
bell_volume = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_volume", NULL);
bell_pitch = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_pitch", NULL);
bell_duration = gconf_client_get_int (client, "/gnome/desktop/peripherals/keyboard/bell_duration", NULL);
if (repeat) {
XAutoRepeatOn (GDK_DISPLAY ());
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
if (XF86MiscQueryExtension (GDK_DISPLAY (),
&event_base_return,
&error_base_return) == True)
{
kbdsettings.type = 0;
kbdsettings.rate = rate;
g_message ("Setting rate to %d", kbdsettings.rate);
kbdsettings.delay = delay;
kbdsettings.servnumlock = False;
XF86MiscSetKbdSettings (GDK_DISPLAY (), &kbdsettings);
} else {
XAutoRepeatOff (GDK_DISPLAY ());
}
#endif
} else {
XAutoRepeatOff (GDK_DISPLAY ());
}
kbdcontrol.key_click_percent =
click ? volume : 0;
kbdcontrol.bell_percent = bell_volume;
kbdcontrol.bell_pitch = bell_pitch;
kbdcontrol.bell_duration = bell_duration;
XChangeKeyboardControl (GDK_DISPLAY (), KBKeyClickPercent,
&kbdcontrol);
}
void
gnome_settings_keyboard_init (GConfEngine *engine)
{
gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", (KeyCallbackFunc) apply_settings);
}
void
gnome_settings_keyboard_load (GConfEngine *engine)
{
apply_settings ();
}

View file

@ -0,0 +1,33 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-keyboard.h
*
* Copyright © 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.
*/
#ifndef __GNOME_SETTINGS_KEYBOARD_H
#define __GNOME_SETTINGS_KEYBOARD_H
#include <gconf/gconf.h>
void gnome_settings_keyboard_init (GConfEngine *engine);
void gnome_settings_keyboard_load (GConfEngine *engine);
#endif