2004-05-31 Padraig O'Briain <[email protected]>
authorpadraigo
Mon, 31 May 2004 15:41:20 +0000
changeset 2969 5f9bb35ef9b6
parent 2968 0d456273e43f
child 2970 92049db4eabf
2004-05-31 Padraig O'Briain <[email protected]> * gnome-applets.spec, patches/gnome-applets-09-accessx-fix-crash.diff: Backport of fix for bug #137585.
ChangeLog
gnome-applets.spec
patches/gnome-applets-09-accessx-fix-crash.diff
--- a/ChangeLog	Mon May 31 15:17:50 2004 +0000
+++ b/ChangeLog	Mon May 31 15:41:20 2004 +0000
@@ -1,3 +1,8 @@
+2004-05-31  Padraig O'Briain <[email protected]>
+
+	* gnome-applets.spec, patches/gnome-applets-09-accessx-fix-crash.diff:
+	Backport of fix for bug #137585.
+
 2004-05-31  Padraig O'Briain <[email protected]>
 
 	* control-center.spec: Fix typo adding patch 
--- a/gnome-applets.spec	Mon May 31 15:17:50 2004 +0000
+++ b/gnome-applets.spec	Mon May 31 15:41:20 2004 +0000
@@ -18,6 +18,7 @@
 Patch6:       gnome-applets-06-mini-commander-tooltip.diff
 Patch7:       gnome-applets-07-accessx-xkb-check.diff
 Patch8:       gnome-applets-08-wireless-tooltip.diff
+Patch9:       gnome-applets-09-accessx-fix-crash.diff
 URL:          http://www.gnome.org
 BuildRoot:    %{_tmppath}/%{name}-%{version}-build
 Docdir:       %{_defaultdocdir}/gnome-applets
@@ -56,6 +57,7 @@
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
 
 %build
 libtoolize --force
@@ -165,6 +167,9 @@
 %{_libexecdir}/*
 
 %changelog
+* Mon May 31 2004 - [email protected]
+- Add patch gnome-applets-08-accessx-fix-crash.diff bugzilla - bug #137585.
+
 * Mon May 31 2004 - [email protected]
 - Update to 2.6.1, remove patch-05, re-apply 01, rename 09 to 05
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gnome-applets-09-accessx-fix-crash.diff	Mon May 31 15:41:20 2004 +0000
@@ -0,0 +1,99 @@
+--- gnome-applets-2.6.1-orig/accessx-status/applet.c	Fri May 28 14:17:41 2004
++++ gnome-applets-2.6.1/accessx-status/applet.c	Fri May 28 15:06:31 2004
+@@ -997,7 +997,8 @@
+ 
+ 	gtk_widget_show (sapplet->box);
+ 	gtk_widget_show (GTK_WIDGET (sapplet->applet));
+-	if (GTK_WIDGET_REALIZED (sapplet->applet))
++	if (GTK_WIDGET_REALIZED (sapplet->applet) &&
++	    sapplet->initialized)
+ 		accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
+ }
+ 
+@@ -1051,25 +1052,6 @@
+ 	g_free (error_txt);
+ }
+ 
+-static void
+-accessx_status_applet_realize (GtkWidget *widget, gpointer user_data)
+-{
+-	AccessxStatusApplet *sapplet = user_data;
+-	if (!sapplet->initialized) {
+-		sapplet->initialized = True;
+-		if (!accessx_status_applet_xkb_select (sapplet)) {
+-			disable_applet (sapplet);
+-			popup_error_dialog (sapplet);
+-			return;
+-		}
+-
+-		gdk_window_add_filter (NULL, accessx_status_xkb_filter, sapplet);
+-	}
+-	accessx_status_applet_init_modifiers (sapplet);
+-	accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
+-	return;
+-}
+-
+ static AccessxStatusApplet *
+ create_applet (PanelApplet *applet)
+ {
+@@ -1262,17 +1244,45 @@
+ 	return FALSE;
+ }
+ 
++static void
++accessx_status_applet_initialize (AccessxStatusApplet *sapplet)
++{
++	if (!sapplet->initialized) {
++		sapplet->initialized = True;
++		accessx_status_applet_xkb_select (sapplet);
++		gdk_window_add_filter (NULL, accessx_status_xkb_filter, sapplet);
++	}
++	accessx_status_applet_init_modifiers (sapplet);
++	accessx_status_applet_update (sapplet, ACCESSX_STATUS_ALL, NULL);
++}
++
++static void
++accessx_status_applet_realize (GtkWidget *widget, gpointer user_data)
++{
++	AccessxStatusApplet *sapplet = user_data;
++
++	accessx_status_applet_initialize (sapplet);
++	g_idle_add (accessx_status_applet_reset, sapplet);
++	return;
++}
++
+ static gboolean
+ accessx_status_applet_fill (PanelApplet *applet)
+ {
+ 	AccessxStatusApplet *sapplet;
+ 	AtkObject           *atk_object;
++	gboolean was_realized = FALSE;
+ 
+ 	sapplet = create_applet (applet);
+ 
+-	g_signal_connect_after (G_OBJECT (sapplet->box), 
+-				"realize", G_CALLBACK (accessx_status_applet_realize), 
+-				sapplet);
++	if (!GTK_WIDGET_REALIZED (sapplet->box)) {
++		g_signal_connect_after (G_OBJECT (sapplet->box), 
++					"realize", G_CALLBACK (accessx_status_applet_realize), 
++					sapplet);
++	} else {
++		accessx_status_applet_initialize (sapplet);
++		was_realized = TRUE;
++	}
+ 
+ 	g_object_connect (sapplet->applet,
+ 			  "signal::destroy", accessx_status_applet_destroy, sapplet,
+@@ -1317,8 +1327,9 @@
+ 	atk_object_set_description (atk_object,
+ 				    _("Displays current state of keyboard accessibility features"));
+ 	gtk_widget_show_all (GTK_WIDGET (sapplet->applet));
+-	/* hack for race insurance */
+-	reset_timeout = g_timeout_add (1000, accessx_status_applet_reset, sapplet);
++	if (was_realized) {
++		accessx_status_applet_reset (sapplet);
++	}
+ 
+ 	return TRUE;
+ }