final speedup patch ...



Hi Guys,

	I just committed this - a cleaned up version of last night's
stuff. It should substantialy improve the performance of Nautilus and
gnumeric, and certainly improves evolution performance markedly [ more so
in conjunction with the previously posted evolution patch ].

	So - I need it hammering on; perhaps now is your time to win glory
by finding the heinous bug in it; can anyone that builds bonobo from CVS
update and give it a go ?

	Many thanks,

		Michael.

For reference, here is the diff - not a massive change I hope.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1150
diff -u -p -u -w -r1.1150 ChangeLog
--- ChangeLog	2001/11/16 15:56:50	1.1150
+++ ChangeLog	2001/12/15 15:12:03
@@ -1,3 +1,27 @@
+2001-12-15  Michael Meeks  <michael ximian com>
+
+	* bonobo/bonobo-ui-engine.c (override_fn): move logic
+	from bonobo-ui-xml.c into here.
+
+	* bonobo/bonobo-ui-xml.c (override_node_with):
+	if we have the same name,
+
+	* bonobo/bonobo-ui-node.c (bonobo_ui_node_transparent):
+	special case the placeholder - separators should not be
+	'transparent', their ownership matters lots, also special
+	case 'menu' since Nautilus relies on this being transparent
+	for some complex rootwindow thing.
+
+2001-12-14  Michael Meeks  <michael ximian com>
+
+	* bonobo/bonobo-ui-toolbar-button-item.c
+	(set_icon): don't be constantly destroying and
+	re-creating that icon - just set the new pixbuf.
+
+	* bonobo/bonobo-ui-util.c
+	(bonobo_ui_util_xml_get_icon_pixbuf): impl.
+	a pixbuf cache.
+
 2001-11-16  Frederic Crozat  <fcrozat mandrakesoft com>

 	* bonobo/bonobo-arg.c: (bonobo_arg_copy):
Index: bonobo/bonobo-ui-engine.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-engine.c,v
retrieving revision 1.17
diff -u -p -u -w -r1.17 bonobo-ui-engine.c
--- bonobo/bonobo-ui-engine.c	2001/06/26 17:35:07	1.17
+++ bonobo/bonobo-ui-engine.c	2001/12/15 15:12:06
@@ -550,10 +550,16 @@ override_fn (GtkObject      *object,
 	fprintf (stderr, "Override '%s'\n",
 		 bonobo_ui_xml_make_path (old));
 #endif
+
+	if (!strcmp (bonobo_ui_node_get_name (new),
+		     bonobo_ui_node_get_name (old))) {
+		replace_override_fn (object, new, old, engine);
+	} else {
 	bonobo_ui_engine_prune_widget_info (engine, old, TRUE);

 	cmd_to_node_remove_node (engine, old, FALSE);
 	cmd_to_node_add_node    (engine, new, FALSE);
+	}
 }

 static void
