[libgnomekbd] Status icon: fix size problems



commit 102cdfac6df7a021ff866192e77e8f97f56ce5a4
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 5 11:06:13 2011 -0400

    Status icon: fix size problems
    
    There are bugs in both the notification area and in GtkStatusIcon
    when it comes to size allocation. This patch tries to work around
    them in a way that makes the keyboard indicator come up with a
    reasonable size initially, and not resize when clicked.
    https://bugzilla.gnome.org/show_bug.cgi?id=642703

 libgnomekbd/gkbd-status.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libgnomekbd/gkbd-status.c b/libgnomekbd/gkbd-status.c
index 276fe54..2f5b41f 100644
--- a/libgnomekbd/gkbd-status.c
+++ b/libgnomekbd/gkbd-status.c
@@ -393,6 +393,12 @@ void
 gkbd_status_reinit_ui (GkbdStatus * gki)
 {
 	gkbd_status_set_current_page (gki);
+        /* To work around combined bugs in notification-area
+         * and GtkStatusIcon, reshow the icon here, to ensure
+         * size changes are picked up.
+         */
+        gtk_status_icon_set_visible (GTK_STATUS_ICON (gki), FALSE);
+        gtk_status_icon_set_visible (GTK_STATUS_ICON (gki), TRUE);
 }
 
 /* Should be called once for all widgets */
@@ -509,6 +515,11 @@ static void
 gkbd_status_size_changed (GkbdStatus * gki, gint size)
 {
 	xkl_debug (150, "Size changed to %d\n", size);
+        /* Ignore the initial size 200 that we get before
+         * we are embedded
+         */
+        if (!gtk_status_icon_is_embedded (GTK_STATUS_ICON (gki)))
+                return;
 	if (globals.current_height != size) {
 		globals.current_height = size;
 		globals.current_width = size * 3 / 2;



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