set sensitivity of audible/visual bell options only if XKB enabled.

2004-06-22  Leena Gunda  <leena.gunda@wipro.com>

        * sound-properties-capplet.c:
        (create_dialog): set sensitivity of audible/visual bell
        options only if XKB enabled.
        (CheckXKB): function to check if XKB support available.
        Fixes bug #144090
This commit is contained in:
Leena Gunda 2004-06-22 09:09:19 +00:00 committed by Leena Sitaram Gunda
parent 21dab40205
commit 4b5e158ec2
2 changed files with 40 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2004-06-22 Leena Gunda <leena.gunda@wipro.com>
* sound-properties-capplet.c:
(create_dialog): set sensitivity of audible/visual bell
options only if XKB enabled.
(CheckXKB): function to check if XKB support available.
Fixes bug #144090
2004-04-15 Jody Goldberg <jody@gnome.org>
* Release 2.6.1

View file

@ -28,6 +28,12 @@
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <gdk/gdkx.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
#include "capplet-util.h"
#include "gconf-property-editor.h"
#include "libsounds/sound-view.h"
@ -51,6 +57,24 @@
static SoundProperties *props = NULL;
static gboolean
CheckXKB (void)
{
gboolean have_xkb = FALSE;
Display *dpy;
int opcode, errorBase, major, minor, xkbEventBase;
gdk_error_trap_push ();
dpy = GDK_DISPLAY ();
have_xkb = XkbQueryExtension (dpy, &opcode, &xkbEventBase,
&errorBase, &major, &minor)
&& XkbUseExtension (dpy, &major, &minor);
XSync (dpy, FALSE);
gdk_error_trap_pop ();
return have_xkb;
}
static void
props_changed_cb (SoundProperties *p, SoundEvent *event, gpointer data)
{
@ -128,6 +152,14 @@ create_dialog (void)
gtk_widget_set_size_request (widget, -1, 250); /* Can this be right? Seems broken for large fonts. */
if (!CheckXKB()) {
GtkWidget *audible_bell_option = WID ("bell_audible_toggle");
GtkWidget *visual_bell_option = WID ("bell_visual_toggle");
gtk_widget_set_sensitive (audible_bell_option, FALSE);
gtk_widget_set_sensitive (visual_bell_option, FALSE);
}
return dialog;
}