summaryrefslogtreecommitdiff
path: root/libmatekbd
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-03 17:14:37 +0200
committerStefano Karapetsas <[email protected]>2012-09-03 17:14:37 +0200
commit74e8c123722068886a8b12872601b14f5cc3bbe9 (patch)
treedd680caed288f9056b31d26221c8f007dc1740d6 /libmatekbd
parent35c8125877e60b0c3279dd15b26bf0e85df5b136 (diff)
downloadlibmatekbd-74e8c123722068886a8b12872601b14f5cc3bbe9.tar.bz2
libmatekbd-74e8c123722068886a8b12872601b14f5cc3bbe9.tar.xz
migrate to gsettings
Diffstat (limited to 'libmatekbd')
-rw-r--r--libmatekbd/Makefile.am29
-rw-r--r--libmatekbd/desktop_mate_peripherals_keyboard_xkb.schemas.in277
-rw-r--r--libmatekbd/matekbd-config-private.h30
-rw-r--r--libmatekbd/matekbd-desktop-config.c198
-rw-r--r--libmatekbd/matekbd-desktop-config.h12
-rw-r--r--libmatekbd/matekbd-indicator-config.c204
-rw-r--r--libmatekbd/matekbd-indicator-config.h13
-rw-r--r--libmatekbd/matekbd-indicator-plugin-manager.c406
-rw-r--r--libmatekbd/matekbd-indicator-plugin-manager.h116
-rw-r--r--libmatekbd/matekbd-indicator-plugin.h125
-rw-r--r--libmatekbd/matekbd-indicator.c95
-rw-r--r--libmatekbd/matekbd-keyboard-config.c539
-rw-r--r--libmatekbd/matekbd-keyboard-config.h22
-rw-r--r--libmatekbd/matekbd-status.c40
-rw-r--r--libmatekbd/matekbd-util.c118
-rw-r--r--libmatekbd/matekbd-util.h3
-rw-r--r--libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml119
17 files changed, 575 insertions, 1771 deletions
diff --git a/libmatekbd/Makefile.am b/libmatekbd/Makefile.am
index 1bcfcd2..b27a6d4 100644
--- a/libmatekbd/Makefile.am
+++ b/libmatekbd/Makefile.am
@@ -6,11 +6,10 @@ ui_DATA = show-layout.ui
common_CFLAGS = \
-I$(top_srcdir) -Wall \
$(GDK_CFLAGS) \
- $(MATECONF_CFLAGS) \
+ $(GIO_CFLAGS) \
$(LIBXKLAVIER_CFLAGS) \
$(XLIB_CFLAGS) \
-I$(top_srcdir)/intl \
- -DSYS_PLUGIN_DIR=\"$(libdir)/matekbd/\" \
-DG_LOG_DOMAIN=\"MateKbdIndicator\" \
-DDATADIR=\"$(datadir)\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \
@@ -26,7 +25,7 @@ common_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
common_LIBADD = \
$(GDK_LIBS) \
- $(MATECONF_LIBS) \
+ $(GIO_LIBS) \
$(LIBXKLAVIER_LIBS) \
$(XLIB_LIBS)
@@ -50,7 +49,6 @@ libmatekbdui_la_SOURCES = \
matekbd-indicator.c \
matekbd-status.c \
matekbd-indicator-marshal.c \
- matekbd-indicator-plugin-manager.c \
matekbd-keyboard-drawing-marshal.c \
matekbd-keyboard-drawing.c
@@ -68,7 +66,6 @@ matekbdinc_HEADERS = \
matekbd-indicator.h \
matekbd-status.h \
matekbd-indicator-config.h \
- matekbd-indicator-plugin.h \
matekbd-keyboard-drawing.h \
matekbd-util.h
@@ -76,8 +73,7 @@ matekbdinc_HEADERS = \
@INTLTOOL_SCHEMAS_RULE@
-noinst_HEADERS = matekbd-indicator-plugin-manager.h \
- $(extra_nih) \
+noinst_HEADERS = $(extra_nih) \
matekbd-config-private.h
EXTRA_DIST = matekbd-indicator-marshal.list \
@@ -104,20 +100,5 @@ matekbd-keyboard-drawing-marshal.c: matekbd-keyboard-drawing-marshal.h
&& mv matekbd-keyboard-drawing-marshal.tmp matekbd-keyboard-drawing-marshal.c ) \
|| ( rm -f matekbd-keyboard-drawing-marshal.tmp && exit 1 )
-schemadir = $(MATECONF_SCHEMA_FILE_DIR)
-schema_in_files= desktop_mate_peripherals_keyboard_xkb.schemas.in
-
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-
-if MATECONF_SCHEMAS_INSTALL
-# don't do this if we are building in eg. rpm
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $$p; \
- done \
- fi
-else
-install-data-local:
-endif
-
+gsettings_SCHEMAS = org.mate.peripherals-keyboard-xkb.gschema.xml
+@GSETTINGS_RULES@
diff --git a/libmatekbd/desktop_mate_peripherals_keyboard_xkb.schemas.in b/libmatekbd/desktop_mate_peripherals_keyboard_xkb.schemas.in
deleted file mode 100644
index 6ac1108..0000000
--- a/libmatekbd/desktop_mate_peripherals_keyboard_xkb.schemas.in
+++ /dev/null
@@ -1,277 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/kbd/model</key>
- <applyto>/desktop/mate/peripherals/keyboard/kbd/model</applyto>
- <owner>mate</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Keyboard model</short>
- <long>keyboard model</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/kbd/layouts</key>
- <applyto>/desktop/mate/peripherals/keyboard/kbd/layouts</applyto>
- <owner>mate</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Keyboard layout</short>
- <long>keyboard layout</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/kbd/options</key>
- <applyto>/desktop/mate/peripherals/keyboard/kbd/options</applyto>
- <owner>mate</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Keyboard options</short>
- <long>Keyboard options</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/update_handlers</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/update_handlers</applyto>
- <owner>mate</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Keyboard Update Handlers</short>
- <long>A collection of scripts to run whenever the keyboard state is
- reloaded. Useful for re-applying xmodmap based adjustments</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/known_file_list</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/known_file_list</applyto>
- <owner>mate</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>modmap file list</short>
- <long>A list of modmap files available in the $HOME directory.</long>
- </locale>
- </schema>
-
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/defaultGroup</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/defaultGroup</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>Default group, assigned on window creation</short>
- <long>Default group, assigned on window creation</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/groupPerWindow</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/groupPerWindow</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Keep and manage separate group per window</short>
- <long>Keep and manage separate group per window</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/handleIndicators</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/handleIndicators</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Save/restore indicators together with layout groups</short>
- <long>Save/restore indicators together with layout groups</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/layoutNamesAsGroupNames</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/layoutNamesAsGroupNames</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Show layout names instead of group names</short>
- <long>Show layout names instead of group names (only for versions of XFree supporting multiple layouts)</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/loadExtraItems</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/loadExtraItems</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Load extra configuration items</short>
- <long>Load exotic, rarely used layouts and options</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/general/disable_sysconfig_changed_warning</key>
- <applyto>/desktop/mate/peripherals/keyboard/general/disable_sysconfig_changed_warning</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Suppress the "X sysconfig changed" warning message</short>
- <long>Suppress the "X sysconfig changed" warning message</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/preview/x</key>
- <applyto>/desktop/mate/peripherals/keyboard/preview/x</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>The Keyboard Preview, X offset</short>
- <long>The Keyboard Preview, X offset</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/preview/y</key>
- <applyto>/desktop/mate/peripherals/keyboard/preview/y</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>The Keyboard Preview, Y offset</short>
- <long>The Keyboard Preview, Y offset</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/preview/width</key>
- <applyto>/desktop/mate/peripherals/keyboard/preview/width</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>The Keyboard Preview, width</short>
- <long>The Keyboard Preview, width</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/preview/height</key>
- <applyto>/desktop/mate/peripherals/keyboard/preview/height</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>The Keyboard Preview, height</short>
- <long>The Keyboard Preview, height</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/secondary</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/secondary</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>Secondary groups</short>
- <long>Secondary groups</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/showFlags</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/showFlags</applyto>
- <owner>mate</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short><!-- TRANSLATORS: real national flags -->
- Show flags in the applet</short>
- <long><!-- TRANSLATORS: real national flags -->
- Show flags in the applet to indicate the current layout</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/fontFamily</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/fontFamily</applyto>
- <owner>mate</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>The font family</short>
- <long>The font family for the layout indicator</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/fontSize</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/fontSize</applyto>
- <owner>mate</owner>
- <type>int</type>
- <default>10</default>
- <locale name="C">
- <short>The font size</short>
- <long>The font size for the layout indicator</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/foregroundColor</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/foregroundColor</applyto>
- <owner>mate</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>The foreground color</short>
- <long>The foreground color for the layout indicator</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/backgroundColor</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/backgroundColor</applyto>
- <owner>mate</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>The background color</short>
- <long>The background color for the layout indicator</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/desktop/mate/peripherals/keyboard/indicator/enabledPlugins</key>
- <applyto>/desktop/mate/peripherals/keyboard/indicator/enabledPlugins</applyto>
- <owner>mate</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>The list of enabled Keyboard Indicator plugins</short>
- <long>The list of enabled Keyboard Indicator plugins</long>
- </locale>
- </schema>
- </schemalist>
-</mateconfschemafile>
diff --git a/libmatekbd/matekbd-config-private.h b/libmatekbd/matekbd-config-private.h
index a49c373..18d9432 100644
--- a/libmatekbd/matekbd-config-private.h
+++ b/libmatekbd/matekbd-config-private.h
@@ -23,9 +23,8 @@
#include "libmatekbd/matekbd-desktop-config.h"
#include "libmatekbd/matekbd-keyboard-config.h"
-#define MATEKBD_CONFIG_KEY_PREFIX "/desktop/mate/peripherals/keyboard"
+#define MATEKBD_CONFIG_SCHEMA "org.mate.peripherals-keyboard-xkb"
-extern const gchar MATEKBD_PREVIEW_CONFIG_DIR[];
extern const gchar MATEKBD_PREVIEW_CONFIG_KEY_X[];
extern const gchar MATEKBD_PREVIEW_CONFIG_KEY_Y[];
extern const gchar MATEKBD_PREVIEW_CONFIG_KEY_WIDTH[];
@@ -34,34 +33,13 @@ extern const gchar MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT[];
/**
* General config functions (private)
*/
-extern void
- matekbd_desktop_config_add_listener (MateConfClient * conf_client,
- const gchar * key,
- MateConfClientNotifyFunc func,
- gpointer user_data, int *pid);
-
-
-extern void
- matekbd_desktop_config_remove_listener (MateConfClient * conf_client, int *pid);
-
extern void matekbd_keyboard_config_model_set (MatekbdKeyboardConfig *
kbd_config,
const gchar * model_name);
-extern void matekbd_keyboard_config_layouts_reset (MatekbdKeyboardConfig *
- kbd_config);
-extern void matekbd_keyboard_config_layouts_add (MatekbdKeyboardConfig *
- kbd_config,
- const gchar * layout_name,
- const gchar * variant_name);
-
-extern void matekbd_keyboard_config_layouts_reset (MatekbdKeyboardConfig *
- kbd_config);
-extern void matekbd_keyboard_config_options_reset (MatekbdKeyboardConfig *
- kbd_config);
-
-extern void matekbd_keyboard_config_options_add (MatekbdKeyboardConfig *
+extern void matekbd_keyboard_config_options_set (MatekbdKeyboardConfig *
kbd_config,
+ gint idx,
const gchar * group_name,
const gchar * option_name);
extern gboolean matekbd_keyboard_config_options_is_set (MatekbdKeyboardConfig *
@@ -77,7 +55,7 @@ extern gboolean matekbd_keyboard_config_dump_settings (MatekbdKeyboardConfig *
extern void matekbd_keyboard_config_start_listen (MatekbdKeyboardConfig *
kbd_config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void matekbd_keyboard_config_stop_listen (MatekbdKeyboardConfig *
diff --git a/libmatekbd/matekbd-desktop-config.c b/libmatekbd/matekbd-desktop-config.c
index bcc2259..47a1486 100644
--- a/libmatekbd/matekbd-desktop-config.c
+++ b/libmatekbd/matekbd-desktop-config.c
@@ -25,26 +25,20 @@
#include <X11/keysym.h>
#include <glib/gi18n.h>
-
+#include <gio/gio.h>
#include <matekbd-desktop-config.h>
#include <matekbd-config-private.h>
/**
* MatekbdDesktopConfig
*/
-#define MATEKBD_DESKTOP_CONFIG_KEY_PREFIX MATEKBD_CONFIG_KEY_PREFIX "/general"
-
-const gchar MATEKBD_DESKTOP_CONFIG_DIR[] = MATEKBD_DESKTOP_CONFIG_KEY_PREFIX;
-const gchar MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[] =
- MATEKBD_DESKTOP_CONFIG_KEY_PREFIX "/defaultGroup";
-const gchar MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW[] =
- MATEKBD_DESKTOP_CONFIG_KEY_PREFIX "/groupPerWindow";
-const gchar MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS[] =
- MATEKBD_DESKTOP_CONFIG_KEY_PREFIX "/handleIndicators";
-const gchar MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES[]
- = MATEKBD_DESKTOP_CONFIG_KEY_PREFIX "/layoutNamesAsGroupNames";
-const gchar MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS[]
- = MATEKBD_DESKTOP_CONFIG_KEY_PREFIX "/loadExtraItems";
+#define MATEKBD_DESKTOP_CONFIG_SCHEMA MATEKBD_CONFIG_SCHEMA ".general"
+
+const gchar MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[] = "default-group";
+const gchar MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW[] = "group-per-window";
+const gchar MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS[] = "handle-indicators";
+const gchar MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES[] = "layout-names-as-group-names";
+const gchar MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS[] = "load-extra-items";
/**
* static common functions
@@ -129,135 +123,54 @@ static gboolean
return TRUE;
}
-void
-matekbd_desktop_config_add_listener (MateConfClient * conf_client,
- const gchar * key,
- MateConfClientNotifyFunc func,
- gpointer user_data, int *pid)
-{
- GError *gerror = NULL;
- xkl_debug (150, "Listening to [%s]\n", key);
- *pid = mateconf_client_notify_add (conf_client,
- key, func, user_data, NULL,
- &gerror);
- if (0 == *pid) {
- g_warning ("Error listening for configuration: [%s]\n",
- gerror->message);
- g_error_free (gerror);
- }
-}
-
-void
-matekbd_desktop_config_remove_listener (MateConfClient * conf_client, int *pid)
-{
- if (*pid != 0) {
- mateconf_client_notify_remove (conf_client, *pid);
- *pid = 0;
- }
-}
-
/**
* extern MatekbdDesktopConfig config functions
*/
void
matekbd_desktop_config_init (MatekbdDesktopConfig * config,
- MateConfClient * conf_client, XklEngine * engine)
+ XklEngine * engine)
{
- GError *gerror = NULL;
-
memset (config, 0, sizeof (*config));
- config->conf_client = conf_client;
+ config->settings = g_settings_new (MATEKBD_CONFIG_SCHEMA);
config->engine = engine;
- g_object_ref (config->conf_client);
-
- mateconf_client_add_dir (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, &gerror);
- if (gerror != NULL) {
- g_warning ("err: %s\n", gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
}
void
matekbd_desktop_config_term (MatekbdDesktopConfig * config)
{
- g_object_unref (config->conf_client);
- config->conf_client = NULL;
+ g_object_unref (config->settings);
+ config->settings = NULL;
}
void
-matekbd_desktop_config_load_from_mateconf (MatekbdDesktopConfig * config)
+matekbd_desktop_config_load_from_gsettings (MatekbdDesktopConfig * config)
{
- GError *gerror = NULL;
-
config->group_per_app =
- mateconf_client_get_bool (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- config->group_per_app = FALSE;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW);
xkl_debug (150, "group_per_app: %d\n", config->group_per_app);
config->handle_indicators =
- mateconf_client_get_bool (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- config->handle_indicators = FALSE;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS);
xkl_debug (150, "handle_indicators: %d\n",
config->handle_indicators);
config->layout_names_as_group_names =
- mateconf_client_get_bool (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- config->layout_names_as_group_names = TRUE;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES);
xkl_debug (150, "layout_names_as_group_names: %d\n",
config->layout_names_as_group_names);
config->load_extra_items =
- mateconf_client_get_bool (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- config->load_extra_items = FALSE;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS);
xkl_debug (150, "load_extra_items: %d\n",
config->load_extra_items);
config->default_group =
- mateconf_client_get_int (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- config->default_group = -1;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_int (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP);
if (config->default_group < -1
|| config->default_group >=
@@ -267,38 +180,27 @@ matekbd_desktop_config_load_from_mateconf (MatekbdDesktopConfig * config)
}
void
-matekbd_desktop_config_save_to_mateconf (MatekbdDesktopConfig * config)
+matekbd_desktop_config_save_to_gsettings (MatekbdDesktopConfig * config)
{
- MateConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = mateconf_change_set_new ();
-
- mateconf_change_set_set_bool (cs,
- MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
- config->group_per_app);
- mateconf_change_set_set_bool (cs,
- MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS,
- config->handle_indicators);
- mateconf_change_set_set_bool (cs,
- MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES,
- config->layout_names_as_group_names);
- mateconf_change_set_set_bool (cs,
- MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS,
- config->load_extra_items);
- mateconf_change_set_set_int (cs,
- MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP,
- config->default_group);
-
- mateconf_client_commit_change_set (config->conf_client, cs, TRUE,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error saving active configuration: %s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
- mateconf_change_set_unref (cs);
+ g_settings_delay (config->settings);
+
+ g_settings_set_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
+ config->group_per_app);
+ g_settings_set_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS,
+ config->handle_indicators);
+ g_settings_set_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES,
+ config->layout_names_as_group_names);
+ g_settings_set_boolean (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS,
+ config->load_extra_items);
+ g_settings_set_int (config->settings,
+ MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP,
+ config->default_group);
+
+ g_settings_apply (config->settings);
}
gboolean
@@ -339,20 +241,20 @@ matekbd_desktop_config_restore_group (MatekbdDesktopConfig * config)
void
matekbd_desktop_config_start_listen (MatekbdDesktopConfig * config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data)
{
- matekbd_desktop_config_add_listener (config->conf_client,
- MATEKBD_DESKTOP_CONFIG_DIR, func,
- user_data,
- &config->config_listener_id);
+ config->config_listener_id =
+ g_signal_connect (config->settings, "changed", func,
+ user_data);
}
void
matekbd_desktop_config_stop_listen (MatekbdDesktopConfig * config)
{
- matekbd_desktop_config_remove_listener (config->conf_client,
- &config->config_listener_id);
+ g_signal_handler_disconnect (config->settings,
+ config->config_listener_id);
+ config->config_listener_id = 0;
}
gboolean
diff --git a/libmatekbd/matekbd-desktop-config.h b/libmatekbd/matekbd-desktop-config.h
index e6a1639..ee5dd09 100644
--- a/libmatekbd/matekbd-desktop-config.h
+++ b/libmatekbd/matekbd-desktop-config.h
@@ -22,10 +22,9 @@
#include <X11/Xlib.h>
#include <glib.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libxklavier/xklavier.h>
-extern const gchar MATEKBD_DESKTOP_CONFIG_DIR[];
extern const gchar MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[];
extern const gchar MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW[];
extern const gchar MATEKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS[];
@@ -42,7 +41,7 @@ typedef struct _MatekbdDesktopConfig {
gboolean load_extra_items;
/* private, transient */
- MateConfClient *conf_client;
+ GSettings *settings;
int config_listener_id;
XklEngine *engine;
} MatekbdDesktopConfig;
@@ -51,14 +50,13 @@ typedef struct _MatekbdDesktopConfig {
* MatekbdDesktopConfig functions
*/
extern void matekbd_desktop_config_init (MatekbdDesktopConfig * config,
- MateConfClient * conf_client,
XklEngine * engine);
extern void matekbd_desktop_config_term (MatekbdDesktopConfig * config);
-extern void matekbd_desktop_config_load_from_mateconf (MatekbdDesktopConfig *
+extern void matekbd_desktop_config_load_from_gsettings (MatekbdDesktopConfig *
config);
-extern void matekbd_desktop_config_save_to_mateconf (MatekbdDesktopConfig * config);
+extern void matekbd_desktop_config_save_to_gsettings (MatekbdDesktopConfig * config);
extern gboolean matekbd_desktop_config_activate (MatekbdDesktopConfig * config);
@@ -84,7 +82,7 @@ extern void matekbd_desktop_config_lock_prev_group (MatekbdDesktopConfig *
extern void matekbd_desktop_config_restore_group (MatekbdDesktopConfig * config);
extern void matekbd_desktop_config_start_listen (MatekbdDesktopConfig * config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void matekbd_desktop_config_stop_listen (MatekbdDesktopConfig * config);
diff --git a/libmatekbd/matekbd-indicator-config.c b/libmatekbd/matekbd-indicator-config.c
index 328e0cb..6925595 100644
--- a/libmatekbd/matekbd-indicator-config.c
+++ b/libmatekbd/matekbd-indicator-config.c
@@ -37,76 +37,32 @@
/**
* MatekbdIndicatorConfig
*/
-#define MATEKBD_INDICATOR_CONFIG_KEY_PREFIX MATEKBD_CONFIG_KEY_PREFIX "/indicator"
+#define MATEKBD_INDICATOR_CONFIG_SCHEMA MATEKBD_CONFIG_SCHEMA ".indicator"
#define GTK_STYLE_PATH "*PanelWidget*"
-const gchar MATEKBD_INDICATOR_CONFIG_DIR[] = MATEKBD_INDICATOR_CONFIG_KEY_PREFIX;
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/showFlags";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/enabledPlugins";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/secondary";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/fontFamily";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_FONT_SIZE[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/fontSize";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/foregroundColor";
-const gchar MATEKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR[] =
- MATEKBD_INDICATOR_CONFIG_KEY_PREFIX "/backgroundColor";
-
-#define SYSTEM_FONT_MATECONF_ENTRY "/desktop/mate/interface/font_name"
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] = "show-flags";
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES[] = "secondary";
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY[] = "font-family";
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_FONT_SIZE[] = "font-size";
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR[] = "foreground-color";
+const gchar MATEKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR[] = "background-color";
+
+#define SYSTEM_FONT_SCHEMA "org.mate.interface"
+#define SYSTEM_FONT_KEY "font-name"
/**
* static applet config functions
*/
static void
-matekbd_indicator_config_free_enabled_plugins (MatekbdIndicatorConfig *
- ind_config)
-{
- GSList *plugin_node = ind_config->enabled_plugins;
- if (plugin_node != NULL) {
- do {
- if (plugin_node->data != NULL) {
- g_free (plugin_node->data);
- plugin_node->data = NULL;
- }
- plugin_node = g_slist_next (plugin_node);
- } while (plugin_node != NULL);
- g_slist_free (ind_config->enabled_plugins);
- ind_config->enabled_plugins = NULL;
- }
-}
-
-static void
matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->font_family =
- mateconf_client_get_string (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- ind_config->font_family = g_strdup ("Helvetica");
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_string (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY);
ind_config->font_size =
- mateconf_client_get_int (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_FONT_SIZE,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- ind_config->font_size = 10;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_int (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_FONT_SIZE);
if (ind_config->font_family == NULL ||
ind_config->font_family[0] == '\0') {
@@ -135,18 +91,9 @@ matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config)
static void
matekbd_indicator_config_load_colors (MatekbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->foreground_color =
- mateconf_client_get_string (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_string (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR);
if (ind_config->foreground_color == NULL ||
ind_config->foreground_color[0] == '\0') {
@@ -175,15 +122,8 @@ matekbd_indicator_config_load_colors (MatekbdIndicatorConfig * ind_config)
}
ind_config->background_color =
- mateconf_client_get_string (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_string (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR);
}
void
@@ -209,9 +149,9 @@ matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig *
return NULL;
if ((kbd_config->layouts_variants != NULL) &&
- (g_slist_length (kbd_config->layouts_variants) > group)) {
- char *full_layout_name = (char *)
- g_slist_nth_data (kbd_config->layouts_variants, group);
+ (g_strv_length (kbd_config->layouts_variants) > group)) {
+ char *full_layout_name =
+ kbd_config->layouts_variants[group];
if (full_layout_name != NULL) {
char *l, *v;
@@ -277,24 +217,13 @@ matekbd_indicator_config_free_image_filenames (MatekbdIndicatorConfig *
void
matekbd_indicator_config_init (MatekbdIndicatorConfig * ind_config,
- MateConfClient * conf_client, XklEngine * engine)
+ XklEngine * engine)
{
- GError *gerror = NULL;
gchar *sp;
memset (ind_config, 0, sizeof (*ind_config));
- ind_config->conf_client = conf_client;
+ ind_config->settings = g_settings_new (MATEKBD_INDICATOR_CONFIG_SCHEMA);
ind_config->engine = engine;
- g_object_ref (ind_config->conf_client);
-
- mateconf_client_add_dir (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, &gerror);
- if (gerror != NULL) {
- g_warning ("err1:%s\n", gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
ind_config->icon_theme = gtk_icon_theme_get_default ();
@@ -336,86 +265,39 @@ matekbd_indicator_config_term (MatekbdIndicatorConfig * ind_config)
matekbd_indicator_config_free_image_filenames (ind_config);
- matekbd_indicator_config_free_enabled_plugins (ind_config);
- g_object_unref (ind_config->conf_client);
- ind_config->conf_client = NULL;
+ g_object_unref (ind_config->settings);
+ ind_config->settings = NULL;
}
void
-matekbd_indicator_config_load_from_mateconf (MatekbdIndicatorConfig * ind_config)
+matekbd_indicator_config_load_from_gsettings (MatekbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->secondary_groups_mask =
- mateconf_client_get_int (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- ind_config->secondary_groups_mask = 0;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_int (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES);
ind_config->show_flags =
- mateconf_client_get_bool (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error reading kbdConfiguration:%s\n",
- gerror->message);
- ind_config->show_flags = FALSE;
- g_error_free (gerror);
- gerror = NULL;
- }
+ g_settings_get_boolean (ind_config->settings,
+ MATEKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS);
matekbd_indicator_config_load_font (ind_config);
matekbd_indicator_config_load_colors (ind_config);
- matekbd_indicator_config_free_enabled_plugins (ind_config);
- ind_config->enabled_plugins =
- mateconf_client_get_list (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS,
- MATECONF_VALUE_STRING, &gerror);
-
- if (gerror != NULL) {
- g_warning ("Error reading kbd_configuration:%s\n",
- gerror->message);
- ind_config->enabled_plugins = NULL;
- g_error_free (gerror);
- gerror = NULL;
- }
}
void
-matekbd_indicator_config_save_to_mateconf (MatekbdIndicatorConfig * ind_config)
+matekbd_indicator_config_save_to_gsettings (MatekbdIndicatorConfig * ind_config)
{
- MateConfChangeSet *cs;
- GError *gerror = NULL;
+ g_settings_delay (ind_config->settings);
- cs = mateconf_change_set_new ();
-
- mateconf_change_set_set_int (cs,
+ g_settings_set_int (ind_config->settings,
MATEKBD_INDICATOR_CONFIG_KEY_SECONDARIES,
ind_config->secondary_groups_mask);
- mateconf_change_set_set_bool (cs,
+ g_settings_set_boolean (ind_config->settings,
MATEKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS,
ind_config->show_flags);
- mateconf_change_set_set_list (cs,
- MATEKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS,
- MATECONF_VALUE_STRING,
- ind_config->enabled_plugins);
-
- mateconf_client_commit_change_set (ind_config->conf_client, cs,
- TRUE, &gerror);
- if (gerror != NULL) {
- g_warning ("Error saving configuration: %s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
- mateconf_change_set_unref (cs);
+
+ g_settings_apply (ind_config->settings);
}
void
@@ -428,18 +310,18 @@ matekbd_indicator_config_activate (MatekbdIndicatorConfig * ind_config)
void
matekbd_indicator_config_start_listen (MatekbdIndicatorConfig *
ind_config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data)
{
- matekbd_desktop_config_add_listener (ind_config->conf_client,
- MATEKBD_INDICATOR_CONFIG_DIR, func,
- user_data,
- &ind_config->config_listener_id);
+ ind_config->config_listener_id =
+ g_signal_connect (ind_config->settings, "changed", func,
+ user_data);
}
void
matekbd_indicator_config_stop_listen (MatekbdIndicatorConfig * ind_config)
{
- matekbd_desktop_config_remove_listener (ind_config->conf_client,
- &ind_config->config_listener_id);
+ g_signal_handler_disconnect (ind_config->settings,
+ ind_config->config_listener_id);
+ ind_config->config_listener_id = 0;
}
diff --git a/libmatekbd/matekbd-indicator-config.h b/libmatekbd/matekbd-indicator-config.h
index d01cadc..390c0c8 100644
--- a/libmatekbd/matekbd-indicator-config.h
+++ b/libmatekbd/matekbd-indicator-config.h
@@ -36,10 +36,8 @@ typedef struct _MatekbdIndicatorConfig {
gchar *foreground_color;
gchar *background_color;
- GSList *enabled_plugins;
-
/* private, transient */
- MateConfClient *conf_client;
+ GSettings *settings;
GSList *image_filenames;
GtkIconTheme *icon_theme;
int config_listener_id;
@@ -53,14 +51,13 @@ typedef struct _MatekbdIndicatorConfig {
*/
extern void matekbd_indicator_config_init (MatekbdIndicatorConfig *
applet_config,
- MateConfClient * conf_client,
XklEngine * engine);
extern void matekbd_indicator_config_term (MatekbdIndicatorConfig *
applet_config);
-extern void matekbd_indicator_config_load_from_mateconf (MatekbdIndicatorConfig
+extern void matekbd_indicator_config_load_from_gsettings (MatekbdIndicatorConfig
* applet_config);
-extern void matekbd_indicator_config_save_to_mateconf (MatekbdIndicatorConfig *
+extern void matekbd_indicator_config_save_to_gsettings (MatekbdIndicatorConfig *
applet_config);
extern void matekbd_indicator_config_refresh_style (MatekbdIndicatorConfig *
@@ -79,13 +76,13 @@ extern void matekbd_indicator_config_load_image_filenames (MatekbdIndicatorConfi
extern void matekbd_indicator_config_free_image_filenames (MatekbdIndicatorConfig
* applet_config);
-/* Should be updated on Indicator/MateConf configuration change */
+/* Should be updated on Indicator/GSettings configuration change */
extern void matekbd_indicator_config_activate (MatekbdIndicatorConfig *
applet_config);
extern void matekbd_indicator_config_start_listen (MatekbdIndicatorConfig *
applet_config,
- MateConfClientNotifyFunc
+ GCallback
func, gpointer user_data);
extern void matekbd_indicator_config_stop_listen (MatekbdIndicatorConfig *
diff --git a/libmatekbd/matekbd-indicator-plugin-manager.c b/libmatekbd/matekbd-indicator-plugin-manager.c
deleted file mode 100644
index 8236038..0000000
--- a/libmatekbd/matekbd-indicator-plugin-manager.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Copyright (C) 2006 Sergey V. Udaltsov <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <libxklavier/xklavier.h>
-
-#include <matekbd-indicator-plugin-manager.h>
-
-#define FOREACH_INITED_PLUGIN() \
-{ \
- GSList *prec; \
- for( prec = manager->inited_plugin_recs; prec != NULL; prec = prec->next ) \
- { \
- const MatekbdIndicatorPlugin *plugin = \
- ( ( MatekbdIndicatorPluginManagerRecord * ) ( prec->data ) )->plugin; \
- if( plugin != NULL ) \
- {
-
-#define NEXT_INITED_PLUGIN() \
- } \
- } \
-}
-
-static void
-matekbd_indicator_plugin_manager_add_plugins_dir (MatekbdIndicatorPluginManager *
- manager,
- const char *dirname)
-{
- GDir *dir = g_dir_open (dirname, 0, NULL);
- const gchar *filename;
- const MatekbdIndicatorPlugin *plugin;
-
- if (dir == NULL)
- return;
-
- xkl_debug (100, "Scanning [%s]...\n", dirname);
- while ((filename = g_dir_read_name (dir)) != NULL) {
- gchar *full_path =
- g_build_filename (dirname, filename, NULL);
- xkl_debug (100, "Loading plugin module [%s]...\n",
- full_path);
- if (full_path != NULL) {
- GModule *module = g_module_open (full_path, 0);
- if (module != NULL) {
- gpointer get_plugin_func;
- if (g_module_symbol
- (module, "GetPlugin",
- &get_plugin_func)) {
- plugin =
- ((MatekbdIndicatorPluginGetPluginFunc)
- get_plugin_func) ();
- if (plugin != NULL) {
- MatekbdIndicatorPluginManagerRecord
- * rec =
- g_new0
- (MatekbdIndicatorPluginManagerRecord,
- 1);
- xkl_debug (100,
- "Loaded plugin from [%s]: [%s]/[%s]...\n",
- full_path,
- plugin->name,
- plugin->description);
- rec->full_path = full_path;
- rec->module = module;
- rec->plugin = plugin;
- g_hash_table_insert
- (manager->all_plugin_recs,
- full_path, rec);
- continue;
- }
- } else
- xkl_debug (0,
- "Bad plugin: [%s]\n",
- full_path);
- g_module_close (module);
- } else
- xkl_debug (0, "Bad module: [%s], %s\n",
- full_path, g_module_error ());
- g_free (full_path);
- }
- }
- g_dir_close (dir);
-}
-
-static void
-matekbd_indicator_plugin_manager_load_all (MatekbdIndicatorPluginManager *
- manager)
-{
- if (!g_module_supported ()) {
- xkl_debug (0, "Modules are not supported - no plugins!\n");
- return;
- }
- matekbd_indicator_plugin_manager_add_plugins_dir (manager,
- SYS_PLUGIN_DIR);
-}
-
-static void
-matekbd_indicator_plugin_manager_rec_term (MatekbdIndicatorPluginManagerRecord *
- rec, void *user_data)
-{
- const MatekbdIndicatorPlugin *plugin = rec->plugin;
- if (plugin != NULL) {
- xkl_debug (100, "Terminating plugin: [%s]...\n",
- plugin->name);
- if (plugin->term_callback)
- (*plugin->term_callback) ();
- }
-}
-
-static void
-matekbd_indicator_plugin_manager_rec_destroy (MatekbdIndicatorPluginManagerRecord
- * rec)
-{
- xkl_debug (100, "Unloading plugin: [%s]...\n", rec->plugin->name);
-
- g_module_close (rec->module);
- g_free (rec);
-}
-
-void
-matekbd_indicator_plugin_manager_init (MatekbdIndicatorPluginManager * manager)
-{
- manager->all_plugin_recs =
- g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify)
- matekbd_indicator_plugin_manager_rec_destroy);
- matekbd_indicator_plugin_manager_load_all (manager);
-}
-
-void
-matekbd_indicator_plugin_manager_term (MatekbdIndicatorPluginManager * manager)
-{
- matekbd_indicator_plugin_manager_term_initialized_plugins (manager);
- if (manager->all_plugin_recs != NULL) {
- g_hash_table_destroy (manager->all_plugin_recs);
- manager->all_plugin_recs = NULL;
- }
-}
-
-void
- matekbd_indicator_plugin_manager_init_enabled_plugins
- (MatekbdIndicatorPluginManager * manager,
- MatekbdIndicatorPluginContainer * pc, GSList * enabled_plugins) {
- GSList *plugin_name_node = enabled_plugins;
- if (manager->all_plugin_recs == NULL)
- return;
- xkl_debug (100, "Initializing all enabled plugins...\n");
- while (plugin_name_node != NULL) {
- const char *full_path = plugin_name_node->data;
- if (full_path != NULL) {
- MatekbdIndicatorPluginManagerRecord *rec =
- (MatekbdIndicatorPluginManagerRecord *)
- g_hash_table_lookup (manager->all_plugin_recs,
- full_path);
-
- if (rec != NULL) {
- const MatekbdIndicatorPlugin *plugin =
- rec->plugin;
- gboolean initialized = FALSE;
- xkl_debug (100,
- "Initializing plugin: [%s] from [%s]...\n",
- plugin->name, full_path);
- if (plugin->init_callback != NULL)
- initialized =
- (*plugin->init_callback) (pc);
- else
- initialized = TRUE;
-
- manager->inited_plugin_recs =
- g_slist_append
- (manager->inited_plugin_recs, rec);
- xkl_debug (100,
- "Plugin [%s] initialized: %d\n",
- plugin->name, initialized);
- }
- }
- plugin_name_node = g_slist_next (plugin_name_node);
- }
-}
-
-void
- matekbd_indicator_plugin_manager_term_initialized_plugins
- (MatekbdIndicatorPluginManager * manager) {
-
- if (manager->inited_plugin_recs == NULL)
- return;
- g_slist_foreach (manager->inited_plugin_recs,
- (GFunc) matekbd_indicator_plugin_manager_rec_term,
- NULL);
- g_slist_free (manager->inited_plugin_recs);
- manager->inited_plugin_recs = NULL;
-}
-
-void
-matekbd_indicator_plugin_manager_toggle_plugins (MatekbdIndicatorPluginManager *
- manager,
- MatekbdIndicatorPluginContainer
- * pc,
- GSList * enabled_plugins)
-{
- matekbd_indicator_plugin_manager_term_initialized_plugins (manager);
- matekbd_indicator_plugin_manager_init_enabled_plugins (manager, pc,
- enabled_plugins);
-}
-
-void
-matekbd_indicator_plugin_manager_group_changed (MatekbdIndicatorPluginManager *
- manager, GtkWidget * notebook,
- int new_group)
-{
- FOREACH_INITED_PLUGIN ();
- if (plugin->group_changed_callback)
- (*plugin->group_changed_callback) (notebook, new_group);
- NEXT_INITED_PLUGIN ();
-}
-
-void
-matekbd_indicator_plugin_manager_config_changed (MatekbdIndicatorPluginManager *
- manager,
- MatekbdKeyboardConfig * from,
- MatekbdKeyboardConfig * to)
-{
- FOREACH_INITED_PLUGIN ();
- if (plugin->config_changed_callback)
- (*plugin->config_changed_callback) (from, to);
- NEXT_INITED_PLUGIN ();
-}
-
-const MatekbdIndicatorPlugin *
-matekbd_indicator_plugin_manager_get_plugin (MatekbdIndicatorPluginManager *
- manager, const char *full_path)
-{
- MatekbdIndicatorPluginManagerRecord *rec =
- (MatekbdIndicatorPluginManagerRecord *)
- g_hash_table_lookup (manager->all_plugin_recs,
- full_path);
- if (rec == NULL)
- return NULL;
- return rec->plugin;
-}
-
-void
-matekbd_indicator_plugin_manager_promote_plugin (MatekbdIndicatorPluginManager *
- manager,
- GSList * enabled_plugins,
- const char *full_path)
-{
- GSList *the_node = enabled_plugins;
- GSList *prev_node = NULL;
-
- while (the_node != NULL) {
- if (!strcmp (the_node->data, full_path)) {
- if (prev_node != NULL) {
- char *tmp = (char *) prev_node->data;
- prev_node->data = the_node->data;
- the_node->data = tmp;
- }
- break;
- }
- prev_node = the_node;
- the_node = g_slist_next (the_node);
- }
-}
-
-void
-matekbd_indicator_plugin_manager_demote_plugin (MatekbdIndicatorPluginManager *
- manager,
- GSList * enabled_plugins,
- const char *full_path)
-{
- GSList *the_node = g_slist_find_custom (enabled_plugins, full_path,
- (GCompareFunc) strcmp);
- if (the_node != NULL) {
- GSList *next_node = g_slist_next (the_node);
- if (next_node != NULL) {
- char *tmp = (char *) next_node->data;
- next_node->data = the_node->data;
- the_node->data = tmp;
- }
- }
-}
-
-void
-matekbd_indicator_plugin_manager_enable_plugin (MatekbdIndicatorPluginManager *
- manager,
- GSList ** enabled_plugins,
- const char *full_path)
-{
- if (NULL !=
- matekbd_indicator_plugin_manager_get_plugin (manager,
- full_path)) {
- *enabled_plugins =
- g_slist_append (*enabled_plugins,
- (gpointer) g_strdup (full_path));
- }
-}
-
-void
-matekbd_indicator_plugin_manager_disable_plugin (MatekbdIndicatorPluginManager *
- manager,
- GSList ** enabled_plugins,
- const char *full_path)
-{
- GSList *the_node =
- g_slist_find_custom (*enabled_plugins, full_path,
- (GCompareFunc) strcmp);
- if (the_node != NULL) {
- g_free (the_node->data);
- *enabled_plugins =
- g_slist_delete_link (*enabled_plugins, the_node);
- }
-}
-
-int
-matekbd_indicator_plugin_manager_window_created (MatekbdIndicatorPluginManager *
- manager, Window win,
- Window parent)
-{
- FOREACH_INITED_PLUGIN ();
- if (plugin->window_created_callback) {
- int group_to_assign =
- (*plugin->window_created_callback) (win, parent);
- if (group_to_assign != -1) {
- xkl_debug (100,
- "Plugin [%s] assigned group %d to new window %ld\n",
- plugin->name, group_to_assign, win);
- return group_to_assign;
- }
- }
- NEXT_INITED_PLUGIN ();
- return -1;
-}
-
-GtkWidget *
-matekbd_indicator_plugin_manager_decorate_widget (MatekbdIndicatorPluginManager *
- manager, GtkWidget * widget,
- const gint group,
- const char
- *group_description,
- MatekbdKeyboardConfig *
- kbd_config)
-{
- FOREACH_INITED_PLUGIN ();
- if (plugin->decorate_widget_callback) {
- GtkWidget *decorated_widget =
- (*plugin->decorate_widget_callback) (widget, group,
- group_description,
- kbd_config);
- if (decorated_widget != NULL) {
- xkl_debug (100,
- "Plugin [%s] decorated widget %p to %p\n",
- plugin->name, widget, decorated_widget);
- return decorated_widget;
- }
- }
- NEXT_INITED_PLUGIN ();
- return NULL;
-}
-
-void
-matekbd_indicator_plugin_manager_configure_plugin (MatekbdIndicatorPluginManager
- * manager,
- MatekbdIndicatorPluginContainer
- * pc,
- const char *full_path,
- GtkWindow * parent)
-{
- const MatekbdIndicatorPlugin *plugin =
- matekbd_indicator_plugin_manager_get_plugin (manager, full_path);
- if (plugin->configure_properties_callback != NULL)
- plugin->configure_properties_callback (pc, parent);
-}
-
-void
-matekbd_indicator_plugin_container_init (MatekbdIndicatorPluginContainer * pc,
- MateConfClient * conf_client)
-{
- pc->conf_client = conf_client;
- g_object_ref (pc->conf_client);
-}
-
-void
-matekbd_indicator_plugin_container_term (MatekbdIndicatorPluginContainer * pc)
-{
- g_object_unref (pc->conf_client);
-}
diff --git a/libmatekbd/matekbd-indicator-plugin-manager.h b/libmatekbd/matekbd-indicator-plugin-manager.h
deleted file mode 100644
index 416bdab..0000000
--- a/libmatekbd/matekbd-indicator-plugin-manager.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2006 Sergey V. Udaltsov <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GSWITCHIT_PLUGIN_MANAGER_H__
-#define __GSWITCHIT_PLUGIN_MANAGER_H__
-
-#include <gmodule.h>
-#include <libmatekbd/matekbd-indicator-plugin.h>
-
-typedef struct _MatekbdIndicatorPluginManager {
- GHashTable *all_plugin_recs;
- GSList *inited_plugin_recs;
-} MatekbdIndicatorPluginManager;
-
-typedef struct _MatekbdIndicatorPluginManagerRecord {
- const char *full_path;
- GModule *module;
- const MatekbdIndicatorPlugin *plugin;
-} MatekbdIndicatorPluginManagerRecord;
-
-extern void
- matekbd_indicator_plugin_manager_init (MatekbdIndicatorPluginManager * manager);
-
-extern void
- matekbd_indicator_plugin_manager_term (MatekbdIndicatorPluginManager * manager);
-
-extern void
- matekbd_indicator_plugin_manager_init_enabled_plugins (MatekbdIndicatorPluginManager * manager,
- MatekbdIndicatorPluginContainer
- * pc,
- GSList *
- enabled_plugins);
-
-extern void
- matekbd_indicator_plugin_manager_term_initialized_plugins (MatekbdIndicatorPluginManager * manager);
-
-extern void
- matekbd_indicator_plugin_manager_toggle_plugins (MatekbdIndicatorPluginManager * manager,
- MatekbdIndicatorPluginContainer
- * pc,
- GSList * enabled_plugins);
-
-extern const MatekbdIndicatorPlugin
- *
-matekbd_indicator_plugin_manager_get_plugin (MatekbdIndicatorPluginManager *
- manager, const char *full_path);
-
-extern void
- matekbd_indicator_plugin_manager_promote_plugin (MatekbdIndicatorPluginManager * manager,
- GSList * enabled_plugins,
- const char *full_path);
-
-extern void
- matekbd_indicator_plugin_manager_demote_plugin (MatekbdIndicatorPluginManager * manager,
- GSList * enabled_plugins,
- const char *full_path);
-
-extern void
- matekbd_indicator_plugin_manager_enable_plugin (MatekbdIndicatorPluginManager * manager,
- GSList ** enabled_plugins,
- const char *full_path);
-
-extern void
- matekbd_indicator_plugin_manager_disable_plugin (MatekbdIndicatorPluginManager * manager,
- GSList ** enabled_plugins,
- const char *full_path);
-
-extern void
- matekbd_indicator_plugin_manager_configure_plugin (MatekbdIndicatorPluginManager * manager,
- MatekbdIndicatorPluginContainer
- * pc,
- const char *full_path,
- GtkWindow * parent);
-
-/* actual calling plugin notification methods */
-
-extern void
- matekbd_indicator_plugin_manager_group_changed (MatekbdIndicatorPluginManager * manager,
- GtkWidget * notebook,
- int new_group);
-
-extern void
- matekbd_indicator_plugin_manager_config_changed (MatekbdIndicatorPluginManager * manager,
- MatekbdKeyboardConfig * from,
- MatekbdKeyboardConfig * to);
-
-extern int
- matekbd_indicator_plugin_manager_window_created (MatekbdIndicatorPluginManager * manager,
- Window win, Window parent);
-
-extern GtkWidget
- *
-matekbd_indicator_plugin_manager_decorate_widget (MatekbdIndicatorPluginManager *
- manager, GtkWidget * widget,
- const gint group, const char
- *group_description,
- MatekbdKeyboardConfig *
- config);
-
-#endif
diff --git a/libmatekbd/matekbd-indicator-plugin.h b/libmatekbd/matekbd-indicator-plugin.h
deleted file mode 100644
index c1398c0..0000000
--- a/libmatekbd/matekbd-indicator-plugin.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2006 Sergey V. Udaltsov <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __MATEKBD_INDICATOR_PLUGIN_H__
-#define __MATEKBD_INDICATOR_PLUGIN_H__
-
-#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
-#include <libmatekbd/matekbd-keyboard-config.h>
-
-#define MAX_LOCAL_NAME_BUF_LENGTH 512
-
-struct _MatekbdIndicatorPlugin;
-
-typedef struct _MatekbdIndicatorPluginContainer {
- MateConfClient *conf_client;
-} MatekbdIndicatorPluginContainer;
-
-typedef const struct _MatekbdIndicatorPlugin
-*(*MatekbdIndicatorPluginGetPluginFunc) (void);
-
-typedef
- gboolean (*MatekbdIndicatorPluginInitFunc) (MatekbdIndicatorPluginContainer *
- pc);
-
-typedef void (*MatekbdIndicatorPluginGroupChangedFunc) (GtkWidget * notebook,
- int new_group);
-
-typedef void (*MatekbdIndicatorPluginConfigChangedFunc) (const
- MatekbdKeyboardConfig *
- from,
- const
- MatekbdKeyboardConfig *
- to);
-
-typedef int (*MatekbdIndicatorPluginWindowCreatedFunc) (const Window win,
- const Window parent);
-
-typedef void (*MatekbdIndicatorPluginTermFunc) (void);
-
-typedef GtkWidget *(*MatekbdIndicatorPluginCreateWidget) (void);
-
-typedef GtkWidget *(*MatekbdIndicatorPluginDecorateWidget) (GtkWidget *
- widget,
- const gint group,
- const char
- *group_description,
- MatekbdKeyboardConfig
- * config);
-
-typedef
-void (*MatekbdIndicatorPluginConfigureProperties)
- (MatekbdIndicatorPluginContainer * pc, GtkWindow * parent);
-
-typedef struct _MatekbdIndicatorPlugin {
- const char *name;
-
- const char *description;
-
-/* implemented */
- MatekbdIndicatorPluginInitFunc init_callback;
-
-/* implemented */
- MatekbdIndicatorPluginTermFunc term_callback;
-
-/* implemented */
- MatekbdIndicatorPluginConfigureProperties
- configure_properties_callback;
-
-/* implemented */
- MatekbdIndicatorPluginGroupChangedFunc group_changed_callback;
-
-/* implemented */
- MatekbdIndicatorPluginWindowCreatedFunc window_created_callback;
-
-/* implemented */
- MatekbdIndicatorPluginDecorateWidget decorate_widget_callback;
-
-/* not implemented */
- MatekbdIndicatorPluginConfigChangedFunc config_changed_callback;
-
-/* not implemented */
- MatekbdIndicatorPluginCreateWidget create_widget_callback;
-
-} MatekbdIndicatorPlugin;
-
-/**
- * Functions accessible for plugins
- */
-
-extern void
- matekbd_indicator_plugin_container_init (MatekbdIndicatorPluginContainer * pc,
- MateConfClient * conf_client);
-
-extern void
- matekbd_indicator_plugin_container_term (MatekbdIndicatorPluginContainer * pc);
-
-extern void
- matekbd_indicator_plugin_container_reinit_ui (MatekbdIndicatorPluginContainer * pc);
-
-extern guint
-matekbd_indicator_plugin_get_num_groups (MatekbdIndicatorPluginContainer * pc);
-
-extern gchar
- **
- matekbd_indicator_plugin_load_localized_group_names
- (MatekbdIndicatorPluginContainer * pc);
-
-#endif
diff --git a/libmatekbd/matekbd-indicator.c b/libmatekbd/matekbd-indicator.c
index a361c8d..5ca05e7 100644
--- a/libmatekbd/matekbd-indicator.c
+++ b/libmatekbd/matekbd-indicator.c
@@ -30,8 +30,6 @@
#include <matekbd-desktop-config.h>
#include <matekbd-indicator-config.h>
-#include <matekbd-indicator-plugin-manager.h>
-
typedef struct _gki_globals {
XklEngine *engine;
XklConfigRegistry *registry;
@@ -40,9 +38,6 @@ typedef struct _gki_globals {
MatekbdIndicatorConfig ind_cfg;
MatekbdKeyboardConfig kbd_cfg;
- MatekbdIndicatorPluginContainer plugin_container;
- MatekbdIndicatorPluginManager plugin_manager;
-
const gchar *tooltips_format;
gchar **full_group_names;
gchar **short_group_names;
@@ -206,7 +201,7 @@ matekbd_indicator_fill (MatekbdIndicator * gki)
GtkNotebook *notebook = GTK_NOTEBOOK (gki);
for (grp = 0; grp < total_groups; grp++) {
- GtkWidget *page, *decorated_page = NULL;
+ GtkWidget *page;
gchar *full_group_name =
(grp <
g_strv_length (globals.full_group_names)) ?
@@ -216,13 +211,6 @@ matekbd_indicator_fill (MatekbdIndicator * gki)
if (page == NULL)
page = gtk_label_new ("");
- decorated_page =
- matekbd_indicator_plugin_manager_decorate_widget
- (&globals.plugin_manager, page, grp,
- full_group_name, &globals.kbd_cfg);
-
- page = decorated_page == NULL ? page : decorated_page;
-
gtk_notebook_append_page (notebook, page, NULL);
gtk_widget_show_all (page);
}
@@ -316,9 +304,8 @@ matekbd_indicator_extract_layout_name (int group, XklEngine * engine,
if (group < g_strv_length (short_group_names)) {
if (xkl_engine_get_features (engine) &
XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
- char *full_layout_name = (char *)
- g_slist_nth_data (kbd_cfg->layouts_variants,
- group);
+ char *full_layout_name =
+ kbd_cfg->layouts_variants[group];
char *variant_name;
if (!matekbd_keyboard_config_split_items
(full_layout_name, &layout_name,
@@ -494,12 +481,13 @@ matekbd_indicator_reinit_ui (MatekbdIndicator * gki)
/* Should be called once for all widgets */
static void
-matekbd_indicator_cfg_changed (MateConfClient * client,
- guint cnxn_id, MateConfEntry * entry)
+matekbd_indicator_cfg_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
xkl_debug (100,
- "General configuration changed in MateConf - reiniting...\n");
- matekbd_desktop_config_load_from_mateconf (&globals.cfg);
+ "General configuration changed in GSettings - reiniting...\n");
+ matekbd_desktop_config_load_from_gsettings (&globals.cfg);
matekbd_desktop_config_activate (&globals.cfg);
ForAllIndicators () {
matekbd_indicator_reinit_ui (gki);
@@ -508,19 +496,16 @@ matekbd_indicator_cfg_changed (MateConfClient * client,
/* Should be called once for all widgets */
static void
-matekbd_indicator_ind_cfg_changed (MateConfClient * client,
- guint cnxn_id, MateConfEntry * entry)
+matekbd_indicator_ind_cfg_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
xkl_debug (100,
- "Applet configuration changed in MateConf - reiniting...\n");
- matekbd_indicator_config_load_from_mateconf (&globals.ind_cfg);
+ "Applet configuration changed in GSettings - reiniting...\n");
+ matekbd_indicator_config_load_from_gsettings (&globals.ind_cfg);
matekbd_indicator_update_images ();
matekbd_indicator_config_activate (&globals.ind_cfg);
- matekbd_indicator_plugin_manager_toggle_plugins
- (&globals.plugin_manager, &globals.plugin_container,
- globals.ind_cfg.enabled_plugins);
-
ForAllIndicators () {
matekbd_indicator_reinit_ui (gki);
} NextIndicator ();
@@ -596,9 +581,6 @@ matekbd_indicator_state_callback (XklEngine * engine,
if (changeType == GROUP_CHANGED) {
ForAllIndicators () {
- matekbd_indicator_plugin_manager_group_changed
- (&globals.plugin_manager, GTK_WIDGET (gki),
- group);
xkl_debug (200, "do repaint\n");
matekbd_indicator_set_current_page_for_group
(gki, group);
@@ -776,16 +758,10 @@ matekbd_indicator_global_term (void)
matekbd_desktop_config_stop_listen (&globals.cfg);
matekbd_indicator_config_stop_listen (&globals.ind_cfg);
- matekbd_indicator_plugin_manager_term_initialized_plugins
- (&globals.plugin_manager);
- matekbd_indicator_plugin_manager_term (&globals.plugin_manager);
-
matekbd_indicator_config_term (&globals.ind_cfg);
matekbd_keyboard_config_term (&globals.kbd_cfg);
matekbd_desktop_config_term (&globals.cfg);
- matekbd_indicator_plugin_container_term (&globals.plugin_container);
-
g_object_unref (G_OBJECT (globals.registry));
globals.registry = NULL;
g_object_unref (G_OBJECT (globals.engine));
@@ -823,7 +799,6 @@ matekbd_indicator_class_init (MatekbdIndicatorClass * klass)
static void
matekbd_indicator_global_init (void)
{
- MateConfClient *mateconf_client;
XklConfigRec *xklrec = xkl_config_rec_new ();
globals.engine = xkl_engine_get_instance(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
@@ -834,8 +809,6 @@ matekbd_indicator_global_init (void)
return;
}
- mateconf_client = mateconf_client_get_default ();
-
g_signal_connect (globals.engine, "X-state-changed",
G_CALLBACK (matekbd_indicator_state_callback),
NULL);
@@ -843,19 +816,11 @@ matekbd_indicator_global_init (void)
G_CALLBACK (matekbd_indicator_kbd_cfg_callback),
NULL);
- matekbd_indicator_plugin_container_init (&globals.plugin_container,
- mateconf_client);
-
- matekbd_desktop_config_init (&globals.cfg, mateconf_client,
- globals.engine);
- matekbd_keyboard_config_init (&globals.kbd_cfg, mateconf_client,
- globals.engine);
- matekbd_indicator_config_init (&globals.ind_cfg, mateconf_client,
- globals.engine);
-
- g_object_unref (mateconf_client);
+ matekbd_desktop_config_init (&globals.cfg, globals.engine);
+ matekbd_keyboard_config_init (&globals.kbd_cfg, globals.engine);
+ matekbd_indicator_config_init (&globals.ind_cfg, globals.engine);
- matekbd_desktop_config_load_from_mateconf (&globals.cfg);
+ matekbd_desktop_config_load_from_gsettings (&globals.cfg);
matekbd_desktop_config_activate (&globals.cfg);
globals.registry =
@@ -866,7 +831,7 @@ matekbd_indicator_global_init (void)
matekbd_keyboard_config_load_from_x_current (&globals.kbd_cfg,
xklrec);
- matekbd_indicator_config_load_from_mateconf (&globals.ind_cfg);
+ matekbd_indicator_config_load_from_gsettings (&globals.ind_cfg);
matekbd_indicator_update_images ();
matekbd_indicator_config_activate (&globals.ind_cfg);
@@ -875,16 +840,12 @@ matekbd_indicator_global_init (void)
xklrec->variants);
g_object_unref (G_OBJECT (xklrec));
- matekbd_indicator_plugin_manager_init (&globals.plugin_manager);
- matekbd_indicator_plugin_manager_init_enabled_plugins
- (&globals.plugin_manager, &globals.plugin_container,
- globals.ind_cfg.enabled_plugins);
matekbd_desktop_config_start_listen (&globals.cfg,
- (MateConfClientNotifyFunc)
+ (GCallback)
matekbd_indicator_cfg_changed,
NULL);
matekbd_indicator_config_start_listen (&globals.ind_cfg,
- (MateConfClientNotifyFunc)
+ (GCallback)
matekbd_indicator_ind_cfg_changed,
NULL);
matekbd_indicator_start_listen ();
@@ -961,19 +922,3 @@ matekbd_indicator_set_angle (MatekbdIndicator * gki, gdouble angle)
{
gki->priv->angle = angle;
}
-
-/* Plugin support */
-/* Preserve the plugin container functions during the linking */
-void
-matekbd_indicator_plugin_container_reinit_ui (MatekbdIndicatorPluginContainer *
- pc)
-{
- ForAllIndicators () {
- matekbd_indicator_reinit_ui (gki);
- } NextIndicator ();
-}
-
-gchar **matekbd_indicator_plugin_load_localized_group_names
- (MatekbdIndicatorPluginContainer * pc) {
- return globals.full_group_names;
-}
diff --git a/libmatekbd/matekbd-keyboard-config.c b/libmatekbd/matekbd-keyboard-config.c
index 8be2a37..9de35f4 100644
--- a/libmatekbd/matekbd-keyboard-config.c
+++ b/libmatekbd/matekbd-keyboard-config.c
@@ -24,26 +24,23 @@
#include <stdlib.h>
#include <X11/keysym.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <matekbd-keyboard-config.h>
#include <matekbd-config-private.h>
+#include <matekbd-util.h>
/**
* MatekbdKeyboardConfig
*/
-#define MATEKBD_KEYBOARD_CONFIG_KEY_PREFIX MATEKBD_CONFIG_KEY_PREFIX "/kbd"
+#define MATEKBD_KEYBOARD_CONFIG_SCHEMA MATEKBD_CONFIG_SCHEMA ".kbd"
#define GROUP_SWITCHERS_GROUP "grp"
#define DEFAULT_GROUP_SWITCH "grp:shift_caps_toggle"
-const gchar MATEKBD_KEYBOARD_CONFIG_DIR[] = MATEKBD_KEYBOARD_CONFIG_KEY_PREFIX;
-const gchar MATEKBD_KEYBOARD_CONFIG_KEY_MODEL[] =
- MATEKBD_KEYBOARD_CONFIG_KEY_PREFIX "/model";
-const gchar MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[] =
- MATEKBD_KEYBOARD_CONFIG_KEY_PREFIX "/layouts";
-const gchar MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS[] =
- MATEKBD_KEYBOARD_CONFIG_KEY_PREFIX "/options";
+const gchar MATEKBD_KEYBOARD_CONFIG_KEY_MODEL[] = "model";
+const gchar MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[] = "layouts";
+const gchar MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS[] = "options";
const gchar *MATEKBD_KEYBOARD_CONFIG_ACTIVE[] = {
MATEKBD_KEYBOARD_CONFIG_KEY_MODEL,
@@ -54,33 +51,30 @@ const gchar *MATEKBD_KEYBOARD_CONFIG_ACTIVE[] = {
/**
* static common functions
*/
-static void
-matekbd_keyboard_config_string_list_reset (GSList ** plist)
-{
- while (*plist != NULL) {
- GSList *p = *plist;
- *plist = (*plist)->next;
- g_free (p->data);
- g_slist_free_1 (p);
- }
-}
static gboolean
-gslist_str_equal (GSList * l1, GSList * l2)
+g_strv_equal (gchar ** l1, gchar ** l2)
{
if (l1 == l2)
return TRUE;
- while (l1 != NULL && l2 != NULL) {
- if ((l1->data != l2->data) &&
- (l1->data != NULL) &&
- (l2->data != NULL) &&
- g_ascii_strcasecmp (l1->data, l2->data))
- return False;
-
- l1 = l1->next;
- l2 = l2->next;
+ if (l1 == NULL)
+ return g_strv_length (l2) == 0;
+ if (l2 == NULL)
+ return g_strv_length (l1) == 0;
+
+ while ((*l1 != NULL) && (*l2 != NULL)) {
+ if (*l1 != *l2) {
+ if (*l1 && *l2) {
+ if (g_ascii_strcasecmp (*l1, *l2))
+ return FALSE;
+ } else
+ return FALSE;
+ }
+
+ l1++;
+ l2++;
}
- return (l1 == NULL && l2 == NULL);
+ return (*l1 == NULL) && (*l2 == NULL);
}
gboolean
@@ -188,64 +182,65 @@ matekbd_keyboard_config_split_items (const gchar * merged, gchar ** parent,
* static MatekbdKeyboardConfig functions
*/
static void
-matekbd_keyboard_config_options_add_full (MatekbdKeyboardConfig * kbd_config,
- const gchar * full_option_name)
-{
- kbd_config->options =
- g_slist_append (kbd_config->options,
- g_strdup (full_option_name));
-}
-
-static void
-matekbd_keyboard_config_layouts_add_full (MatekbdKeyboardConfig * kbd_config,
- const gchar * full_layout_name)
-{
- kbd_config->layouts_variants =
- g_slist_append (kbd_config->layouts_variants,
- g_strdup (full_layout_name));
-}
-
-static void
matekbd_keyboard_config_copy_from_xkl_config (MatekbdKeyboardConfig * kbd_config,
XklConfigRec * pdata)
{
char **p, **p1;
+ int i;
matekbd_keyboard_config_model_set (kbd_config, pdata->model);
xkl_debug (150, "Loaded Kbd model: [%s]\n", pdata->model);
- matekbd_keyboard_config_layouts_reset (kbd_config);
- p = pdata->layouts;
- p1 = pdata->variants;
- while (p != NULL && *p != NULL) {
- const gchar *full_layout =
- matekbd_keyboard_config_merge_items (*p, *p1);
- xkl_debug (150,
- "Loaded Kbd layout (with variant): [%s]\n",
- full_layout);
- matekbd_keyboard_config_layouts_add_full (kbd_config,
- full_layout);
- p++;
- p1++;
+ /* Layouts */
+ g_strfreev (kbd_config->layouts_variants);
+ kbd_config->layouts_variants = NULL;
+ if (pdata->layouts != NULL) {
+ p = pdata->layouts;
+ p1 = pdata->variants;
+ kbd_config->layouts_variants =
+ g_new0 (gchar *, g_strv_length (pdata->layouts) + 1);
+ i = 0;
+ while (*p != NULL) {
+ const gchar *full_layout =
+ matekbd_keyboard_config_merge_items (*p, *p1);
+ xkl_debug (150,
+ "Loaded Kbd layout (with variant): [%s]\n",
+ full_layout);
+ kbd_config->layouts_variants[i++] =
+ g_strdup (full_layout);
+ p++;
+ p1++;
+ }
}
- matekbd_keyboard_config_options_reset (kbd_config);
- p = pdata->options;
- while (p != NULL && *p != NULL) {
- char group[XKL_MAX_CI_NAME_LENGTH];
- char *option = *p;
- char *delim =
- (option != NULL) ? strchr (option, ':') : NULL;
- int len;
- if ((delim != NULL) &&
- ((len = (delim - option)) < XKL_MAX_CI_NAME_LENGTH)) {
- strncpy (group, option, len);
- group[len] = 0;
- xkl_debug (150, "Loaded Kbd option: [%s][%s]\n",
- group, option);
- matekbd_keyboard_config_options_add (kbd_config,
- group, option);
+ /* Options */
+ g_strfreev (kbd_config->options);
+ kbd_config->options = NULL;
+
+ if (pdata->options != NULL) {
+ p = pdata->options;
+ kbd_config->options =
+ g_new0 (gchar *, g_strv_length (pdata->options) + 1);
+ i = 0;
+ while (*p != NULL) {
+ char group[XKL_MAX_CI_NAME_LENGTH];
+ char *option = *p;
+ char *delim =
+ (option != NULL) ? strchr (option, ':') : NULL;
+ int len;
+ if ((delim != NULL) &&
+ ((len =
+ (delim - option)) <
+ XKL_MAX_CI_NAME_LENGTH)) {
+ strncpy (group, option, len);
+ group[len] = 0;
+ xkl_debug (150,
+ "Loaded Kbd option: [%s][%s]\n",
+ group, option);
+ matekbd_keyboard_config_options_set
+ (kbd_config, i++, group, option);
+ }
+ p++;
}
- p++;
}
}
@@ -261,14 +256,14 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
num_layouts =
(kbd_config->layouts_variants ==
- NULL) ? 0 : g_slist_length (kbd_config->layouts_variants);
+ NULL) ? 0 : g_strv_length (kbd_config->layouts_variants);
num_options =
(kbd_config->options ==
- NULL) ? 0 : g_slist_length (kbd_config->options);
+ NULL) ? 0 : g_strv_length (kbd_config->options);
xkl_debug (150, "Taking %d layouts\n", num_layouts);
if (num_layouts != 0) {
- GSList *the_layout_variant = kbd_config->layouts_variants;
+ gchar **the_layout_variant = kbd_config->layouts_variants;
char **p1 = pdata->layouts =
g_new0 (char *, num_layouts + 1);
char **p2 = pdata->variants =
@@ -276,7 +271,7 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
for (i = num_layouts; --i >= 0;) {
char *layout, *variant;
if (matekbd_keyboard_config_split_items
- (the_layout_variant->data, &layout, &variant)
+ (*the_layout_variant, &layout, &variant)
&& variant != NULL) {
*p1 =
(layout ==
@@ -288,9 +283,9 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
g_strdup (variant);
} else {
*p1 =
- (the_layout_variant->data ==
+ (*the_layout_variant ==
NULL) ? g_strdup ("") :
- g_strdup (the_layout_variant->data);
+ g_strdup (*the_layout_variant);
*p2 = g_strdup ("");
}
xkl_debug (150, "Adding [%s]/%p and [%s]/%p\n",
@@ -298,26 +293,26 @@ matekbd_keyboard_config_copy_to_xkl_config (MatekbdKeyboardConfig * kbd_config,
*p2 ? *p2 : "(nil)", *p2);
p1++;
p2++;
- the_layout_variant = the_layout_variant->next;
+ the_layout_variant++;
}
}
if (num_options != 0) {
- GSList *the_option = kbd_config->options;
+ gchar **the_option = kbd_config->options;
char **p = pdata->options =
g_new0 (char *, num_options + 1);
for (i = num_options; --i >= 0;) {
char *group, *option;
if (matekbd_keyboard_config_split_items
- (the_option->data, &group, &option)
+ (*the_option, &group, &option)
&& option != NULL)
*(p++) = g_strdup (option);
else {
*(p++) = g_strdup ("");
xkl_debug (150, "Could not split [%s]\n",
- the_option->data);
+ *the_option);
}
- the_option = the_option->next;
+ the_option++;
}
}
}
@@ -326,20 +321,10 @@ static void
matekbd_keyboard_config_load_params (MatekbdKeyboardConfig * kbd_config,
const gchar * param_names[])
{
- GError *gerror = NULL;
gchar *pc;
- GSList *pl, *l;
-
- pc = mateconf_client_get_string (kbd_config->conf_client,
- param_names[0], &gerror);
- if (pc == NULL || gerror != NULL) {
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- g_error_free (gerror);
- g_free (pc);
- gerror = NULL;
- }
+
+ pc = g_settings_get_string (kbd_config->settings, param_names[0]);
+ if (pc == NULL) {
matekbd_keyboard_config_model_set (kbd_config, NULL);
} else {
matekbd_keyboard_config_model_set (kbd_config, pc);
@@ -348,97 +333,73 @@ matekbd_keyboard_config_load_params (MatekbdKeyboardConfig * kbd_config,
xkl_debug (150, "Loaded Kbd model: [%s]\n",
kbd_config->model ? kbd_config->model : "(null)");
- matekbd_keyboard_config_layouts_reset (kbd_config);
-
- l = pl = mateconf_client_get_list (kbd_config->conf_client,
- param_names[1],
- MATECONF_VALUE_STRING, &gerror);
- if (pl == NULL || gerror != NULL) {
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
- }
+ g_strfreev (kbd_config->layouts_variants);
- while (l != NULL) {
- xkl_debug (150, "Loaded Kbd layout: [%s]\n", l->data);
- matekbd_keyboard_config_layouts_add_full (kbd_config,
- l->data);
- l = l->next;
- }
- matekbd_keyboard_config_string_list_reset (&pl);
-
- matekbd_keyboard_config_options_reset (kbd_config);
-
- l = pl = mateconf_client_get_list (kbd_config->conf_client,
- param_names[2],
- MATECONF_VALUE_STRING, &gerror);
- if (pl == NULL || gerror != NULL) {
- if (gerror != NULL) {
- g_warning ("Error reading configuration:%s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
+ kbd_config->layouts_variants =
+ g_settings_get_strv (kbd_config->settings, param_names[1]);
+
+ if (kbd_config->layouts_variants != NULL
+ && kbd_config->layouts_variants[0] == NULL) {
+ g_strfreev (kbd_config->layouts_variants);
+ kbd_config->layouts_variants = NULL;
}
- while (l != NULL) {
- xkl_debug (150, "Loaded Kbd option: [%s]\n", l->data);
- matekbd_keyboard_config_options_add_full (kbd_config,
- (const gchar *)
- l->data);
- l = l->next;
+ g_strfreev (kbd_config->options);
+
+ kbd_config->options =
+ g_settings_get_strv (kbd_config->settings, param_names[2]);
+
+ if (kbd_config->options != NULL && kbd_config->options[0] == NULL) {
+ g_strfreev (kbd_config->options);
+ kbd_config->options = NULL;
}
- matekbd_keyboard_config_string_list_reset (&pl);
}
static void
matekbd_keyboard_config_save_params (MatekbdKeyboardConfig * kbd_config,
- MateConfChangeSet * cs,
const gchar * param_names[])
{
- GSList *pl;
+ gchar **pl;
if (kbd_config->model)
- mateconf_change_set_set_string (cs, param_names[0],
- kbd_config->model);
+ g_settings_set_string (kbd_config->settings, param_names[0],
+ kbd_config->model);
else
- mateconf_change_set_unset (cs, param_names[0]);
+ g_settings_set_string (kbd_config->settings, param_names[0],
+ NULL);
xkl_debug (150, "Saved Kbd model: [%s]\n",
kbd_config->model ? kbd_config->model : "(null)");
if (kbd_config->layouts_variants) {
pl = kbd_config->layouts_variants;
- while (pl != NULL) {
- xkl_debug (150, "Saved Kbd layout: [%s]\n",
- pl->data);
- pl = pl->next;
+ while (*pl != NULL) {
+ xkl_debug (150, "Saved Kbd layout: [%s]\n", *pl);
+ pl++;
}
- mateconf_change_set_set_list (cs,
- param_names[1],
- MATECONF_VALUE_STRING,
- kbd_config->layouts_variants);
+ g_settings_set_strv (kbd_config->settings,
+ param_names[1],
+ (const gchar * const *)
+ kbd_config->layouts_variants);
} else {
xkl_debug (150, "Saved Kbd layouts: []\n");
- mateconf_change_set_unset (cs, param_names[1]);
+ g_settings_set_strv (kbd_config->settings,
+ param_names[1], NULL);
}
if (kbd_config->options) {
pl = kbd_config->options;
- while (pl != NULL) {
- xkl_debug (150, "Saved Kbd option: [%s]\n",
- pl->data);
- pl = pl->next;
+ while (*pl != NULL) {
+ xkl_debug (150, "Saved Kbd option: [%s]\n", *pl);
+ pl++;
}
- mateconf_change_set_set_list (cs,
- param_names[2],
- MATECONF_VALUE_STRING,
- kbd_config->options);
+ g_settings_set_strv (kbd_config->settings,
+ param_names[2],
+ (const gchar *
+ const *) kbd_config->options);
} else {
xkl_debug (150, "Saved Kbd options: []\n");
- mateconf_change_set_unset (cs, param_names[2]);
+ g_settings_set_strv (kbd_config->settings,
+ param_names[2], NULL);
}
}
@@ -447,23 +408,11 @@ matekbd_keyboard_config_save_params (MatekbdKeyboardConfig * kbd_config,
*/
void
matekbd_keyboard_config_init (MatekbdKeyboardConfig * kbd_config,
- MateConfClient * conf_client, XklEngine * engine)
+ XklEngine * engine)
{
- GError *gerror = NULL;
-
memset (kbd_config, 0, sizeof (*kbd_config));
- kbd_config->conf_client = conf_client;
+ kbd_config->settings = g_settings_new (MATEKBD_KEYBOARD_CONFIG_SCHEMA);
kbd_config->engine = engine;
- g_object_ref (kbd_config->conf_client);
-
- mateconf_client_add_dir (kbd_config->conf_client,
- MATEKBD_KEYBOARD_CONFIG_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, &gerror);
- if (gerror != NULL) {
- g_warning ("err: %s\n", gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
}
void
@@ -471,15 +420,17 @@ matekbd_keyboard_config_term (MatekbdKeyboardConfig * kbd_config)
{
matekbd_keyboard_config_model_set (kbd_config, NULL);
- matekbd_keyboard_config_layouts_reset (kbd_config);
- matekbd_keyboard_config_options_reset (kbd_config);
+ g_strfreev (kbd_config->layouts_variants);
+ kbd_config->layouts_variants = NULL;
+ g_strfreev (kbd_config->options);
+ kbd_config->options = NULL;
- g_object_unref (kbd_config->conf_client);
- kbd_config->conf_client = NULL;
+ g_object_unref (kbd_config->settings);
+ kbd_config->settings = NULL;
}
void
-matekbd_keyboard_config_load_from_mateconf (MatekbdKeyboardConfig * kbd_config,
+matekbd_keyboard_config_load_from_gsettings (MatekbdKeyboardConfig * kbd_config,
MatekbdKeyboardConfig *
kbd_config_default)
{
@@ -487,31 +438,20 @@ matekbd_keyboard_config_load_from_mateconf (MatekbdKeyboardConfig * kbd_config,
MATEKBD_KEYBOARD_CONFIG_ACTIVE);
if (kbd_config_default != NULL) {
- GSList *pl;
if (kbd_config->model == NULL)
kbd_config->model =
g_strdup (kbd_config_default->model);
if (kbd_config->layouts_variants == NULL) {
- pl = kbd_config_default->layouts_variants;
- while (pl != NULL) {
- kbd_config->layouts_variants =
- g_slist_append
- (kbd_config->layouts_variants,
- g_strdup (pl->data));
- pl = pl->next;
- }
+ kbd_config->layouts_variants =
+ g_strdupv
+ (kbd_config_default->layouts_variants);
}
if (kbd_config->options == NULL) {
- pl = kbd_config_default->options;
- while (pl != NULL) {
- kbd_config->options =
- g_slist_append (kbd_config->options,
- g_strdup (pl->data));
- pl = pl->next;
- }
+ kbd_config->options =
+ g_strdupv (kbd_config_default->options);
}
}
}
@@ -554,6 +494,56 @@ matekbd_keyboard_config_load_from_x_initial (MatekbdKeyboardConfig * kbd_config,
g_object_unref (G_OBJECT (data));
}
+static gboolean
+matekbd_keyboard_config_options_equals (MatekbdKeyboardConfig * kbd_config1,
+ MatekbdKeyboardConfig * kbd_config2)
+{
+ int num_options, num_options2;
+
+ num_options =
+ (kbd_config1->options ==
+ NULL) ? 0 : g_strv_length (kbd_config1->options);
+ num_options2 =
+ (kbd_config2->options ==
+ NULL) ? 0 : g_strv_length (kbd_config2->options);
+
+ if (num_options != num_options2)
+ return False;
+
+ if (num_options != 0) {
+ int i;
+ char *group1, *option1;
+
+ for (i = 0; i < num_options; i++) {
+ int j;
+ char *group2, *option2;
+ gboolean are_equal = FALSE;
+
+ if (!matekbd_keyboard_config_split_items
+ (kbd_config1->options[i], &group1, &option1))
+ continue;
+
+ option1 = g_strdup (option1);
+
+ for (j = 0; j < num_options && !are_equal; j++) {
+ if (matekbd_keyboard_config_split_items
+ (kbd_config2->options[j], &group2,
+ &option2)) {
+ are_equal =
+ strcmp (option1, option2) == 0;
+ }
+ }
+
+ g_free (option1);
+
+ if (!are_equal)
+ return False;
+ }
+ }
+
+ return True;
+}
+
gboolean
matekbd_keyboard_config_equals (MatekbdKeyboardConfig * kbd_config1,
MatekbdKeyboardConfig * kbd_config2)
@@ -565,32 +555,26 @@ matekbd_keyboard_config_equals (MatekbdKeyboardConfig * kbd_config1,
(kbd_config2->model != NULL) &&
g_ascii_strcasecmp (kbd_config1->model, kbd_config2->model))
return False;
- return gslist_str_equal (kbd_config1->layouts_variants,
- kbd_config2->layouts_variants)
- && gslist_str_equal (kbd_config1->options,
- kbd_config2->options);
+ if (!g_strv_equal (kbd_config1->layouts_variants,
+ kbd_config2->layouts_variants))
+ return False;
+
+ if (!matekbd_keyboard_config_options_equals
+ (kbd_config1, kbd_config2))
+ return False;
+
+ return True;
}
void
-matekbd_keyboard_config_save_to_mateconf (MatekbdKeyboardConfig * kbd_config)
+matekbd_keyboard_config_save_to_gsettings (MatekbdKeyboardConfig * kbd_config)
{
- MateConfChangeSet *cs;
- GError *gerror = NULL;
+ g_settings_delay (kbd_config->settings);
- cs = mateconf_change_set_new ();
+ matekbd_keyboard_config_save_params (kbd_config,
+ MATEKBD_KEYBOARD_CONFIG_ACTIVE);
- matekbd_keyboard_config_save_params (kbd_config, cs,
- MATEKBD_KEYBOARD_CONFIG_ACTIVE);
-
- mateconf_client_commit_change_set (kbd_config->conf_client, cs, TRUE,
- &gerror);
- if (gerror != NULL) {
- g_warning ("Error saving active configuration: %s\n",
- gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
- mateconf_change_set_unref (cs);
+ g_settings_apply (kbd_config->settings);
}
void
@@ -605,35 +589,8 @@ matekbd_keyboard_config_model_set (MatekbdKeyboardConfig * kbd_config,
}
void
-matekbd_keyboard_config_layouts_add (MatekbdKeyboardConfig * kbd_config,
- const gchar * layout_name,
- const gchar * variant_name)
-{
- const gchar *merged;
- if (layout_name == NULL)
- return;
- merged =
- matekbd_keyboard_config_merge_items (layout_name, variant_name);
- if (merged == NULL)
- return;
- matekbd_keyboard_config_layouts_add_full (kbd_config, merged);
-}
-
-void
-matekbd_keyboard_config_layouts_reset (MatekbdKeyboardConfig * kbd_config)
-{
- matekbd_keyboard_config_string_list_reset
- (&kbd_config->layouts_variants);
-}
-
-void
-matekbd_keyboard_config_options_reset (MatekbdKeyboardConfig * kbd_config)
-{
- matekbd_keyboard_config_string_list_reset (&kbd_config->options);
-}
-
-void
-matekbd_keyboard_config_options_add (MatekbdKeyboardConfig * kbd_config,
+matekbd_keyboard_config_options_set (MatekbdKeyboardConfig * kbd_config,
+ gint idx,
const gchar * group_name,
const gchar * option_name)
{
@@ -644,7 +601,7 @@ matekbd_keyboard_config_options_add (MatekbdKeyboardConfig * kbd_config,
matekbd_keyboard_config_merge_items (group_name, option_name);
if (merged == NULL)
return;
- matekbd_keyboard_config_options_add_full (kbd_config, merged);
+ kbd_config->options[idx] = g_strdup (merged);
}
gboolean
@@ -652,14 +609,17 @@ matekbd_keyboard_config_options_is_set (MatekbdKeyboardConfig * kbd_config,
const gchar * group_name,
const gchar * option_name)
{
+ gchar **p = kbd_config->options;
const gchar *merged =
matekbd_keyboard_config_merge_items (group_name, option_name);
if (merged == NULL)
return FALSE;
- return NULL != g_slist_find_custom (kbd_config->options, (gpointer)
- merged, (GCompareFunc)
- g_ascii_strcasecmp);
+ while (p && *p) {
+ if (!g_ascii_strcasecmp (merged, *p++))
+ return TRUE;
+ }
+ return FALSE;
}
gboolean
@@ -677,21 +637,20 @@ matekbd_keyboard_config_activate (MatekbdKeyboardConfig * kbd_config)
void
matekbd_keyboard_config_start_listen (MatekbdKeyboardConfig * kbd_config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data)
{
- matekbd_desktop_config_add_listener (kbd_config->conf_client,
- MATEKBD_KEYBOARD_CONFIG_DIR, func,
- user_data,
- &kbd_config->config_listener_id);
+ kbd_config->config_listener_id =
+ g_signal_connect (kbd_config->settings, "changed", func,
+ user_data);
}
void
matekbd_keyboard_config_stop_listen (MatekbdKeyboardConfig * kbd_config)
{
- matekbd_desktop_config_remove_listener (kbd_config->conf_client,
- &kbd_config->
- config_listener_id);
+ g_signal_handler_disconnect (kbd_config->settings,
+ kbd_config->config_listener_id);
+ kbd_config->config_listener_id = 0;
}
gboolean
@@ -735,19 +694,18 @@ matekbd_keyboard_config_to_string (const MatekbdKeyboardConfig * config)
gchar *layouts = NULL, *options = NULL;
GString *buffer = g_string_new (NULL);
- GSList *iter;
+ gchar **iter;
gint count;
gchar *result;
if (config->layouts_variants) {
/* g_slist_length is "expensive", so we determinate the length on the fly */
- for (iter = config->layouts_variants, count = 0; iter;
- iter = iter->next, ++count) {
+ for (iter = config->layouts_variants, count = 0; *iter;
+ iter++, ++count) {
if (buffer->len)
g_string_append (buffer, " ");
- g_string_append (buffer,
- (const gchar *) iter->data);
+ g_string_append (buffer, *iter);
}
/* Translators: The count is related to the number of options. The %s
@@ -760,13 +718,12 @@ matekbd_keyboard_config_to_string (const MatekbdKeyboardConfig * config)
}
if (config->options) {
/* g_slist_length is "expensive", so we determinate the length on the fly */
- for (iter = config->options, count = 0; iter;
- iter = iter->next, ++count) {
+ for (iter = config->options, count = 0; *iter;
+ iter++, ++count) {
if (buffer->len)
g_string_append (buffer, " ");
- g_string_append (buffer,
- (const gchar *) iter->data);
+ g_string_append (buffer, *iter);
}
/* Translators: The count is related to the number of options. The %s
@@ -791,27 +748,35 @@ matekbd_keyboard_config_to_string (const MatekbdKeyboardConfig * config)
return result;
}
-GSList *
-matekbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
- layouts_list,
- GSList *
- options_list, gboolean *was_appended)
+/**
+ * matekbd_keyboard_config_add_default_switch_option_if_necessary:
+ *
+ * Returns: (transfer full) (array zero-terminated=1): List of options
+ */
+gchar **
+matekbd_keyboard_config_add_default_switch_option_if_necessary (gchar **
+ layouts_list,
+ gchar **
+ options_list,
+ gboolean *was_appended)
{
*was_appended = FALSE;
- if (g_slist_length (layouts_list) >= 2) {
+ if (g_strv_length (layouts_list) >= 2) {
gboolean any_switcher = False;
- GSList *option = options_list;
- while (option != NULL) {
- char *g, *o;
- if (matekbd_keyboard_config_split_items
- (option->data, &g, &o)) {
- if (!g_ascii_strcasecmp
- (g, GROUP_SWITCHERS_GROUP)) {
- any_switcher = True;
- break;
+ if (*options_list != NULL) {
+ gchar **option = options_list;
+ while (*option != NULL) {
+ char *g, *o;
+ if (matekbd_keyboard_config_split_items
+ (*option, &g, &o)) {
+ if (!g_ascii_strcasecmp
+ (g, GROUP_SWITCHERS_GROUP)) {
+ any_switcher = True;
+ break;
+ }
}
+ option++;
}
- option = option->next;
}
if (!any_switcher) {
const gchar *id =
@@ -819,7 +784,7 @@ matekbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
(GROUP_SWITCHERS_GROUP,
DEFAULT_GROUP_SWITCH);
options_list =
- g_slist_append (options_list, g_strdup (id));
+ matekbd_strv_append (options_list, g_strdup (id));
*was_appended = TRUE;
}
}
diff --git a/libmatekbd/matekbd-keyboard-config.h b/libmatekbd/matekbd-keyboard-config.h
index db5bf76..73e1078 100644
--- a/libmatekbd/matekbd-keyboard-config.h
+++ b/libmatekbd/matekbd-keyboard-config.h
@@ -22,10 +22,9 @@
#include <X11/Xlib.h>
#include <glib.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libxklavier/xklavier.h>
-extern const gchar MATEKBD_KEYBOARD_CONFIG_DIR[];
extern const gchar MATEKBD_KEYBOARD_CONFIG_KEY_MODEL[];
extern const gchar MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[];
extern const gchar MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS[];
@@ -35,11 +34,11 @@ extern const gchar MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS[];
*/
typedef struct _MatekbdKeyboardConfig {
gchar *model;
- GSList *layouts_variants;
- GSList *options;
+ gchar **layouts_variants;
+ gchar **options;
/* private, transient */
- MateConfClient *conf_client;
+ GSettings *settings;
int config_listener_id;
XklEngine *engine;
} MatekbdKeyboardConfig;
@@ -48,16 +47,15 @@ typedef struct _MatekbdKeyboardConfig {
* MatekbdKeyboardConfig functions
*/
extern void matekbd_keyboard_config_init (MatekbdKeyboardConfig * kbd_config,
- MateConfClient * conf_client,
XklEngine * engine);
extern void matekbd_keyboard_config_term (MatekbdKeyboardConfig * kbd_config);
-extern void matekbd_keyboard_config_load_from_mateconf (MatekbdKeyboardConfig *
+extern void matekbd_keyboard_config_load_from_gsettings (MatekbdKeyboardConfig *
kbd_config,
MatekbdKeyboardConfig *
kbd_config_default);
-extern void matekbd_keyboard_config_save_to_mateconf (MatekbdKeyboardConfig *
+extern void matekbd_keyboard_config_save_to_gsettings (MatekbdKeyboardConfig *
kbd_config);
extern void matekbd_keyboard_config_load_from_x_initial (MatekbdKeyboardConfig *
@@ -70,7 +68,7 @@ extern void matekbd_keyboard_config_load_from_x_current (MatekbdKeyboardConfig *
extern void matekbd_keyboard_config_start_listen (MatekbdKeyboardConfig *
kbd_config,
- MateConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void matekbd_keyboard_config_stop_listen (MatekbdKeyboardConfig *
@@ -112,10 +110,10 @@ extern const gchar *matekbd_keyboard_config_format_full_layout (const gchar
extern gchar *matekbd_keyboard_config_to_string (const MatekbdKeyboardConfig *
config);
-extern GSList
- *matekbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
+extern gchar
+ **matekbd_keyboard_config_add_default_switch_option_if_necessary (gchar **
layouts_list,
- GSList *
+ gchar **
options_list,
gboolean
*
diff --git a/libmatekbd/matekbd-status.c b/libmatekbd/matekbd-status.c
index 6b55828..a37332c 100644
--- a/libmatekbd/matekbd-status.c
+++ b/libmatekbd/matekbd-status.c
@@ -420,12 +420,13 @@ matekbd_status_reinit_ui (MatekbdStatus * gki)
/* Should be called once for all widgets */
static void
-matekbd_status_cfg_changed (MateConfClient * client,
- guint cnxn_id, MateConfEntry * entry)
+matekbd_status_cfg_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
xkl_debug (100,
- "General configuration changed in MateConf - reiniting...\n");
- matekbd_desktop_config_load_from_mateconf (&globals.cfg);
+ "General configuration changed in settings - reiniting...\n");
+ matekbd_desktop_config_load_from_gsettings (&globals.cfg);
matekbd_desktop_config_activate (&globals.cfg);
ForAllIndicators () {
matekbd_status_reinit_ui (gki);
@@ -434,12 +435,13 @@ matekbd_status_cfg_changed (MateConfClient * client,
/* Should be called once for all widgets */
static void
-matekbd_status_ind_cfg_changed (MateConfClient * client,
- guint cnxn_id, MateConfEntry * entry)
+matekbd_status_ind_cfg_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
xkl_debug (100,
- "Applet configuration changed in MateConf - reiniting...\n");
- matekbd_indicator_config_load_from_mateconf (&globals.ind_cfg);
+ "Applet configuration changed in settings - reiniting...\n");
+ matekbd_indicator_config_load_from_gsettings (&globals.ind_cfg);
matekbd_indicator_config_free_image_filenames (&globals.ind_cfg);
matekbd_indicator_config_load_image_filenames (&globals.ind_cfg,
@@ -768,7 +770,6 @@ matekbd_status_class_init (MatekbdStatusClass * klass)
static void
matekbd_status_global_init (void)
{
- MateConfClient *mateconf_client;
XklConfigRec *xklrec = xkl_config_rec_new ();
globals.engine = xkl_engine_get_instance(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
@@ -778,8 +779,6 @@ matekbd_status_global_init (void)
return;
}
- mateconf_client = mateconf_client_get_default ();
-
globals.state_changed_handler =
g_signal_connect (globals.engine, "X-state-changed",
G_CALLBACK (matekbd_status_state_callback),
@@ -789,16 +788,11 @@ matekbd_status_global_init (void)
G_CALLBACK (matekbd_status_kbd_cfg_callback),
NULL);
- matekbd_desktop_config_init (&globals.cfg, mateconf_client,
- globals.engine);
- matekbd_keyboard_config_init (&globals.kbd_cfg, mateconf_client,
- globals.engine);
- matekbd_indicator_config_init (&globals.ind_cfg, mateconf_client,
- globals.engine);
-
- g_object_unref (mateconf_client);
+ matekbd_desktop_config_init (&globals.cfg, globals.engine);
+ matekbd_keyboard_config_init (&globals.kbd_cfg, globals.engine);
+ matekbd_indicator_config_init (&globals.ind_cfg, globals.engine);
- matekbd_desktop_config_load_from_mateconf (&globals.cfg);
+ matekbd_desktop_config_load_from_gsettings (&globals.cfg);
matekbd_desktop_config_activate (&globals.cfg);
globals.registry =
@@ -809,7 +803,7 @@ matekbd_status_global_init (void)
matekbd_keyboard_config_load_from_x_current (&globals.kbd_cfg,
xklrec);
- matekbd_indicator_config_load_from_mateconf (&globals.ind_cfg);
+ matekbd_indicator_config_load_from_gsettings (&globals.ind_cfg);
matekbd_indicator_config_load_image_filenames (&globals.ind_cfg,
&globals.kbd_cfg);
@@ -821,10 +815,10 @@ matekbd_status_global_init (void)
g_object_unref (G_OBJECT (xklrec));
matekbd_desktop_config_start_listen (&globals.cfg,
- (MateConfClientNotifyFunc)
+ (GCallback)
matekbd_status_cfg_changed, NULL);
matekbd_indicator_config_start_listen (&globals.ind_cfg,
- (MateConfClientNotifyFunc)
+ (GCallback)
matekbd_status_ind_cfg_changed,
NULL);
matekbd_status_start_listen ();
diff --git a/libmatekbd/matekbd-util.c b/libmatekbd/matekbd-util.c
index e52ee5c..50e1b36 100644
--- a/libmatekbd/matekbd-util.c
+++ b/libmatekbd/matekbd-util.c
@@ -27,7 +27,7 @@
#include <libxklavier/xklavier.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <matekbd-config-private.h>
@@ -47,70 +47,26 @@ matekbd_install_glib_log_appender (void)
xkl_set_log_appender (matekbd_log_appender);
}
-#define MATEKBD_PREVIEW_CONFIG_KEY_PREFIX MATEKBD_CONFIG_KEY_PREFIX "/preview"
+#define MATEKBD_PREVIEW_CONFIG_SCHEMA MATEKBD_CONFIG_SCHEMA ".preview"
-const gchar MATEKBD_PREVIEW_CONFIG_DIR[] = MATEKBD_PREVIEW_CONFIG_KEY_PREFIX;
-const gchar MATEKBD_PREVIEW_CONFIG_KEY_X[] =
- MATEKBD_PREVIEW_CONFIG_KEY_PREFIX "/x";
-const gchar MATEKBD_PREVIEW_CONFIG_KEY_Y[] =
- MATEKBD_PREVIEW_CONFIG_KEY_PREFIX "/y";
-const gchar MATEKBD_PREVIEW_CONFIG_KEY_WIDTH[] =
- MATEKBD_PREVIEW_CONFIG_KEY_PREFIX "/width";
-const gchar MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT[] =
- MATEKBD_PREVIEW_CONFIG_KEY_PREFIX "/height";
+const gchar MATEKBD_PREVIEW_CONFIG_KEY_X[] = "x";
+const gchar MATEKBD_PREVIEW_CONFIG_KEY_Y[] = "y";
+const gchar MATEKBD_PREVIEW_CONFIG_KEY_WIDTH[] = "width";
+const gchar MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT[] = "height";
GdkRectangle *
matekbd_preview_load_position (void)
{
- GError *gerror = NULL;
GdkRectangle *rv = NULL;
gint x, y, w, h;
- MateConfClient *conf_client = mateconf_client_get_default ();
-
- if (conf_client == NULL)
- return NULL;
-
- x = mateconf_client_get_int (conf_client,
- MATEKBD_PREVIEW_CONFIG_KEY_X, &gerror);
- if (gerror != NULL) {
- xkl_debug (0, "Error getting the preview x: %s\n",
- gerror->message);
- g_error_free (gerror);
- g_object_unref (G_OBJECT (conf_client));
- return NULL;
- }
-
- y = mateconf_client_get_int (conf_client,
- MATEKBD_PREVIEW_CONFIG_KEY_Y, &gerror);
- if (gerror != NULL) {
- xkl_debug (0, "Error getting the preview y: %s\n",
- gerror->message);
- g_error_free (gerror);
- g_object_unref (G_OBJECT (conf_client));
- return NULL;
- }
-
- w = mateconf_client_get_int (conf_client,
- MATEKBD_PREVIEW_CONFIG_KEY_WIDTH, &gerror);
- if (gerror != NULL) {
- xkl_debug (0, "Error getting the preview width: %s\n",
- gerror->message);
- g_error_free (gerror);
- g_object_unref (G_OBJECT (conf_client));
- return NULL;
- }
+ GSettings* settings = g_settings_new (MATEKBD_PREVIEW_CONFIG_SCHEMA);
- h = mateconf_client_get_int (conf_client,
- MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT, &gerror);
- if (gerror != NULL) {
- xkl_debug (0, "Error getting the preview height: %s\n",
- gerror->message);
- g_error_free (gerror);
- g_object_unref (G_OBJECT (conf_client));
- return NULL;
- }
+ x = g_settings_get_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_X);
+ y = g_settings_get_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_Y);
+ w = g_settings_get_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_WIDTH);
+ h = g_settings_get_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT);
- g_object_unref (G_OBJECT (conf_client));
+ g_object_unref (settings);
rv = g_new (GdkRectangle, 1);
if (x == -1 || y == -1 || w == -1 || h == -1) {
@@ -135,25 +91,35 @@ matekbd_preview_load_position (void)
void
matekbd_preview_save_position (GdkRectangle * rect)
{
- MateConfClient *conf_client = mateconf_client_get_default ();
- MateConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = mateconf_change_set_new ();
-
- mateconf_change_set_set_int (cs, MATEKBD_PREVIEW_CONFIG_KEY_X, rect->x);
- mateconf_change_set_set_int (cs, MATEKBD_PREVIEW_CONFIG_KEY_Y, rect->y);
- mateconf_change_set_set_int (cs, MATEKBD_PREVIEW_CONFIG_KEY_WIDTH,
- rect->width);
- mateconf_change_set_set_int (cs, MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT,
- rect->height);
-
- mateconf_client_commit_change_set (conf_client, cs, TRUE, &gerror);
- if (gerror != NULL) {
- g_warning ("Error saving preview configuration: %s\n",
- gerror->message);
- g_error_free (gerror);
+ GSettings* settings = g_settings_new (MATEKBD_PREVIEW_CONFIG_SCHEMA);
+
+ g_settings_delay (settings);
+
+ g_settings_set_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_X, rect->x);
+ g_settings_set_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_Y, rect->y);
+ g_settings_set_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_WIDTH, rect->width);
+ g_settings_set_int (settings, MATEKBD_PREVIEW_CONFIG_KEY_HEIGHT, rect->height);
+
+ g_settings_apply (settings);
+
+ g_object_unref (settings);
+}
+
+/**
+ * matekbd_strv_append:
+ *
+ * Returns: (transfer full) (array zero-terminated=1): Append string to strv array
+ */
+gchar **
+matekbd_strv_append (gchar ** arr, gchar * element)
+{
+ gint old_length = (arr == NULL) ? 0 : g_strv_length (arr);
+ gchar **new_arr = g_new0 (gchar *, old_length + 2);
+ if (arr != NULL) {
+ memcpy (new_arr, arr, old_length * sizeof (gchar *));
+ g_free (arr);
}
- mateconf_change_set_unref (cs);
- g_object_unref (G_OBJECT (conf_client));
+ new_arr[old_length] = element;
+ return new_arr;
}
+
diff --git a/libmatekbd/matekbd-util.h b/libmatekbd/matekbd-util.h
index 68d534d..bb379d0 100644
--- a/libmatekbd/matekbd-util.h
+++ b/libmatekbd/matekbd-util.h
@@ -29,5 +29,8 @@ extern GdkRectangle *matekbd_preview_load_position (void);
extern void matekbd_preview_save_position (GdkRectangle * rect);
+/* Missing in glib */
+extern gchar **matekbd_strv_append (gchar ** arr, gchar * element);
+
#endif
diff --git a/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml b/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml
new file mode 100644
index 0000000..7d89db2
--- /dev/null
+++ b/libmatekbd/org.mate.peripherals-keyboard-xkb.gschema.xml
@@ -0,0 +1,119 @@
+<schemalist>
+ <schema id="org.mate.peripherals-keyboard-xkb" path="/desktop/mate/peripherals/keyboard/">
+ <child name="kbd" schema="org.mate.peripherals-keyboard-xkb.kbd"/>
+ <child name="general" schema="org.mate.peripherals-keyboard-xkb.general"/>
+ <child name="preview" schema="org.mate.peripherals-keyboard-xkb.preview"/>
+ <child name="indicator" schema="org.mate.peripherals-keyboard-xkb.indicator"/>
+ </schema>
+ <schema id="org.mate.peripherals-keyboard-xkb.kbd" path="/desktop/mate/peripherals/keyboard/kbd/">
+ <key name="model" type="s">
+ <default>''</default>
+ <summary>Keyboard model</summary>
+ <description>keyboard model</description>
+ </key>
+ <key name="layouts" type="as">
+ <default>[]</default>
+ <summary>Keyboard layout</summary>
+ <description>keyboard layout</description>
+ </key>
+ <key name="options" type="as">
+ <default>[]</default>
+ <summary>Keyboard options</summary>
+ <description>Keyboard options</description>
+ </key>
+ </schema>
+ <schema id="org.mate.peripherals-keyboard-xkb.general" path="/desktop/mate/peripherals/keyboard/general/">
+ <key name="update-handlers" type="as">
+ <default>[]</default>
+ <summary>Keyboard Update Handlers</summary>
+ <description>A collection of scripts to run whenever the keyboard state is reloaded. Useful for re-applying xmodmap based adjustments</description>
+ </key>
+ <key name="known-file-list" type="as">
+ <default>[]</default>
+ <summary>modmap file list</summary>
+ <description>A list of modmap files available in the $HOME directory.</description>
+ </key>
+ <key name="default-group" type="i">
+ <default>-1</default>
+ <summary>Default group, assigned on window creation</summary>
+ <description>Default group, assigned on window creation</description>
+ </key>
+ <key name="group-per-window" type="b">
+ <default>true</default>
+ <summary>Keep and manage separate group per window</summary>
+ <description>Keep and manage separate group per window</description>
+ </key>
+ <key name="handle-indicators" type="b">
+ <default>false</default>
+ <summary>Save/restore indicators together with layout groups</summary>
+ <description>Save/restore indicators together with layout groups</description>
+ </key>
+ <key name="layout-names-as-group-names" type="b">
+ <default>true</default>
+ <summary>Show layout names instead of group names</summary>
+ <description>Show layout names instead of group names (only for versions of XFree supporting multiple layouts)</description>
+ </key>
+ <key name="load-extra-items" type="b">
+ <default>false</default>
+ <summary>Load extra configuration items</summary>
+ <description>Load exotic, rarely used layouts and options</description>
+ </key>
+ <key name="disable-sysconfig-changed-warning" type="b">
+ <default>false</default>
+ <summary>Suppress the "X sysconfig changed" warning message</summary>
+ <description>Suppress the "X sysconfig changed" warning message</description>
+ </key>
+ </schema>
+ <schema id="org.mate.peripherals-keyboard-xkb.preview" path="/desktop/mate/peripherals/keyboard/preview/">
+ <key name="x" type="i">
+ <default>-1</default>
+ <summary>The Keyboard Preview, X offset</summary>
+ <description>The Keyboard Preview, X offset</description>
+ </key>
+ <key name="y" type="i">
+ <default>-1</default>
+ <summary>The Keyboard Preview, Y offset</summary>
+ <description>The Keyboard Preview, Y offset</description>
+ </key>
+ <key name="width" type="i">
+ <default>-1</default>
+ <summary>The Keyboard Preview, width</summary>
+ <description>The Keyboard Preview, width</description>
+ </key>
+ <key name="height" type="i">
+ <default>-1</default>
+ <summary>The Keyboard Preview, height</summary>
+ <description>The Keyboard Preview, height</description>
+ </key>
+ </schema>
+ <schema id="org.mate.peripherals-keyboard-xkb.indicator" path="/desktop/mate/peripherals/keyboard/indicator/">
+ <key name="secondary" type="i">
+ <default>0</default>
+ <summary>Secondary groups</summary>
+ <description>Secondary groups</description>
+ </key>
+ <key name="show-flags" type="b">
+ <default>false</default>
+ </key>
+ <key name="font-family" type="s">
+ <default>''</default>
+ <summary>The font family</summary>
+ <description>The font family for the layout indicator</description>
+ </key>
+ <key name="font-size" type="i">
+ <default>10</default>
+ <summary>The font size</summary>
+ <description>The font size for the layout indicator</description>
+ </key>
+ <key name="foreground-color" type="s">
+ <default>''</default>
+ <summary>The foreground color</summary>
+ <description>The foreground color for the layout indicator</description>
+ </key>
+ <key name="background-color" type="s">
+ <default>''</default>
+ <summary>The background color</summary>
+ <description>The background color for the layout indicator</description>
+ </key>
+ </schema>
+</schemalist>