Enabling DBUS, getting rid of bonobo, libgswitchit API update
This commit is contained in:
parent
98a2fc742a
commit
9412291893
12 changed files with 375 additions and 173 deletions
|
@ -6,3 +6,7 @@ GNOME_SettingsDaemon-skels.c
|
|||
GNOME_SettingsDaemon-stubs.c
|
||||
GNOME_SettingsDaemon.h
|
||||
GNOME_SettingsDaemon.server
|
||||
org.gnome.SettingsDaemon.service
|
||||
gnome-settings-daemon.pc
|
||||
gnome-settings-client.h
|
||||
gnome-settings-server.h
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2006-06-23 Sergey Udaltsov <svu@gnome.org>
|
||||
|
||||
* factory.c, gnome-settings-daemon.c,
|
||||
gnome-settings-daemon.h,gnome-settings-daemon.pc.in,
|
||||
gnome-settings-dbus.c, gnome-settings-keyboard-xkb.c,
|
||||
gnome-settings-keyboard-xkb.h, gsd-infos.xml,
|
||||
org.gnome.SettingsDaemon.service.in: g-s-d is now DBUS-enabled,
|
||||
implements 2 interfaces - one for gnome-session, another for keyboard
|
||||
indication (see gsd-infos.xml)
|
||||
Also, major libgswitchit API change.
|
||||
|
||||
2006-05-24 Paolo Borelli <pborelli@katamail.com>
|
||||
|
||||
Fixes #342570
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SUBDIRS = xrdb actions
|
||||
|
||||
INCLUDES=$(LIBXKLAVIER_CFLAGS) $(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground -I$(top_srcdir) \
|
||||
INCLUDES=$(DBUS_CFLAGS) $(LIBXKLAVIER_CFLAGS) $(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground -I$(top_srcdir) \
|
||||
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
|
||||
-DESD_SERVER="\"$(ESD_SERVER)\"" \
|
||||
-DDATADIR="\"$(datadir)\"" \
|
||||
|
@ -41,6 +41,8 @@ gnome_settings_daemon_SOURCES = \
|
|||
gnome-settings-default-editor.h \
|
||||
gnome-settings-gtk1theme.c \
|
||||
gnome-settings-gtk1theme.h \
|
||||
gnome-settings-server.h \
|
||||
gnome-settings-dbus.c \
|
||||
gnome-settings-xrdb.c \
|
||||
gnome-settings-xrdb.h \
|
||||
xsettings-common.c \
|
||||
|
@ -66,6 +68,7 @@ gnome_settings_daemon_SOURCES = \
|
|||
# $(AccessX_files)
|
||||
|
||||
gnome_settings_daemon_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(LIBXKLAVIER_LIBS) \
|
||||
$(top_builddir)/libbackground/libbackground.la \
|
||||
$(top_builddir)/libsounds/libsounds.a \
|
||||
|
@ -81,36 +84,35 @@ gnome_settings_daemon_LDADD = \
|
|||
# AccessXproto.h \
|
||||
# AccessXlibint.h
|
||||
|
||||
CORBA_GENERATED_HEADER_FILES = GNOME_SettingsDaemon.h
|
||||
|
||||
CORBA_GENERATED = \
|
||||
$(CORBA_GENERATED_HEADER_FILES) \
|
||||
GNOME_SettingsDaemon-common.c \
|
||||
GNOME_SettingsDaemon-stubs.c \
|
||||
GNOME_SettingsDaemon-skels.c
|
||||
|
||||
BUILT_SOURCES=$(CORBA_GENERATED)
|
||||
|
||||
idl_dir = $(top_srcdir)/idl
|
||||
|
||||
IDL_FLAGS = -D__GNOME_SettingsDaemon_COMPILATION -I $(idl_dir) -I $(datadir)/idl \
|
||||
-I $(LIBBONOBO_IDL_DIR) \
|
||||
-I $(BONOBO_ACTIVATION_IDL_DIR)
|
||||
|
||||
$(CORBA_GENERATED): $(idl_dir)/GNOME_SettingsDaemon.idl $(ORBIT_IDL)
|
||||
$(ORBIT_IDL) $(IDL_FLAGS) $(idl_dir)/GNOME_SettingsDaemon.idl
|
||||
|
||||
Gladedir = $(GNOMECC_GLADE_DIR)
|
||||
Glade_DATA = modmap-dialog.glade
|
||||
|
||||
serverfile = GNOME_SettingsDaemon.server.in
|
||||
serverdir = $(libdir)/bonobo/servers
|
||||
install-data-hook :
|
||||
$(mkinstalldirs) $(DESTDIR)$(serverdir)
|
||||
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $(srcdir)/$(serverfile) > $(DESTDIR)$(serverdir)/$(serverfile:.in=)
|
||||
Dbusapidir = $(includedir)/gnome-settings-daemon-2.0/gnome-settings-daemon
|
||||
Dbusapi_DATA = gnome-settings-client.h
|
||||
|
||||
EXTRA_DIST = $(serverfile) $(Glade_DATA)
|
||||
#Rule to generate the binding headers
|
||||
gnome-settings-server.h: gsd-infos.xml
|
||||
dbus-binding-tool --prefix=settings_daemon --mode=glib-server $< > $@
|
||||
|
||||
gnome-settings-client.h: gsd-infos.xml
|
||||
dbus-binding-tool --prefix=settings_daemon --mode=glib-client $< > $@
|
||||
|
||||
# DBUS stuff
|
||||
servicedir = $(DBUS_SERVICES_DIR)
|
||||
service_in_files = org.gnome.SettingsDaemon.service.in
|
||||
service_DATA = $(service_in_files:.service.in=.service)
|
||||
|
||||
org.gnome.SettingsDaemon.service: org.gnome.SettingsDaemon.service.in Makefile
|
||||
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
|
||||
|
||||
EXTRA_DIST = $(serverfile) $(Glade_DATA) $(Dbusapi_DATA) \
|
||||
gnome-settings-daemon.pc.in gsd-infos.xml org.gnome.SettingsDaemon.service.in
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = gnome-settings-daemon.pc
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(serverdir)/$(serverfile:.in=)
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
#include "gnome-settings-daemon.h"
|
||||
|
||||
#include <libintl.h>
|
||||
#include <string.h>
|
||||
#include <bonobo.h>
|
||||
#include <bonobo/bonobo-object.h>
|
||||
#include <bonobo/bonobo-generic-factory.h>
|
||||
|
||||
#include <gconf/gconf.h>
|
||||
|
||||
|
@ -13,32 +11,8 @@
|
|||
#include <libgnomeui/gnome-ui-init.h>
|
||||
#include <libgnomeui/gnome-client.h>
|
||||
|
||||
static BonoboObject *services_server = NULL;
|
||||
GConfClient *conf_client = NULL;
|
||||
|
||||
static void
|
||||
register_server (BonoboObject *server)
|
||||
{
|
||||
Bonobo_RegistrationResult ret;
|
||||
GSList *reg_env;
|
||||
char *display;
|
||||
char *p;
|
||||
|
||||
display = gdk_display_get_name (gdk_display_get_default ());
|
||||
|
||||
reg_env = bonobo_activation_registration_env_set (NULL, "DISPLAY", display);
|
||||
|
||||
ret = bonobo_activation_register_active_server ("OAFIID:GNOME_SettingsDaemon",
|
||||
BONOBO_OBJREF (server),
|
||||
reg_env);
|
||||
if (ret != Bonobo_ACTIVATION_REG_SUCCESS) {
|
||||
g_warning ("Encountered problems registering the settings daemon with bonobo-activation. "
|
||||
"Clients may not detect that the settings daemon is already running.");
|
||||
}
|
||||
|
||||
bonobo_activation_registration_env_free (reg_env);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv [])
|
||||
{
|
||||
GnomeClient *session;
|
||||
|
@ -56,16 +30,9 @@ int main (int argc, char *argv [])
|
|||
GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,
|
||||
NULL);
|
||||
|
||||
if (!bonobo_init (&argc, argv)) {
|
||||
g_error (_("Could not initialize Bonobo"));
|
||||
}
|
||||
|
||||
gconf_init (argc, argv, NULL); /* exits w/ message on failure */
|
||||
|
||||
/* start the settings daemon */
|
||||
services_server = BONOBO_OBJECT (gnome_settings_daemon_new ());
|
||||
|
||||
register_server (services_server);
|
||||
gnome_settings_daemon_new ();
|
||||
|
||||
session = gnome_master_client ();
|
||||
gnome_client_set_restart_command (session, 2, restart_argv);
|
||||
|
|
|
@ -59,8 +59,6 @@
|
|||
#include "gnome-settings-xrdb.h"
|
||||
#include "gnome-settings-typing-break.h"
|
||||
|
||||
#include "GNOME_SettingsDaemon.h"
|
||||
|
||||
#include "clipboard-manager.h"
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
@ -214,18 +212,6 @@ manager_event_filter (GdkXEvent *xevent,
|
|||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
static CORBA_boolean
|
||||
awake_impl (PortableServer_Servant servant,
|
||||
const CORBA_char *service,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
#if 0
|
||||
printf ("I received an activate request for %s\n", service);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
|
@ -257,8 +243,6 @@ gnome_settings_daemon_class_init (GnomeSettingsDaemonClass *klass)
|
|||
|
||||
object_class->finalize = finalize;
|
||||
|
||||
klass->epv.awake = awake_impl;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
|
@ -268,8 +252,8 @@ gnome_settings_daemon_init (GnomeSettingsDaemon *settings)
|
|||
settings->private = g_new (GnomeSettingsDaemonPrivate, 1);
|
||||
}
|
||||
|
||||
BONOBO_TYPE_FUNC_FULL(GnomeSettingsDaemon, GNOME_SettingsDaemon,
|
||||
BONOBO_TYPE_OBJECT, gnome_settings_daemon)
|
||||
G_DEFINE_TYPE (GnomeSettingsDaemon, gnome_settings_daemon,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
GObject *
|
||||
gnome_settings_daemon_new (void)
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
|
||||
#include "GNOME_SettingsDaemon.h"
|
||||
|
||||
typedef void (* KeyCallbackFunc) (GConfEntry *entry);
|
||||
|
||||
void gnome_settings_daemon_register_callback (const char *dir,
|
||||
|
@ -54,14 +52,13 @@ typedef struct _GnomeSettingsDaemonPrivate GnomeSettingsDaemonPrivate;
|
|||
|
||||
struct _GnomeSettingsDaemon
|
||||
{
|
||||
BonoboObject parent_instance;
|
||||
GObject parent_instance;
|
||||
GnomeSettingsDaemonPrivate *private;
|
||||
};
|
||||
|
||||
struct _GnomeSettingsDaemonClass
|
||||
{
|
||||
BonoboObjectClass parent_class;
|
||||
POA_GNOME_SettingsDaemon__epv epv;
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType gnome_settings_daemon_get_type (void);
|
||||
|
|
11
gnome-settings-daemon/gnome-settings-daemon.pc.in
Normal file
11
gnome-settings-daemon/gnome-settings-daemon.pc.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: gnome-settings-daemon
|
||||
Description: Utility library for accessing gnome-settings-daemon over DBUS
|
||||
Requires: glib-2.0 dbus-1 dbus-glib-1
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir}
|
||||
Cflags: -DDBUS_API_SUBJECT_TO_CHANGE -I${includedir}/gnome-settings-daemon-2.0
|
182
gnome-settings-daemon/gnome-settings-dbus.c
Normal file
182
gnome-settings-daemon/gnome-settings-dbus.c
Normal file
|
@ -0,0 +1,182 @@
|
|||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <dbus/dbus-glib-bindings.h>
|
||||
|
||||
#include "gnome-settings-keyboard-xkb.h"
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
typedef struct KeyboardConfigRegistry KeyboardConfigRegistry;
|
||||
typedef struct KeyboardConfigRegistryClass KeyboardConfigRegistryClass;
|
||||
|
||||
struct KeyboardConfigRegistry {
|
||||
GObject parent;
|
||||
|
||||
XklConfigRegistry *registry;
|
||||
};
|
||||
|
||||
struct KeyboardConfigRegistryClass {
|
||||
GObjectClass parent;
|
||||
DBusGConnection *connection;
|
||||
};
|
||||
|
||||
#define KEYBOARD_CONFIG_TYPE_REGISTRY (keyboard_config_registry_get_type ())
|
||||
#define KEYBOARD_CONFIG_REGISTRY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), KEYBOARD_CONFIG_TYPE_REGISTRY, KeyboardConfigRegistry))
|
||||
#define KEYBOARD_CONFIG_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KEYBOARD_CONFIG_TYPE_REGISTRY, KeyboardConfigRegistryClass))
|
||||
#define KEYBOARD_CONFIG_IS_REGISTRY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), KEYBOARD_CONFIG_TYPE_REGISTRY))
|
||||
#define KEYBOARD_CONFIG_IS_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KEYBOARD_CONFIG_TYPE_REGISTRY))
|
||||
#define KEYBOARD_CONFIG_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KEYBOARD_CONFIG_TYPE_REGISTRY, KeyboardConfigRegistryClass))
|
||||
|
||||
gboolean
|
||||
settings_daemon_awake (GObject * object, GError ** error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
keyboard_config_registry_get_current_descriptions_as_utf8
|
||||
(KeyboardConfigRegistry * registry,
|
||||
gchar *** short_layout_descriptions,
|
||||
gchar *** long_layout_descriptions,
|
||||
gchar *** short_variant_descriptions,
|
||||
gchar *** long_variant_descriptions, GError ** error) {
|
||||
if (!
|
||||
(xkl_engine_get_features (xkl_engine) &
|
||||
XKLF_MULTIPLE_LAYOUTS_SUPPORTED))
|
||||
return FALSE;
|
||||
|
||||
XklConfigRec *xkl_config = xkl_config_rec_new ();
|
||||
|
||||
if (!xkl_config_rec_get_from_server (xkl_config, xkl_engine))
|
||||
return FALSE;
|
||||
|
||||
char **pl = xkl_config->layouts;
|
||||
char **pv = xkl_config->variants;
|
||||
guint total_layouts = g_strv_length (xkl_config->layouts);
|
||||
gchar **sld = *short_layout_descriptions =
|
||||
g_new0 (char *, total_layouts + 1);
|
||||
gchar **lld = *long_layout_descriptions =
|
||||
g_new0 (char *, total_layouts + 1);
|
||||
gchar **svd = *short_variant_descriptions =
|
||||
g_new0 (char *, total_layouts + 1);
|
||||
gchar **lvd = *long_variant_descriptions =
|
||||
g_new0 (char *, total_layouts + 1);
|
||||
|
||||
while (pl != NULL && *pl != NULL) {
|
||||
XklConfigItem item;
|
||||
|
||||
g_snprintf (item.name, sizeof item.name, "%s", *pl);
|
||||
if (xkl_config_registry_find_layout
|
||||
(registry->registry, &item)) {
|
||||
*sld++ = g_strdup (item.short_description);
|
||||
*lld++ = g_strdup (item.description);
|
||||
} else {
|
||||
*sld++ = g_strdup ("");
|
||||
*lld++ = g_strdup ("");
|
||||
}
|
||||
|
||||
if (*pv != NULL) {
|
||||
g_snprintf (item.name, sizeof item.name, "%s",
|
||||
*pv);
|
||||
if (xkl_config_registry_find_variant
|
||||
(registry->registry, *pl, &item)) {
|
||||
*svd = g_strdup (item.short_description);
|
||||
*lvd = g_strdup (item.description);
|
||||
} else {
|
||||
*svd++ = g_strdup ("");
|
||||
*lvd++ = g_strdup ("");
|
||||
}
|
||||
} else {
|
||||
*svd++ = g_strdup ("");
|
||||
*lvd++ = g_strdup ("");
|
||||
}
|
||||
|
||||
*pl++, *pv++;
|
||||
}
|
||||
g_object_unref (G_OBJECT (xkl_config));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (KeyboardConfigRegistry, keyboard_config_registry,
|
||||
G_TYPE_OBJECT)
|
||||
#include "gnome-settings-server.h"
|
||||
static void
|
||||
finalize (GObject * object)
|
||||
{
|
||||
KeyboardConfigRegistry *registry;
|
||||
|
||||
registry = KEYBOARD_CONFIG_REGISTRY (object);
|
||||
if (registry->registry == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_unref (registry->registry);
|
||||
registry->registry = NULL;
|
||||
|
||||
g_object_unref (xkl_engine);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_config_registry_class_init (KeyboardConfigRegistryClass * klass)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GObjectClass *object_class;
|
||||
|
||||
/* Init the DBus connection, per-klass */
|
||||
klass->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
if (klass->connection == NULL) {
|
||||
g_warning ("Unable to connect to dbus: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
/* &dbus_glib__object_info is provided in the server-bindings.h file */
|
||||
dbus_g_object_type_install_info (KEYBOARD_CONFIG_TYPE_REGISTRY,
|
||||
&dbus_glib_settings_daemon_object_info);
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_config_registry_init (KeyboardConfigRegistry * registry)
|
||||
{
|
||||
GError *error = NULL;
|
||||
DBusGProxy *driver_proxy;
|
||||
KeyboardConfigRegistryClass *klass =
|
||||
KEYBOARD_CONFIG_REGISTRY_GET_CLASS (registry);
|
||||
unsigned request_ret;
|
||||
|
||||
/* Register DBUS path */
|
||||
dbus_g_connection_register_g_object (klass->connection,
|
||||
"/org/gnome/SettingsDaemon",
|
||||
G_OBJECT (registry));
|
||||
|
||||
/* Register the service name, the constant here are defined in dbus-glib-bindings.h */
|
||||
driver_proxy = dbus_g_proxy_new_for_name (klass->connection,
|
||||
DBUS_SERVICE_DBUS,
|
||||
DBUS_PATH_DBUS,
|
||||
DBUS_INTERFACE_DBUS);
|
||||
|
||||
if (!org_freedesktop_DBus_request_name (driver_proxy, "org.gnome.SettingsDaemon", 0, &request_ret, /* See tutorial for more infos about these */
|
||||
&error)) {
|
||||
g_warning ("Unable to register service: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_object_unref (driver_proxy);
|
||||
|
||||
/* Init libxklavier stuff */
|
||||
g_object_ref (xkl_engine);
|
||||
|
||||
registry->registry = xkl_config_registry_get_instance (xkl_engine);
|
||||
|
||||
xkl_config_registry_load (registry->registry);
|
||||
}
|
|
@ -35,24 +35,23 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <libxklavier/xklavier.h>
|
||||
#include <libgswitchit/gswitchit_config.h>
|
||||
|
||||
#include "gnome-settings-keyboard-xkb.h"
|
||||
#include "gnome-settings-daemon.h"
|
||||
|
||||
static XklEngine *engine;
|
||||
XklEngine *xkl_engine;
|
||||
|
||||
static GSwitchItConfig currentConfig;
|
||||
static GSwitchItKbdConfig currentKbdConfig;
|
||||
static GSwitchItConfig current_config;
|
||||
static GSwitchItKbdConfig current_kbd_config;
|
||||
|
||||
/* never terminated */
|
||||
static GSwitchItKbdConfig initialSysKbdConfig;
|
||||
static GSwitchItKbdConfig initial_sys_kbd_config;
|
||||
|
||||
static gboolean initedOk;
|
||||
static gboolean inited_ok;
|
||||
|
||||
static PostActivationCallback paCallback = NULL;
|
||||
static void *paCallbackUserData = NULL;
|
||||
static PostActivationCallback pa_callback = NULL;
|
||||
static void *pa_callback_user_data = NULL;
|
||||
|
||||
static const char KNOWN_FILES_KEY[] =
|
||||
"/desktop/gnome/peripherals/keyboard/general/known_file_list";
|
||||
|
@ -130,39 +129,40 @@ activation_error (void)
|
|||
static void
|
||||
apply_settings (void)
|
||||
{
|
||||
if (!initedOk)
|
||||
if (!inited_ok)
|
||||
return;
|
||||
|
||||
GSwitchItConfigLoadFromGConf (¤tConfig);
|
||||
gswitchit_config_load_from_gconf (¤t_config);
|
||||
/* again, probably it would be nice to compare things
|
||||
before activating them */
|
||||
GSwitchItConfigActivate (¤tConfig);
|
||||
gswitchit_config_activate (¤t_config);
|
||||
}
|
||||
|
||||
static void
|
||||
apply_xkb_settings (void)
|
||||
{
|
||||
GConfClient *confClient;
|
||||
GSwitchItKbdConfig currentSysKbdConfig;
|
||||
GConfClient *conf_client;
|
||||
GSwitchItKbdConfig current_sys_kbd_config;
|
||||
|
||||
if (!initedOk)
|
||||
if (!inited_ok)
|
||||
return;
|
||||
|
||||
confClient = gnome_settings_daemon_get_conf_client ();
|
||||
GSwitchItKbdConfigInit (¤tSysKbdConfig, confClient, engine);
|
||||
conf_client = gnome_settings_daemon_get_conf_client ();
|
||||
gswitchit_kbd_config_init (¤t_sys_kbd_config, conf_client,
|
||||
xkl_engine);
|
||||
|
||||
GSwitchItKbdConfigLoadFromGConf (¤tKbdConfig,
|
||||
&initialSysKbdConfig);
|
||||
gswitchit_kbd_config_load_from_gconf (¤t_kbd_config,
|
||||
&initial_sys_kbd_config);
|
||||
|
||||
GSwitchItKbdConfigLoadFromXCurrent (¤tSysKbdConfig);
|
||||
gswitchit_kbd_config_load_from_x_current (¤t_sys_kbd_config);
|
||||
/* Activate - only if different! */
|
||||
if (!GSwitchItKbdConfigEquals
|
||||
(¤tKbdConfig, ¤tSysKbdConfig)) {
|
||||
if (GSwitchItKbdConfigActivate (¤tKbdConfig)) {
|
||||
GSwitchItKbdConfigSaveToGConfBackup
|
||||
(&initialSysKbdConfig);
|
||||
if (paCallback != NULL) {
|
||||
(*paCallback) (paCallbackUserData);
|
||||
if (!gswitchit_kbd_config_equals
|
||||
(¤t_kbd_config, ¤t_sys_kbd_config)) {
|
||||
if (gswitchit_kbd_config_activate (¤t_kbd_config)) {
|
||||
gswitchit_kbd_config_save_to_gconf_backup
|
||||
(&initial_sys_kbd_config);
|
||||
if (pa_callback != NULL) {
|
||||
(*pa_callback) (pa_callback_user_data);
|
||||
}
|
||||
} else {
|
||||
g_warning
|
||||
|
@ -173,7 +173,7 @@ apply_xkb_settings (void)
|
|||
xkl_debug (100,
|
||||
"Actual KBD configuration was not changed: redundant notification\n");
|
||||
|
||||
GSwitchItKbdConfigTerm (¤tSysKbdConfig);
|
||||
gswitchit_kbd_config_term (¤t_sys_kbd_config);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -181,29 +181,29 @@ gnome_settings_keyboard_xkb_sysconfig_changed_response (GtkDialog * dialog,
|
|||
SysConfigChangedMsgResponse
|
||||
what2do)
|
||||
{
|
||||
GConfClient *confClient;
|
||||
GSwitchItKbdConfig emptyKbdConfig;
|
||||
gboolean dontShowAgain =
|
||||
GConfClient *conf_client;
|
||||
GSwitchItKbdConfig empty_kbd_config;
|
||||
gboolean dont_show_again =
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
|
||||
(g_object_get_data
|
||||
(G_OBJECT (dialog),
|
||||
"chkDontShowAgain")));
|
||||
|
||||
confClient = gnome_settings_daemon_get_conf_client ();
|
||||
conf_client = gnome_settings_daemon_get_conf_client ();
|
||||
|
||||
switch (what2do) {
|
||||
case RESPONSE_USE_X:
|
||||
GSwitchItKbdConfigInit (&emptyKbdConfig, confClient,
|
||||
engine);
|
||||
GSwitchItKbdConfigSaveToGConf (&emptyKbdConfig);
|
||||
gswitchit_kbd_config_init (&empty_kbd_config, conf_client,
|
||||
xkl_engine);
|
||||
gswitchit_kbd_config_save_to_gconf (&empty_kbd_config);
|
||||
break;
|
||||
case RESPONSE_USE_GNOME:
|
||||
/* Do absolutely nothing - just keep things the way they are */
|
||||
break;
|
||||
}
|
||||
|
||||
if (dontShowAgain)
|
||||
gconf_client_set_bool (confClient,
|
||||
if (dont_show_again)
|
||||
gconf_client_set_bool (conf_client,
|
||||
DISABLE_SYSCONF_CHANGED_WARNING_KEY,
|
||||
TRUE, NULL);
|
||||
|
||||
|
@ -213,47 +213,57 @@ gnome_settings_keyboard_xkb_sysconfig_changed_response (GtkDialog * dialog,
|
|||
static void
|
||||
gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
||||
{
|
||||
GConfClient *confClient;
|
||||
GSwitchItKbdConfig backupGConfKbdConfig;
|
||||
gboolean isConfigChanged, dontShow;
|
||||
GConfClient *conf_client;
|
||||
GSwitchItKbdConfig backup_gconf_kbd_config;
|
||||
gboolean is_config_changed, dont_show;
|
||||
|
||||
if (!initedOk)
|
||||
if (!inited_ok)
|
||||
return;
|
||||
confClient = gnome_settings_daemon_get_conf_client ();
|
||||
GSwitchItKbdConfigInit (&backupGConfKbdConfig, confClient, engine);
|
||||
GSwitchItKbdConfigInit (&initialSysKbdConfig, confClient, engine);
|
||||
dontShow =
|
||||
gconf_client_get_bool (confClient,
|
||||
conf_client = gnome_settings_daemon_get_conf_client ();
|
||||
gswitchit_kbd_config_init (&backup_gconf_kbd_config, conf_client,
|
||||
xkl_engine);
|
||||
gswitchit_kbd_config_init (&initial_sys_kbd_config, conf_client,
|
||||
xkl_engine);
|
||||
dont_show =
|
||||
gconf_client_get_bool (conf_client,
|
||||
DISABLE_SYSCONF_CHANGED_WARNING_KEY,
|
||||
NULL);
|
||||
GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig);
|
||||
GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig);
|
||||
gswitchit_kbd_config_load_from_gconf_backup
|
||||
(&backup_gconf_kbd_config);
|
||||
gswitchit_kbd_config_load_from_x_initial (&initial_sys_kbd_config);
|
||||
|
||||
isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) &&
|
||||
!GSwitchItKbdConfigEquals (&initialSysKbdConfig,
|
||||
&backupGConfKbdConfig);
|
||||
is_config_changed =
|
||||
g_slist_length (backup_gconf_kbd_config.layouts)
|
||||
&& !gswitchit_kbd_config_equals (&initial_sys_kbd_config,
|
||||
&backup_gconf_kbd_config);
|
||||
|
||||
/* config was changed!!! */
|
||||
if (isConfigChanged) {
|
||||
if (dontShow) {
|
||||
if (is_config_changed) {
|
||||
if (dont_show) {
|
||||
g_warning
|
||||
("The system configuration changed - but we remain silent\n");
|
||||
} else {
|
||||
GtkWidget *chkDontShowAgain =
|
||||
GtkWidget *chk_dont_show_again =
|
||||
gtk_check_button_new_with_mnemonic (_
|
||||
("Do _not show this warning again"));
|
||||
GtkWidget *alignDontShowAgain = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
GtkWidget *align_dont_show_again =
|
||||
gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
GtkWidget *msg;
|
||||
|
||||
char *gnome_settings = GSwitchItKbdConfigToString(&backupGConfKbdConfig);
|
||||
char *system_settings = GSwitchItKbdConfigToString(&initialSysKbdConfig);
|
||||
char *gnome_settings =
|
||||
gswitchit_kbd_config_to_string
|
||||
(&backup_gconf_kbd_config);
|
||||
char *system_settings =
|
||||
gswitchit_kbd_config_to_string
|
||||
(&initial_sys_kbd_config);
|
||||
|
||||
msg = gtk_message_dialog_new_with_markup (
|
||||
NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, /* !! temporary one */
|
||||
_("<b>The X system keyboard settings differ from your current GNOME keyboard settings.</b>\n\n"
|
||||
msg = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, /* !! temporary one */
|
||||
_
|
||||
("<b>The X system keyboard settings differ from your current GNOME keyboard settings.</b>\n\n"
|
||||
"Expected was %s, but the the following settings were found: %s.\n\n"
|
||||
"Which set would you like to use?"),
|
||||
gnome_settings, system_settings);
|
||||
gnome_settings,
|
||||
system_settings);
|
||||
|
||||
g_free (gnome_settings);
|
||||
g_free (system_settings);
|
||||
|
@ -262,14 +272,14 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
|||
"gnome-dev-keyboard");
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER
|
||||
(alignDontShowAgain),
|
||||
(align_dont_show_again),
|
||||
12);
|
||||
gtk_container_add (GTK_CONTAINER
|
||||
(alignDontShowAgain),
|
||||
chkDontShowAgain);
|
||||
(align_dont_show_again),
|
||||
chk_dont_show_again);
|
||||
gtk_container_add (GTK_CONTAINER
|
||||
((GTK_DIALOG (msg))->vbox),
|
||||
alignDontShowAgain);
|
||||
align_dont_show_again);
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (msg),
|
||||
_("Use X settings"),
|
||||
|
@ -280,7 +290,7 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
|||
RESPONSE_USE_GNOME);
|
||||
g_object_set_data (G_OBJECT (msg),
|
||||
"chkDontShowAgain",
|
||||
chkDontShowAgain);
|
||||
chk_dont_show_again);
|
||||
g_signal_connect (msg, "response",
|
||||
G_CALLBACK
|
||||
(gnome_settings_keyboard_xkb_sysconfig_changed_response),
|
||||
|
@ -288,32 +298,33 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
|||
gtk_widget_show_all (msg);
|
||||
}
|
||||
}
|
||||
GSwitchItKbdConfigTerm (&backupGConfKbdConfig);
|
||||
gswitchit_kbd_config_term (&backup_gconf_kbd_config);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnome_settings_chk_file_list (void)
|
||||
{
|
||||
GDir *homeDir;
|
||||
GDir *home_dir;
|
||||
G_CONST_RETURN gchar *fname;
|
||||
GSList *file_list = NULL;
|
||||
GSList *last_login_file_list = NULL;
|
||||
GSList *tmp = NULL;
|
||||
GSList *tmp_l = NULL;
|
||||
gboolean new_file_exist = FALSE;
|
||||
GConfClient *confClient = gnome_settings_daemon_get_conf_client ();
|
||||
GConfClient *conf_client =
|
||||
gnome_settings_daemon_get_conf_client ();
|
||||
|
||||
homeDir = g_dir_open (g_get_home_dir (), 0, NULL);
|
||||
while ((fname = g_dir_read_name (homeDir)) != NULL) {
|
||||
home_dir = g_dir_open (g_get_home_dir (), 0, NULL);
|
||||
while ((fname = g_dir_read_name (home_dir)) != NULL) {
|
||||
if (g_strrstr (fname, "modmap")) {
|
||||
file_list =
|
||||
g_slist_append (file_list, g_strdup (fname));
|
||||
}
|
||||
}
|
||||
g_dir_close (homeDir);
|
||||
g_dir_close (home_dir);
|
||||
|
||||
last_login_file_list =
|
||||
gconf_client_get_list (confClient, KNOWN_FILES_KEY,
|
||||
gconf_client_get_list (conf_client, KNOWN_FILES_KEY,
|
||||
GCONF_VALUE_STRING, NULL);
|
||||
|
||||
/* Compare between the two file list, currently available modmap files
|
||||
|
@ -336,7 +347,7 @@ gnome_settings_chk_file_list (void)
|
|||
}
|
||||
|
||||
if (new_file_exist)
|
||||
gconf_client_set_list (confClient, KNOWN_FILES_KEY,
|
||||
gconf_client_set_list (conf_client, KNOWN_FILES_KEY,
|
||||
GCONF_VALUE_STRING, file_list,
|
||||
NULL);
|
||||
|
||||
|
@ -362,32 +373,33 @@ gnome_settings_keyboard_xkb_chk_lcl_xmm (void)
|
|||
|
||||
void
|
||||
gnome_settings_keyboard_xkb_set_post_activation_callback
|
||||
(PostActivationCallback fun, void *userData) {
|
||||
paCallback = fun;
|
||||
paCallbackUserData = userData;
|
||||
(PostActivationCallback fun, void *user_data) {
|
||||
pa_callback = fun;
|
||||
pa_callback_user_data = user_data;
|
||||
}
|
||||
|
||||
static GdkFilterReturn
|
||||
gnome_settings_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event)
|
||||
{
|
||||
XEvent *xevent = (XEvent *) xev;
|
||||
xkl_engine_filter_events (engine, xevent);
|
||||
xkl_engine_filter_events (xkl_engine, xevent);
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
void
|
||||
gnome_settings_keyboard_xkb_init (GConfClient * client)
|
||||
{
|
||||
GObject *reg = NULL;
|
||||
#ifdef GSDKX
|
||||
XklSetDebugLevel (200);
|
||||
xkl_set_debug_level (200);
|
||||
logfile = fopen ("/tmp/gsdkx.log", "a");
|
||||
XklSetLogAppender (gnome_settings_keyboard_log_appender);
|
||||
xkl_set_log_appender (gnome_settings_keyboard_log_appender);
|
||||
#endif
|
||||
|
||||
engine = xkl_engine_get_instance (GDK_DISPLAY ());
|
||||
if (engine) {
|
||||
initedOk = TRUE;
|
||||
xkl_engine_backup_names_prop (engine);
|
||||
xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ());
|
||||
if (xkl_engine) {
|
||||
inited_ok = TRUE;
|
||||
xkl_engine_backup_names_prop (xkl_engine);
|
||||
gnome_settings_keyboard_xkb_analyze_sysconfig ();
|
||||
gnome_settings_keyboard_xkb_chk_lcl_xmm ();
|
||||
|
||||
|
@ -406,18 +418,23 @@ gnome_settings_keyboard_xkb_init (GConfClient * client)
|
|||
(GdkFilterFunc)
|
||||
gnome_settings_keyboard_xkb_evt_filter,
|
||||
NULL);
|
||||
xkl_engine_start_listen (engine,
|
||||
xkl_engine_start_listen (xkl_engine,
|
||||
XKLL_MANAGE_LAYOUTS |
|
||||
XKLL_MANAGE_WINDOW_STATES);
|
||||
|
||||
reg =
|
||||
g_object_new (keyboard_config_registry_get_type (),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_settings_keyboard_xkb_load (GConfClient * client)
|
||||
{
|
||||
GSwitchItConfigInit (¤tConfig, client, engine);
|
||||
gswitchit_config_init (¤t_config, client, xkl_engine);
|
||||
apply_settings ();
|
||||
|
||||
GSwitchItKbdConfigInit (¤tKbdConfig, client, engine);
|
||||
gswitchit_kbd_config_init (¤t_kbd_config, client,
|
||||
xkl_engine);
|
||||
apply_xkb_settings ();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <gconf/gconf.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include <libxklavier/xklavier.h>
|
||||
|
||||
void gnome_settings_keyboard_xkb_init (GConfClient * client);
|
||||
void gnome_settings_keyboard_xkb_load (GConfClient * client);
|
||||
|
||||
|
@ -37,4 +39,8 @@ void gnome_settings_keyboard_xkb_set_post_activation_callback(
|
|||
PostActivationCallback fun,
|
||||
void *userData );
|
||||
|
||||
GType keyboard_config_registry_get_type (void);
|
||||
|
||||
extern XklEngine * xkl_engine;
|
||||
|
||||
#endif
|
||||
|
|
18
gnome-settings-daemon/gsd-infos.xml
Normal file
18
gnome-settings-daemon/gsd-infos.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<node name="/org/gnome/SettingsDaemon">
|
||||
<interface name="org.gnome.SettingsDaemon">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="settings_daemon"/>
|
||||
<method name="Awake"/>
|
||||
</interface>
|
||||
<interface name="org.gnome.KeyboardConfigRegistry">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="keyboard_config_registry"/>
|
||||
<method name="GetCurrentDescriptionsAsUtf8">
|
||||
<arg type="as" name="shortLayoutDescriptions" direction="out" />
|
||||
<arg type="as" name="longLayoutDescriptions" direction="out" />
|
||||
<arg type="as" name="shortVariantDescriptions" direction="out" />
|
||||
<arg type="as" name="longVariantDescriptions" direction="out" />
|
||||
</method>
|
||||
<!-- Add more methods/signals if you want -->
|
||||
</interface>
|
||||
</node>
|
|
@ -0,0 +1,3 @@
|
|||
[D-BUS Service]
|
||||
Name=org.gnome.SettingsDaemon
|
||||
Exec=@libexecdir@/gnome-settings-daemon
|
Loading…
Add table
Reference in a new issue