[libgnomekbd] added gkbd_configuration_get_current_group



commit 2e76ce5ece796a39fc9af690b48a06c2b67d32f5
Author: Sergey V. Udaltsov <svu gnome org>
Date:   Tue Jan 4 21:13:35 2011 +0000

    added gkbd_configuration_get_current_group
    
    For js API

 libgnomekbd/gkbd-configuration.c |   40 +++++++++++++++++++++++--------------
 libgnomekbd/gkbd-configuration.h |    7 ++++-
 2 files changed, 30 insertions(+), 17 deletions(-)
---
diff --git a/libgnomekbd/gkbd-configuration.c b/libgnomekbd/gkbd-configuration.c
index 4971887..a592683 100644
--- a/libgnomekbd/gkbd-configuration.c
+++ b/libgnomekbd/gkbd-configuration.c
@@ -109,8 +109,10 @@ gkbd_configuration_load_group_names (GkbdConfiguration * configuration,
 							  xklrec->layouts,
 							  (const char **)
 							  xklrec->variants,
-							  &priv->short_group_names,
-							  &priv->full_group_names))
+							  &priv->
+							  short_group_names,
+							  &priv->
+							  full_group_names))
 	{
 		/* We just populate no short names (remain NULL) - 
 		 * full names are going to be used anyway */
@@ -356,8 +358,8 @@ gkbd_configuration_get_image_filename (GkbdConfiguration * configuration,
 {
 	if (!configuration->priv->ind_cfg.show_flags)
 		return NULL;
-	return (gchar *) g_slist_nth_data (configuration->priv->
-					   ind_cfg.image_filenames, group);
+	return (gchar *) g_slist_nth_data (configuration->priv->ind_cfg.
+					   image_filenames, group);
 }
 
 /**
@@ -383,8 +385,8 @@ gkbd_configuration_get_current_tooltip (GkbdConfiguration * configuration)
 		return NULL;
 
 	return g_strdup_printf (configuration->priv->tooltips_format,
-				configuration->
-				priv->full_group_names[state->group]);
+				configuration->priv->
+				full_group_names[state->group]);
 }
 
 gboolean
@@ -405,8 +407,8 @@ gkbd_configuration_extract_layout_name (GkbdConfiguration * configuration,
 		if (xkl_engine_get_features (engine) &
 		    XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
 			char *full_layout_name =
-			    configuration->priv->
-			    kbd_cfg.layouts_variants[group];
+			    configuration->priv->kbd_cfg.
+			    layouts_variants[group];
 			char *variant_name;
 			if (!gkbd_keyboard_config_split_items
 			    (full_layout_name, &layout_name,
@@ -446,11 +448,19 @@ gkbd_configuration_lock_next_group (GkbdConfiguration * configuration)
 }
 
 void
-gkbd_configuration_lock_group (GkbdConfiguration * configuration, guint group)
+gkbd_configuration_lock_group (GkbdConfiguration * configuration,
+			       guint group)
 {
 	xkl_engine_lock_group (configuration->priv->engine, group);
 }
 
+guint
+gkbd_configuration_get_current_group (GkbdConfiguration * configuration)
+{
+	XklState *state =
+	    xkl_engine_get_current_state (configuration->priv->engine);
+	return state ? state->group : 0;
+}
 
 /**
  * gkbd_configuration_get_indicator_config: 
@@ -509,10 +519,10 @@ gkbd_configuration_load_images (GkbdConfiguration * configuration)
 	GSList *image_filename, *images;
 
 	images = NULL;
-	gkbd_indicator_config_load_image_filenames (&configuration->priv->
-						    ind_cfg,
-						    &configuration->priv->
-						    kbd_cfg);
+	gkbd_indicator_config_load_image_filenames (&configuration->
+						    priv->ind_cfg,
+						    &configuration->
+						    priv->kbd_cfg);
 
 	if (!configuration->priv->ind_cfg.show_flags)
 		return NULL;
@@ -548,8 +558,8 @@ gkbd_configuration_free_images (GkbdConfiguration * configuration,
 	GdkPixbuf *pi;
 	GSList *img_node;
 
-	gkbd_indicator_config_free_image_filenames (&configuration->priv->
-						    ind_cfg);
+	gkbd_indicator_config_free_image_filenames (&configuration->
+						    priv->ind_cfg);
 
 	while ((img_node = images) != NULL) {
 		pi = GDK_PIXBUF (img_node->data);
diff --git a/libgnomekbd/gkbd-configuration.h b/libgnomekbd/gkbd-configuration.h
index b7dad09..f6c573a 100644
--- a/libgnomekbd/gkbd-configuration.h
+++ b/libgnomekbd/gkbd-configuration.h
@@ -65,8 +65,8 @@ extern gchar **gkbd_configuration_get_short_group_names (GkbdConfiguration
 							 * configuration);
 
 extern gchar *gkbd_configuration_get_image_filename (GkbdConfiguration *
-						      configuration,
-						      guint group);
+						     configuration,
+						     guint group);
 
 extern gchar *gkbd_configuration_get_current_tooltip (GkbdConfiguration *
 						      configuration);
@@ -84,6 +84,9 @@ extern void gkbd_configuration_lock_next_group (GkbdConfiguration *
 extern void gkbd_configuration_lock_group (GkbdConfiguration *
 					   configuration, guint group);
 
+extern guint gkbd_configuration_get_current_group (GkbdConfiguration *
+						   configuration);
+
 extern GkbdIndicatorConfig
     * gkbd_configuration_get_indicator_config (GkbdConfiguration *
 					       configuration);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]