[libgnomekbd] Moving from gconf to gsettings. API/ABI changes
- From: Sergey V. Udaltsov <svu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnomekbd] Moving from gconf to gsettings. API/ABI changes
- Date: Sun, 3 Oct 2010 07:45:54 +0000 (UTC)
commit a177d5a7e194cfc106a906ca0d81b16a99fe02ee
Author: Sergey V. Udaltsov <svu gnome org>
Date: Sun Oct 3 08:42:48 2010 +0100
Moving from gconf to gsettings. API/ABI changes
capplet/gkbd-indicator-plugins-add.c | 311 +++++++++--------
capplet/gkbd-indicator-plugins-capplet.c | 171 ++++-----
configure.in | 21 +-
debian/control | 2 -
debian/control.in | 2 -
libgnomekbd/.gitignore | 1 +
libgnomekbd/Makefile.am | 28 +--
...sktop_gnome_peripherals_keyboard_xkb.schemas.in | 277 ---------------
libgnomekbd/gkbd-config-private.h | 30 +--
libgnomekbd/gkbd-desktop-config.c | 192 +++--------
libgnomekbd/gkbd-desktop-config.h | 15 +-
libgnomekbd/gkbd-indicator-config.c | 238 ++++---------
libgnomekbd/gkbd-indicator-config.h | 20 +-
libgnomekbd/gkbd-indicator-plugin-manager.c | 217 ++++++------
libgnomekbd/gkbd-indicator-plugin-manager.h | 83 +++--
libgnomekbd/gkbd-indicator-plugin.h | 19 +-
libgnomekbd/gkbd-indicator.c | 92 ++---
libgnomekbd/gkbd-keyboard-config.c | 366 +++++++-------------
libgnomekbd/gkbd-keyboard-config.h | 38 +-
libgnomekbd/gkbd-keyboard-drawing.c | 60 ++--
libgnomekbd/gkbd-keyboard-drawing.h | 3 +-
libgnomekbd/gkbd-status.c | 80 ++---
libgnomekbd/gkbd-util.c | 83 +----
.../org.gnome.libgnomekbd.desktop.gschema.xml | 45 +++
libgnomekbd/org.gnome.libgnomekbd.gschema.xml | 66 ++++
.../org.gnome.libgnomekbd.keyboard.gschema.xml | 20 +
po/POTFILES.in | 1 -
27 files changed, 951 insertions(+), 1530 deletions(-)
---
diff --git a/capplet/gkbd-indicator-plugins-add.c b/capplet/gkbd-indicator-plugins-add.c
index e9ff8df..9c6440e 100644
--- a/capplet/gkbd-indicator-plugins-add.c
+++ b/capplet/gkbd-indicator-plugins-add.c
@@ -35,28 +35,31 @@ CappletAddAvailablePluginFunc (const char *fullPath,
GkbdIndicatorPluginManagerRecord * rec,
GkbdIndicatorPluginsCapplet * gipc)
{
- GtkListStore *availablePluginsModel;
- GtkTreeIter iter;
- const GkbdIndicatorPlugin *plugin = rec->plugin;
-
- if (NULL !=
- g_slist_find_custom (gipc->applet_cfg.enabled_plugins,
- fullPath, (GCompareFunc) strcmp))
- return;
-
- availablePluginsModel =
- GTK_LIST_STORE (g_object_get_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.availablePluginsModel"));
- if (availablePluginsModel == NULL)
- return;
-
- if (plugin != NULL)
- {
- gtk_list_store_append (availablePluginsModel, &iter);
- gtk_list_store_set (availablePluginsModel, &iter,
- NAME_COLUMN, plugin->name,
- FULLPATH_COLUMN, fullPath, -1);
- }
+ GtkListStore *availablePluginsModel;
+ GtkTreeIter iter;
+ const GkbdIndicatorPlugin *plugin = rec->plugin;
+
+ gchar **p = gipc->applet_cfg.enabled_plugins;
+ if (p != NULL) {
+ while (*p != NULL) {
+ if (!strcmp (*p, fullPath))
+ return;
+ p++;
+ }
+ }
+
+ availablePluginsModel =
+ GTK_LIST_STORE (g_object_get_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.availablePluginsModel"));
+ if (availablePluginsModel == NULL)
+ return;
+
+ if (plugin != NULL) {
+ gtk_list_store_append (availablePluginsModel, &iter);
+ gtk_list_store_set (availablePluginsModel, &iter,
+ NAME_COLUMN, plugin->name,
+ FULLPATH_COLUMN, fullPath, -1);
+ }
}
static void
@@ -64,144 +67,154 @@ CappletFillAvailablePluginList (GtkTreeView *
availablePluginsList,
GkbdIndicatorPluginsCapplet * gipc)
{
- GtkListStore *availablePluginsModel =
- GTK_LIST_STORE (gtk_tree_view_get_model
- (GTK_TREE_VIEW (availablePluginsList)));
- GSList *pluginPathNode = gipc->applet_cfg.enabled_plugins;
- GHashTable *allPluginRecs = gipc->plugin_manager.all_plugin_recs;
-
- gtk_list_store_clear (availablePluginsModel);
- if (allPluginRecs == NULL)
- return;
-
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.availablePluginsModel",
- availablePluginsModel);
- g_hash_table_foreach (allPluginRecs,
- (GHFunc) CappletAddAvailablePluginFunc, gipc);
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.availablePluginsModel",
- NULL);
- pluginPathNode = g_slist_next (pluginPathNode);
+ GtkListStore *availablePluginsModel =
+ GTK_LIST_STORE (gtk_tree_view_get_model
+ (GTK_TREE_VIEW (availablePluginsList)));
+ GHashTable *allPluginRecs = gipc->plugin_manager.all_plugin_recs;
+
+ gtk_list_store_clear (availablePluginsModel);
+ if (allPluginRecs == NULL)
+ return;
+
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.availablePluginsModel",
+ availablePluginsModel);
+ g_hash_table_foreach (allPluginRecs,
+ (GHFunc) CappletAddAvailablePluginFunc,
+ gipc);
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.availablePluginsModel",
+ NULL);
}
static void
CappletAvailablePluginsSelectionChanged (GtkTreeSelection *
selection,
- GkbdIndicatorPluginsCapplet * gipc)
+ GkbdIndicatorPluginsCapplet *
+ gipc)
{
- GtkWidget *availablePluginsList =
- GTK_WIDGET (gtk_tree_selection_get_tree_view (selection));
- gboolean isAnythingSelected = FALSE;
- GtkWidget *lblDescription =
- GTK_WIDGET (g_object_get_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.lblDescription"));
-
- char *fullPath =
- CappletGetSelectedPluginPath (GTK_TREE_VIEW (availablePluginsList),
- gipc);
- isAnythingSelected = fullPath != NULL;
- gtk_label_set_text (GTK_LABEL (lblDescription),
- g_strconcat ("<small><i>",
- _("No description."),
- "</i></small>", NULL));
- gtk_label_set_use_markup (GTK_LABEL (lblDescription), TRUE);
-
- if (fullPath != NULL)
- {
- const GkbdIndicatorPlugin *plugin =
- gkbd_indicator_plugin_manager_get_plugin (&gipc->plugin_manager,
- fullPath);
- if (plugin != NULL && plugin->description != NULL)
+ GtkWidget *availablePluginsList =
+ GTK_WIDGET (gtk_tree_selection_get_tree_view (selection));
+ gboolean isAnythingSelected = FALSE;
+ GtkWidget *lblDescription =
+ GTK_WIDGET (g_object_get_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.lblDescription"));
+
+ char *fullPath =
+ CappletGetSelectedPluginPath (GTK_TREE_VIEW
+ (availablePluginsList),
+ gipc);
+ isAnythingSelected = fullPath != NULL;
gtk_label_set_text (GTK_LABEL (lblDescription),
g_strconcat ("<small><i>",
- plugin->
- description, "</i></small>", NULL));
- gtk_label_set_use_markup (GTK_LABEL (lblDescription), TRUE);
- }
- gtk_widget_set_sensitive (GTK_WIDGET
- (g_object_get_data
- (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.btnOK")),
- isAnythingSelected);
+ _("No description."),
+ "</i></small>", NULL));
+ gtk_label_set_use_markup (GTK_LABEL (lblDescription), TRUE);
+
+ if (fullPath != NULL) {
+ const GkbdIndicatorPlugin *plugin =
+ gkbd_indicator_plugin_manager_get_plugin (&gipc->
+ plugin_manager,
+ fullPath);
+ if (plugin != NULL && plugin->description != NULL)
+ gtk_label_set_text (GTK_LABEL (lblDescription),
+ g_strconcat ("<small><i>",
+ plugin->description,
+ "</i></small>",
+ NULL));
+ gtk_label_set_use_markup (GTK_LABEL (lblDescription),
+ TRUE);
+ }
+ gtk_widget_set_sensitive (GTK_WIDGET
+ (g_object_get_data
+ (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.btnOK")),
+ isAnythingSelected);
}
void
-CappletEnablePlugin (GtkWidget * btnAdd, GkbdIndicatorPluginsCapplet * gipc)
+CappletEnablePlugin (GtkWidget * btnAdd,
+ GkbdIndicatorPluginsCapplet * gipc)
{
- /* default domain! */
- GtkBuilder *builder;
- GError *error = NULL;
- GtkWidget *popup;
- GtkWidget *availablePluginsList;
- GtkTreeModel *availablePluginsModel;
- GtkCellRenderer *renderer =
- GTK_CELL_RENDERER (gtk_cell_renderer_text_new ());
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes (NULL,
- renderer,
- "text",
- 0,
- NULL);
- GtkTreeSelection *selection;
- gint response;
-
- builder = gtk_builder_new ();
-
- if (!gtk_builder_add_from_file (builder,
- UIDIR "/gkbd-indicator-plugins_add.ui",
- &error)) {
- g_warning ("Could not load builder file: %s", error->message);
- g_error_free(error);
- return;
- }
-
- popup = GTK_WIDGET (gtk_builder_get_object (builder,
- "gkbd_indicator_plugins_add"));
-
- availablePluginsList = GTK_WIDGET (gtk_builder_get_object (builder,
- "allPlugins"));
- availablePluginsModel =
- GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING));
- gtk_tree_view_set_model (GTK_TREE_VIEW (availablePluginsList),
- availablePluginsModel);
- gtk_tree_view_append_column (GTK_TREE_VIEW (availablePluginsList), column);
- selection =
- gtk_tree_view_get_selection (GTK_TREE_VIEW (availablePluginsList));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- CappletFillAvailablePluginList (GTK_TREE_VIEW (availablePluginsList), gipc);
- g_signal_connect (G_OBJECT (selection), "changed",
- G_CALLBACK
- (CappletAvailablePluginsSelectionChanged), gipc);
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.btnOK",
- GTK_WIDGET (gtk_builder_get_object (builder, "btnOK")));
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.lblDescription",
- GTK_WIDGET (gtk_builder_get_object (builder, "lblDescription")));
- CappletAvailablePluginsSelectionChanged (selection, gipc);
- response = gtk_dialog_run (GTK_DIALOG (popup));
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.lblDescription", NULL);
- g_object_set_data (G_OBJECT (gipc->capplet),
- "gkbd_indicator_plugins_add.btnOK", NULL);
- gtk_widget_hide_all (popup);
- if (response == GTK_RESPONSE_OK)
- {
- char *fullPath =
- CappletGetSelectedPluginPath (GTK_TREE_VIEW (availablePluginsList),
- gipc);
- if (fullPath != NULL)
- {
- gkbd_indicator_plugin_manager_enable_plugin (&gipc->
- plugin_manager,
- &gipc->
- applet_cfg.
- enabled_plugins,
- fullPath);
- CappletFillActivePluginList (gipc);
- g_free (fullPath);
- gkbd_indicator_config_save_to_gconf (&gipc->applet_cfg);
+ /* default domain! */
+ GtkBuilder *builder;
+ GError *error = NULL;
+ GtkWidget *popup;
+ GtkWidget *availablePluginsList;
+ GtkTreeModel *availablePluginsModel;
+ GtkCellRenderer *renderer =
+ GTK_CELL_RENDERER (gtk_cell_renderer_text_new ());
+ GtkTreeViewColumn *column =
+ gtk_tree_view_column_new_with_attributes (NULL,
+ renderer,
+ "text",
+ 0,
+ NULL);
+ GtkTreeSelection *selection;
+ gint response;
+
+ builder = gtk_builder_new ();
+
+ if (!gtk_builder_add_from_file (builder,
+ UIDIR
+ "/gkbd-indicator-plugins_add.ui",
+ &error)) {
+ g_warning ("Could not load builder file: %s",
+ error->message);
+ g_error_free (error);
+ return;
+ }
+
+ popup = GTK_WIDGET (gtk_builder_get_object (builder,
+ "gkbd_indicator_plugins_add"));
+
+ availablePluginsList = GTK_WIDGET (gtk_builder_get_object (builder,
+ "allPlugins"));
+ availablePluginsModel =
+ GTK_TREE_MODEL (gtk_list_store_new
+ (2, G_TYPE_STRING, G_TYPE_STRING));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (availablePluginsList),
+ availablePluginsModel);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (availablePluginsList),
+ column);
+ selection =
+ gtk_tree_view_get_selection (GTK_TREE_VIEW
+ (availablePluginsList));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+ CappletFillAvailablePluginList (GTK_TREE_VIEW
+ (availablePluginsList), gipc);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK
+ (CappletAvailablePluginsSelectionChanged), gipc);
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.btnOK",
+ GTK_WIDGET (gtk_builder_get_object
+ (builder, "btnOK")));
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.lblDescription",
+ GTK_WIDGET (gtk_builder_get_object
+ (builder, "lblDescription")));
+ CappletAvailablePluginsSelectionChanged (selection, gipc);
+ response = gtk_dialog_run (GTK_DIALOG (popup));
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.lblDescription",
+ NULL);
+ g_object_set_data (G_OBJECT (gipc->capplet),
+ "gkbd_indicator_plugins_add.btnOK", NULL);
+ gtk_widget_hide_all (popup);
+ if (response == GTK_RESPONSE_OK) {
+ char *fullPath =
+ CappletGetSelectedPluginPath (GTK_TREE_VIEW
+ (availablePluginsList),
+ gipc);
+ if (fullPath != NULL) {
+ gkbd_indicator_plugin_manager_enable_plugin
+ (&gipc->plugin_manager,
+ &gipc->applet_cfg.enabled_plugins, fullPath);
+ CappletFillActivePluginList (gipc);
+ g_free (fullPath);
+ gkbd_indicator_config_save (&gipc->applet_cfg);
+ }
}
- }
- gtk_widget_destroy (popup);
+ gtk_widget_destroy (popup);
}
diff --git a/capplet/gkbd-indicator-plugins-capplet.c b/capplet/gkbd-indicator-plugins-capplet.c
index 752d28c..c2c8440 100644
--- a/capplet/gkbd-indicator-plugins-capplet.c
+++ b/capplet/gkbd-indicator-plugins-capplet.c
@@ -39,28 +39,33 @@ CappletFillActivePluginList (GkbdIndicatorPluginsCapplet * gipc)
GtkListStore *activePluginsModel =
GTK_LIST_STORE (gtk_tree_view_get_model
(GTK_TREE_VIEW (activePlugins)));
- GSList *pluginPathNode = gipc->applet_cfg.enabled_plugins;
+ gchar **pluginPathNode = gipc->applet_cfg.enabled_plugins;
GHashTable *allPluginRecs = gipc->plugin_manager.all_plugin_recs;
gtk_list_store_clear (activePluginsModel);
if (allPluginRecs == NULL)
return;
- while (pluginPathNode != NULL) {
- GtkTreeIter iter;
- const char *fullPath = (const char *) pluginPathNode->data;
- const GkbdIndicatorPlugin *plugin =
- gkbd_indicator_plugin_manager_get_plugin (&gipc->
- plugin_manager,
- fullPath);
- if (plugin != NULL) {
- gtk_list_store_append (activePluginsModel, &iter);
- gtk_list_store_set (activePluginsModel, &iter,
- NAME_COLUMN, plugin->name,
- FULLPATH_COLUMN, fullPath, -1);
+ if (pluginPathNode != NULL) {
+ while (*pluginPathNode != NULL) {
+ GtkTreeIter iter;
+ const char *fullPath = *pluginPathNode;
+ const GkbdIndicatorPlugin *plugin =
+ gkbd_indicator_plugin_manager_get_plugin
+ (&gipc->plugin_manager,
+ fullPath);
+ if (plugin != NULL) {
+ gtk_list_store_append (activePluginsModel,
+ &iter);
+ gtk_list_store_set (activePluginsModel,
+ &iter, NAME_COLUMN,
+ plugin->name,
+ FULLPATH_COLUMN,
+ fullPath, -1);
+ }
+
+ pluginPathNode++;
}
-
- pluginPathNode = g_slist_next (pluginPathNode);
}
}
@@ -110,8 +115,10 @@ CappletActivePluginsSelectionChanged (GtkTreeSelection *
GtkWidget *btnRemove = CappletGetUiWidget (gipc, "btnRemove");
GtkWidget *btnUp = CappletGetUiWidget (gipc, "btnUp");
GtkWidget *btnDown = CappletGetUiWidget (gipc, "btnDown");
- GtkWidget *btnProperties = CappletGetUiWidget (gipc, "btnProperties");
- GtkWidget *lblDescription = CappletGetUiWidget (gipc, "lblDescription");
+ GtkWidget *btnProperties =
+ CappletGetUiWidget (gipc, "btnProperties");
+ GtkWidget *lblDescription =
+ CappletGetUiWidget (gipc, "lblDescription");
gtk_label_set_text (GTK_LABEL (lblDescription),
g_strconcat ("<small><i>",
@@ -127,9 +134,9 @@ CappletActivePluginsSelectionChanged (GtkTreeSelection *
gint *indices = gtk_tree_path_get_indices (treePath);
char *fullPath = CappletGetSelectedActivePluginPath (gipc);
const GkbdIndicatorPlugin *plugin =
- gkbd_indicator_plugin_manager_get_plugin (&gipc->
- plugin_manager,
- fullPath);
+ gkbd_indicator_plugin_manager_get_plugin
+ (&gipc->plugin_manager,
+ fullPath);
isAnythingSelected = TRUE;
@@ -142,8 +149,7 @@ CappletActivePluginsSelectionChanged (GtkTreeSelection *
NULL);
gtk_label_set_text (GTK_LABEL (lblDescription),
g_strconcat ("<small><i>",
- plugin->
- description,
+ plugin->description,
"</i></small>",
NULL));
gtk_label_set_use_markup (GTK_LABEL
@@ -168,15 +174,12 @@ CappletPromotePlugin (GtkWidget * btnUp,
{
char *fullPath = CappletGetSelectedActivePluginPath (gipc);
if (fullPath != NULL) {
- gkbd_indicator_plugin_manager_promote_plugin (&gipc->
- plugin_manager,
- gipc->
- applet_cfg.
- enabled_plugins,
- fullPath);
+ gkbd_indicator_plugin_manager_promote_plugin
+ (&gipc->plugin_manager,
+ gipc->applet_cfg.enabled_plugins, fullPath);
g_free (fullPath);
CappletFillActivePluginList (gipc);
- gkbd_indicator_config_save_to_gconf (&gipc->applet_cfg);
+ gkbd_indicator_config_save (&gipc->applet_cfg);
}
}
@@ -185,15 +188,12 @@ CappletDemotePlugin (GtkWidget * btnUp, GkbdIndicatorPluginsCapplet * gipc)
{
char *fullPath = CappletGetSelectedActivePluginPath (gipc);
if (fullPath != NULL) {
- gkbd_indicator_plugin_manager_demote_plugin (&gipc->
- plugin_manager,
- gipc->
- applet_cfg.
- enabled_plugins,
- fullPath);
+ gkbd_indicator_plugin_manager_demote_plugin
+ (&gipc->plugin_manager,
+ gipc->applet_cfg.enabled_plugins, fullPath);
g_free (fullPath);
CappletFillActivePluginList (gipc);
- gkbd_indicator_config_save_to_gconf (&gipc->applet_cfg);
+ gkbd_indicator_config_save (&gipc->applet_cfg);
}
}
@@ -203,15 +203,12 @@ CappletDisablePlugin (GtkWidget * btnRemove,
{
char *fullPath = CappletGetSelectedActivePluginPath (gipc);
if (fullPath != NULL) {
- gkbd_indicator_plugin_manager_disable_plugin (&gipc->
- plugin_manager,
- &gipc->
- applet_cfg.
- enabled_plugins,
- fullPath);
+ gkbd_indicator_plugin_manager_disable_plugin
+ (&gipc->plugin_manager,
+ &gipc->applet_cfg.enabled_plugins, fullPath);
g_free (fullPath);
CappletFillActivePluginList (gipc);
- gkbd_indicator_config_save_to_gconf (&gipc->applet_cfg);
+ gkbd_indicator_config_save (&gipc->applet_cfg);
}
}
@@ -221,14 +218,9 @@ CappletConfigurePlugin (GtkWidget * btnRemove,
{
char *fullPath = CappletGetSelectedActivePluginPath (gipc);
if (fullPath != NULL) {
- gkbd_indicator_plugin_manager_configure_plugin (&gipc->
- plugin_manager,
- &gipc->
- plugin_container,
- fullPath,
- GTK_WINDOW
- (gipc->
- capplet));
+ gkbd_indicator_plugin_manager_configure_plugin
+ (&gipc->plugin_manager, &gipc->plugin_container,
+ fullPath, GTK_WINDOW (gipc->capplet));
g_free (fullPath);
}
}
@@ -292,15 +284,17 @@ CappletSetup (GkbdIndicatorPluginsCapplet * gipc)
/* default domain! */
if (!gtk_builder_add_from_file (builder,
- UIDIR "/gkbd-indicator-plugins.ui",
- &error)) {
- g_warning ("Could not load builder file: %s", error->message);
- g_error_free(error);
+ UIDIR "/gkbd-indicator-plugins.ui",
+ &error)) {
+ g_warning ("Could not load builder file: %s",
+ error->message);
+ g_error_free (error);
return;
}
gipc->capplet = capplet =
- GTK_WIDGET (gtk_builder_get_object (builder, "gkbd_indicator_plugins"));
+ GTK_WIDGET (gtk_builder_get_object
+ (builder, "gkbd_indicator_plugins"));
gtk_builder_connect_signals (builder, NULL);
@@ -315,26 +309,23 @@ CappletSetup (GkbdIndicatorPluginsCapplet * gipc)
"response", G_CALLBACK (CappletResponse), NULL);
button = GTK_WIDGET (gtk_builder_get_object (builder, "btnUp"));
- g_signal_connect (button, "clicked",
- G_CALLBACK
- (CappletPromotePlugin), gipc);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (CappletPromotePlugin), gipc);
button = GTK_WIDGET (gtk_builder_get_object (builder, "btnDown"));
- g_signal_connect (button,
- "clicked",
- G_CALLBACK
- (CappletDemotePlugin), gipc);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (CappletDemotePlugin), gipc);
button = GTK_WIDGET (gtk_builder_get_object (builder, "btnAdd"));
- g_signal_connect (button, "clicked",
- G_CALLBACK
- (CappletEnablePlugin), gipc);
- button = GTK_WIDGET (gtk_builder_get_object (builder, "btnRemove"));
- g_signal_connect (button, "clicked",
- G_CALLBACK
- (CappletDisablePlugin), gipc);
- button = GTK_WIDGET (gtk_builder_get_object (builder, "btnProperties"));
- g_signal_connect (button, "clicked",
- G_CALLBACK
- (CappletConfigurePlugin), gipc);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (CappletEnablePlugin), gipc);
+ button =
+ GTK_WIDGET (gtk_builder_get_object (builder, "btnRemove"));
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (CappletDisablePlugin), gipc);
+ button =
+ GTK_WIDGET (gtk_builder_get_object (builder, "btnProperties"));
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (CappletConfigurePlugin), gipc);
activePlugins = CappletGetUiWidget (gipc, "activePlugins");
activePluginsModel =
@@ -360,46 +351,32 @@ main (int argc, char **argv)
{
GkbdIndicatorPluginsCapplet gipc;
- GError *gconf_error = NULL;
- GConfClient *confClient;
-
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
memset (&gipc, 0, sizeof (gipc));
gtk_init_with_args (&argc, &argv, "gkbd", NULL, NULL, NULL);
- if (!gconf_init (argc, argv, &gconf_error)) {
- g_warning (_("Failed to init GConf: %s\n"),
- gconf_error->message);
- g_error_free (gconf_error);
- return 1;
- }
- gconf_error = NULL;
/*GkbdIndicatorInstallGlibLogAppender( ); */
- gipc.engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ gipc.engine =
+ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY
+ (gdk_display_get_default ()));
gipc.config_registry =
xkl_config_registry_get_instance (gipc.engine);
- confClient = gconf_client_get_default ();
- gkbd_indicator_plugin_container_init (&gipc.plugin_container,
- confClient);
- g_object_unref (confClient);
+ gkbd_indicator_plugin_container_init (&gipc.plugin_container);
- gkbd_keyboard_config_init (&gipc.kbd_cfg, confClient, gipc.engine);
- gkbd_keyboard_config_init (&initialSysKbdConfig, confClient,
- gipc.engine);
+ gkbd_keyboard_config_init (&gipc.kbd_cfg, gipc.engine);
+ gkbd_keyboard_config_init (&initialSysKbdConfig, gipc.engine);
- gkbd_indicator_config_init (&gipc.applet_cfg, confClient,
- gipc.engine);
+ gkbd_indicator_config_init (&gipc.applet_cfg, gipc.engine);
gkbd_indicator_plugin_manager_init (&gipc.plugin_manager);
gkbd_keyboard_config_load_from_x_initial (&initialSysKbdConfig,
NULL);
- gkbd_keyboard_config_load_from_gconf (&gipc.kbd_cfg,
- &initialSysKbdConfig);
+ gkbd_keyboard_config_load (&gipc.kbd_cfg, &initialSysKbdConfig);
- gkbd_indicator_config_load_from_gconf (&gipc.applet_cfg);
+ gkbd_indicator_config_load (&gipc.applet_cfg);
loop = g_main_loop_new (NULL, TRUE);
diff --git a/configure.in b/configure.in
index 6aca5f0..2bd2ab9 100644
--- a/configure.in
+++ b/configure.in
@@ -1,10 +1,10 @@
dnl ***************************************************************************
dnl *** configure.in for libgnomekbd ***
dnl ***************************************************************************
-AC_INIT(libgnomekbd, 2.32.0, [http://bugzilla.gnome.org/enter_bug.cgi?product=libgnomekbd])
+AC_INIT(libgnomekbd, 2.90.0, [http://bugzilla.gnome.org/enter_bug.cgi?product=libgnomekbd])
AC_PREREQ(2.59)
-VERSION_INFO=6:0:2
+VERSION_INFO=7:0:0
AC_SUBST(VERSION_INFO)
AM_CONFIG_HEADER(config.h)
@@ -16,18 +16,18 @@ dnl ***************************************************************************
dnl *** Minimum library versions for libgnomekbd ***
dnl ***************************************************************************
GLIB_REQUIRED=2.18
-GCONF_REQUIRED=2.14.0
GDK_REQUIRED=2.18
GTK_REQUIRED=2.18
LIBXKLAVIER_REQUIRED=5.0
-AC_SUBST([GCONF_REQUIRED])
AC_SUBST([GDK_REQUIRED])
AC_SUBST([GTK_REQUIRED])
AC_SUBST([LIBXKLAVIER_REQUIRED])
dnl ***************************************************************************
+GLIB_GSETTINGS
+
GNOME_COMMON_INIT
GNOME_COMPILE_WARNINGS
@@ -57,11 +57,6 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED)
-
-AC_SUBST(GCONF_CFLAGS)
-AC_SUBST(GCONF_LIBS)
-
PKG_CHECK_MODULES(GDK, gdk-2.0 >= $GDK_REQUIRED)
AC_SUBST(GDK_CFLAGS)
@@ -83,14 +78,6 @@ XLIB_LIBS="$X_LIBS -lX11 $X_EXTRA_LIBS"
AC_SUBST(XLIB_CFLAGS)
AC_SUBST(XLIB_LIBS)
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
-fi
-
-AM_GCONF_SOURCE_2
-
AC_ARG_ENABLE([tests],
AC_HELP_STRING([--disable-tests], [Dont build the test apps]),,
[enable_tests=yes])
diff --git a/debian/control b/debian/control
index 9d85206..38b98f6 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,6 @@ Build-Depends: debhelper (>= 5),
autotools-dev,
cdbs,
libglib2.0-dev (>= 2.16),
- libgconf2-dev (>= 2.14.0),
libgtk2.0-dev (>= 2.13),
libxklavier-dev (>= 4.0),
libxml-parser-perl,
@@ -23,7 +22,6 @@ Section: libdevel
Architecture: any
Depends: libgnomekbd4 (= ${binary:Version}),
libglib2.0-dev (>= 2.6),
- libgconf2-dev,
libx11-dev,
libgtk2.0-dev,
libxklavier-dev
diff --git a/debian/control.in b/debian/control.in
index 0a9b72c..d7d1448 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -7,7 +7,6 @@ Build-Depends: debhelper (>= 5),
autotools-dev,
cdbs,
libglib2.0-dev (>= 2.16),
- libgconf2-dev (>= 2.14.0),
libgtk2.0-dev (>= 2.13),
libxklavier-dev (>= 4.0),
libxml-parser-perl,
@@ -23,7 +22,6 @@ Section: libdevel
Architecture: any
Depends: libgnomekbd4 (= ${binary:Version}),
libglib2.0-dev (>= 2.6),
- libgconf2-dev,
libx11-dev,
libgtk2.0-dev,
libxklavier-dev
diff --git a/libgnomekbd/.gitignore b/libgnomekbd/.gitignore
index 851cf86..2841c46 100644
--- a/libgnomekbd/.gitignore
+++ b/libgnomekbd/.gitignore
@@ -3,6 +3,7 @@ desktop_gnome_peripherals_keyboard_xkb.schemas
*.la
.libs
*.lo
+*.gschema.valid
Makefile
Makefile.in
*marshal.c
diff --git a/libgnomekbd/Makefile.am b/libgnomekbd/Makefile.am
index ed796cf..509d6f2 100644
--- a/libgnomekbd/Makefile.am
+++ b/libgnomekbd/Makefile.am
@@ -3,10 +3,14 @@ lib_LTLIBRARIES = libgnomekbd.la libgnomekbdui.la
uidir="$(pkgdatadir)/ui"
ui_DATA = show-layout.ui
+gsettings_SCHEMAS = org.gnome.libgnomekbd.desktop.gschema.xml \
+ org.gnome.libgnomekbd.keyboard.gschema.xml \
+ org.gnome.libgnomekbd.gschema.xml
+ GSETTINGS_RULES@
+
common_CFLAGS = \
-I$(top_srcdir) -Wall \
$(GDK_CFLAGS) \
- $(GCONF_CFLAGS) \
$(LIBXKLAVIER_CFLAGS) \
$(XLIB_CFLAGS) \
-I$(top_srcdir)/intl \
@@ -26,7 +30,6 @@ common_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
common_LIBADD = \
$(GDK_LIBS) \
- $(GCONF_LIBS) \
$(LIBXKLAVIER_LIBS) \
$(XLIB_LIBS)
@@ -72,15 +75,13 @@ gnomekbdinc_HEADERS = \
@INTLTOOL_DESKTOP_RULE@
- INTLTOOL_SCHEMAS_RULE@
-
noinst_HEADERS = gkbd-indicator-plugin-manager.h \
$(extra_nih) \
gkbd-config-private.h
EXTRA_DIST = gkbd-indicator-marshal.list \
gkbd-keyboard-drawing-marshal.list \
- $(schema_in_files) $(ui_DATA)
+ $(ui_DATA) $(gsettings_SCHEMAS)
GLIB_GENMARSHAL = $(shell pkg-config --variable=glib_genmarshal glib-2.0)
@@ -102,20 +103,3 @@ gkbd-keyboard-drawing-marshal.c: gkbd-keyboard-drawing-marshal.h
&& mv gkbd-keyboard-drawing-marshal.tmp gkbd-keyboard-drawing-marshal.c ) \
|| ( rm -f gkbd-keyboard-drawing-marshal.tmp && exit 1 )
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_files= desktop_gnome_peripherals_keyboard_xkb.schemas.in
-
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-
-if GCONF_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 \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
- done \
- fi
-else
-install-data-local:
-endif
-
diff --git a/libgnomekbd/gkbd-config-private.h b/libgnomekbd/gkbd-config-private.h
index cdaa711..92eb623 100644
--- a/libgnomekbd/gkbd-config-private.h
+++ b/libgnomekbd/gkbd-config-private.h
@@ -25,6 +25,8 @@
#define GKBD_CONFIG_KEY_PREFIX "/desktop/gnome/peripherals/keyboard"
+#define GKBD_SCHEMA "org.gnome.libgnomekbd"
+
extern const gchar GKBD_PREVIEW_CONFIG_DIR[];
extern const gchar GKBD_PREVIEW_CONFIG_KEY_X[];
extern const gchar GKBD_PREVIEW_CONFIG_KEY_Y[];
@@ -34,36 +36,16 @@ extern const gchar GKBD_PREVIEW_CONFIG_KEY_HEIGHT[];
/**
* General config functions (private)
*/
-extern void
- gkbd_desktop_config_add_listener (GConfClient * conf_client,
- const gchar * key,
- GConfClientNotifyFunc func,
- gpointer user_data, int *pid);
-
-
-extern void
- gkbd_desktop_config_remove_listener (GConfClient * conf_client, int *pid);
extern void gkbd_keyboard_config_model_set (GkbdKeyboardConfig *
kbd_config,
const gchar * model_name);
-extern void gkbd_keyboard_config_layouts_reset (GkbdKeyboardConfig *
- kbd_config);
-extern void gkbd_keyboard_config_layouts_add (GkbdKeyboardConfig *
- kbd_config,
- const gchar * layout_name,
- const gchar * variant_name);
-
-extern void gkbd_keyboard_config_layouts_reset (GkbdKeyboardConfig *
- kbd_config);
-extern void gkbd_keyboard_config_options_reset (GkbdKeyboardConfig *
- kbd_config);
-
-extern void gkbd_keyboard_config_options_add (GkbdKeyboardConfig *
- kbd_config,
+extern void gkbd_keyboard_config_options_set (GkbdKeyboardConfig *
+ kbd_config, gint idx,
const gchar * group_name,
const gchar * option_name);
+
extern gboolean gkbd_keyboard_config_options_is_set (GkbdKeyboardConfig *
kbd_config,
const gchar *
@@ -77,7 +59,7 @@ extern gboolean gkbd_keyboard_config_dump_settings (GkbdKeyboardConfig *
extern void gkbd_keyboard_config_start_listen (GkbdKeyboardConfig *
kbd_config,
- GConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void gkbd_keyboard_config_stop_listen (GkbdKeyboardConfig *
diff --git a/libgnomekbd/gkbd-desktop-config.c b/libgnomekbd/gkbd-desktop-config.c
index 8a8ab91..ac5ef41 100644
--- a/libgnomekbd/gkbd-desktop-config.c
+++ b/libgnomekbd/gkbd-desktop-config.c
@@ -32,19 +32,15 @@
/**
* GkbdDesktopConfig
*/
-#define GKBD_DESKTOP_CONFIG_KEY_PREFIX GKBD_CONFIG_KEY_PREFIX "/general"
-
-const gchar GKBD_DESKTOP_CONFIG_DIR[] = GKBD_DESKTOP_CONFIG_KEY_PREFIX;
-const gchar GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[] =
- GKBD_DESKTOP_CONFIG_KEY_PREFIX "/defaultGroup";
+const gchar GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[] = "default-group";
const gchar GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW[] =
- GKBD_DESKTOP_CONFIG_KEY_PREFIX "/groupPerWindow";
+ "group-per-window";
const gchar GKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS[] =
- GKBD_DESKTOP_CONFIG_KEY_PREFIX "/handleIndicators";
+ "handle-indicators";
const gchar GKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES[]
- = GKBD_DESKTOP_CONFIG_KEY_PREFIX "/layoutNamesAsGroupNames";
+ = "layout-names-as-group-names";
const gchar GKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS[]
- = GKBD_DESKTOP_CONFIG_KEY_PREFIX "/loadExtraItems";
+ = "load-extra-items";
/**
* static common functions
@@ -129,135 +125,53 @@ static gboolean
return TRUE;
}
-void
-gkbd_desktop_config_add_listener (GConfClient * conf_client,
- const gchar * key,
- GConfClientNotifyFunc func,
- gpointer user_data, int *pid)
-{
- GError *gerror = NULL;
- xkl_debug (150, "Listening to [%s]\n", key);
- *pid = gconf_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
-gkbd_desktop_config_remove_listener (GConfClient * conf_client, int *pid)
-{
- if (*pid != 0) {
- gconf_client_notify_remove (conf_client, *pid);
- *pid = 0;
- }
-}
-
/**
* extern GkbdDesktopConfig config functions
*/
void
-gkbd_desktop_config_init (GkbdDesktopConfig * config,
- GConfClient * conf_client, XklEngine * engine)
+gkbd_desktop_config_init (GkbdDesktopConfig * config, XklEngine * engine)
{
- GError *gerror = NULL;
-
memset (config, 0, sizeof (*config));
- config->conf_client = conf_client;
+ config->settings = g_settings_new (GKBD_DESKTOP_SCHEMA);
config->engine = engine;
- g_object_ref (config->conf_client);
-
- gconf_client_add_dir (config->conf_client,
- GKBD_DESKTOP_CONFIG_DIR,
- GCONF_CLIENT_PRELOAD_NONE, &gerror);
- if (gerror != NULL) {
- g_warning ("err: %s\n", gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
}
void
gkbd_desktop_config_term (GkbdDesktopConfig * config)
{
- g_object_unref (config->conf_client);
- config->conf_client = NULL;
+ g_object_unref (config->settings);
+ config->settings = NULL;
}
void
-gkbd_desktop_config_load_from_gconf (GkbdDesktopConfig * config)
+gkbd_desktop_config_load (GkbdDesktopConfig * config)
{
- GError *gerror = NULL;
-
config->group_per_app =
- gconf_client_get_bool (config->conf_client,
- GKBD_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,
+ GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW);
xkl_debug (150, "group_per_app: %d\n", config->group_per_app);
config->handle_indicators =
- gconf_client_get_bool (config->conf_client,
- GKBD_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,
+ GKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS);
xkl_debug (150, "handle_indicators: %d\n",
config->handle_indicators);
config->layout_names_as_group_names =
- gconf_client_get_bool (config->conf_client,
- GKBD_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,
+ GKBD_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 =
- gconf_client_get_bool (config->conf_client,
- GKBD_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,
+ GKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS);
xkl_debug (150, "load_extra_items: %d\n",
config->load_extra_items);
config->default_group =
- gconf_client_get_int (config->conf_client,
- GKBD_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,
+ GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP);
if (config->default_group < -1
|| config->default_group >=
@@ -267,38 +181,27 @@ gkbd_desktop_config_load_from_gconf (GkbdDesktopConfig * config)
}
void
-gkbd_desktop_config_save_to_gconf (GkbdDesktopConfig * config)
+gkbd_desktop_config_save (GkbdDesktopConfig * config)
{
- GConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_bool (cs,
- GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
- config->group_per_app);
- gconf_change_set_set_bool (cs,
- GKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS,
- config->handle_indicators);
- gconf_change_set_set_bool (cs,
- GKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES,
- config->layout_names_as_group_names);
- gconf_change_set_set_bool (cs,
- GKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS,
- config->load_extra_items);
- gconf_change_set_set_int (cs,
- GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP,
- config->default_group);
-
- gconf_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;
- }
- gconf_change_set_unref (cs);
+ g_settings_delay (config->settings);
+
+ g_settings_set_boolean (config->settings,
+ GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
+ config->group_per_app);
+ g_settings_set_boolean (config->settings,
+ GKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS,
+ config->handle_indicators);
+ g_settings_set_boolean (config->settings,
+ GKBD_DESKTOP_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES,
+ config->layout_names_as_group_names);
+ g_settings_set_boolean (config->settings,
+ GKBD_DESKTOP_CONFIG_KEY_LOAD_EXTRA_ITEMS,
+ config->load_extra_items);
+ g_settings_set_int (config->settings,
+ GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP,
+ config->default_group);
+
+ g_settings_apply (config->settings);
}
gboolean
@@ -339,20 +242,19 @@ gkbd_desktop_config_restore_group (GkbdDesktopConfig * config)
void
gkbd_desktop_config_start_listen (GkbdDesktopConfig * config,
- GConfClientNotifyFunc func,
- gpointer user_data)
+ GCallback func, gpointer user_data)
{
- gkbd_desktop_config_add_listener (config->conf_client,
- GKBD_DESKTOP_CONFIG_DIR, func,
- user_data,
- &config->config_listener_id);
+ config->config_listener_id =
+ g_signal_connect (config->settings, "changed", func,
+ user_data);
}
void
gkbd_desktop_config_stop_listen (GkbdDesktopConfig * config)
{
- gkbd_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/libgnomekbd/gkbd-desktop-config.h b/libgnomekbd/gkbd-desktop-config.h
index 5f66909..acd160c 100644
--- a/libgnomekbd/gkbd-desktop-config.h
+++ b/libgnomekbd/gkbd-desktop-config.h
@@ -22,10 +22,11 @@
#include <X11/Xlib.h>
#include <glib.h>
-#include <gconf/gconf-client.h>
+#include <gio/gio.h>
#include <libxklavier/xklavier.h>
-extern const gchar GKBD_DESKTOP_CONFIG_DIR[];
+#define GKBD_DESKTOP_SCHEMA "org.gnome.libgnomekbd.desktop"
+
extern const gchar GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP[];
extern const gchar GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW[];
extern const gchar GKBD_DESKTOP_CONFIG_KEY_HANDLE_INDICATORS[];
@@ -42,7 +43,7 @@ typedef struct _GkbdDesktopConfig {
gboolean load_extra_items;
/* private, transient */
- GConfClient *conf_client;
+ GSettings *settings;
int config_listener_id;
XklEngine *engine;
} GkbdDesktopConfig;
@@ -51,14 +52,12 @@ typedef struct _GkbdDesktopConfig {
* GkbdDesktopConfig functions
*/
extern void gkbd_desktop_config_init (GkbdDesktopConfig * config,
- GConfClient * conf_client,
XklEngine * engine);
extern void gkbd_desktop_config_term (GkbdDesktopConfig * config);
-extern void gkbd_desktop_config_load_from_gconf (GkbdDesktopConfig *
- config);
+extern void gkbd_desktop_config_load (GkbdDesktopConfig * config);
-extern void gkbd_desktop_config_save_to_gconf (GkbdDesktopConfig * config);
+extern void gkbd_desktop_config_save (GkbdDesktopConfig * config);
extern gboolean gkbd_desktop_config_activate (GkbdDesktopConfig * config);
@@ -84,7 +83,7 @@ extern void gkbd_desktop_config_lock_prev_group (GkbdDesktopConfig *
extern void gkbd_desktop_config_restore_group (GkbdDesktopConfig * config);
extern void gkbd_desktop_config_start_listen (GkbdDesktopConfig * config,
- GConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void gkbd_desktop_config_stop_listen (GkbdDesktopConfig * config);
diff --git a/libgnomekbd/gkbd-indicator-config.c b/libgnomekbd/gkbd-indicator-config.c
index 5cabdcb..d6cae01 100644
--- a/libgnomekbd/gkbd-indicator-config.c
+++ b/libgnomekbd/gkbd-indicator-config.c
@@ -37,76 +37,33 @@
/**
* GkbdIndicatorConfig
*/
-#define GKBD_INDICATOR_CONFIG_KEY_PREFIX GKBD_CONFIG_KEY_PREFIX "/indicator"
#define GTK_STYLE_PATH "*PanelWidget*"
-const gchar GKBD_INDICATOR_CONFIG_DIR[] = GKBD_INDICATOR_CONFIG_KEY_PREFIX;
-const gchar GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/showFlags";
+const gchar GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] = "show-flags";
const gchar GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/enabledPlugins";
-const gchar GKBD_INDICATOR_CONFIG_KEY_SECONDARIES[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/secondary";
-const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/fontFamily";
-const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_SIZE[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/fontSize";
+ "enabled-plugins";
+const gchar GKBD_INDICATOR_CONFIG_KEY_SECONDARIES[] = "secondary";
+const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY[] = "font-family";
+const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_SIZE[] = "font-size";
const gchar GKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/foregroundColor";
+ "foreground-color";
const gchar GKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR[] =
- GKBD_INDICATOR_CONFIG_KEY_PREFIX "/backgroundColor";
-
-#define SYSTEM_FONT_GCONF_ENTRY "/desktop/gnome/interface/font_name"
+ "background-color";
/**
* static applet config functions
*/
-static void
-gkbd_indicator_config_free_enabled_plugins (GkbdIndicatorConfig *
- 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
gkbd_indicator_config_load_font (GkbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->font_family =
- gconf_client_get_string (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY);
ind_config->font_size =
- gconf_client_get_int (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_FONT_SIZE);
if (ind_config->font_family == NULL ||
ind_config->font_family[0] == '\0') {
@@ -135,18 +92,9 @@ gkbd_indicator_config_load_font (GkbdIndicatorConfig * ind_config)
static void
gkbd_indicator_config_load_colors (GkbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->foreground_color =
- gconf_client_get_string (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR);
if (ind_config->foreground_color == NULL ||
ind_config->foreground_color[0] == '\0') {
@@ -158,32 +106,25 @@ gkbd_indicator_config_load_colors (GkbdIndicatorConfig * ind_config)
if (style != NULL) {
ind_config->foreground_color =
g_strdup_printf ("%g %g %g", ((double)
- style->
- fg
- [GTK_STATE_NORMAL].red)
+ style->fg
+ [GTK_STATE_NORMAL].
+ red)
/ 0x10000, ((double)
- style->
- fg
- [GTK_STATE_NORMAL].green)
+ style->fg
+ [GTK_STATE_NORMAL].
+ green)
/ 0x10000, ((double)
- style->
- fg
- [GTK_STATE_NORMAL].blue)
+ style->fg
+ [GTK_STATE_NORMAL].
+ blue)
/ 0x10000);
}
}
ind_config->background_color =
- gconf_client_get_string (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR);
}
void
@@ -209,9 +150,9 @@ gkbd_indicator_config_get_images_file (GkbdIndicatorConfig *
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 +218,14 @@ gkbd_indicator_config_free_image_filenames (GkbdIndicatorConfig *
void
gkbd_indicator_config_init (GkbdIndicatorConfig * ind_config,
- GConfClient * 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 ("org.gnome.libgnomekbd.indicator");
ind_config->engine = engine;
- g_object_ref (ind_config->conf_client);
-
- gconf_client_add_dir (ind_config->conf_client,
- GKBD_INDICATOR_CONFIG_DIR,
- GCONF_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,110 +267,73 @@ gkbd_indicator_config_term (GkbdIndicatorConfig * ind_config)
gkbd_indicator_config_free_image_filenames (ind_config);
- gkbd_indicator_config_free_enabled_plugins (ind_config);
- g_object_unref (ind_config->conf_client);
- ind_config->conf_client = NULL;
+ g_strfreev (ind_config->enabled_plugins);
+ ind_config->enabled_plugins = NULL;
+ g_object_unref (ind_config->settings);
+ ind_config->settings = NULL;
}
void
-gkbd_indicator_config_load_from_gconf (GkbdIndicatorConfig * ind_config)
+gkbd_indicator_config_load (GkbdIndicatorConfig * ind_config)
{
- GError *gerror = NULL;
-
ind_config->secondary_groups_mask =
- gconf_client_get_int (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_SECONDARIES);
ind_config->show_flags =
- gconf_client_get_bool (ind_config->conf_client,
- GKBD_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,
+ GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS);
gkbd_indicator_config_load_font (ind_config);
gkbd_indicator_config_load_colors (ind_config);
- gkbd_indicator_config_free_enabled_plugins (ind_config);
+ g_strfreev (ind_config->enabled_plugins);
ind_config->enabled_plugins =
- gconf_client_get_list (ind_config->conf_client,
- GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS,
- GCONF_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;
- }
+ g_settings_get_strv (ind_config->settings,
+ GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS);
}
void
-gkbd_indicator_config_save_to_gconf (GkbdIndicatorConfig * ind_config)
+gkbd_indicator_config_save (GkbdIndicatorConfig * ind_config)
{
- GConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_int (cs,
- GKBD_INDICATOR_CONFIG_KEY_SECONDARIES,
- ind_config->secondary_groups_mask);
- gconf_change_set_set_bool (cs,
- GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS,
- ind_config->show_flags);
- gconf_change_set_set_list (cs,
- GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS,
- GCONF_VALUE_STRING,
- ind_config->enabled_plugins);
-
- gconf_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;
- }
- gconf_change_set_unref (cs);
+ g_settings_delay (ind_config->settings);
+
+ g_settings_set_int (ind_config->settings,
+ GKBD_INDICATOR_CONFIG_KEY_SECONDARIES,
+ ind_config->secondary_groups_mask);
+ g_settings_set_boolean (ind_config->settings,
+ GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS,
+ ind_config->show_flags);
+ g_settings_set_strv (ind_config->settings,
+ GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS,
+ (const gchar *
+ const *) ind_config->enabled_plugins);
+
+ g_settings_apply (ind_config->settings);
}
void
gkbd_indicator_config_activate (GkbdIndicatorConfig * ind_config)
{
xkl_engine_set_secondary_groups_mask (ind_config->engine,
- ind_config->secondary_groups_mask);
+ ind_config->
+ secondary_groups_mask);
}
void
gkbd_indicator_config_start_listen (GkbdIndicatorConfig *
ind_config,
- GConfClientNotifyFunc func,
- gpointer user_data)
+ GCallback func, gpointer user_data)
{
- gkbd_desktop_config_add_listener (ind_config->conf_client,
- GKBD_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
gkbd_indicator_config_stop_listen (GkbdIndicatorConfig * ind_config)
{
- gkbd_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/libgnomekbd/gkbd-indicator-config.h b/libgnomekbd/gkbd-indicator-config.h
index 6675947..d1928b3 100644
--- a/libgnomekbd/gkbd-indicator-config.h
+++ b/libgnomekbd/gkbd-indicator-config.h
@@ -36,10 +36,10 @@ typedef struct _GkbdIndicatorConfig {
gchar *foreground_color;
gchar *background_color;
- GSList *enabled_plugins;
+ gchar **enabled_plugins;
/* private, transient */
- GConfClient *conf_client;
+ GSettings *settings;
GSList *image_filenames;
GtkIconTheme *icon_theme;
int config_listener_id;
@@ -52,16 +52,14 @@ typedef struct _GkbdIndicatorConfig {
* for loading approptiate images
*/
extern void gkbd_indicator_config_init (GkbdIndicatorConfig *
- applet_config,
- GConfClient * conf_client,
- XklEngine * engine);
+ applet_config, XklEngine * engine);
extern void gkbd_indicator_config_term (GkbdIndicatorConfig *
applet_config);
-extern void gkbd_indicator_config_load_from_gconf (GkbdIndicatorConfig
- * applet_config);
-extern void gkbd_indicator_config_save_to_gconf (GkbdIndicatorConfig *
- applet_config);
+extern void gkbd_indicator_config_load (GkbdIndicatorConfig
+ * applet_config);
+extern void gkbd_indicator_config_save (GkbdIndicatorConfig *
+ applet_config);
extern void gkbd_indicator_config_refresh_style (GkbdIndicatorConfig *
applet_config);
@@ -85,8 +83,8 @@ extern void gkbd_indicator_config_activate (GkbdIndicatorConfig *
extern void gkbd_indicator_config_start_listen (GkbdIndicatorConfig *
applet_config,
- GConfClientNotifyFunc
- func, gpointer user_data);
+ GCallback func,
+ gpointer user_data);
extern void gkbd_indicator_config_stop_listen (GkbdIndicatorConfig *
applet_config);
diff --git a/libgnomekbd/gkbd-indicator-plugin-manager.c b/libgnomekbd/gkbd-indicator-plugin-manager.c
index 59a29a3..b07e3b6 100644
--- a/libgnomekbd/gkbd-indicator-plugin-manager.c
+++ b/libgnomekbd/gkbd-indicator-plugin-manager.c
@@ -24,6 +24,7 @@
#include <libxklavier/xklavier.h>
#include <gkbd-indicator-plugin-manager.h>
+#include <gkbd-config-private.h>
#define FOREACH_INITED_PLUGIN() \
{ \
@@ -78,12 +79,14 @@ gkbd_indicator_plugin_manager_add_plugins_dir (GkbdIndicatorPluginManager *
"Loaded plugin from [%s]: [%s]/[%s]...\n",
full_path,
plugin->name,
- plugin->description);
+ plugin->
+ description);
rec->full_path = full_path;
rec->module = module;
rec->plugin = plugin;
g_hash_table_insert
- (manager->all_plugin_recs,
+ (manager->
+ all_plugin_recs,
full_path, rec);
continue;
}
@@ -160,41 +163,49 @@ gkbd_indicator_plugin_manager_term (GkbdIndicatorPluginManager * manager)
void
gkbd_indicator_plugin_manager_init_enabled_plugins
(GkbdIndicatorPluginManager * manager,
- GkbdIndicatorPluginContainer * pc, GSList * enabled_plugins) {
- GSList *plugin_name_node = enabled_plugins;
+ GkbdIndicatorPluginContainer * pc, gchar ** enabled_plugins) {
+ gchar **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) {
- GkbdIndicatorPluginManagerRecord *rec =
- (GkbdIndicatorPluginManagerRecord *)
- g_hash_table_lookup (manager->all_plugin_recs,
- full_path);
-
- if (rec != NULL) {
- const GkbdIndicatorPlugin *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);
+ if (plugin_name_node != NULL) {
+ while (*plugin_name_node != NULL) {
+ const char *full_path = *plugin_name_node;
+ if (full_path != NULL) {
+ GkbdIndicatorPluginManagerRecord *rec =
+ (GkbdIndicatorPluginManagerRecord *)
+ g_hash_table_lookup
+ (manager->all_plugin_recs,
+ full_path);
+
+ if (rec != NULL) {
+ const GkbdIndicatorPlugin *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++;
}
- plugin_name_node = g_slist_next (plugin_name_node);
}
}
@@ -216,7 +227,7 @@ gkbd_indicator_plugin_manager_toggle_plugins (GkbdIndicatorPluginManager *
manager,
GkbdIndicatorPluginContainer
* pc,
- GSList * enabled_plugins)
+ gchar ** enabled_plugins)
{
gkbd_indicator_plugin_manager_term_initialized_plugins (manager);
gkbd_indicator_plugin_manager_init_enabled_plugins (manager, pc,
@@ -262,84 +273,93 @@ gkbd_indicator_plugin_manager_get_plugin (GkbdIndicatorPluginManager *
void
gkbd_indicator_plugin_manager_promote_plugin (GkbdIndicatorPluginManager *
manager,
- GSList * enabled_plugins,
+ gchar ** 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;
+ gchar **the_node = enabled_plugins;
+ gchar **prev_node = NULL;
+
+ if (the_node != NULL) {
+ while (*the_node != NULL) {
+ if (!strcmp (*the_node, full_path)) {
+ if (prev_node != NULL) {
+ char *tmp = *prev_node;
+ *prev_node = *the_node;
+ *the_node = tmp;
+ }
+ break;
}
- break;
+ prev_node = the_node;
+ the_node++;
}
- prev_node = the_node;
- the_node = g_slist_next (the_node);
}
}
void
gkbd_indicator_plugin_manager_demote_plugin (GkbdIndicatorPluginManager *
manager,
- GSList * enabled_plugins,
+ gchar ** enabled_plugins,
const char *full_path)
{
- GSList *the_node = g_slist_find_custom (enabled_plugins, full_path,
- (GCompareFunc) strcmp);
+ gchar **the_node = enabled_plugins;
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;
+ while (*the_node != NULL) {
+ if (!strcmp (*the_node, full_path)) {
+ gchar **next_node = the_node + 1;
+ if (*next_node != NULL) {
+ char *tmp = *next_node;
+ *next_node = *the_node;
+ *the_node = tmp;
+ }
+ }
+ the_node++;
}
}
}
void
-gkbd_indicator_plugin_manager_enable_plugin (GkbdIndicatorPluginManager *
- manager,
- GSList ** enabled_plugins,
- const char *full_path)
-{
+ gkbd_indicator_plugin_manager_enable_plugin
+ (GkbdIndicatorPluginManager * manager,
+ gchar *** enabled_plugins, const char *full_path) {
if (NULL !=
gkbd_indicator_plugin_manager_get_plugin (manager,
full_path)) {
- *enabled_plugins =
- g_slist_append (*enabled_plugins,
- (gpointer) g_strdup (full_path));
+ gint old_length = g_strv_length (*enabled_plugins);
+ gchar **new_enabled_plugins =
+ g_new0 (gchar *, old_length + 2);
+ memcpy (new_enabled_plugins, *enabled_plugins,
+ old_length * sizeof (gchar *));
+ new_enabled_plugins[old_length] = g_strdup (full_path);
+ g_free (*enabled_plugins);
+ *enabled_plugins = new_enabled_plugins;
}
}
void
-gkbd_indicator_plugin_manager_disable_plugin (GkbdIndicatorPluginManager *
- 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);
+ gkbd_indicator_plugin_manager_disable_plugin
+ (GkbdIndicatorPluginManager * manager,
+ gchar *** enabled_plugins, const char *full_path) {
+ gchar **p = *enabled_plugins;
+ if (p != NULL) {
+ while (*p != NULL) {
+ if (!strcmp (*p, full_path)) {
+ gint remains = g_strv_length (p);
+ memmove (p, p + 1, remains * sizeof(gchar*));
+ return;
+ }
+ p++;
+ }
}
}
int
-gkbd_indicator_plugin_manager_window_created (GkbdIndicatorPluginManager *
- manager, Window win,
- Window parent)
-{
+ gkbd_indicator_plugin_manager_window_created
+ (GkbdIndicatorPluginManager * manager, Window win, Window parent) {
FOREACH_INITED_PLUGIN ();
if (plugin->window_created_callback) {
int group_to_assign =
- (*plugin->window_created_callback) (win, parent);
+ (*plugin->window_created_callback) (win,
+ parent);
if (group_to_assign != -1) {
xkl_debug (100,
"Plugin [%s] assigned group %d to new window %ld\n",
@@ -351,19 +371,16 @@ gkbd_indicator_plugin_manager_window_created (GkbdIndicatorPluginManager *
return -1;
}
-GtkWidget *
-gkbd_indicator_plugin_manager_decorate_widget (GkbdIndicatorPluginManager *
- manager, GtkWidget * widget,
- const gint group,
- const char
- *group_description,
- GkbdKeyboardConfig *
- kbd_config)
-{
+GtkWidget
+ * gkbd_indicator_plugin_manager_decorate_widget
+ (GkbdIndicatorPluginManager * manager, GtkWidget * widget,
+ const gint group, const char *group_description,
+ GkbdKeyboardConfig * kbd_config) {
FOREACH_INITED_PLUGIN ();
if (plugin->decorate_widget_callback) {
GtkWidget *decorated_widget =
- (*plugin->decorate_widget_callback) (widget, group,
+ (*plugin->decorate_widget_callback) (widget,
+ group,
group_description,
kbd_config);
if (decorated_widget != NULL) {
@@ -378,29 +395,25 @@ gkbd_indicator_plugin_manager_decorate_widget (GkbdIndicatorPluginManager *
}
void
-gkbd_indicator_plugin_manager_configure_plugin (GkbdIndicatorPluginManager
- * manager,
- GkbdIndicatorPluginContainer
- * pc,
- const char *full_path,
- GtkWindow * parent)
-{
+ gkbd_indicator_plugin_manager_configure_plugin
+ (GkbdIndicatorPluginManager * manager,
+ GkbdIndicatorPluginContainer * pc, const char *full_path,
+ GtkWindow * parent) {
const GkbdIndicatorPlugin *plugin =
- gkbd_indicator_plugin_manager_get_plugin (manager, full_path);
+ gkbd_indicator_plugin_manager_get_plugin (manager,
+ full_path);
if (plugin->configure_properties_callback != NULL)
plugin->configure_properties_callback (pc, parent);
}
void
-gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc,
- GConfClient * conf_client)
+gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc)
{
- pc->conf_client = conf_client;
- g_object_ref (pc->conf_client);
+ pc->settings = g_settings_new (GKBD_SCHEMA);
}
void
gkbd_indicator_plugin_container_term (GkbdIndicatorPluginContainer * pc)
{
- g_object_unref (pc->conf_client);
+ g_object_unref (pc->settings);
}
diff --git a/libgnomekbd/gkbd-indicator-plugin-manager.h b/libgnomekbd/gkbd-indicator-plugin-manager.h
index 5a457bd..92370f7 100644
--- a/libgnomekbd/gkbd-indicator-plugin-manager.h
+++ b/libgnomekbd/gkbd-indicator-plugin-manager.h
@@ -41,71 +41,76 @@ extern void
gkbd_indicator_plugin_manager_term (GkbdIndicatorPluginManager * manager);
extern void
- gkbd_indicator_plugin_manager_init_enabled_plugins (GkbdIndicatorPluginManager * manager,
- GkbdIndicatorPluginContainer
- * pc,
- GSList *
- enabled_plugins);
+ gkbd_indicator_plugin_manager_init_enabled_plugins
+ (GkbdIndicatorPluginManager * manager,
+ GkbdIndicatorPluginContainer * pc, gchar ** enabled_plugins);
extern void
- gkbd_indicator_plugin_manager_term_initialized_plugins (GkbdIndicatorPluginManager * manager);
+ gkbd_indicator_plugin_manager_term_initialized_plugins
+ (GkbdIndicatorPluginManager * manager);
extern void
- gkbd_indicator_plugin_manager_toggle_plugins (GkbdIndicatorPluginManager * manager,
- GkbdIndicatorPluginContainer
- * pc,
- GSList * enabled_plugins);
+gkbd_indicator_plugin_manager_toggle_plugins (GkbdIndicatorPluginManager *
+ manager,
+ GkbdIndicatorPluginContainer
+ * pc,
+ gchar ** enabled_plugins);
-extern const GkbdIndicatorPlugin
- *
+extern const GkbdIndicatorPlugin *
gkbd_indicator_plugin_manager_get_plugin (GkbdIndicatorPluginManager *
manager, const char *full_path);
extern void
- gkbd_indicator_plugin_manager_promote_plugin (GkbdIndicatorPluginManager * manager,
- GSList * enabled_plugins,
- const char *full_path);
+gkbd_indicator_plugin_manager_promote_plugin (GkbdIndicatorPluginManager *
+ manager,
+ gchar ** enabled_plugins,
+ const char *full_path);
extern void
- gkbd_indicator_plugin_manager_demote_plugin (GkbdIndicatorPluginManager * manager,
- GSList * enabled_plugins,
- const char *full_path);
+gkbd_indicator_plugin_manager_demote_plugin (GkbdIndicatorPluginManager *
+ manager,
+ gchar ** enabled_plugins,
+ const char *full_path);
extern void
- gkbd_indicator_plugin_manager_enable_plugin (GkbdIndicatorPluginManager * manager,
- GSList ** enabled_plugins,
- const char *full_path);
+gkbd_indicator_plugin_manager_enable_plugin (GkbdIndicatorPluginManager *
+ manager,
+ gchar *** enabled_plugins,
+ const char *full_path);
extern void
- gkbd_indicator_plugin_manager_disable_plugin (GkbdIndicatorPluginManager * manager,
- GSList ** enabled_plugins,
- const char *full_path);
+gkbd_indicator_plugin_manager_disable_plugin (GkbdIndicatorPluginManager *
+ manager,
+ gchar *** enabled_plugins,
+ const char *full_path);
extern void
- gkbd_indicator_plugin_manager_configure_plugin (GkbdIndicatorPluginManager * manager,
- GkbdIndicatorPluginContainer
- * pc,
- const char *full_path,
- GtkWindow * parent);
+gkbd_indicator_plugin_manager_configure_plugin (GkbdIndicatorPluginManager
+ * manager,
+ GkbdIndicatorPluginContainer
+ * pc,
+ const char *full_path,
+ GtkWindow * parent);
/* actual calling plugin notification methods */
extern void
- gkbd_indicator_plugin_manager_group_changed (GkbdIndicatorPluginManager * manager,
- GtkWidget * notebook,
- int new_group);
+gkbd_indicator_plugin_manager_group_changed (GkbdIndicatorPluginManager *
+ manager, GtkWidget * notebook,
+ int new_group);
extern void
- gkbd_indicator_plugin_manager_config_changed (GkbdIndicatorPluginManager * manager,
- GkbdKeyboardConfig * from,
- GkbdKeyboardConfig * to);
+gkbd_indicator_plugin_manager_config_changed (GkbdIndicatorPluginManager *
+ manager,
+ GkbdKeyboardConfig * from,
+ GkbdKeyboardConfig * to);
extern int
- gkbd_indicator_plugin_manager_window_created (GkbdIndicatorPluginManager * manager,
- Window win, Window parent);
+gkbd_indicator_plugin_manager_window_created (GkbdIndicatorPluginManager *
+ manager, Window win,
+ Window parent);
-extern GtkWidget
- *
+extern GtkWidget *
gkbd_indicator_plugin_manager_decorate_widget (GkbdIndicatorPluginManager *
manager, GtkWidget * widget,
const gint group, const char
diff --git a/libgnomekbd/gkbd-indicator-plugin.h b/libgnomekbd/gkbd-indicator-plugin.h
index 7bce9aa..3747b98 100644
--- a/libgnomekbd/gkbd-indicator-plugin.h
+++ b/libgnomekbd/gkbd-indicator-plugin.h
@@ -21,7 +21,6 @@
#define __GKBD_INDICATOR_PLUGIN_H__
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include <libgnomekbd/gkbd-keyboard-config.h>
#define MAX_LOCAL_NAME_BUF_LENGTH 512
@@ -29,15 +28,18 @@
struct _GkbdIndicatorPlugin;
typedef struct _GkbdIndicatorPluginContainer {
- GConfClient *conf_client;
+ GSettings *settings;
} GkbdIndicatorPluginContainer;
typedef const struct _GkbdIndicatorPlugin
*(*GkbdIndicatorPluginGetPluginFunc) (void);
typedef
- gboolean (*GkbdIndicatorPluginInitFunc) (GkbdIndicatorPluginContainer *
- pc);
+
+
+
+gboolean (*GkbdIndicatorPluginInitFunc) (GkbdIndicatorPluginContainer *
+ pc);
typedef void (*GkbdIndicatorPluginGroupChangedFunc) (GtkWidget * notebook,
int new_group);
@@ -105,14 +107,17 @@ typedef struct _GkbdIndicatorPlugin {
*/
extern void
- gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc,
- GConfClient * conf_client);
+ gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc);
extern void
gkbd_indicator_plugin_container_term (GkbdIndicatorPluginContainer * pc);
extern void
- gkbd_indicator_plugin_container_reinit_ui (GkbdIndicatorPluginContainer * pc);
+
+
+
+gkbd_indicator_plugin_container_reinit_ui (GkbdIndicatorPluginContainer *
+ pc);
extern guint
gkbd_indicator_plugin_get_num_groups (GkbdIndicatorPluginContainer * pc);
diff --git a/libgnomekbd/gkbd-indicator.c b/libgnomekbd/gkbd-indicator.c
index 89ed92a..6411c2e 100644
--- a/libgnomekbd/gkbd-indicator.c
+++ b/libgnomekbd/gkbd-indicator.c
@@ -117,8 +117,7 @@ gkbd_indicator_load_images ()
GTK_BUTTONS_OK,
_
("There was an error loading an image: %s"),
- gerror->
- message);
+ gerror->message);
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK
@@ -273,28 +272,29 @@ flag_exposed (GtkWidget * flag, GdkEventExpose * event, GdkPixbuf * image)
int ih = gdk_pixbuf_get_height (image);
GtkAllocation allocation;
double xwiratio, ywiratio, wiratio;
- cairo_t *cr;
+ cairo_t *cr;
gtk_widget_get_allocation (flag, &allocation);
- cr = gdk_cairo_create (event->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
+ cr = gdk_cairo_create (event->window);
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
/* widget-to-image scales, X and Y */
xwiratio = 1.0 * allocation.width / iw;
ywiratio = 1.0 * allocation.height / ih;
wiratio = xwiratio < ywiratio ? xwiratio : ywiratio;
- /* transform cairo context */
- cairo_translate (cr, allocation.width / 2.0, allocation.height / 2.0);
- cairo_scale (cr, wiratio, wiratio);
- cairo_translate (cr, - iw / 2.0, - ih / 2.0);
+ /* transform cairo context */
+ cairo_translate (cr, allocation.width / 2.0,
+ allocation.height / 2.0);
+ cairo_scale (cr, wiratio, wiratio);
+ cairo_translate (cr, -iw / 2.0, -ih / 2.0);
- gdk_cairo_set_source_pixbuf (cr, image, 0, 0);
- cairo_paint (cr);
+ gdk_cairo_set_source_pixbuf (cr, image, 0, 0);
+ cairo_paint (cr);
- cairo_destroy (cr);
+ cairo_destroy (cr);
}
gchar *
@@ -307,9 +307,8 @@ gkbd_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 (!gkbd_keyboard_config_split_items
(full_layout_name, &layout_name,
@@ -411,8 +410,10 @@ gkbd_indicator_prepare_drawing (GkbdIndicator * gki, int group)
gkbd_indicator_extract_layout_name (group,
globals.engine,
&globals.kbd_cfg,
- globals.short_group_names,
- globals.full_group_names);
+ globals.
+ short_group_names,
+ globals.
+ full_group_names);
lbl_title =
gkbd_indicator_create_label_title (group,
@@ -485,12 +486,11 @@ gkbd_indicator_reinit_ui (GkbdIndicator * gki)
/* Should be called once for all widgets */
static void
-gkbd_indicator_cfg_changed (GConfClient * client,
- guint cnxn_id, GConfEntry * entry)
+gkbd_indicator_cfg_changed (GSettings * settings, gchar * key)
{
xkl_debug (100,
"General configuration changed in GConf - reiniting...\n");
- gkbd_desktop_config_load_from_gconf (&globals.cfg);
+ gkbd_desktop_config_load (&globals.cfg);
gkbd_desktop_config_activate (&globals.cfg);
ForAllIndicators () {
gkbd_indicator_reinit_ui (gki);
@@ -499,12 +499,11 @@ gkbd_indicator_cfg_changed (GConfClient * client,
/* Should be called once for all widgets */
static void
-gkbd_indicator_ind_cfg_changed (GConfClient * client,
- guint cnxn_id, GConfEntry * entry)
+gkbd_indicator_ind_cfg_changed (GSettings * settings, gchar * key)
{
xkl_debug (100,
"Applet configuration changed in GConf - reiniting...\n");
- gkbd_indicator_config_load_from_gconf (&globals.ind_cfg);
+ gkbd_indicator_config_load (&globals.ind_cfg);
gkbd_indicator_update_images ();
gkbd_indicator_config_activate (&globals.ind_cfg);
@@ -528,17 +527,14 @@ gkbd_indicator_load_group_names (const gchar ** layout_ids,
* full names are going to be used anyway */
gint i, total_groups =
xkl_engine_get_num_groups (globals.engine);
- globals.full_group_names =
- g_new0 (char *, total_groups + 1);
if (xkl_engine_get_features (globals.engine) &
XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
- GSList *lst = globals.kbd_cfg.layouts_variants;
- for (i = 0; lst; lst = lst->next, i++) {
- globals.full_group_names[i] =
- g_strdup ((char *) lst->data);
- }
+ globals.full_group_names =
+ g_strdupv (globals.kbd_cfg.layouts_variants);
} else {
+ globals.full_group_names =
+ g_new0 (char *, total_groups + 1);
for (i = total_groups; --i >= 0;) {
globals.full_group_names[i] =
g_strdup_printf ("Group %d", i);
@@ -606,8 +602,7 @@ gkbd_indicator_set_current_page (GkbdIndicator * gki)
cur_state = xkl_engine_get_current_state (globals.engine);
if (cur_state->group >= 0)
gkbd_indicator_set_current_page_for_group (gki,
- cur_state->
- group);
+ cur_state->group);
}
void
@@ -814,17 +809,16 @@ gkbd_indicator_class_init (GkbdIndicatorClass * klass)
static void
gkbd_indicator_global_init (void)
{
- GConfClient *gconf_client;
XklConfigRec *xklrec = xkl_config_rec_new ();
- globals.engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ globals.engine =
+ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY
+ (gdk_display_get_default ()));
if (globals.engine == NULL) {
xkl_debug (0, "Libxklavier initialization error");
return;
}
- gconf_client = gconf_client_get_default ();
-
g_signal_connect (globals.engine, "X-state-changed",
G_CALLBACK (gkbd_indicator_state_callback),
NULL);
@@ -832,19 +826,13 @@ gkbd_indicator_global_init (void)
G_CALLBACK (gkbd_indicator_kbd_cfg_callback),
NULL);
- gkbd_indicator_plugin_container_init (&globals.plugin_container,
- gconf_client);
-
- gkbd_desktop_config_init (&globals.cfg, gconf_client,
- globals.engine);
- gkbd_keyboard_config_init (&globals.kbd_cfg, gconf_client,
- globals.engine);
- gkbd_indicator_config_init (&globals.ind_cfg, gconf_client,
- globals.engine);
+ gkbd_indicator_plugin_container_init (&globals.plugin_container);
- g_object_unref (gconf_client);
+ gkbd_desktop_config_init (&globals.cfg, globals.engine);
+ gkbd_keyboard_config_init (&globals.kbd_cfg, globals.engine);
+ gkbd_indicator_config_init (&globals.ind_cfg, globals.engine);
- gkbd_desktop_config_load_from_gconf (&globals.cfg);
+ gkbd_desktop_config_load (&globals.cfg);
gkbd_desktop_config_activate (&globals.cfg);
globals.registry =
@@ -855,7 +843,7 @@ gkbd_indicator_global_init (void)
gkbd_keyboard_config_load_from_x_current (&globals.kbd_cfg,
xklrec);
- gkbd_indicator_config_load_from_gconf (&globals.ind_cfg);
+ gkbd_indicator_config_load (&globals.ind_cfg);
gkbd_indicator_update_images ();
gkbd_indicator_config_activate (&globals.ind_cfg);
@@ -868,12 +856,10 @@ gkbd_indicator_global_init (void)
gkbd_indicator_plugin_manager_init_enabled_plugins
(&globals.plugin_manager, &globals.plugin_container,
globals.ind_cfg.enabled_plugins);
- gkbd_desktop_config_start_listen (&globals.cfg,
- (GConfClientNotifyFunc)
+ gkbd_desktop_config_start_listen (&globals.cfg, (GCallback)
gkbd_indicator_cfg_changed,
NULL);
- gkbd_indicator_config_start_listen (&globals.ind_cfg,
- (GConfClientNotifyFunc)
+ gkbd_indicator_config_start_listen (&globals.ind_cfg, (GCallback)
gkbd_indicator_ind_cfg_changed,
NULL);
gkbd_indicator_start_listen ();
diff --git a/libgnomekbd/gkbd-keyboard-config.c b/libgnomekbd/gkbd-keyboard-config.c
index 622c1bd..fdeb6f7 100644
--- a/libgnomekbd/gkbd-keyboard-config.c
+++ b/libgnomekbd/gkbd-keyboard-config.c
@@ -32,18 +32,13 @@
/**
* GkbdKeyboardConfig
*/
-#define GKBD_KEYBOARD_CONFIG_KEY_PREFIX GKBD_CONFIG_KEY_PREFIX "/kbd"
#define GROUP_SWITCHERS_GROUP "grp"
#define DEFAULT_GROUP_SWITCH "grp:shift_caps_toggle"
-const gchar GKBD_KEYBOARD_CONFIG_DIR[] = GKBD_KEYBOARD_CONFIG_KEY_PREFIX;
-const gchar GKBD_KEYBOARD_CONFIG_KEY_MODEL[] =
- GKBD_KEYBOARD_CONFIG_KEY_PREFIX "/model";
-const gchar GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[] =
- GKBD_KEYBOARD_CONFIG_KEY_PREFIX "/layouts";
-const gchar GKBD_KEYBOARD_CONFIG_KEY_OPTIONS[] =
- GKBD_KEYBOARD_CONFIG_KEY_PREFIX "/options";
+const gchar GKBD_KEYBOARD_CONFIG_KEY_MODEL[] = "model";
+const gchar GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[] = "layouts";
+const gchar GKBD_KEYBOARD_CONFIG_KEY_OPTIONS[] = "options";
const gchar *GKBD_KEYBOARD_CONFIG_ACTIVE[] = {
GKBD_KEYBOARD_CONFIG_KEY_MODEL,
@@ -54,33 +49,25 @@ const gchar *GKBD_KEYBOARD_CONFIG_ACTIVE[] = {
/**
* static common functions
*/
-static void
-gkbd_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 != *l2) {
+ if (*l1 && *l2) {
+ if (g_ascii_strcasecmp (*l1, *l2))
+ return FALSE;
+ } else
+ return FALSE;
+ }
+
+ l1++;
+ l2++;
}
- return (l1 == NULL && l2 == NULL);
+ return (*l1 && *l2);
}
gboolean
@@ -187,49 +174,38 @@ gkbd_keyboard_config_split_items (const gchar * merged, gchar ** parent,
/**
* static GkbdKeyboardConfig functions
*/
-static void
-gkbd_keyboard_config_options_add_full (GkbdKeyboardConfig * kbd_config,
- const gchar * full_option_name)
-{
- kbd_config->options =
- g_slist_append (kbd_config->options,
- g_strdup (full_option_name));
-}
-
-static void
-gkbd_keyboard_config_layouts_add_full (GkbdKeyboardConfig * 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
gkbd_keyboard_config_copy_from_xkl_config (GkbdKeyboardConfig * kbd_config,
XklConfigRec * pdata)
{
char **p, **p1;
+ int i;
gkbd_keyboard_config_model_set (kbd_config, pdata->model);
xkl_debug (150, "Loaded Kbd model: [%s]\n", pdata->model);
- gkbd_keyboard_config_layouts_reset (kbd_config);
+ g_strfreev (kbd_config->layouts_variants);
p = pdata->layouts;
p1 = pdata->variants;
+ kbd_config->layouts_variants =
+ g_new0 (gchar *, g_strv_length (pdata->layouts) + 1);
+ i = 0;
while (p != NULL && *p != NULL) {
const gchar *full_layout =
gkbd_keyboard_config_merge_items (*p, *p1);
xkl_debug (150,
"Loaded Kbd layout (with variant): [%s]\n",
full_layout);
- gkbd_keyboard_config_layouts_add_full (kbd_config,
- full_layout);
+ kbd_config->layouts_variants[i++] = g_strdup (full_layout);
p++;
p1++;
}
- gkbd_keyboard_config_options_reset (kbd_config);
+ g_strfreev (kbd_config->options);
+ kbd_config->options =
+ g_new0 (gchar *, g_strv_length (pdata->options) + 1);
p = pdata->options;
+ i = 0;
while (p != NULL && *p != NULL) {
char group[XKL_MAX_CI_NAME_LENGTH];
char *option = *p;
@@ -242,7 +218,7 @@ gkbd_keyboard_config_copy_from_xkl_config (GkbdKeyboardConfig * kbd_config,
group[len] = 0;
xkl_debug (150, "Loaded Kbd option: [%s][%s]\n",
group, option);
- gkbd_keyboard_config_options_add (kbd_config,
+ gkbd_keyboard_config_options_set (kbd_config, i++,
group, option);
}
p++;
@@ -261,14 +237,14 @@ gkbd_keyboard_config_copy_to_xkl_config (GkbdKeyboardConfig * 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 +252,7 @@ gkbd_keyboard_config_copy_to_xkl_config (GkbdKeyboardConfig * kbd_config,
for (i = num_layouts; --i >= 0;) {
char *layout, *variant;
if (gkbd_keyboard_config_split_items
- (the_layout_variant->data, &layout, &variant)
+ (*the_layout_variant, &layout, &variant)
&& variant != NULL) {
*p1 =
(layout ==
@@ -288,9 +264,9 @@ gkbd_keyboard_config_copy_to_xkl_config (GkbdKeyboardConfig * 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 +274,26 @@ gkbd_keyboard_config_copy_to_xkl_config (GkbdKeyboardConfig * 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 (gkbd_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 +302,10 @@ static void
gkbd_keyboard_config_load_params (GkbdKeyboardConfig * kbd_config,
const gchar * param_names[])
{
- GError *gerror = NULL;
gchar *pc;
- GSList *pl, *l;
-
- pc = gconf_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) {
gkbd_keyboard_config_model_set (kbd_config, NULL);
} else {
gkbd_keyboard_config_model_set (kbd_config, pc);
@@ -348,97 +314,62 @@ gkbd_keyboard_config_load_params (GkbdKeyboardConfig * kbd_config,
xkl_debug (150, "Loaded Kbd model: [%s]\n",
kbd_config->model ? kbd_config->model : "(null)");
- gkbd_keyboard_config_layouts_reset (kbd_config);
-
- l = pl = gconf_client_get_list (kbd_config->conf_client,
- param_names[1],
- GCONF_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);
- gkbd_keyboard_config_layouts_add_full (kbd_config,
- l->data);
- l = l->next;
- }
- gkbd_keyboard_config_string_list_reset (&pl);
-
- gkbd_keyboard_config_options_reset (kbd_config);
-
- l = pl = gconf_client_get_list (kbd_config->conf_client,
- param_names[2],
- GCONF_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]);
- while (l != NULL) {
- xkl_debug (150, "Loaded Kbd option: [%s]\n", l->data);
- gkbd_keyboard_config_options_add_full (kbd_config,
- (const gchar *)
- l->data);
- l = l->next;
- }
- gkbd_keyboard_config_string_list_reset (&pl);
+ g_strfreev (kbd_config->options);
+
+ kbd_config->options =
+ g_settings_get_strv (kbd_config->settings, param_names[2]);
}
static void
gkbd_keyboard_config_save_params (GkbdKeyboardConfig * kbd_config,
- GConfChangeSet * cs,
const gchar * param_names[])
{
- GSList *pl;
+ gchar **pl;
if (kbd_config->model)
- gconf_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
- gconf_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++;
}
- gconf_change_set_set_list (cs,
- param_names[1],
- GCONF_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");
- gconf_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++;
}
- gconf_change_set_set_list (cs,
- param_names[2],
- GCONF_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");
- gconf_change_set_unset (cs, param_names[2]);
+ g_settings_set_strv (kbd_config->settings,
+ param_names[2], NULL);
}
}
@@ -447,23 +378,11 @@ gkbd_keyboard_config_save_params (GkbdKeyboardConfig * kbd_config,
*/
void
gkbd_keyboard_config_init (GkbdKeyboardConfig * kbd_config,
- GConfClient * 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 (GKBD_KEYBOARD_SCHEMA);
kbd_config->engine = engine;
- g_object_ref (kbd_config->conf_client);
-
- gconf_client_add_dir (kbd_config->conf_client,
- GKBD_KEYBOARD_CONFIG_DIR,
- GCONF_CLIENT_PRELOAD_NONE, &gerror);
- if (gerror != NULL) {
- g_warning ("err: %s\n", gerror->message);
- g_error_free (gerror);
- gerror = NULL;
- }
}
void
@@ -471,47 +390,37 @@ gkbd_keyboard_config_term (GkbdKeyboardConfig * kbd_config)
{
gkbd_keyboard_config_model_set (kbd_config, NULL);
- gkbd_keyboard_config_layouts_reset (kbd_config);
- gkbd_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
-gkbd_keyboard_config_load_from_gconf (GkbdKeyboardConfig * kbd_config,
- GkbdKeyboardConfig *
- kbd_config_default)
+gkbd_keyboard_config_load (GkbdKeyboardConfig * kbd_config,
+ GkbdKeyboardConfig * kbd_config_default)
{
gkbd_keyboard_config_load_params (kbd_config,
GKBD_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);
}
}
}
@@ -565,32 +474,20 @@ gkbd_keyboard_config_equals (GkbdKeyboardConfig * 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);
+ return g_strv_equal (kbd_config1->layouts_variants,
+ kbd_config2->layouts_variants)
+ && g_strv_equal (kbd_config1->options, kbd_config2->options);
}
void
-gkbd_keyboard_config_save_to_gconf (GkbdKeyboardConfig * kbd_config)
+gkbd_keyboard_config_save (GkbdKeyboardConfig * kbd_config)
{
- GConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = gconf_change_set_new ();
+ g_settings_delay (kbd_config->settings);
- gkbd_keyboard_config_save_params (kbd_config, cs,
+ gkbd_keyboard_config_save_params (kbd_config,
GKBD_KEYBOARD_CONFIG_ACTIVE);
- gconf_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;
- }
- gconf_change_set_unref (cs);
+ g_settings_apply (kbd_config->settings);
}
void
@@ -605,36 +502,8 @@ gkbd_keyboard_config_model_set (GkbdKeyboardConfig * kbd_config,
}
void
-gkbd_keyboard_config_layouts_add (GkbdKeyboardConfig * kbd_config,
- const gchar * layout_name,
- const gchar * variant_name)
-{
- const gchar *merged;
- if (layout_name == NULL)
- return;
- merged =
- gkbd_keyboard_config_merge_items (layout_name, variant_name);
- if (merged == NULL)
- return;
- gkbd_keyboard_config_layouts_add_full (kbd_config, merged);
-}
-
-void
-gkbd_keyboard_config_layouts_reset (GkbdKeyboardConfig * kbd_config)
-{
- gkbd_keyboard_config_string_list_reset
- (&kbd_config->layouts_variants);
-}
-
-void
-gkbd_keyboard_config_options_reset (GkbdKeyboardConfig * kbd_config)
-{
- gkbd_keyboard_config_string_list_reset (&kbd_config->options);
-}
-
-void
-gkbd_keyboard_config_options_add (GkbdKeyboardConfig * kbd_config,
- const gchar * group_name,
+gkbd_keyboard_config_options_set (GkbdKeyboardConfig * kbd_config,
+ gint idx, const gchar * group_name,
const gchar * option_name)
{
const gchar *merged;
@@ -644,7 +513,7 @@ gkbd_keyboard_config_options_add (GkbdKeyboardConfig * kbd_config,
gkbd_keyboard_config_merge_items (group_name, option_name);
if (merged == NULL)
return;
- gkbd_keyboard_config_options_add_full (kbd_config, merged);
+ kbd_config->options[idx] = g_strdup (merged);
}
gboolean
@@ -652,14 +521,17 @@ gkbd_keyboard_config_options_is_set (GkbdKeyboardConfig * kbd_config,
const gchar * group_name,
const gchar * option_name)
{
+ gchar **p = kbd_config->options;
const gchar *merged =
gkbd_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 +549,19 @@ gkbd_keyboard_config_activate (GkbdKeyboardConfig * kbd_config)
void
gkbd_keyboard_config_start_listen (GkbdKeyboardConfig * kbd_config,
- GConfClientNotifyFunc func,
- gpointer user_data)
+ GCallback func, gpointer user_data)
{
- gkbd_desktop_config_add_listener (kbd_config->conf_client,
- GKBD_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
gkbd_keyboard_config_stop_listen (GkbdKeyboardConfig * kbd_config)
{
- gkbd_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 +605,18 @@ gkbd_keyboard_config_to_string (const GkbdKeyboardConfig * 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 +629,12 @@ gkbd_keyboard_config_to_string (const GkbdKeyboardConfig * 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
@@ -795,7 +663,9 @@ GSList *
gkbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
layouts_list,
GSList *
- options_list, gboolean *was_appended)
+ options_list,
+ gboolean *
+ was_appended)
{
*was_appended = FALSE;
if (g_slist_length (layouts_list) >= 2) {
diff --git a/libgnomekbd/gkbd-keyboard-config.h b/libgnomekbd/gkbd-keyboard-config.h
index dfe2bbc..20f454b 100644
--- a/libgnomekbd/gkbd-keyboard-config.h
+++ b/libgnomekbd/gkbd-keyboard-config.h
@@ -22,10 +22,11 @@
#include <X11/Xlib.h>
#include <glib.h>
-#include <gconf/gconf-client.h>
+#include <gio/gio.h>
#include <libxklavier/xklavier.h>
-extern const gchar GKBD_KEYBOARD_CONFIG_DIR[];
+#define GKBD_KEYBOARD_SCHEMA "org.gnome.libgnomekbd.keyboard"
+
extern const gchar GKBD_KEYBOARD_CONFIG_KEY_MODEL[];
extern const gchar GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[];
extern const gchar GKBD_KEYBOARD_CONFIG_KEY_OPTIONS[];
@@ -35,11 +36,11 @@ extern const gchar GKBD_KEYBOARD_CONFIG_KEY_OPTIONS[];
*/
typedef struct _GkbdKeyboardConfig {
gchar *model;
- GSList *layouts_variants;
- GSList *options;
+ gchar **layouts_variants;
+ gchar **options;
/* private, transient */
- GConfClient *conf_client;
+ GSettings *settings;
int config_listener_id;
XklEngine *engine;
} GkbdKeyboardConfig;
@@ -48,17 +49,14 @@ typedef struct _GkbdKeyboardConfig {
* GkbdKeyboardConfig functions
*/
extern void gkbd_keyboard_config_init (GkbdKeyboardConfig * kbd_config,
- GConfClient * conf_client,
XklEngine * engine);
extern void gkbd_keyboard_config_term (GkbdKeyboardConfig * kbd_config);
-extern void gkbd_keyboard_config_load_from_gconf (GkbdKeyboardConfig *
- kbd_config,
- GkbdKeyboardConfig *
- kbd_config_default);
+extern void gkbd_keyboard_config_load (GkbdKeyboardConfig * kbd_config,
+ GkbdKeyboardConfig *
+ kbd_config_default);
-extern void gkbd_keyboard_config_save_to_gconf (GkbdKeyboardConfig *
- kbd_config);
+extern void gkbd_keyboard_config_save (GkbdKeyboardConfig * kbd_config);
extern void gkbd_keyboard_config_load_from_x_initial (GkbdKeyboardConfig *
kbd_config,
@@ -70,7 +68,7 @@ extern void gkbd_keyboard_config_load_from_x_current (GkbdKeyboardConfig *
extern void gkbd_keyboard_config_start_listen (GkbdKeyboardConfig *
kbd_config,
- GConfClientNotifyFunc func,
+ GCallback func,
gpointer user_data);
extern void gkbd_keyboard_config_stop_listen (GkbdKeyboardConfig *
@@ -113,12 +111,12 @@ extern gchar *gkbd_keyboard_config_to_string (const GkbdKeyboardConfig *
config);
extern GSList
- *gkbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
- layouts_list,
- GSList *
- options_list,
- gboolean
- *
- was_appended);
+ * gkbd_keyboard_config_add_default_switch_option_if_necessary (GSList *
+ layouts_list,
+ GSList *
+ options_list,
+ gboolean
+ *
+ was_appended);
#endif
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 3de2125..74a1cbe 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -1101,8 +1101,9 @@ invalidate_indicator_doodad_region (GkbdKeyboardDrawing * drawing,
doodad->doodad->indicator.left,
doodad->origin_y +
doodad->doodad->indicator.top,
- &drawing->xkb->geom->shapes[doodad->
- doodad->indicator.shape_ndx]);
+ &drawing->xkb->geom->shapes[doodad->doodad->
+ indicator.
+ shape_ndx]);
}
static void
@@ -1116,8 +1117,8 @@ invalidate_key_region (GkbdKeyboardDrawing * drawing,
key->angle,
key->origin_x,
key->origin_y,
- &drawing->xkb->geom->shapes[key->
- xkbkey->shape_ndx]);
+ &drawing->xkb->geom->shapes[key->xkbkey->
+ shape_ndx]);
}
static void
@@ -1324,7 +1325,7 @@ static void
draw_keyboard (GkbdKeyboardDrawing * drawing)
{
GtkStateType state = gtk_widget_get_state (GTK_WIDGET (drawing));
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (drawing));
+ GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (drawing));
GtkAllocation allocation;
if (!drawing->xkb)
@@ -1337,10 +1338,10 @@ draw_keyboard (GkbdKeyboardDrawing * drawing)
allocation.width, allocation.height, -1);
if (create_cairo (drawing)) {
- /* blank background */
- gdk_cairo_set_source_color (drawing->renderContext->cr,
- &style->base[state]);
- cairo_paint (drawing->renderContext->cr);
+ /* blank background */
+ gdk_cairo_set_source_color (drawing->renderContext->cr,
+ &style->base[state]);
+ cairo_paint (drawing->renderContext->cr);
draw_keyboard_to_context (drawing->renderContext, drawing);
destroy_cairo (drawing);
@@ -1384,7 +1385,7 @@ expose_event (GtkWidget * widget,
GdkEventExpose * event, GkbdKeyboardDrawing * drawing)
{
GtkAllocation allocation;
- cairo_t *cr;
+ cairo_t *cr;
if (!drawing->xkb)
return FALSE;
@@ -1392,14 +1393,14 @@ expose_event (GtkWidget * widget,
if (drawing->pixmap == NULL)
return FALSE;
- cr = gdk_cairo_create (event->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
+ cr = gdk_cairo_create (event->window);
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
- gdk_cairo_set_source_pixmap (cr, drawing->pixmap, 0, 0);
- cairo_paint (cr);
+ gdk_cairo_set_source_pixmap (cr, drawing->pixmap, 0, 0);
+ cairo_paint (cr);
- cairo_destroy (cr);
+ cairo_destroy (cr);
if (gtk_widget_has_focus (widget)) {
gtk_widget_get_allocation (widget, &allocation);
@@ -1686,8 +1687,8 @@ init_keys_and_doodads (GkbdKeyboardDrawing * drawing)
drawing->xkb->geom->shapes +
xkbkey->shape_ndx;
guint keycode = find_keycode (drawing,
- xkbkey->
- name.name);
+ xkbkey->name.
+ name);
if (keycode == INVALID_KEYCODE)
continue;
@@ -1798,9 +1799,8 @@ init_colors (GkbdKeyboardDrawing * drawing)
for (i = 0; i < drawing->xkb->geom->num_colors; i++) {
result =
- parse_xkb_color_spec (drawing->xkb->geom->
- colors[i].spec,
- drawing->colors + i);
+ parse_xkb_color_spec (drawing->xkb->geom->colors[i].
+ spec, drawing->colors + i);
if (!result)
g_warning
@@ -1930,8 +1930,8 @@ xkb_state_notify_event_filter (GdkXEvent * gdkxev,
process_indicators_state_notify (&
((XkbEvent
*)
- gdkxev)->indicators,
-drawing);
+ gdkxev)->
+indicators, drawing);
}
break;
@@ -2169,9 +2169,15 @@ gkbd_keyboard_drawing_get_pixbuf (GkbdKeyboardDrawing * drawing)
return gdk_pixbuf_get_from_drawable (NULL, drawing->pixmap, NULL,
0, 0, 0, 0,
xkb_to_pixmap_coord (context,
- drawing->xkb->geom->width_mm),
+ drawing->
+ xkb->
+ geom->
+ width_mm),
xkb_to_pixmap_coord (context,
- drawing->xkb->geom->height_mm));
+ drawing->
+ xkb->
+ geom->
+ height_mm));
}
/**
@@ -2524,7 +2530,9 @@ gkbd_keyboard_drawing_new_dialog (gint group, gchar * group_name)
GdkRectangle *rect;
GError *error = NULL;
char title[128] = "";
- XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ XklEngine *engine =
+ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY
+ (gdk_display_get_default ()));
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, UIDIR "/show-layout.ui",
diff --git a/libgnomekbd/gkbd-keyboard-drawing.h b/libgnomekbd/gkbd-keyboard-drawing.h
index ca2a12e..d1d22ab 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.h
+++ b/libgnomekbd/gkbd-keyboard-drawing.h
@@ -209,7 +209,8 @@ void gkbd_keyboard_drawing_print (GkbdKeyboardDrawing * drawing,
const gchar * description);
-GtkWidget* gkbd_keyboard_drawing_new_dialog (gint group, gchar* group_name);
+GtkWidget *gkbd_keyboard_drawing_new_dialog (gint group,
+ gchar * group_name);
G_END_DECLS
#endif /* #ifndef GKBD_KEYBOARD_DRAWING_H */
diff --git a/libgnomekbd/gkbd-status.c b/libgnomekbd/gkbd-status.c
index c6ac2d6..3f3c9c8 100644
--- a/libgnomekbd/gkbd-status.c
+++ b/libgnomekbd/gkbd-status.c
@@ -215,8 +215,10 @@ gkbd_status_render_cairo (cairo_t * cr, int group)
layout_name = gkbd_indicator_extract_layout_name (group,
globals.engine,
&globals.kbd_cfg,
- globals.short_group_names,
- globals.full_group_names);
+ globals.
+ short_group_names,
+ globals.
+ full_group_names);
lbl_title =
gkbd_indicator_create_label_title (group, &ln2cnt_map,
layout_name);
@@ -305,13 +307,14 @@ gkbd_status_prepare_drawing (GkbdStatus * gki, int group)
if (globals.ind_cfg.show_flags) {
image_filename =
- (char *) g_slist_nth_data (globals.
- ind_cfg.image_filenames,
- group);
+ (char *) g_slist_nth_data (globals.ind_cfg.
+ image_filenames, group);
image = gdk_pixbuf_new_from_file_at_size (image_filename,
- globals.current_width,
- globals.current_height,
+ globals.
+ current_width,
+ globals.
+ current_height,
&gerror);
if (image == NULL) {
@@ -326,7 +329,8 @@ gkbd_status_prepare_drawing (GkbdStatus * gki, int group)
NULL ?
"Unknown"
:
- gerror->message);
+ gerror->
+ message);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
@@ -420,12 +424,11 @@ gkbd_status_reinit_ui (GkbdStatus * gki)
/* Should be called once for all widgets */
static void
-gkbd_status_cfg_changed (GConfClient * client,
- guint cnxn_id, GConfEntry * entry)
+gkbd_status_cfg_changed (GSettings * settings, gchar * key)
{
xkl_debug (100,
"General configuration changed in GConf - reiniting...\n");
- gkbd_desktop_config_load_from_gconf (&globals.cfg);
+ gkbd_desktop_config_load (&globals.cfg);
gkbd_desktop_config_activate (&globals.cfg);
ForAllIndicators () {
gkbd_status_reinit_ui (gki);
@@ -434,12 +437,11 @@ gkbd_status_cfg_changed (GConfClient * client,
/* Should be called once for all widgets */
static void
-gkbd_status_ind_cfg_changed (GConfClient * client,
- guint cnxn_id, GConfEntry * entry)
+gkbd_status_ind_cfg_changed (GSettings * settings, gchar * key)
{
xkl_debug (100,
"Applet configuration changed in GConf - reiniting...\n");
- gkbd_indicator_config_load_from_gconf (&globals.ind_cfg);
+ gkbd_indicator_config_load (&globals.ind_cfg);
gkbd_indicator_config_free_image_filenames (&globals.ind_cfg);
gkbd_indicator_config_load_image_filenames (&globals.ind_cfg,
@@ -465,17 +467,14 @@ gkbd_status_load_group_names (const gchar ** layout_ids,
xkl_engine_get_num_groups (globals.engine);
xkl_debug (150, "group descriptions loaded: %d!\n",
total_groups);
- globals.full_group_names =
- g_new0 (char *, total_groups + 1);
if (xkl_engine_get_features (globals.engine) &
XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
- GSList *lst = globals.kbd_cfg.layouts_variants;
- for (i = 0; lst; lst = lst->next, i++) {
- globals.full_group_names[i] =
- g_strdup ((char *) lst->data);
- }
+ globals.full_group_names =
+ g_strdupv (globals.kbd_cfg.layouts_variants);
} else {
+ globals.full_group_names =
+ g_new0 (char *, total_groups + 1);
for (i = total_groups; --i >= 0;) {
globals.full_group_names[i] =
g_strdup_printf ("Group %d", i);
@@ -693,9 +692,8 @@ gkbd_status_finalize (GObject * obj)
for (i = sizeof (settings_signal_names) /
sizeof (settings_signal_names[0]); --i >= 0;)
g_signal_handler_disconnect (gtk_settings_get_default (),
- gki->
- priv->settings_signal_handlers
- [i]);
+ gki->priv->
+ settings_signal_handlers[i]);
/* remove BEFORE all termination work is finished */
globals.widget_instances =
@@ -730,13 +728,15 @@ gkbd_status_global_term (void)
if (g_signal_handler_is_connected
(globals.engine, globals.state_changed_handler)) {
g_signal_handler_disconnect (globals.engine,
- globals.state_changed_handler);
+ globals.
+ state_changed_handler);
globals.state_changed_handler = 0;
}
if (g_signal_handler_is_connected
(globals.engine, globals.config_changed_handler)) {
g_signal_handler_disconnect (globals.engine,
- globals.config_changed_handler);
+ globals.
+ config_changed_handler);
globals.config_changed_handler = 0;
}
@@ -768,17 +768,16 @@ gkbd_status_class_init (GkbdStatusClass * klass)
static void
gkbd_status_global_init (void)
{
- GConfClient *gconf_client;
XklConfigRec *xklrec = xkl_config_rec_new ();
- globals.engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ globals.engine =
+ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY
+ (gdk_display_get_default ()));
if (globals.engine == NULL) {
xkl_debug (0, "Libxklavier initialization error");
return;
}
- gconf_client = gconf_client_get_default ();
-
globals.state_changed_handler =
g_signal_connect (globals.engine, "X-state-changed",
G_CALLBACK (gkbd_status_state_callback),
@@ -788,16 +787,11 @@ gkbd_status_global_init (void)
G_CALLBACK (gkbd_status_kbd_cfg_callback),
NULL);
- gkbd_desktop_config_init (&globals.cfg, gconf_client,
- globals.engine);
- gkbd_keyboard_config_init (&globals.kbd_cfg, gconf_client,
- globals.engine);
- gkbd_indicator_config_init (&globals.ind_cfg, gconf_client,
- globals.engine);
-
- g_object_unref (gconf_client);
+ gkbd_desktop_config_init (&globals.cfg, globals.engine);
+ gkbd_keyboard_config_init (&globals.kbd_cfg, globals.engine);
+ gkbd_indicator_config_init (&globals.ind_cfg, globals.engine);
- gkbd_desktop_config_load_from_gconf (&globals.cfg);
+ gkbd_desktop_config_load (&globals.cfg);
gkbd_desktop_config_activate (&globals.cfg);
globals.registry =
@@ -808,7 +802,7 @@ gkbd_status_global_init (void)
gkbd_keyboard_config_load_from_x_current (&globals.kbd_cfg,
xklrec);
- gkbd_indicator_config_load_from_gconf (&globals.ind_cfg);
+ gkbd_indicator_config_load (&globals.ind_cfg);
gkbd_indicator_config_load_image_filenames (&globals.ind_cfg,
&globals.kbd_cfg);
@@ -819,11 +813,9 @@ gkbd_status_global_init (void)
(const gchar **) xklrec->variants);
g_object_unref (G_OBJECT (xklrec));
- gkbd_desktop_config_start_listen (&globals.cfg,
- (GConfClientNotifyFunc)
+ gkbd_desktop_config_start_listen (&globals.cfg, (GCallback)
gkbd_status_cfg_changed, NULL);
- gkbd_indicator_config_start_listen (&globals.ind_cfg,
- (GConfClientNotifyFunc)
+ gkbd_indicator_config_start_listen (&globals.ind_cfg, (GCallback)
gkbd_status_ind_cfg_changed,
NULL);
gkbd_status_start_listen ();
diff --git a/libgnomekbd/gkbd-util.c b/libgnomekbd/gkbd-util.c
index d2495f9..0812804 100644
--- a/libgnomekbd/gkbd-util.c
+++ b/libgnomekbd/gkbd-util.c
@@ -27,8 +27,6 @@
#include <libxklavier/xklavier.h>
-#include <gconf/gconf-client.h>
-
#include <gkbd-config-private.h>
static void
@@ -62,55 +60,22 @@ const gchar GKBD_PREVIEW_CONFIG_KEY_HEIGHT[] =
GdkRectangle *
gkbd_preview_load_position (void)
{
- GError *gerror = NULL;
GdkRectangle *rv = NULL;
gint x, y, w, h;
- GConfClient *conf_client = gconf_client_get_default ();
+ GSettings *settings = g_settings_new (GKBD_SCHEMA);
- if (conf_client == NULL)
+ if (settings == NULL)
return NULL;
- x = gconf_client_get_int (conf_client,
- GKBD_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;
- }
+ x = g_settings_get_int (settings, GKBD_PREVIEW_CONFIG_KEY_X);
- y = gconf_client_get_int (conf_client,
- GKBD_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;
- }
+ y = g_settings_get_int (settings, GKBD_PREVIEW_CONFIG_KEY_Y);
- w = gconf_client_get_int (conf_client,
- GKBD_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;
- }
+ w = g_settings_get_int (settings, GKBD_PREVIEW_CONFIG_KEY_WIDTH);
- h = gconf_client_get_int (conf_client,
- GKBD_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;
- }
+ h = g_settings_get_int (settings, GKBD_PREVIEW_CONFIG_KEY_HEIGHT);
- g_object_unref (G_OBJECT (conf_client));
+ g_object_unref (G_OBJECT (settings));
rv = g_new (GdkRectangle, 1);
if (x == -1 || y == -1 || w == -1 || h == -1) {
@@ -135,25 +100,17 @@ gkbd_preview_load_position (void)
void
gkbd_preview_save_position (GdkRectangle * rect)
{
- GConfClient *conf_client = gconf_client_get_default ();
- GConfChangeSet *cs;
- GError *gerror = NULL;
-
- cs = gconf_change_set_new ();
-
- gconf_change_set_set_int (cs, GKBD_PREVIEW_CONFIG_KEY_X, rect->x);
- gconf_change_set_set_int (cs, GKBD_PREVIEW_CONFIG_KEY_Y, rect->y);
- gconf_change_set_set_int (cs, GKBD_PREVIEW_CONFIG_KEY_WIDTH,
- rect->width);
- gconf_change_set_set_int (cs, GKBD_PREVIEW_CONFIG_KEY_HEIGHT,
- rect->height);
-
- gconf_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);
- }
- gconf_change_set_unref (cs);
- g_object_unref (G_OBJECT (conf_client));
+ GSettings *settings = g_settings_new (GKBD_SCHEMA);
+
+ g_settings_delay (settings);
+
+ g_settings_set_int (settings, GKBD_PREVIEW_CONFIG_KEY_X, rect->x);
+ g_settings_set_int (settings, GKBD_PREVIEW_CONFIG_KEY_Y, rect->y);
+ g_settings_set_int (settings, GKBD_PREVIEW_CONFIG_KEY_WIDTH,
+ rect->width);
+ g_settings_set_int (settings, GKBD_PREVIEW_CONFIG_KEY_HEIGHT,
+ rect->height);
+
+ g_settings_apply (settings);
+ g_object_unref (G_OBJECT (settings));
}
diff --git a/libgnomekbd/org.gnome.libgnomekbd.desktop.gschema.xml b/libgnomekbd/org.gnome.libgnomekbd.desktop.gschema.xml
new file mode 100644
index 0000000..61e839f
--- /dev/null
+++ b/libgnomekbd/org.gnome.libgnomekbd.desktop.gschema.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<schemalist>
+ <schema id="org.gnome.libgnomekbd.desktop" path="/desktop/gnome/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-chg-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>
+</schemalist>
diff --git a/libgnomekbd/org.gnome.libgnomekbd.gschema.xml b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml
new file mode 100644
index 0000000..a2c9ace
--- /dev/null
+++ b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<schemalist>
+ <schema id="org.gnome.libgnomekbd" path="/desktop/gnome/peripherals/keyboard/">
+ <child name="preview" schema="org.gnome.libgnomekbd.preview"/>
+ <child name="indicator" schema="org.gnome.libgnomekbd.indicator"/>
+ </schema>
+ <schema id="org.gnome.libgnomekbd.preview" path="/desktop/gnome/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.gnome.libgnomekbd.indicator" path="/desktop/gnome/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>
+ <summary>Show flags in the applet</summary>
+ <description>Show flags in the applet to indicate the current layout</description>
+ </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>
+ <key name="enabled-plugins" type="as">
+ <default>[]</default>
+ <summary>The list of enabled Keyboard Indicator plugins</summary>
+ <description>The list of enabled Keyboard Indicator plugins</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/libgnomekbd/org.gnome.libgnomekbd.keyboard.gschema.xml b/libgnomekbd/org.gnome.libgnomekbd.keyboard.gschema.xml
new file mode 100644
index 0000000..902b8c0
--- /dev/null
+++ b/libgnomekbd/org.gnome.libgnomekbd.keyboard.gschema.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schemalist>
+ <schema id="org.gnome.libgnomekbd.keyboard" path="/desktop/gnome/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>
+</schemalist>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6c996a5..23a04ee 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,7 +6,6 @@ libgnomekbd/gkbd-keyboard-drawing.c
libgnomekbd/gkbd-keyboard-config.c
libgnomekbd/gkbd-status.c
libgnomekbd/gkbd-util.c
-libgnomekbd/desktop_gnome_peripherals_keyboard_xkb.schemas.in
[type: gettext/glade]libgnomekbd/show-layout.ui
[type: gettext/glade]capplet/gkbd-indicator-plugins.ui
[type: gettext/glade]capplet/gkbd-indicator-plugins_add.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]