all modules use now the new arch.
2007-06-21 Rodrigo Moya <rodrigo@gnome-db.org> * gnome-settings-accessibility-keyboard.c: * gnome-settings-keybindings.c: * gnome-settings-keyboard.c: * gnome-settings-multimedia-keys.c: * gnome-settings-xrdb.c: * gnome-settings-daemon.c: all modules use now the new arch. * gnome-settings-background.c (background_callback): pass the correct argument to the idle callback. svn path=/trunk/; revision=7756
This commit is contained in:
parent
39fc05602e
commit
4f4291f6d4
15 changed files with 820 additions and 670 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
2007-06-21 Rodrigo Moya <rodrigo@gnome-db.org>
|
||||||
|
|
||||||
|
* gnome-settings-accessibility-keyboard.c:
|
||||||
|
* gnome-settings-keybindings.c:
|
||||||
|
* gnome-settings-keyboard.c:
|
||||||
|
* gnome-settings-multimedia-keys.c:
|
||||||
|
* gnome-settings-xrdb.c:
|
||||||
|
* gnome-settings-daemon.c: all modules use now the new arch.
|
||||||
|
|
||||||
|
* gnome-settings-background.c (background_callback): pass the correct
|
||||||
|
argument to the idle callback.
|
||||||
|
|
||||||
|
2007-06-21 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gnome-settings-screensaver.c (gnome_settings_module_screensaver_start):
|
||||||
|
fix spawning of gnome-screensaver.
|
||||||
|
|
||||||
2007-06-19 Rodrigo Moya <rodrigo@gnome-db.org>
|
2007-06-19 Rodrigo Moya <rodrigo@gnome-db.org>
|
||||||
|
|
||||||
* gnome-settings-module.c (gnome_settings_module_start|_stop): return
|
* gnome-settings-module.c (gnome_settings_module_start|_stop): return
|
||||||
|
|
|
@ -20,7 +20,6 @@ gnome_settings_daemon_SOURCES = \
|
||||||
eggaccelerators.h \
|
eggaccelerators.h \
|
||||||
eggaccelerators.c \
|
eggaccelerators.c \
|
||||||
factory.c \
|
factory.c \
|
||||||
gnome-settings-accessibility-keyboard.h \
|
|
||||||
gnome-settings-accessibility-keyboard.c \
|
gnome-settings-accessibility-keyboard.c \
|
||||||
gnome-settings-background.c \
|
gnome-settings-background.c \
|
||||||
gnome-settings-clipboard.c \
|
gnome-settings-clipboard.c \
|
||||||
|
@ -32,17 +31,14 @@ gnome_settings_daemon_SOURCES = \
|
||||||
gnome-settings-font.c \
|
gnome-settings-font.c \
|
||||||
gnome-settings-gtk1theme.c \
|
gnome-settings-gtk1theme.c \
|
||||||
gnome-settings-keybindings.c \
|
gnome-settings-keybindings.c \
|
||||||
gnome-settings-keybindings.h \
|
|
||||||
gnome-settings-keyboard-xkb.h \
|
gnome-settings-keyboard-xkb.h \
|
||||||
gnome-settings-keyboard-xkb.c \
|
gnome-settings-keyboard-xkb.c \
|
||||||
gnome-settings-keyboard.h \
|
|
||||||
gnome-settings-keyboard.c \
|
gnome-settings-keyboard.c \
|
||||||
gnome-settings-locate-pointer.c \
|
gnome-settings-locate-pointer.c \
|
||||||
gnome-settings-locate-pointer.h \
|
gnome-settings-locate-pointer.h \
|
||||||
gnome-settings-module.c \
|
gnome-settings-module.c \
|
||||||
gnome-settings-module.h \
|
gnome-settings-module.h \
|
||||||
gnome-settings-mouse.c \
|
gnome-settings-mouse.c \
|
||||||
gnome-settings-multimedia-keys.h \
|
|
||||||
gnome-settings-multimedia-keys.c \
|
gnome-settings-multimedia-keys.c \
|
||||||
gnome-settings-screensaver.c \
|
gnome-settings-screensaver.c \
|
||||||
gnome-settings-server.h \
|
gnome-settings-server.h \
|
||||||
|
@ -51,7 +47,6 @@ gnome_settings_daemon_SOURCES = \
|
||||||
gnome-settings-xmodmap.c \
|
gnome-settings-xmodmap.c \
|
||||||
gnome-settings-xmodmap.h \
|
gnome-settings-xmodmap.h \
|
||||||
gnome-settings-xrdb.c \
|
gnome-settings-xrdb.c \
|
||||||
gnome-settings-xrdb.h \
|
|
||||||
gnome-settings-xsettings.c \
|
gnome-settings-xsettings.c \
|
||||||
gsd-media-keys-window.c \
|
gsd-media-keys-window.c \
|
||||||
gsd-media-keys-window.h \
|
gsd-media-keys-window.h \
|
||||||
|
|
|
@ -31,8 +31,71 @@
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
#include <libgnome/gnome-help.h>
|
#include <libgnome/gnome-help.h>
|
||||||
|
|
||||||
#include "gnome-settings-accessibility-keyboard.h"
|
#include "gnome-settings-module.h"
|
||||||
#include "gnome-settings-daemon.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModule parent;
|
||||||
|
} GnomeSettingsModuleAccessibilityKeyboard;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModuleClass parent_class;
|
||||||
|
} GnomeSettingsModuleAccessibilityKeyboardClass;
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel gnome_settings_module_accessibility_keyboard_get_runlevel (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_accessibility_keyboard_initialize (GnomeSettingsModule *module,
|
||||||
|
GConfClient *client);
|
||||||
|
static gboolean gnome_settings_module_accessibility_keyboard_start (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_accessibility_keyboard_stop (GnomeSettingsModule *module);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_accessibility_keyboard_class_init (GnomeSettingsModuleAccessibilityKeyboardClass *klass)
|
||||||
|
{
|
||||||
|
GnomeSettingsModuleClass *module_class;
|
||||||
|
|
||||||
|
module_class = (GnomeSettingsModuleClass *) klass;
|
||||||
|
module_class->get_runlevel = gnome_settings_module_accessibility_keyboard_get_runlevel;
|
||||||
|
module_class->initialize = gnome_settings_module_accessibility_keyboard_initialize;
|
||||||
|
module_class->start = gnome_settings_module_accessibility_keyboard_start;
|
||||||
|
module_class->stop = gnome_settings_module_accessibility_keyboard_stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_accessibility_keyboard_init (GnomeSettingsModuleAccessibilityKeyboard *module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gnome_settings_module_accessibility_keyboard_get_type (void)
|
||||||
|
{
|
||||||
|
static GType module_type = 0;
|
||||||
|
|
||||||
|
if (!module_type) {
|
||||||
|
static const GTypeInfo module_info = {
|
||||||
|
sizeof (GnomeSettingsModuleAccessibilityKeyboardClass),
|
||||||
|
NULL, /* base_init */
|
||||||
|
NULL, /* base_finalize */
|
||||||
|
(GClassInitFunc) gnome_settings_module_accessibility_keyboard_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GnomeSettingsModuleAccessibilityKeyboard),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gnome_settings_module_accessibility_keyboard_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||||
|
"GnomeSettingsModuleAccessibilityKeyboard",
|
||||||
|
&module_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return module_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel
|
||||||
|
gnome_settings_module_accessibility_keyboard_get_runlevel (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XKB_H
|
#ifdef HAVE_X11_EXTENSIONS_XKB_H
|
||||||
# include <X11/XKBlib.h>
|
# include <X11/XKBlib.h>
|
||||||
|
@ -293,24 +356,20 @@ ax_response_callback (gint response_id, guint revert_controls_mask, gboolean ena
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
switch (response_id)
|
switch (response_id) {
|
||||||
{
|
|
||||||
case GTK_RESPONSE_DELETE_EVENT:
|
case GTK_RESPONSE_DELETE_EVENT:
|
||||||
case GTK_RESPONSE_REJECT:
|
case GTK_RESPONSE_REJECT:
|
||||||
case GTK_RESPONSE_CANCEL:
|
case GTK_RESPONSE_CANCEL: {
|
||||||
{
|
|
||||||
GConfClient *client = gnome_settings_get_config_client ();
|
GConfClient *client = gnome_settings_get_config_client ();
|
||||||
|
|
||||||
/* we're reverting, so we invert sense of 'enabled' flag */
|
/* we're reverting, so we invert sense of 'enabled' flag */
|
||||||
d ("cancelling AccessX request");
|
d ("cancelling AccessX request");
|
||||||
if (revert_controls_mask == XkbStickyKeysMask)
|
if (revert_controls_mask == XkbStickyKeysMask) {
|
||||||
{
|
|
||||||
success = gconf_client_set_bool (client, CONFIG_ROOT "/stickykeys_enable", !enabled, &err);
|
success = gconf_client_set_bool (client, CONFIG_ROOT "/stickykeys_enable", !enabled, &err);
|
||||||
if (err != NULL)
|
if (err != NULL)
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
}
|
}
|
||||||
if (revert_controls_mask == XkbSlowKeysMask)
|
if (revert_controls_mask == XkbSlowKeysMask) {
|
||||||
{
|
|
||||||
success = gconf_client_set_bool (client, CONFIG_ROOT "/slowkeys_enable", !enabled, &err);
|
success = gconf_client_set_bool (client, CONFIG_ROOT "/slowkeys_enable", !enabled, &err);
|
||||||
if (err != NULL)
|
if (err != NULL)
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
|
@ -503,8 +562,7 @@ set_gconf_from_server (GConfEntry *ignored)
|
||||||
changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/togglekeys_enable",
|
changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/togglekeys_enable",
|
||||||
desc->ctrls->ax_options & XkbAX_IndicatorFBMask);
|
desc->ctrls->ax_options & XkbAX_IndicatorFBMask);
|
||||||
|
|
||||||
if (!changed && stickykeys_changed^slowkeys_changed)
|
if (!changed && stickykeys_changed^slowkeys_changed) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* sticky or slowkeys has changed, singly, without our intervention.
|
* sticky or slowkeys has changed, singly, without our intervention.
|
||||||
* 99% chance this is due to a keyboard shortcut being used.
|
* 99% chance this is due to a keyboard shortcut being used.
|
||||||
|
@ -515,8 +573,7 @@ set_gconf_from_server (GConfEntry *ignored)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* sanity check: are keyboard shortcuts available? */
|
/* sanity check: are keyboard shortcuts available? */
|
||||||
if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask)
|
if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask) {
|
||||||
{
|
|
||||||
if (slowkeys_changed)
|
if (slowkeys_changed)
|
||||||
ax_slowkeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbSlowKeysMask);
|
ax_slowkeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbSlowKeysMask);
|
||||||
else
|
else
|
||||||
|
@ -561,15 +618,24 @@ cb_xkb_event_filter (GdkXEvent *xevent, GdkEvent *ignored1, gpointer ignored2)
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_accessibility_keyboard_load (GConfClient *client)
|
gnome_settings_module_accessibility_keyboard_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
|
{
|
||||||
|
gnome_settings_register_config_callback (CONFIG_ROOT, &set_server_from_gconf);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_accessibility_keyboard_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
guint event_mask = XkbControlsNotifyMask;
|
guint event_mask = XkbControlsNotifyMask;
|
||||||
#ifdef DEBUG_ACCESSIBILITY
|
#ifdef DEBUG_ACCESSIBILITY
|
||||||
event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask); /* make default when AXN_AXKWarning works */
|
event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!xkb_enabled ())
|
if (!xkb_enabled ())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
/* be sure to init before starting to monitor the server */
|
/* be sure to init before starting to monitor the server */
|
||||||
set_server_from_gconf (NULL);
|
set_server_from_gconf (NULL);
|
||||||
|
@ -584,23 +650,30 @@ gnome_settings_accessibility_keyboard_load (GConfClient *client)
|
||||||
gdk_error_trap_pop ();
|
gdk_error_trap_pop ();
|
||||||
|
|
||||||
gdk_window_add_filter (NULL, cb_xkb_event_filter, NULL);
|
gdk_window_add_filter (NULL, cb_xkb_event_filter, NULL);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
gnome_settings_accessibility_keyboard_init (GConfClient *client)
|
|
||||||
{
|
|
||||||
gnome_settings_register_config_callback (CONFIG_ROOT, &set_server_from_gconf);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_accessibility_keyboard_load (GConfClient *client)
|
gnome_settings_module_accessibility_keyboard_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
{
|
{
|
||||||
g_warning ("Unsupported in this build");
|
g_warning ("Unsupported in this build");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
void
|
|
||||||
gnome_settings_accessibility_keyboard_init (GConfClient *client)
|
static gboolean
|
||||||
|
gnome_settings_module_accessibility_keyboard_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
|
g_warning ("Unsupported in this build");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_accessibility_keyboard_stop (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* gnome-settings-accessibility-keyboard.h
|
|
||||||
*
|
|
||||||
* Copyright © 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H
|
|
||||||
#define __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H
|
|
||||||
|
|
||||||
#include <gconf/gconf.h>
|
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
void gnome_settings_accessibility_keyboard_init (GConfClient *client);
|
|
||||||
void gnome_settings_accessibility_keyboard_load (GConfClient *client);
|
|
||||||
|
|
||||||
#endif /* __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H */
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include <gconf/gconf.h>
|
#include <gconf/gconf.h>
|
||||||
|
|
||||||
#include "gnome-settings-keyboard.h"
|
|
||||||
#include "gnome-settings-module.h"
|
#include "gnome-settings-module.h"
|
||||||
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
@ -89,7 +88,7 @@ background_callback (GConfClient *client,
|
||||||
g_source_remove (module_bg->applier_idle_id);
|
g_source_remove (module_bg->applier_idle_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_bg->applier_idle_id = g_timeout_add (100, applier_idle, NULL);
|
module_bg->applier_idle_id = g_timeout_add (100, applier_idle, module_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -33,29 +33,25 @@
|
||||||
#include "xsettings-manager.h"
|
#include "xsettings-manager.h"
|
||||||
#include "gnome-settings-daemon.h"
|
#include "gnome-settings-daemon.h"
|
||||||
#include "gnome-settings-module.h"
|
#include "gnome-settings-module.h"
|
||||||
#include "gnome-settings-xmodmap.h"
|
|
||||||
|
|
||||||
/*#include "gnome-settings-disk.h"*/
|
|
||||||
#include "gnome-settings-keyboard-xkb.h"
|
|
||||||
#include "gnome-settings-keyboard.h"
|
|
||||||
#include "gnome-settings-accessibility-keyboard.h"
|
|
||||||
#include "gnome-settings-keybindings.h"
|
|
||||||
#include "gnome-settings-multimedia-keys.h"
|
|
||||||
#include "gnome-settings-xrdb.h"
|
|
||||||
|
|
||||||
struct _GnomeSettingsDaemonPrivate {
|
struct _GnomeSettingsDaemonPrivate {
|
||||||
GHashTable *loaded_modules;
|
GHashTable *loaded_modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GType gnome_settings_module_accessibility_keyboard_get_type (void);
|
||||||
GType gnome_settings_module_background_get_type (void);
|
GType gnome_settings_module_background_get_type (void);
|
||||||
GType gnome_settings_module_clipboard_get_type (void);
|
GType gnome_settings_module_clipboard_get_type (void);
|
||||||
GType gnome_settings_module_default_editor_get_type (void);
|
GType gnome_settings_module_default_editor_get_type (void);
|
||||||
GType gnome_settings_module_font_get_type (void);
|
GType gnome_settings_module_font_get_type (void);
|
||||||
GType gnome_settings_module_gtk1_get_type (void);
|
GType gnome_settings_module_gtk1_get_type (void);
|
||||||
|
GType gnome_settings_module_keybindings_get_type (void);
|
||||||
|
GType gnome_settings_module_keyboard_get_type (void);
|
||||||
GType gnome_settings_module_mouse_get_type (void);
|
GType gnome_settings_module_mouse_get_type (void);
|
||||||
|
GType gnome_settings_module_multimedia_keys_get_type (void);
|
||||||
GType gnome_settings_module_screensaver_get_type (void);
|
GType gnome_settings_module_screensaver_get_type (void);
|
||||||
GType gnome_settings_module_sound_get_type (void);
|
GType gnome_settings_module_sound_get_type (void);
|
||||||
GType gnome_settings_module_typing_break_get_type (void);
|
GType gnome_settings_module_typing_break_get_type (void);
|
||||||
|
GType gnome_settings_module_xrdb_get_type (void);
|
||||||
GType gnome_settings_module_xsettings_get_type (void);
|
GType gnome_settings_module_xsettings_get_type (void);
|
||||||
|
|
||||||
static GObjectClass *parent_class = NULL;
|
static GObjectClass *parent_class = NULL;
|
||||||
|
@ -187,15 +183,20 @@ gnome_settings_daemon_init (GnomeSettingsDaemon *settings)
|
||||||
settings->priv = g_new (GnomeSettingsDaemonPrivate, 1);
|
settings->priv = g_new (GnomeSettingsDaemonPrivate, 1);
|
||||||
|
|
||||||
/* register all internal modules types */
|
/* register all internal modules types */
|
||||||
if (!gnome_settings_module_background_get_type ()
|
if (!gnome_settings_module_accessibility_keyboard_get_type ()
|
||||||
|
|| !gnome_settings_module_background_get_type ()
|
||||||
|| !gnome_settings_module_clipboard_get_type ()
|
|| !gnome_settings_module_clipboard_get_type ()
|
||||||
|| !gnome_settings_module_default_editor_get_type ()
|
|| !gnome_settings_module_default_editor_get_type ()
|
||||||
|| !gnome_settings_module_font_get_type ()
|
|| !gnome_settings_module_font_get_type ()
|
||||||
|| !gnome_settings_module_gtk1_get_type ()
|
|| !gnome_settings_module_gtk1_get_type ()
|
||||||
|
|| !gnome_settings_module_keybindings_get_type ()
|
||||||
|
|| !gnome_settings_module_keyboard_get_type ()
|
||||||
|| !gnome_settings_module_mouse_get_type ()
|
|| !gnome_settings_module_mouse_get_type ()
|
||||||
|
|| !gnome_settings_module_multimedia_keys_get_type ()
|
||||||
|| !gnome_settings_module_screensaver_get_type ()
|
|| !gnome_settings_module_screensaver_get_type ()
|
||||||
|| !gnome_settings_module_sound_get_type ()
|
|| !gnome_settings_module_sound_get_type ()
|
||||||
|| !gnome_settings_module_typing_break_get_type ()
|
|| !gnome_settings_module_typing_break_get_type ()
|
||||||
|
|| !gnome_settings_module_xrdb_get_type ()
|
||||||
|| !gnome_settings_module_xsettings_get_type ())
|
|| !gnome_settings_module_xsettings_get_type ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -281,17 +282,6 @@ gnome_settings_daemon_new (void)
|
||||||
|
|
||||||
client = gnome_settings_get_config_client ();
|
client = gnome_settings_get_config_client ();
|
||||||
|
|
||||||
/* gnome_settings_disk_init (client);*/
|
|
||||||
/* Essential - xkb initialization should happen before */
|
|
||||||
gnome_settings_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) gnome_settings_load_modmap_files, NULL);
|
|
||||||
gnome_settings_keyboard_xkb_init (client);
|
|
||||||
gnome_settings_keyboard_init (client);
|
|
||||||
gnome_settings_multimedia_keys_init (client);
|
|
||||||
/* */
|
|
||||||
gnome_settings_accessibility_keyboard_init (client);
|
|
||||||
gnome_settings_keybindings_init (client);
|
|
||||||
gnome_settings_xrdb_init (client);
|
|
||||||
|
|
||||||
/* load all modules */
|
/* load all modules */
|
||||||
initialize_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS);
|
initialize_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS);
|
||||||
initialize_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS);
|
initialize_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS);
|
||||||
|
@ -307,16 +297,6 @@ gnome_settings_daemon_new (void)
|
||||||
manager_event_filter, GINT_TO_POINTER (i));
|
manager_event_filter, GINT_TO_POINTER (i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gnome_settings_disk_load (client);*/
|
|
||||||
/* Essential - xkb initialization should happen before */
|
|
||||||
gnome_settings_keyboard_xkb_load (client);
|
|
||||||
gnome_settings_keyboard_load (client);
|
|
||||||
gnome_settings_multimedia_keys_load (client);
|
|
||||||
/* */
|
|
||||||
gnome_settings_accessibility_keyboard_load (client);
|
|
||||||
gnome_settings_keybindings_load (client);
|
|
||||||
gnome_settings_xrdb_load (client);
|
|
||||||
|
|
||||||
/* start all modules */
|
/* start all modules */
|
||||||
start_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS);
|
start_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS);
|
||||||
start_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS);
|
start_modules (daemon, GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS);
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include "gnome-settings-daemon.h"
|
#include "gnome-settings-module.h"
|
||||||
#include "gnome-settings-keybindings.h"
|
|
||||||
#include "eggaccelerators.h"
|
#include "eggaccelerators.h"
|
||||||
|
|
||||||
/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what
|
/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what
|
||||||
|
@ -21,6 +20,14 @@
|
||||||
|
|
||||||
#define GCONF_BINDING_DIR "/desktop/gnome/keybindings"
|
#define GCONF_BINDING_DIR "/desktop/gnome/keybindings"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModule parent;
|
||||||
|
} GnomeSettingsModuleKeybindings;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModuleClass parent_class;
|
||||||
|
} GnomeSettingsModuleKeybindingsClass;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint keysym;
|
guint keysym;
|
||||||
guint state;
|
guint state;
|
||||||
|
@ -35,9 +42,63 @@ typedef struct {
|
||||||
Key previous_key;
|
Key previous_key;
|
||||||
} Binding;
|
} Binding;
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel gnome_settings_module_keybindings_get_runlevel (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_keybindings_initialize (GnomeSettingsModule *module, GConfClient *client);
|
||||||
|
static gboolean gnome_settings_module_keybindings_start (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_keybindings_stop (GnomeSettingsModule *module);
|
||||||
|
|
||||||
static GSList *binding_list = NULL;
|
static GSList *binding_list = NULL;
|
||||||
static GSList *screens = NULL;
|
static GSList *screens = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_keybindings_class_init (GnomeSettingsModuleKeybindingsClass *klass)
|
||||||
|
{
|
||||||
|
GnomeSettingsModuleClass *module_class;
|
||||||
|
|
||||||
|
module_class = GNOME_SETTINGS_MODULE_CLASS (klass);
|
||||||
|
module_class->get_runlevel = gnome_settings_module_keybindings_get_runlevel;
|
||||||
|
module_class->initialize = gnome_settings_module_keybindings_initialize;
|
||||||
|
module_class->start = gnome_settings_module_keybindings_start;
|
||||||
|
module_class->stop = gnome_settings_module_keybindings_stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_keybindings_init (GnomeSettingsModuleKeybindings *module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gnome_settings_module_keybindings_get_type (void)
|
||||||
|
{
|
||||||
|
static GType module_type = 0;
|
||||||
|
|
||||||
|
if (!module_type) {
|
||||||
|
static const GTypeInfo module_info = {
|
||||||
|
sizeof (GnomeSettingsModuleKeybindingsClass),
|
||||||
|
NULL, /* base_init */
|
||||||
|
NULL, /* base_finalize */
|
||||||
|
(GClassInitFunc) gnome_settings_module_keybindings_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GnomeSettingsModuleKeybindings),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gnome_settings_module_keybindings_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||||
|
"GnomeSettingsModuleKeybindings",
|
||||||
|
&module_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return module_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel
|
||||||
|
gnome_settings_module_keybindings_get_runlevel (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
static GSList *
|
static GSList *
|
||||||
get_screens_list (void)
|
get_screens_list (void)
|
||||||
{
|
{
|
||||||
|
@ -200,23 +261,19 @@ bindings_get_entry (const char *subdir)
|
||||||
/* Get entries for this binding */
|
/* Get entries for this binding */
|
||||||
list = gconf_client_all_entries (client, subdir, NULL);
|
list = gconf_client_all_entries (client, subdir, NULL);
|
||||||
|
|
||||||
for (li = list; li != NULL; li = li->next)
|
for (li = list; li != NULL; li = li->next) {
|
||||||
{
|
|
||||||
GConfEntry *entry = li->data;
|
GConfEntry *entry = li->data;
|
||||||
char *key_name = g_path_get_basename (gconf_entry_get_key (entry));
|
char *key_name = g_path_get_basename (gconf_entry_get_key (entry));
|
||||||
|
|
||||||
if (key_name == NULL)
|
if (key_name == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
else if (strcmp (key_name, "action") == 0)
|
else if (strcmp (key_name, "action") == 0) {
|
||||||
{
|
|
||||||
if (!action)
|
if (!action)
|
||||||
action = entry_get_string (entry);
|
action = entry_get_string (entry);
|
||||||
else
|
else
|
||||||
g_warning (_("Key Binding (%s) has its action defined multiple times\n"),
|
g_warning (_("Key Binding (%s) has its action defined multiple times\n"),
|
||||||
gconf_key);
|
gconf_key);
|
||||||
}
|
} else if (strcmp (key_name, "binding") == 0) {
|
||||||
else if (strcmp (key_name, "binding") == 0)
|
|
||||||
{
|
|
||||||
if (!key)
|
if (!key)
|
||||||
key = entry_get_string (entry);
|
key = entry_get_string (entry);
|
||||||
else
|
else
|
||||||
|
@ -227,8 +284,7 @@ bindings_get_entry (const char *subdir)
|
||||||
gconf_entry_free (entry);
|
gconf_entry_free (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!action || !key)
|
if (!action || !key) {
|
||||||
{
|
|
||||||
g_warning (_("Key Binding (%s) is incomplete\n"), gconf_key);
|
g_warning (_("Key Binding (%s) is incomplete\n"), gconf_key);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -238,8 +294,7 @@ bindings_get_entry (const char *subdir)
|
||||||
|
|
||||||
if (!tmp_elem)
|
if (!tmp_elem)
|
||||||
new_binding = g_new0 (Binding, 1);
|
new_binding = g_new0 (Binding, 1);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
new_binding = (Binding*) tmp_elem->data;
|
new_binding = (Binding*) tmp_elem->data;
|
||||||
g_free (new_binding->binding_str);
|
g_free (new_binding->binding_str);
|
||||||
g_free (new_binding->action);
|
g_free (new_binding->action);
|
||||||
|
@ -253,19 +308,16 @@ bindings_get_entry (const char *subdir)
|
||||||
new_binding->previous_key.state = new_binding->key.state;
|
new_binding->previous_key.state = new_binding->key.state;
|
||||||
new_binding->previous_key.keycode = new_binding->key.keycode;
|
new_binding->previous_key.keycode = new_binding->key.keycode;
|
||||||
|
|
||||||
if (parse_binding (new_binding))
|
if (parse_binding (new_binding)) {
|
||||||
{
|
|
||||||
binding_list = g_slist_append (binding_list, new_binding);
|
binding_list = g_slist_append (binding_list, new_binding);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
g_warning (_("Key Binding (%s) is invalid\n"), gconf_key);
|
g_warning (_("Key Binding (%s) is invalid\n"), gconf_key);
|
||||||
g_free (new_binding->binding_str);
|
g_free (new_binding->binding_str);
|
||||||
g_free (new_binding->action);
|
g_free (new_binding->action);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_slist_free (list);
|
g_slist_free (list);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -275,8 +327,7 @@ key_already_used (Binding *binding)
|
||||||
{
|
{
|
||||||
GSList *li;
|
GSList *li;
|
||||||
|
|
||||||
for (li = binding_list; li != NULL; li = li->next)
|
for (li = binding_list; li != NULL; li = li->next) {
|
||||||
{
|
|
||||||
Binding *tmp_binding = (Binding*) li->data;
|
Binding *tmp_binding = (Binding*) li->data;
|
||||||
|
|
||||||
if (tmp_binding != binding && tmp_binding->key.keycode == binding->key.keycode &&
|
if (tmp_binding != binding && tmp_binding->key.keycode == binding->key.keycode &&
|
||||||
|
@ -348,16 +399,13 @@ binding_register_keys (void)
|
||||||
gdk_error_trap_push();
|
gdk_error_trap_push();
|
||||||
|
|
||||||
/* Now check for changes and grab new key if not already used */
|
/* Now check for changes and grab new key if not already used */
|
||||||
for (li = binding_list ; li != NULL; li = li->next)
|
for (li = binding_list ; li != NULL; li = li->next) {
|
||||||
{
|
|
||||||
Binding *binding = (Binding *) li->data;
|
Binding *binding = (Binding *) li->data;
|
||||||
|
|
||||||
if (binding->previous_key.keycode != binding->key.keycode ||
|
if (binding->previous_key.keycode != binding->key.keycode ||
|
||||||
binding->previous_key.state != binding->key.state)
|
binding->previous_key.state != binding->key.state) {
|
||||||
{
|
|
||||||
/* Ungrab key if it changed and not clashing with previously set binding */
|
/* Ungrab key if it changed and not clashing with previously set binding */
|
||||||
if (!key_already_used (binding))
|
if (!key_already_used (binding)) {
|
||||||
{
|
|
||||||
if (binding->previous_key.keycode)
|
if (binding->previous_key.keycode)
|
||||||
do_grab (FALSE, &binding->previous_key);
|
do_grab (FALSE, &binding->previous_key);
|
||||||
do_grab (TRUE, &binding->key);
|
do_grab (TRUE, &binding->key);
|
||||||
|
@ -365,8 +413,7 @@ binding_register_keys (void)
|
||||||
binding->previous_key.keysym = binding->key.keysym;
|
binding->previous_key.keysym = binding->key.keysym;
|
||||||
binding->previous_key.state = binding->key.state;
|
binding->previous_key.state = binding->key.state;
|
||||||
binding->previous_key.keycode = binding->key.keycode;
|
binding->previous_key.keycode = binding->key.keycode;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
g_warning (_("Key Binding (%s) is already in use\n"), binding->binding_str);
|
g_warning (_("Key Binding (%s) is already in use\n"), binding->binding_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,13 +452,11 @@ keybindings_filter (GdkXEvent *gdk_xevent,
|
||||||
keycode = xevent->xkey.keycode;
|
keycode = xevent->xkey.keycode;
|
||||||
state = xevent->xkey.state;
|
state = xevent->xkey.state;
|
||||||
|
|
||||||
for (li = binding_list; li != NULL; li = li->next)
|
for (li = binding_list; li != NULL; li = li->next) {
|
||||||
{
|
|
||||||
Binding *binding = (Binding*) li->data;
|
Binding *binding = (Binding*) li->data;
|
||||||
|
|
||||||
if (keycode == binding->key.keycode &&
|
if (keycode == binding->key.keycode &&
|
||||||
(state & USED_MODS) == binding->key.state)
|
(state & USED_MODS) == binding->key.state) {
|
||||||
{
|
|
||||||
GError* error = NULL;
|
GError* error = NULL;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
gchar **argv = NULL;
|
gchar **argv = NULL;
|
||||||
|
@ -426,7 +471,6 @@ keybindings_filter (GdkXEvent *gdk_xevent,
|
||||||
|
|
||||||
envp = get_exec_environment (xevent);
|
envp = get_exec_environment (xevent);
|
||||||
|
|
||||||
|
|
||||||
retval = g_spawn_async (NULL,
|
retval = g_spawn_async (NULL,
|
||||||
argv,
|
argv,
|
||||||
envp,
|
envp,
|
||||||
|
@ -438,8 +482,7 @@ keybindings_filter (GdkXEvent *gdk_xevent,
|
||||||
g_strfreev (argv);
|
g_strfreev (argv);
|
||||||
g_strfreev (envp);
|
g_strfreev (envp);
|
||||||
|
|
||||||
if (!retval)
|
if (!retval) {
|
||||||
{
|
|
||||||
GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING,
|
GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING,
|
||||||
GTK_BUTTONS_CLOSE,
|
GTK_BUTTONS_CLOSE,
|
||||||
_("Error while trying to run (%s)\n"\
|
_("Error while trying to run (%s)\n"\
|
||||||
|
@ -457,8 +500,8 @@ keybindings_filter (GdkXEvent *gdk_xevent,
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_keybindings_init (GConfClient *client)
|
gnome_settings_module_keybindings_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
{
|
{
|
||||||
GdkDisplay *dpy = gdk_display_get_default ();
|
GdkDisplay *dpy = gdk_display_get_default ();
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
@ -467,24 +510,24 @@ gnome_settings_keybindings_init (GConfClient *client)
|
||||||
|
|
||||||
gnome_settings_register_config_callback (GCONF_BINDING_DIR, bindings_callback);
|
gnome_settings_register_config_callback (GCONF_BINDING_DIR, bindings_callback);
|
||||||
|
|
||||||
for (i = 0; i < screen_num; i++)
|
for (i = 0; i < screen_num; i++) {
|
||||||
{
|
|
||||||
screen = gdk_display_get_screen (dpy, i);
|
screen = gdk_display_get_screen (dpy, i);
|
||||||
gdk_window_add_filter (gdk_screen_get_root_window (screen),
|
gdk_window_add_filter (gdk_screen_get_root_window (screen),
|
||||||
keybindings_filter, NULL);
|
keybindings_filter, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_keybindings_load (GConfClient *client)
|
gnome_settings_module_keybindings_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
GSList *list, *li;
|
GSList *list, *li;
|
||||||
|
|
||||||
list = gconf_client_all_dirs (client, GCONF_BINDING_DIR, NULL);
|
list = gconf_client_all_dirs (gnome_settings_module_get_config_client (module), GCONF_BINDING_DIR, NULL);
|
||||||
screens = get_screens_list ();
|
screens = get_screens_list ();
|
||||||
|
|
||||||
for (li = list; li != NULL; li = li->next)
|
for (li = list; li != NULL; li = li->next) {
|
||||||
{
|
|
||||||
bindings_get_entry (li->data);
|
bindings_get_entry (li->data);
|
||||||
g_free (li->data);
|
g_free (li->data);
|
||||||
}
|
}
|
||||||
|
@ -492,5 +535,12 @@ gnome_settings_keybindings_load (GConfClient *client)
|
||||||
g_slist_free (list);
|
g_slist_free (list);
|
||||||
|
|
||||||
binding_register_keys ();
|
binding_register_keys ();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_keybindings_stop (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/* gnome-settings-keybindings.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2002 Sun Microsystems Inc.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Author: Erwann Chénedé <erwann.chenede@sun.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GNOME_SETTINGS_KEYBINDINGS_H__
|
|
||||||
#define __GNOME_SETTINGS_KEYBINDINGS_H__
|
|
||||||
|
|
||||||
#include <gconf/gconf.h>
|
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
void gnome_settings_keybindings_init (GConfClient *client);
|
|
||||||
void gnome_settings_keybindings_load (GConfClient *client);
|
|
||||||
|
|
||||||
#endif /*__GNOME_SETTINGS_KEYBINDINGS_H__*/
|
|
|
@ -28,10 +28,11 @@
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
#include "gnome-settings-keyboard.h"
|
#include "gnome-settings-keyboard-xkb.h"
|
||||||
#include "gnome-settings-daemon.h"
|
#include "gnome-settings-module.h"
|
||||||
|
#include "gnome-settings-xmodmap.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
||||||
# include <X11/extensions/xf86misc.h>
|
# include <X11/extensions/xf86misc.h>
|
||||||
|
@ -44,6 +45,68 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModule parent;
|
||||||
|
} GnomeSettingsModuleKeyboard;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModuleClass parent_class;
|
||||||
|
} GnomeSettingsModuleKeyboardClass;
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel gnome_settings_module_keyboard_get_runlevel (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_keyboard_initialize (GnomeSettingsModule *module, GConfClient *config_client);
|
||||||
|
static gboolean gnome_settings_module_keyboard_start (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_keyboard_stop (GnomeSettingsModule *module);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_keyboard_class_init (GnomeSettingsModuleKeyboardClass *klass)
|
||||||
|
{
|
||||||
|
GnomeSettingsModuleClass *module_class;
|
||||||
|
|
||||||
|
module_class = (GnomeSettingsModuleClass *) klass;
|
||||||
|
module_class->get_runlevel = gnome_settings_module_keyboard_get_runlevel;
|
||||||
|
module_class->initialize = gnome_settings_module_keyboard_initialize;
|
||||||
|
module_class->start = gnome_settings_module_keyboard_start;
|
||||||
|
module_class->stop = gnome_settings_module_keyboard_stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_keyboard_init (GnomeSettingsModuleKeyboard *module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gnome_settings_module_keyboard_get_type (void)
|
||||||
|
{
|
||||||
|
static GType module_type = 0;
|
||||||
|
|
||||||
|
if (!module_type) {
|
||||||
|
static const GTypeInfo module_info = {
|
||||||
|
sizeof (GnomeSettingsModuleKeyboardClass),
|
||||||
|
NULL, /* base_init */
|
||||||
|
NULL, /* base_finalize */
|
||||||
|
(GClassInitFunc) gnome_settings_module_keyboard_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GnomeSettingsModuleKeyboard),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gnome_settings_module_keyboard_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||||
|
"GnomeSettingsModuleKeyboard",
|
||||||
|
&module_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return module_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel
|
||||||
|
gnome_settings_module_keyboard_get_runlevel (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
||||||
static gboolean
|
static gboolean
|
||||||
xfree86_set_keyboard_autorepeat_rate (int delay, int rate)
|
xfree86_set_keyboard_autorepeat_rate (int delay, int rate)
|
||||||
|
@ -53,8 +116,7 @@ xfree86_set_keyboard_autorepeat_rate (int delay, int rate)
|
||||||
|
|
||||||
if (XF86MiscQueryExtension (GDK_DISPLAY (),
|
if (XF86MiscQueryExtension (GDK_DISPLAY (),
|
||||||
&event_base_return,
|
&event_base_return,
|
||||||
&error_base_return) == True)
|
&error_base_return) == True) {
|
||||||
{
|
|
||||||
/* load the current settings */
|
/* load the current settings */
|
||||||
XF86MiscKbdSettings kbdsettings;
|
XF86MiscKbdSettings kbdsettings;
|
||||||
XF86MiscGetKbdSettings (GDK_DISPLAY (), &kbdsettings);
|
XF86MiscGetKbdSettings (GDK_DISPLAY (), &kbdsettings);
|
||||||
|
@ -74,7 +136,8 @@ static gboolean
|
||||||
xkb_set_keyboard_autorepeat_rate (int delay, int rate)
|
xkb_set_keyboard_autorepeat_rate (int delay, int rate)
|
||||||
{
|
{
|
||||||
int interval = (rate <= 0) ? 1000000 : 1000/rate;
|
int interval = (rate <= 0) ? 1000000 : 1000/rate;
|
||||||
if (delay <= 0) delay = 1;
|
if (delay <= 0)
|
||||||
|
delay = 1;
|
||||||
return XkbSetAutoRepeatRate (GDK_DISPLAY (), XkbUseCoreKbd,
|
return XkbSetAutoRepeatRate (GDK_DISPLAY (), XkbUseCoreKbd,
|
||||||
delay, interval);
|
delay, interval);
|
||||||
}
|
}
|
||||||
|
@ -93,8 +156,7 @@ gsd_keyboard_get_hostname_key (const char *subkey)
|
||||||
|
|
||||||
if (gethostname (hostname, sizeof (hostname)) == 0 &&
|
if (gethostname (hostname, sizeof (hostname)) == 0 &&
|
||||||
strcmp (hostname, "localhost") != 0 &&
|
strcmp (hostname, "localhost") != 0 &&
|
||||||
strcmp (hostname, "localhost.localdomain") != 0)
|
strcmp (hostname, "localhost.localdomain") != 0) {
|
||||||
{
|
|
||||||
char *key = g_strconcat (GSD_KEYBOARD_KEY
|
char *key = g_strconcat (GSD_KEYBOARD_KEY
|
||||||
"/host-",
|
"/host-",
|
||||||
hostname,
|
hostname,
|
||||||
|
@ -102,8 +164,7 @@ gsd_keyboard_get_hostname_key (const char *subkey)
|
||||||
subkey,
|
subkey,
|
||||||
(char *)NULL);
|
(char *)NULL);
|
||||||
return key;
|
return key;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +213,7 @@ static char *
|
||||||
numlock_gconf_state_key (void)
|
numlock_gconf_state_key (void)
|
||||||
{
|
{
|
||||||
char *key = gsd_keyboard_get_hostname_key ("numlock_on");
|
char *key = gsd_keyboard_get_hostname_key ("numlock_on");
|
||||||
if (!key)
|
if (!key) {
|
||||||
{
|
|
||||||
numlock_setup_error = TRUE;
|
numlock_setup_error = TRUE;
|
||||||
g_warning ("numlock: Numlock remembering disabled because your hostname is set to \"localhost\".");
|
g_warning ("numlock: Numlock remembering disabled because your hostname is set to \"localhost\".");
|
||||||
}
|
}
|
||||||
|
@ -218,8 +278,7 @@ numlock_install_xkb_callback (void)
|
||||||
int have_xkb = XkbQueryExtension (dpy,
|
int have_xkb = XkbQueryExtension (dpy,
|
||||||
&op_code, &xkb_event_code,
|
&op_code, &xkb_event_code,
|
||||||
&error_code, &major, &minor);
|
&error_code, &major, &minor);
|
||||||
if (have_xkb != True)
|
if (have_xkb != True) {
|
||||||
{
|
|
||||||
numlock_setup_error = TRUE;
|
numlock_setup_error = TRUE;
|
||||||
g_warning ("numlock: XkbQueryExtension returned an error");
|
g_warning ("numlock: XkbQueryExtension returned an error");
|
||||||
return;
|
return;
|
||||||
|
@ -316,19 +375,34 @@ apply_settings (void)
|
||||||
gdk_error_trap_pop ();
|
gdk_error_trap_pop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
void
|
gnome_settings_module_keyboard_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
gnome_settings_keyboard_init (GConfClient *client)
|
|
||||||
{
|
{
|
||||||
|
/* Essential - xkb initialization should happen before */
|
||||||
|
gnome_settings_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) gnome_settings_load_modmap_files, NULL);
|
||||||
|
gnome_settings_keyboard_xkb_init (client);
|
||||||
|
|
||||||
gnome_settings_register_config_callback (GSD_KEYBOARD_KEY, (GnomeSettingsConfigCallback) apply_settings);
|
gnome_settings_register_config_callback (GSD_KEYBOARD_KEY, (GnomeSettingsConfigCallback) apply_settings);
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XKB_H
|
#ifdef HAVE_X11_EXTENSIONS_XKB_H
|
||||||
numlock_install_xkb_callback ();
|
numlock_install_xkb_callback ();
|
||||||
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
|
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_keyboard_load (GConfClient *client)
|
gnome_settings_module_keyboard_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
|
/* Essential - xkb initialization should happen before */
|
||||||
|
gnome_settings_keyboard_xkb_load (gnome_settings_module_get_config_client (module));
|
||||||
|
|
||||||
apply_settings ();
|
apply_settings ();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_keyboard_stop (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* -*- 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>
|
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
void gnome_settings_keyboard_init (GConfClient *client);
|
|
||||||
void gnome_settings_keyboard_load (GConfClient *client);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -32,14 +32,13 @@
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
#include "eggaccelerators.h"
|
#include "eggaccelerators.h"
|
||||||
|
|
||||||
#include "actions/acme.h"
|
#include "actions/acme.h"
|
||||||
#include "actions/acme-volume.h"
|
#include "actions/acme-volume.h"
|
||||||
#include "gsd-media-keys-window.h"
|
#include "gsd-media-keys-window.h"
|
||||||
#include "gnome-settings-dbus.h"
|
#include "gnome-settings-dbus.h"
|
||||||
|
#include "gnome-settings-module.h"
|
||||||
|
|
||||||
#define VOLUME_STEP 6 /* percents for one volume button press */
|
#define VOLUME_STEP 6 /* percents for one volume button press */
|
||||||
|
|
||||||
|
@ -52,6 +51,14 @@
|
||||||
* for these set */
|
* for these set */
|
||||||
#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
|
#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModule parent;
|
||||||
|
} GnomeSettingsModuleMultimediaKeys;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModuleClass parent_class;
|
||||||
|
} GnomeSettingsModuleMultimediaKeysClass;
|
||||||
|
|
||||||
typedef struct Acme Acme;
|
typedef struct Acme Acme;
|
||||||
|
|
||||||
struct Acme {
|
struct Acme {
|
||||||
|
@ -67,6 +74,61 @@ struct Acme {
|
||||||
GObject *server;
|
GObject *server;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel gnome_settings_module_multimedia_keys_get_runlevel (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_multimedia_keys_initialize (GnomeSettingsModule *module,
|
||||||
|
GConfClient *client);
|
||||||
|
static gboolean gnome_settings_module_multimedia_keys_start (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_multimedia_keys_stop (GnomeSettingsModule *module);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_multimedia_keys_class_init (GnomeSettingsModuleMultimediaKeysClass *klass)
|
||||||
|
{
|
||||||
|
GnomeSettingsModuleClass *module_class;
|
||||||
|
|
||||||
|
module_class = (GnomeSettingsModuleClass *) klass;
|
||||||
|
module_class->get_runlevel = gnome_settings_module_multimedia_keys_get_runlevel;
|
||||||
|
module_class->initialize = gnome_settings_module_multimedia_keys_initialize;
|
||||||
|
module_class->start = gnome_settings_module_multimedia_keys_start;
|
||||||
|
module_class->stop = gnome_settings_module_multimedia_keys_stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_multimedia_keys_init (GnomeSettingsModuleMultimediaKeys *module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gnome_settings_module_multimedia_keys_get_type (void)
|
||||||
|
{
|
||||||
|
static GType module_type = 0;
|
||||||
|
|
||||||
|
if (!module_type) {
|
||||||
|
static const GTypeInfo module_info = {
|
||||||
|
sizeof (GnomeSettingsModuleMultimediaKeysClass),
|
||||||
|
NULL, /* base_init */
|
||||||
|
NULL, /* base_finalize */
|
||||||
|
(GClassInitFunc) gnome_settings_module_multimedia_keys_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GnomeSettingsModuleMultimediaKeys),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gnome_settings_module_multimedia_keys_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||||
|
"GnomeSettingsModuleMultimediaKeys",
|
||||||
|
&module_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return module_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel
|
||||||
|
gnome_settings_module_multimedia_keys_get_runlevel (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return GNOME_SETTINGS_MODULE_RUNLEVEL_GNOME_SETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acme_error (char * msg)
|
acme_error (char * msg)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +149,8 @@ acme_error (char * msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
get_term_command (Acme *acme) {
|
get_term_command (Acme *acme)
|
||||||
|
{
|
||||||
gchar *cmd_term;
|
gchar *cmd_term;
|
||||||
gchar *cmd = NULL;
|
gchar *cmd = NULL;
|
||||||
|
|
||||||
|
@ -139,8 +202,7 @@ execute (Acme *acme, char *cmd, gboolean sync, gboolean need_term)
|
||||||
retval = g_spawn_sync (g_get_home_dir (),
|
retval = g_spawn_sync (g_get_home_dir (),
|
||||||
argv, NULL, G_SPAWN_SEARCH_PATH,
|
argv, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
retval = g_spawn_async (g_get_home_dir (),
|
retval = g_spawn_async (g_get_home_dir (),
|
||||||
argv, NULL, G_SPAWN_SEARCH_PATH,
|
argv, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
@ -148,8 +210,7 @@ execute (Acme *acme, char *cmd, gboolean sync, gboolean need_term)
|
||||||
g_strfreev (argv);
|
g_strfreev (argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == FALSE)
|
if (retval == FALSE) {
|
||||||
{
|
|
||||||
char *msg;
|
char *msg;
|
||||||
msg = g_strdup_printf
|
msg = g_strdup_printf
|
||||||
(_("Couldn't execute command: %s\n"
|
(_("Couldn't execute command: %s\n"
|
||||||
|
@ -165,10 +226,8 @@ execute (Acme *acme, char *cmd, gboolean sync, gboolean need_term)
|
||||||
static void
|
static void
|
||||||
do_sleep_action (char *cmd1, char *cmd2)
|
do_sleep_action (char *cmd1, char *cmd2)
|
||||||
{
|
{
|
||||||
if (g_spawn_command_line_async (cmd1, NULL) == FALSE)
|
if (g_spawn_command_line_async (cmd1, NULL) == FALSE) {
|
||||||
{
|
if (g_spawn_command_line_async (cmd2, NULL) == FALSE) {
|
||||||
if (g_spawn_command_line_async (cmd2, NULL) == FALSE)
|
|
||||||
{
|
|
||||||
acme_error (_("Couldn't put the machine to sleep.\n"
|
acme_error (_("Couldn't put the machine to sleep.\n"
|
||||||
"Verify that the machine is correctly configured."));
|
"Verify that the machine is correctly configured."));
|
||||||
}
|
}
|
||||||
|
@ -179,8 +238,7 @@ static void
|
||||||
dialog_init (Acme *acme)
|
dialog_init (Acme *acme)
|
||||||
{
|
{
|
||||||
if (acme->dialog != NULL &&
|
if (acme->dialog != NULL &&
|
||||||
!gsd_media_keys_window_is_valid (GSD_MEDIA_KEYS_WINDOW (acme->dialog)))
|
!gsd_media_keys_window_is_valid (GSD_MEDIA_KEYS_WINDOW (acme->dialog))) {
|
||||||
{
|
|
||||||
g_object_unref (acme->dialog);
|
g_object_unref (acme->dialog);
|
||||||
acme->dialog = NULL;
|
acme->dialog = NULL;
|
||||||
}
|
}
|
||||||
|
@ -264,10 +322,8 @@ update_kbd_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
|
||||||
g_return_if_fail (entry->key != NULL);
|
g_return_if_fail (entry->key != NULL);
|
||||||
|
|
||||||
/* Find the key that was modified */
|
/* Find the key that was modified */
|
||||||
for (i = 0; i < HANDLED_KEYS; i++)
|
for (i = 0; i < HANDLED_KEYS; i++) {
|
||||||
{
|
if (strcmp (entry->key, keys[i].gconf_key) == 0) {
|
||||||
if (strcmp (entry->key, keys[i].gconf_key) == 0)
|
|
||||||
{
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
Key *key;
|
Key *key;
|
||||||
|
|
||||||
|
@ -282,16 +338,14 @@ update_kbd_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
|
||||||
tmp = gconf_client_get_string (acme->conf_client,
|
tmp = gconf_client_get_string (acme->conf_client,
|
||||||
keys[i].gconf_key, NULL);
|
keys[i].gconf_key, NULL);
|
||||||
|
|
||||||
if (is_valid_shortcut (tmp) == FALSE)
|
if (is_valid_shortcut (tmp) == FALSE) {
|
||||||
{
|
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = g_new0 (Key, 1);
|
key = g_new0 (Key, 1);
|
||||||
if (egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state) == FALSE
|
if (egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state) == FALSE
|
||||||
|| key->keycode == 0)
|
|| key->keycode == 0) {
|
||||||
{
|
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
break;
|
break;
|
||||||
|
@ -323,8 +377,7 @@ init_screens (Acme *acme)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < gdk_display_get_n_screens (display); i++)
|
for (i = 0; i < gdk_display_get_n_screens (display); i++) {
|
||||||
{
|
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
|
||||||
screen = gdk_display_get_screen (display, i);
|
screen = gdk_display_get_screen (display, i);
|
||||||
|
@ -341,8 +394,7 @@ init_kbd (Acme *acme)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < HANDLED_KEYS; i++)
|
for (i = 0; i < HANDLED_KEYS; i++) {
|
||||||
{
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
Key *key;
|
Key *key;
|
||||||
|
|
||||||
|
@ -359,15 +411,13 @@ init_kbd (Acme *acme)
|
||||||
|
|
||||||
key = g_new0 (Key, 1);
|
key = g_new0 (Key, 1);
|
||||||
if (!egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state)
|
if (!egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state)
|
||||||
|| key->keycode == 0)
|
|| key->keycode == 0) {
|
||||||
{
|
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*avoid grabbing all the keyboard when KeyCode cannot be retrieved */
|
/*avoid grabbing all the keyboard when KeyCode cannot be retrieved */
|
||||||
if (key->keycode == AnyKey)
|
if (key->keycode == AnyKey) {
|
||||||
{
|
|
||||||
g_warning ("The shortcut key \"%s\" cannot be found on the current system, ignoring the binding", tmp);
|
g_warning ("The shortcut key \"%s\" cannot be found on the current system, ignoring the binding", tmp);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
@ -491,7 +541,8 @@ do_mail_action (Acme *acme)
|
||||||
if ((string != NULL) && (strcmp (string, "") != 0)) {
|
if ((string != NULL) && (strcmp (string, "") != 0)) {
|
||||||
gchar *cmd;
|
gchar *cmd;
|
||||||
cmd = g_strdup_printf (string, "");
|
cmd = g_strdup_printf (string, "");
|
||||||
execute (acme, cmd, FALSE, gconf_client_get_bool (acme->conf_client,
|
execute (acme, cmd, FALSE,
|
||||||
|
gconf_client_get_bool (acme->conf_client,
|
||||||
"/desktop/gnome/url-handlers/mailto/needs_terminal", NULL));
|
"/desktop/gnome/url-handlers/mailto/needs_terminal", NULL));
|
||||||
g_free (cmd);
|
g_free (cmd);
|
||||||
}
|
}
|
||||||
|
@ -589,16 +640,14 @@ do_sound_action (Acme *acme, int type)
|
||||||
acme_volume_mute_toggle (acme->volobj);
|
acme_volume_mute_toggle (acme->volobj);
|
||||||
break;
|
break;
|
||||||
case VOLUME_DOWN_KEY:
|
case VOLUME_DOWN_KEY:
|
||||||
if (muted)
|
if (muted) {
|
||||||
{
|
|
||||||
acme_volume_mute_toggle(acme->volobj);
|
acme_volume_mute_toggle(acme->volobj);
|
||||||
} else {
|
} else {
|
||||||
acme_volume_set_volume (acme->volobj, vol - vol_step);
|
acme_volume_set_volume (acme->volobj, vol - vol_step);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VOLUME_UP_KEY:
|
case VOLUME_UP_KEY:
|
||||||
if (muted)
|
if (muted) {
|
||||||
{
|
|
||||||
acme_volume_mute_toggle(acme->volobj);
|
acme_volume_mute_toggle(acme->volobj);
|
||||||
} else {
|
} else {
|
||||||
acme_volume_set_volume (acme->volobj, vol + vol_step);
|
acme_volume_set_volume (acme->volobj, vol + vol_step);
|
||||||
|
@ -708,13 +757,11 @@ acme_get_screen_from_event (Acme *acme, XAnyEvent *xanyev)
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
/* Look for which screen we're receiving events */
|
/* Look for which screen we're receiving events */
|
||||||
for (l = acme->screens; l != NULL; l = l->next)
|
for (l = acme->screens; l != NULL; l = l->next) {
|
||||||
{
|
|
||||||
screen = (GdkScreen *) l->data;
|
screen = (GdkScreen *) l->data;
|
||||||
window = gdk_screen_get_root_window (screen);
|
window = gdk_screen_get_root_window (screen);
|
||||||
|
|
||||||
if (GDK_WINDOW_XID (window) == xanyev->window)
|
if (GDK_WINDOW_XID (window) == xanyev->window) {
|
||||||
{
|
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,14 +786,12 @@ acme_filter_events (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||||
keycode = xev->xkey.keycode;
|
keycode = xev->xkey.keycode;
|
||||||
state = xev->xkey.state;
|
state = xev->xkey.state;
|
||||||
|
|
||||||
for (i = 0; i < HANDLED_KEYS; i++)
|
for (i = 0; i < HANDLED_KEYS; i++) {
|
||||||
{
|
|
||||||
if (keys[i].key == NULL)
|
if (keys[i].key == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (keys[i].key->keycode == keycode &&
|
if (keys[i].key->keycode == keycode &&
|
||||||
(state & USED_MODS) == keys[i].key->state)
|
(state & USED_MODS) == keys[i].key->state) {
|
||||||
{
|
|
||||||
switch (keys[i].key_type) {
|
switch (keys[i].key_type) {
|
||||||
case VOLUME_DOWN_KEY:
|
case VOLUME_DOWN_KEY:
|
||||||
case VOLUME_UP_KEY:
|
case VOLUME_UP_KEY:
|
||||||
|
@ -772,20 +817,21 @@ acme_filter_events (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_multimedia_keys_init (GConfClient *client)
|
gnome_settings_module_multimedia_keys_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
{
|
{
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static gboolean
|
||||||
gnome_settings_multimedia_keys_load (GConfClient *client)
|
gnome_settings_module_multimedia_keys_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
Acme *acme;
|
Acme *acme;
|
||||||
|
|
||||||
acme = g_new0 (Acme, 1);
|
acme = g_new0 (Acme, 1);
|
||||||
|
|
||||||
acme->conf_client = client;
|
acme->conf_client = gnome_settings_module_get_config_client (module);
|
||||||
gconf_client_add_dir (acme->conf_client,
|
gconf_client_add_dir (acme->conf_client,
|
||||||
GCONF_BINDING_DIR,
|
GCONF_BINDING_DIR,
|
||||||
GCONF_CLIENT_PRELOAD_ONELEVEL,
|
GCONF_CLIENT_PRELOAD_ONELEVEL,
|
||||||
|
@ -803,5 +849,13 @@ gnome_settings_multimedia_keys_load (GConfClient *client)
|
||||||
for (l = acme->screens; l != NULL; l = l->next)
|
for (l = acme->screens; l != NULL; l = l->next)
|
||||||
gdk_window_add_filter (gdk_screen_get_root_window (l->data),
|
gdk_window_add_filter (gdk_screen_get_root_window (l->data),
|
||||||
acme_filter_events, (gpointer) acme);
|
acme_filter_events, (gpointer) acme);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_multimedia_keys_stop (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* gnome-settings-multimedia_keys.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2002 Sun Microsystems Inc.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Author: Erwann Chénedé <erwann.chenede@sun.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GNOME_SETTINGS_MULTIMEDIA_KEYS_H__
|
|
||||||
#define __GNOME_SETTINGS_MULTIMEDIA_KEYS_H__
|
|
||||||
|
|
||||||
#include <gconf/gconf.h>
|
|
||||||
void gnome_settings_multimedia_keys_init (GConfClient *client);
|
|
||||||
void gnome_settings_multimedia_keys_load (GConfClient *client);
|
|
||||||
|
|
||||||
#endif /*__GNOME_SETTINGS_MULTIMEDIA_KEYS_H__*/
|
|
|
@ -173,7 +173,7 @@ gnome_settings_module_screensaver_start (GnomeSettingsModule *module)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
args[2] = NULL;
|
args[2] = NULL;
|
||||||
|
|
||||||
if (g_spawn_async (g_get_home_dir (), args, NULL, 0, NULL, NULL, &module_ss->screensaver_pid, &gerr))
|
if (g_spawn_async (g_get_home_dir (), args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &module_ss->screensaver_pid, &gerr))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
show_error = gconf_client_get_bool (gnome_settings_module_get_config_client (module),
|
show_error = gconf_client_get_bool (gnome_settings_module_get_config_client (module),
|
||||||
|
|
|
@ -27,10 +27,16 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtkwindow.h>
|
#include <gtk/gtkwindow.h>
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
#include "gnome-settings-daemon.h"
|
#include "gnome-settings-module.h"
|
||||||
#include "gnome-settings-xrdb.h"
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModule parent;
|
||||||
|
} GnomeSettingsModuleXrdb;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GnomeSettingsModuleClass parent_class;
|
||||||
|
} GnomeSettingsModuleXrdbClass;
|
||||||
|
|
||||||
#define SYSTEM_AD_DIR GNOMECC_DATA_DIR "/xrdb"
|
#define SYSTEM_AD_DIR GNOMECC_DATA_DIR "/xrdb"
|
||||||
#define GENERAL_AD SYSTEM_AD_DIR "/General.ad"
|
#define GENERAL_AD SYSTEM_AD_DIR "/General.ad"
|
||||||
|
@ -40,8 +46,30 @@
|
||||||
|
|
||||||
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
||||||
|
|
||||||
|
static GnomeSettingsModuleRunlevel gnome_settings_module_xrdb_get_runlevel (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_xrdb_initialize (GnomeSettingsModule *module, GConfClient *client);
|
||||||
|
static gboolean gnome_settings_module_xrdb_start (GnomeSettingsModule *module);
|
||||||
|
static gboolean gnome_settings_module_xrdb_stop (GnomeSettingsModule *module);
|
||||||
|
|
||||||
static GtkWidget *widget;
|
static GtkWidget *widget;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_xrdb_class_init (GnomeSettingsModuleXrdbClass *klass)
|
||||||
|
{
|
||||||
|
GnomeSettingsModuleClass *module_class;
|
||||||
|
|
||||||
|
module_class = GNOME_SETTINGS_MODULE_CLASS (klass);
|
||||||
|
module_class->get_runlevel = gnome_settings_module_xrdb_get_runlevel;
|
||||||
|
module_class->initialize = gnome_settings_module_xrdb_initialize;
|
||||||
|
module_class->start = gnome_settings_module_xrdb_start;
|
||||||
|
module_class->stop = gnome_settings_module_xrdb_stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_settings_module_xrdb_init (GnomeSettingsModuleXrdb *module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Theme colour functions
|
* Theme colour functions
|
||||||
*/
|
*/
|
||||||
|
@ -129,11 +157,13 @@ compare_basenames (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
char *base_a, *base_b;
|
char *base_a, *base_b;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
base_a = g_path_get_basename (a);
|
base_a = g_path_get_basename (a);
|
||||||
base_b = g_path_get_basename (b);
|
base_b = g_path_get_basename (b);
|
||||||
res = strcmp (base_a, base_b);
|
res = strcmp (base_a, base_b);
|
||||||
g_free (base_a);
|
g_free (base_a);
|
||||||
g_free (base_b);
|
g_free (base_b);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,18 +356,51 @@ static void theme_changed (GtkSettings *settings,
|
||||||
apply_settings (gtk_widget_get_style (widget));
|
apply_settings (gtk_widget_get_style (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
GType
|
||||||
gnome_settings_xrdb_init (GConfClient *client)
|
gnome_settings_module_xrdb_get_type (void)
|
||||||
{
|
{
|
||||||
|
static GType module_type = 0;
|
||||||
|
|
||||||
|
if (!module_type) {
|
||||||
|
static const GTypeInfo module_info = {
|
||||||
|
sizeof (GnomeSettingsModuleXrdbClass),
|
||||||
|
NULL, /* base_init */
|
||||||
|
NULL, /* base_finalize */
|
||||||
|
(GClassInitFunc) gnome_settings_module_xrdb_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GnomeSettingsModuleXrdb),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gnome_settings_module_xrdb_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_type = g_type_register_static (GNOME_SETTINGS_TYPE_MODULE,
|
||||||
|
"GnomeSettingsModuleXrdb",
|
||||||
|
&module_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return module_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static GnomeSettingsModuleRunlevel
|
||||||
gnome_settings_xrdb_load (GConfClient *client)
|
gnome_settings_module_xrdb_get_runlevel (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return GNOME_SETTINGS_MODULE_RUNLEVEL_XSETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_xrdb_initialize (GnomeSettingsModule *module, GConfClient *client)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_xrdb_start (GnomeSettingsModule *module)
|
||||||
{
|
{
|
||||||
static gboolean initialized = FALSE;
|
static gboolean initialized = FALSE;
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized) {
|
||||||
{ /* the initialization is done here otherwise
|
/* the initialization is done here otherwise
|
||||||
gnome_settings_xsettings_load would generate
|
gnome_settings_xsettings_load would generate
|
||||||
false hit as gtk-theme-name is set to Default in
|
false hit as gtk-theme-name is set to Default in
|
||||||
gnome_settings_xsettings_init */
|
gnome_settings_xsettings_init */
|
||||||
|
@ -350,4 +413,12 @@ gnome_settings_xrdb_load (GConfClient *client)
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_widget_ensure_style (widget);
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnome_settings_module_xrdb_stop (GnomeSettingsModule *module)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/* -*- mode: c; style: linux -*- */
|
|
||||||
|
|
||||||
/* gnome-settings-xrdb
|
|
||||||
*
|
|
||||||
* Copyright © 2003 Ross Burton
|
|
||||||
*
|
|
||||||
* Written by Ross Burton <ross@burtonini.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_XRDB_H
|
|
||||||
#define __GNOME_SETTINGS_XRDB_H
|
|
||||||
|
|
||||||
#include <gconf/gconf-client.h>
|
|
||||||
|
|
||||||
void gnome_settings_xrdb_init (GConfClient *client);
|
|
||||||
void gnome_settings_xrdb_load (GConfClient *client);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Add a link
Reference in a new issue