1
/* -*- mode: c; style: linux -*- */
3
/* gnome-accessibility-keyboard-properties.c
4
* Copyright (C) 2002 Ximian, Inc.
6
* Written by: Jody Goldberg <jody@gnome.org>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2, or (at your option)
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29
#include <gconf/gconf-client.h>
31
#include <capplet-util.h>
32
#include <activate-settings-daemon.h>
33
#include "accessibility-keyboard.h"
35
#ifdef HAVE_X11_EXTENSIONS_XKB_H
37
# include <X11/Xlib.h>
38
# include <X11/XKBlib.h>
39
# include <X11/extensions/XKBstr.h>
41
# include <gdk/gdkx.h>
46
gboolean have_xkb = FALSE;
47
int opcode, errorBase, major, minor, xkbEventBase;
49
gdk_error_trap_push ();
50
have_xkb = XkbQueryExtension (GDK_DISPLAY (),
51
&opcode, &xkbEventBase, &errorBase, &major, &minor)
52
&& XkbUseExtension (GDK_DISPLAY (), &major, &minor);
53
XSync (GDK_DISPLAY (), FALSE);
54
gdk_error_trap_pop ();
57
GtkWidget *warn = gtk_message_dialog_new (NULL, 0,
58
GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
59
_("This system does not seem to have the XKB extension. The keyboard accessibility features will not operate without it."));
60
gtk_dialog_run (GTK_DIALOG (warn));
61
gtk_widget_destroy (warn);
67
dialog_response (GtkWidget *widget,
69
GConfChangeSet *changeset)
71
switch (response_id) {
72
case GTK_RESPONSE_HELP:
73
capplet_help (GTK_WINDOW (widget),
77
case GTK_RESPONSE_DELETE_EVENT:
78
case GTK_RESPONSE_CLOSE:
82
/* Import CDE AccessX File */
88
main (int argc, char **argv)
91
GConfChangeSet *changeset;
92
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
93
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
94
textdomain (GETTEXT_PACKAGE);
96
gnome_program_init ("gnome-accessibility-keyboard-properties", VERSION,
97
LIBGNOMEUI_MODULE, argc, argv,
98
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
100
activate_settings_daemon ();
102
#ifdef HAVE_X11_EXTENSIONS_XKB_H
107
dialog = setup_accessX_dialog (changeset);
108
g_signal_connect (G_OBJECT (dialog),
110
G_CALLBACK (dialog_response), changeset);
111
capplet_set_icon (dialog, "gnome-settings-accessibility-keyboard");
112
gtk_widget_show_all (dialog);