[libgnomekbd] A bit of debug polished



commit 1c9b24473b1345af45ca22d357cf1e62bd70d9e0
Author: Sergey V. Udaltsov <svu gnome org>
Date:   Thu Jan 6 14:13:04 2011 +0000

    A bit of debug polished

 libgnomekbd/gkbd-configuration.c |    5 ++++-
 libgnomekbd/gkbd-indicator.c     |    1 -
 libgnomekbd/gkbd-status.c        |   29 +++++++++++++++++------------
 3 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/libgnomekbd/gkbd-configuration.c b/libgnomekbd/gkbd-configuration.c
index d924c75..413f89c 100644
--- a/libgnomekbd/gkbd-configuration.c
+++ b/libgnomekbd/gkbd-configuration.c
@@ -184,6 +184,9 @@ gkbd_configuration_init (GkbdConfiguration * configuration)
 	GkbdConfigurationPrivate *priv;
 	XklConfigRec *xklrec = xkl_config_rec_new ();
 
+	xkl_debug (100, "The config startup process for %p started\n",
+		   configuration);
+
 	priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration);
 	configuration->priv = priv;
 
@@ -242,7 +245,7 @@ gkbd_configuration_init (GkbdConfiguration * configuration)
 					    configuration);
 	xkl_engine_start_listen (priv->engine, XKLL_TRACK_KEYBOARD_STATE);
 
-	xkl_debug (100, "Initiating the widget startup process for %p\n",
+	xkl_debug (100, "The config startup process for %p completed\n",
 		   configuration);
 }
 
diff --git a/libgnomekbd/gkbd-indicator.c b/libgnomekbd/gkbd-indicator.c
index eb4bead..3f6f288 100644
--- a/libgnomekbd/gkbd-indicator.c
+++ b/libgnomekbd/gkbd-indicator.c
@@ -212,7 +212,6 @@ gkbd_indicator_prepare_drawing (GkbdIndicator * gki, int group)
 			return NULL;
 		image = GDK_PIXBUF (pimage);
 		flag = gtk_drawing_area_new ();
-		xkl_debug (0, "%d:%p:%p\n", group, image, flag);
 		gtk_widget_add_events (GTK_WIDGET (flag),
 				       GDK_BUTTON_PRESS_MASK);
 		g_signal_connect (G_OBJECT (flag), "draw",
diff --git a/libgnomekbd/gkbd-status.c b/libgnomekbd/gkbd-status.c
index ed0b058..6a27295 100644
--- a/libgnomekbd/gkbd-status.c
+++ b/libgnomekbd/gkbd-status.c
@@ -388,6 +388,7 @@ gkbd_status_reinit_ui (GkbdStatus * gki)
 static void
 gkbd_status_cfg_callback (GkbdConfiguration * configuration)
 {
+	xkl_debug (150, "Config changed: reinit ui\n");
 	gkbd_status_reinit_globals ();
 	ForAllObjects (configuration) {
 		gkbd_status_reinit_ui (GKBD_STATUS (gki));
@@ -398,8 +399,9 @@ gkbd_status_cfg_callback (GkbdConfiguration * configuration)
 static void
 gkbd_status_state_callback (GkbdConfiguration * configuration, gint group)
 {
+	xkl_debug (150, "Set page to group %d\n", group);
 	ForAllObjects (configuration) {
-		xkl_debug (200, "do repaint\n");
+		xkl_debug (150, "do repaint for icon %p\n", gki);
 		gkbd_status_set_current_page_for_group (GKBD_STATUS (gki),
 							group);
 	}
@@ -420,12 +422,15 @@ gkbd_status_set_current_page (GkbdStatus * gki)
 void
 gkbd_status_set_current_page_for_group (GkbdStatus * gki, int group)
 {
-	xkl_debug (200, "Revalidating for group %d\n", group);
+	GdkPixbuf *page = GDK_PIXBUF (g_slist_nth_data (globals.icons, group));
+	xkl_debug (150, "Revalidating for group %d: %p\n", group, page);
 
-	gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (gki),
-					 GDK_PIXBUF (g_slist_nth_data
-						     (globals.icons,
-						      group)));
+	if (page == NULL) {
+		xkl_debug (0, "Page for group %d is not ready\n", group);
+		return;
+	}
+
+	gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (gki), page);
 
 	gkbd_status_update_tooltips (gki);
 }
@@ -488,6 +493,7 @@ gkbd_status_stop_listen (void)
 static void
 gkbd_status_size_changed (GkbdStatus * gki, gint size)
 {
+	xkl_debug (150, "Size changed to %d\n", size);
 	if (globals.current_height != size) {
 		globals.current_height = size;
 		globals.current_width = size * 3 / 2;
@@ -500,6 +506,7 @@ static void
 gkbd_status_theme_changed (GtkSettings * settings, GParamSpec * pspec,
 			   GkbdStatus * gki)
 {
+	xkl_debug (150, "Theme changed\n");
 	gkbd_indicator_config_refresh_style
 	    (gkbd_configuration_get_indicator_config (globals.config));
 	gkbd_status_reinit_globals ();
@@ -519,7 +526,7 @@ gkbd_status_init (GkbdStatus * gki)
 	/* This should give Notification Area a hint about the order of icons */
 	gtk_status_icon_set_name (GTK_STATUS_ICON (gki), "keyboard");
 
-	xkl_debug (100, "Initiating the widget startup process for %p\n",
+	xkl_debug (100, "The status icon startup process for %p started\n",
 		   gki);
 
 	if (gkbd_configuration_get_xkl_engine (globals.config) == NULL) {
@@ -528,11 +535,6 @@ gkbd_status_init (GkbdStatus * gki)
 		return;
 	}
 
-	gkbd_status_set_tooltips (gki, NULL);
-
-	gkbd_status_fill_icons ();
-	gkbd_status_set_current_page (gki);
-
 	/* append AFTER all initialization work is finished */
 	gkbd_configuration_append_object (globals.config, G_OBJECT (gki));
 
@@ -549,6 +551,9 @@ gkbd_status_init (GkbdStatus * gki)
 					    G_CALLBACK
 					    (gkbd_status_theme_changed),
 					    gki);
+
+	xkl_debug (100, "The status icon startup process for %p completed\n",
+		   gki);
 }
 
 static void



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