Index: bonobo/bonobo-ui-node.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-node.c,v
retrieving revision 1.17
diff -u -p -u -w -r1.17 bonobo-ui-node.c
--- bonobo/bonobo-ui-node.c	2001/08/20 18:11:59	1.17
+++ bonobo/bonobo-ui-node.c	2001/12/15 15:12:06
@@ -512,7 +512,11 @@ bonobo_ui_node_transparent (BonoboUINode
 		ret = FALSE;

 	} else if (!n->properties) {
+		if (!strcmp (XML_NODE (node)->name, "placeholder"))
 		ret = TRUE;
+		else if (!strcmp (XML_NODE (node)->name, "menu"))
+			ret = TRUE; /* Odd - Nautilus depends on this
+				     * for it's root window bits; hmm. */

 	} else if (!n->properties->next) {
 		if (!strcmp (n->properties->name, "name"))
Index: bonobo/bonobo-ui-sync-toolbar.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-sync-toolbar.c,v
retrieving revision 1.13
diff -u -p -u -w -r1.13 bonobo-ui-sync-toolbar.c
--- bonobo/bonobo-ui-sync-toolbar.c	2001/04/03 17:01:32	1.13
+++ bonobo/bonobo-ui-sync-toolbar.c	2001/12/15 15:12:07
@@ -135,7 +135,6 @@ impl_bonobo_ui_sync_toolbar_state (Bonob
 	label = bonobo_ui_engine_get_attr (node, cmd_node, "label");

 	if (!type || !strcmp (type, "toggle")) {
-
 		if (icon_pixbuf) {
 			bonobo_ui_toolbar_button_item_set_icon (
 				BONOBO_UI_TOOLBAR_BUTTON_ITEM (widget), icon_pixbuf);
Index: bonobo/bonobo-ui-toolbar-button-item.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-toolbar-button-item.c,v
retrieving revision 1.9
diff -u -p -u -w -r1.9 bonobo-ui-toolbar-button-item.c
--- bonobo/bonobo-ui-toolbar-button-item.c	2001/01/04 14:34:49	1.9
+++ bonobo/bonobo-ui-toolbar-button-item.c	2001/12/15 15:12:07
@@ -70,15 +70,20 @@ set_icon (BonoboUIToolbarButtonItem *but

 	priv = button_item->priv;

-	if (priv->icon != NULL)
-		gtk_widget_destroy (priv->icon);
-
 	gtk_widget_push_style (gtk_widget_get_style (GTK_WIDGET (priv->button_widget)));

+	if (priv->icon != NULL) {
 	if (pixbuf != NULL)
-		priv->icon = create_pixmap_widget_from_pixbuf (pixbuf);
-	else
+			bonobo_ui_toolbar_icon_set_pixbuf (
+				BONOBO_UI_TOOLBAR_ICON (priv->icon), pixbuf);
+		else {
+			gtk_widget_destroy (priv->icon);
 		priv->icon = NULL;
+		}
+	} else {
+		if (pixbuf != NULL)
+			priv->icon = create_pixmap_widget_from_pixbuf (pixbuf);
+	}

 	gtk_widget_pop_style ();
 }
Index: bonobo/bonobo-ui-toolbar-icon.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-toolbar-icon.c,v
retrieving revision 1.6
diff -u -p -u -w -r1.6 bonobo-ui-toolbar-icon.c
Index: bonobo/bonobo-ui-util.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-util.c,v
retrieving revision 1.50
diff -u -p -u -w -r1.50 bonobo-ui-util.c
--- bonobo/bonobo-ui-util.c	2001/11/14 21:39:26	1.50
+++ bonobo/bonobo-ui-util.c	2001/12/15 15:12:09
@@ -432,8 +432,10 @@ find_pixmap_in_path (const gchar *filena
 GdkPixbuf *
 bonobo_ui_util_xml_get_icon_pixbuf (BonoboUINode *node, gboolean prepend_menu)
 {
-	GdkPixbuf *icon_pixbuf = NULL;
+	char      *key;
 	char      *type, *text;
+	GdkPixbuf *icon_pixbuf = NULL;
+	static GHashTable *pixbuf_cache = NULL;

 	g_return_val_if_fail (node != NULL, NULL);

@@ -448,6 +450,16 @@ bonobo_ui_util_xml_get_icon_pixbuf (Bono
 	if (!text)
 		return NULL;

+	key = g_strdup_printf ("%s!%s!%d", type, text, prepend_menu?1:0);
+
+	if (!pixbuf_cache)
+		pixbuf_cache = g_hash_table_new (g_str_hash, g_str_equal);
+
+	if ((icon_pixbuf = g_hash_table_lookup (pixbuf_cache, key))) {
+		gdk_pixbuf_ref (icon_pixbuf);
+		return icon_pixbuf;
+	}
+
 	if (!strcmp (type, "stock")) {

 		if (prepend_menu) {
@@ -477,6 +489,9 @@ bonobo_ui_util_xml_get_icon_pixbuf (Bono

 	bonobo_ui_node_free_string (text);
 	bonobo_ui_node_free_string (type);
+
+	gdk_pixbuf_ref (icon_pixbuf);
+	g_hash_table_insert (pixbuf_cache, key, icon_pixbuf);

 	return icon_pixbuf;
 }

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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