b=621962 remove support for compilation with GTK+ < 2.4.0 r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 03 Feb 2011 12:20:44 -0500
changeset 61851 bc23b0490406ea8019ba9f7e5e193c60354642dc
parent 61850 bc9d7938cdc714d841a23a007adc6eb7b3b0c42d
child 61852 9a9f6f3eec6ba9acb0249e3d8e4310770c40d59d
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs621962
milestone2.0b12pre
b=621962 remove support for compilation with GTK+ < 2.4.0 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,45 +158,41 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPi
 }
 
 static GtkWidget *gProtoWindow = nsnull;
 static GtkWidget *gStockImageWidget = nsnull;
 #ifdef MOZ_ENABLE_GNOMEUI
 static GnomeIconTheme *gIconTheme = nsnull;
 #endif
 
-#if GTK_CHECK_VERSION(2,4,0)
 static GtkIconFactory *gIconFactory = nsnull;
-#endif
 
 static void
 ensure_stock_image_widget()
 {
   if (!gProtoWindow) {
     gProtoWindow = gtk_window_new(GTK_WINDOW_POPUP);
     gtk_widget_realize(gProtoWindow);
     GtkWidget* protoLayout = gtk_fixed_new();
     gtk_container_add(GTK_CONTAINER(gProtoWindow), protoLayout);
 
     gStockImageWidget = gtk_image_new();
     gtk_container_add(GTK_CONTAINER(protoLayout), gStockImageWidget);
     gtk_widget_realize(gStockImageWidget);
   }
 }
 
-#if GTK_CHECK_VERSION(2,4,0)
 static void
 ensure_icon_factory()
 {
   if (!gIconFactory) {
     gIconFactory = gtk_icon_factory_new();
     gtk_icon_factory_add_default(gIconFactory);
   }
 }
-#endif
 
 #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) {
@@ -290,17 +286,16 @@ moz_gtk_icon_size(const char *name)
 
   return GTK_ICON_SIZE_MENU;
 }
 
 #ifdef MOZ_ENABLE_GNOMEUI
 nsresult
 nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
 {
-#if GTK_CHECK_VERSION(2,4,0)
   nsresult rv;
 
   if (NS_FAILED(ensure_libgnomeui()) || NS_FAILED(ensure_libgnome()) || NS_FAILED(ensure_libgnomevfs())) {
     gTriedToLoadGnomeLibs = PR_TRUE;
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   gTriedToLoadGnomeLibs = PR_TRUE;
@@ -438,19 +433,16 @@ nsIconChannel::InitWithGnome(nsIMozIconU
   }
 
   // XXX Respect icon state
   
   rv = moz_gdk_pixbuf_to_channel(scaled, aIconURI,
                                  getter_AddRefs(mRealChannel));
   g_object_unref(scaled);
   return rv;
-#else // GTK_CHECK_VERSION(2,4,0)
-  return NS_ERROR_NOT_AVAILABLE;
-#endif // GTK_CHECK_VERSION(2,4,0)
 }
 #endif
 
 nsresult
 nsIconChannel::Init(nsIURI* aURI)
 {
   nsCOMPtr<nsIMozIconURI> iconURI = do_QueryInterface(aURI);
   NS_ASSERTION(iconURI, "URI is not an nsIMozIconURI");
@@ -475,33 +467,31 @@ nsIconChannel::Init(nsIURI* aURI)
    
   ensure_stock_image_widget();
 
   gboolean sensitive = strcmp(iconStateString.get(), "disabled");
   gtk_widget_set_sensitive (gStockImageWidget, sensitive);
 
   GdkPixbuf *icon = gtk_widget_render_icon(gStockImageWidget, stockIcon.get(),
                                            icon_size, NULL);
-#if GTK_CHECK_VERSION(2,4,0)
   if (!icon) {
     ensure_icon_factory();
       
     GtkIconSet *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_set_unref(icon_set);
     gtk_icon_source_free(icon_source);
 
     icon = gtk_widget_render_icon(gStockImageWidget, stockIcon.get(),
                                   icon_size, NULL);
   }
-#endif
 
   if (!icon)
     return NS_ERROR_NOT_AVAILABLE;
   
   nsresult rv = moz_gdk_pixbuf_to_channel(icon, iconURI,
                                           getter_AddRefs(mRealChannel));
 
   g_object_unref(icon);
@@ -511,23 +501,21 @@ nsIconChannel::Init(nsIURI* aURI)
 
 void
 nsIconChannel::Shutdown() {
   if (gProtoWindow) {
     gtk_widget_destroy(gProtoWindow);
     gProtoWindow = nsnull;
     gStockImageWidget = nsnull;
   }
-#if GTK_CHECK_VERSION(2,4,0)
   if (gIconFactory) {
     gtk_icon_factory_remove_default(gIconFactory);
     g_object_unref(gIconFactory);
     gIconFactory = nsnull;
   }
-#endif
 #ifdef MOZ_ENABLE_GNOMEUI
   if (gIconTheme) {
     g_object_unref(G_OBJECT(gIconTheme));
     gIconTheme = nsnull;
   }
   gTriedToLoadGnomeLibs = PR_FALSE;
   if (gLibGnomeUI) {
     PR_UnloadLibrary(gLibGnomeUI);