gnome-control-center/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c

117 lines
3.1 KiB
C
Raw Normal View History

/* -*- mode: c; style: linux -*- */
/* gnome-accessibility-keyboard-properties.c
* Copyright (C) 2002 Ximian, Inc.
*
* Written by: Jody Goldberg <jody@gnome.org>
*
* 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 <gnome.h>
#include <gconf/gconf-client.h>
#include <capplet-util.h>
#include <activate-settings-daemon.h>
#include "accessibility-keyboard.h"
#ifdef HAVE_X11_EXTENSIONS_XKB_H
# include <X11/X.h>
# include <X11/Xlib.h>
# include <X11/XKBlib.h>
# include <X11/extensions/XKBstr.h>
# include <gdk/gdk.h>
# include <gdk/gdkx.h>
static void
xkb_enabled (void)
{
gboolean have_xkb = FALSE;
int opcode, errorBase, major, minor, xkbEventBase;
gdk_error_trap_push ();
have_xkb = XkbQueryExtension (GDK_DISPLAY (),
&opcode, &xkbEventBase, &errorBase, &major, &minor)
&& XkbUseExtension (GDK_DISPLAY (), &major, &minor);
XSync (GDK_DISPLAY (), FALSE);
gdk_error_trap_pop ();
if (!have_xkb) {
GtkWidget *warn = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
2003-01-07 14:01:28 +00:00
_("This system does not seem to have the XKB extension. The keyboard accessibility features will not operate without it."));
gtk_dialog_run (GTK_DIALOG (warn));
gtk_widget_destroy (warn);
}
}
#endif
static void
dialog_response (GtkWidget *widget,
gint response_id,
GConfChangeSet *changeset)
{
switch (response_id) {
case GTK_RESPONSE_HELP:
http://bugzilla.gnome.org/show_bug.cgi?id=85397 2002-06-15 Jody Goldberg <jody@gnome.org> http://bugzilla.gnome.org/show_bug.cgi?id=85397 http://bugzilla.gnome.org/show_bug.cgi?id=84545 * mime-types-model.c (mime_types_model_get_value) : gtk_tree_view_search_equal_func does not like NULL. (IS_CATEGORY) : check for NULL. * file-types-capplet.c (create_dialog) : search the description not the mime type. 2002-06-08 Jody Goldberg <jody@gnome.org> * mime-types-model.c (IS_CATEGORY) : test for null in case we are stupid. 2002-06-07 Jody Goldberg <jody@gnome.org> * file-types-capplet.c (dialog_done_cb) : no need to save things again. The only caller had already done that. * mime-type-info.c (mime_type_info_save) : Don't mess with the application here, it should already be setup. However, be really really anal about verifying it because I do not trust the surrounding code or know it well enough to trust it. Make sure that the assigned app is on the short list of associated apps. * mime-category-edit-dialog.c (store_data) : Use mime_edit_dialog_get_app. * mime-edit-dialog.c (store_data) : Use it here too. (mime_edit_dialog_get_app) : new. split some duplicated code out of the type and category dialogs and move it here. Then make it readable and less stupid about creating copies of existing applications. While we're at it have it handle the creation of new applications, merging commands with existing applications and other useful stuff. 2002-06-07 Jody Goldberg <jody@gnome.org> * mime-category-edit-dialog.c (store_data) : clarify and remove the custom flag. * mime-type-info.c (mime_category_info_using_custom_app) : delete. (mime_type_info_using_custom_app) : delete. * mime-edit-dialog.c (validate_data) : correct the warning about invalid type, we would _not_ create one for the user :-( Allow a user to optionally overwrite an existing mime type. This is useful when editing. * mime-edit-dialog.c (store_data) : clarify and remove the custom flag. 2002-06-10 Jody Goldberg <jody@gnome.org> * accessibility-keyboard.c : tweak the layout as requested and adjust the max slowkey delay to 500 to avoid losing the keyboard due to some sort of an X problem. 2002-06-13 Jody Goldberg <jody@gnome.org> * gnome-keyboard-properties.c (accessibility_button_clicked) : produce a better warning for failure to launch the keyboard accessibility capplet.
2002-06-18 18:55:14 +00:00
capplet_help (GTK_WINDOW (widget),
"user-guide.xml",
"goscustaccess-6");
break;
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
gtk_main_quit ();
break;
default:
/* Import CDE AccessX File */
break;
}
}
int
main (int argc, char **argv)
{
GtkWidget *dialog;
GConfChangeSet *changeset;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_program_init ("gnome-accessibility-keyboard-properties", VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
NULL);
activate_settings_daemon ();
#ifdef HAVE_X11_EXTENSIONS_XKB_H
xkb_enabled ();
#endif
changeset = NULL;
http://bugzilla.gnome.org/show_bug.cgi?id=85397 2002-06-15 Jody Goldberg <jody@gnome.org> http://bugzilla.gnome.org/show_bug.cgi?id=85397 http://bugzilla.gnome.org/show_bug.cgi?id=84545 * mime-types-model.c (mime_types_model_get_value) : gtk_tree_view_search_equal_func does not like NULL. (IS_CATEGORY) : check for NULL. * file-types-capplet.c (create_dialog) : search the description not the mime type. 2002-06-08 Jody Goldberg <jody@gnome.org> * mime-types-model.c (IS_CATEGORY) : test for null in case we are stupid. 2002-06-07 Jody Goldberg <jody@gnome.org> * file-types-capplet.c (dialog_done_cb) : no need to save things again. The only caller had already done that. * mime-type-info.c (mime_type_info_save) : Don't mess with the application here, it should already be setup. However, be really really anal about verifying it because I do not trust the surrounding code or know it well enough to trust it. Make sure that the assigned app is on the short list of associated apps. * mime-category-edit-dialog.c (store_data) : Use mime_edit_dialog_get_app. * mime-edit-dialog.c (store_data) : Use it here too. (mime_edit_dialog_get_app) : new. split some duplicated code out of the type and category dialogs and move it here. Then make it readable and less stupid about creating copies of existing applications. While we're at it have it handle the creation of new applications, merging commands with existing applications and other useful stuff. 2002-06-07 Jody Goldberg <jody@gnome.org> * mime-category-edit-dialog.c (store_data) : clarify and remove the custom flag. * mime-type-info.c (mime_category_info_using_custom_app) : delete. (mime_type_info_using_custom_app) : delete. * mime-edit-dialog.c (validate_data) : correct the warning about invalid type, we would _not_ create one for the user :-( Allow a user to optionally overwrite an existing mime type. This is useful when editing. * mime-edit-dialog.c (store_data) : clarify and remove the custom flag. 2002-06-10 Jody Goldberg <jody@gnome.org> * accessibility-keyboard.c : tweak the layout as requested and adjust the max slowkey delay to 500 to avoid losing the keyboard due to some sort of an X problem. 2002-06-13 Jody Goldberg <jody@gnome.org> * gnome-keyboard-properties.c (accessibility_button_clicked) : produce a better warning for failure to launch the keyboard accessibility capplet.
2002-06-18 18:55:14 +00:00
dialog = setup_accessX_dialog (changeset);
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (dialog_response), changeset);
2004-08-20 16:50:57 +00:00
capplet_set_icon (dialog, "gnome-settings-accessibility-keyboard");
gtk_widget_show_all (dialog);
gtk_main ();
return 0;
}