b=621962 no longer add stock id to icon name mappings for icons found by name r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 03 Feb 2011 12:22:52 -0500
changeset 61854 29df2b0fa77bb689e9984499c5f604b8507da8b3
parent 61853 57536671a3637d216f06e1f28b0ddf8b8c5250d3
child 61855 562ae97b263612a46f215d9212d8377acf9cc378
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs621962
milestone2.0b12pre
b=621962 no longer add stock id to icon name mappings for icons found by name r=roc
modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp
--- a/modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp
+++ b/modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp
@@ -158,18 +158,16 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPi
 }
 
 static GtkWidget *gProtoWindow = nsnull;
 static GtkWidget *gStockImageWidget = nsnull;
 #ifdef MOZ_ENABLE_GNOMEUI
 static GnomeIconTheme *gIconTheme = nsnull;
 #endif
 
-static GtkIconFactory *gIconFactory = nsnull;
-
 static void
 ensure_stock_image_widget()
 {
   // Only the style of the GtkImage needs to be used, but the widget is kept
   // to track dynamic style changes.
   if (!gProtoWindow) {
     gProtoWindow = gtk_window_new(GTK_WINDOW_POPUP);
     GtkWidget* protoLayout = gtk_fixed_new();
@@ -177,25 +175,16 @@ ensure_stock_image_widget()
 
     gStockImageWidget = gtk_image_new();
     gtk_container_add(GTK_CONTAINER(protoLayout), gStockImageWidget);
 
     gtk_widget_ensure_style(gStockImageWidget);
   }
 }
 
-static void
-ensure_icon_factory()
-{
-  if (!gIconFactory) {
-    gIconFactory = gtk_icon_factory_new();
-    gtk_icon_factory_add_default(gIconFactory);
-  }
-}
-
 #ifdef MOZ_ENABLE_GNOMEUI
 static nsresult
 ensure_libgnomeui()
 {
   // Attempt to get the libgnomeui symbol references. We do it this way so that stock icons from Init()
   // don't get held back by InitWithGnome()'s libgnomeui dependency.
   if (!gTriedToLoadGnomeLibs) {
     gLibGnomeUI = PR_LoadLibrary("libgnomeui-2.so.0");
@@ -478,29 +467,21 @@ nsIconChannel::Init(nsIURI* aURI)
   if (icon_set) {
     gtk_icon_set_ref(icon_set);
   } else {
     // stockIcon is not a stock id, so assume it is an icon name.
     //
     // Creating a GtkIconSet is a convenient way to allow the style to
     // render the icon, possibly with variations suitable for insensitive
     // states.
-    //
-    // The GtkIconSet is also used to add a new stock id in such a way that
-    // the look up above will succeed next time.  Maybe this is to take
-    // advantage of the cache of stock icon GdkPixbufs.
-
-    ensure_icon_factory();
-      
     icon_set = gtk_icon_set_new();
     GtkIconSource *icon_source = gtk_icon_source_new();
     
     gtk_icon_source_set_icon_name(icon_source, stockIcon.get());
     gtk_icon_set_add_source(icon_set, icon_source);
-    gtk_icon_factory_add(gIconFactory, stockIcon.get(), icon_set);
     gtk_icon_source_free(icon_source);
   }
 
   GdkPixbuf *icon =
     gtk_icon_set_render_icon (icon_set, style,
                               gtk_widget_get_default_direction(), state,
                               icon_size, gStockImageWidget, NULL);
   gtk_icon_set_unref(icon_set);
@@ -520,21 +501,16 @@ nsIconChannel::Init(nsIURI* aURI)
 
 void
 nsIconChannel::Shutdown() {
   if (gProtoWindow) {
     gtk_widget_destroy(gProtoWindow);
     gProtoWindow = nsnull;
     gStockImageWidget = nsnull;
   }
-  if (gIconFactory) {
-    gtk_icon_factory_remove_default(gIconFactory);
-    g_object_unref(gIconFactory);
-    gIconFactory = nsnull;
-  }
 #ifdef MOZ_ENABLE_GNOMEUI
   if (gIconTheme) {
     g_object_unref(G_OBJECT(gIconTheme));
     gIconTheme = nsnull;
   }
   gTriedToLoadGnomeLibs = PR_FALSE;
   if (gLibGnomeUI) {
     PR_UnloadLibrary(gLibGnomeUI);