openmamba logo
GNU/Linux distribution
distribution community wiki forum bugs events products
software   community wiki forum bugs events products
packages firefox-3.0-libgnomeui.patch
      Pages: < 1 >  DOWNLOAD      
Index: modules/libpr0n/decoders/icon/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/decoders/icon/Makefile.in,v
retrieving revision 1.25
diff -u -8 -p -r1.25 Makefile.in
--- modules/libpr0n/decoders/icon/Makefile.in	4 Dec 2007 22:08:41 -0000	1.25
+++ modules/libpr0n/decoders/icon/Makefile.in	7 Dec 2007 20:08:06 -0000
@@ -44,28 +44,20 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= imgicon
 LIBRARY_NAME	= imgicon
 IS_COMPONENT	= 1
 MODULE_NAME	= nsIconDecoderModule
 
 PACKAGE_FILE = imgicon.pkg
 
-ifdef MOZ_ENABLE_GNOMEUI
-EXTRA_DSO_LDOPTS = \
-                   $(MOZ_GNOMEVFS_LIBS) \
-                   $(MOZ_LIBGNOME_LIBS) \
-                   $(MOZ_GTK2_LIBS) \
-                   $(NULL)
-
+ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
+EXTRA_DSO_LDOPTS = $(MOZ_GTK2_LIBS)
 PLATFORM = gtk
 FORCE_SHARED_LIB = 1
-else
-LIBXUL_LIBRARY = 1
-EXPORT_LIBRARY = 1
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 EXTRA_DSO_LIBS = gkgfx
 PLATFORM = win
 endif
 
 ifeq ($(OS_ARCH),OS2)
@@ -89,17 +81,17 @@ REQUIRES	= xpcom \
 		  $(NULL)
 
 CPPSRCS		= \
 		nsIconURI.cpp \
 		nsIconModule.cpp \
 		nsIconProtocolHandler.cpp \
 		$(NULL)
 
-ifdef MOZ_ENABLE_GNOMEUI
+ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 USE_ICON_DECODER = 1
 endif
 ifeq (,$(filter-out Darwin OS2 BeOS,$(OS_ARCH)))
 USE_ICON_DECODER = 1
 endif
 
 ifdef USE_ICON_DECODER
 CPPSRCS		+= nsIconDecoder.cpp
Index: modules/libpr0n/decoders/icon/nsIconModule.cpp
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/decoders/icon/nsIconModule.cpp,v
retrieving revision 1.11
diff -u -8 -p -r1.11 nsIconModule.cpp
--- modules/libpr0n/decoders/icon/nsIconModule.cpp	9 Nov 2007 08:23:13 -0000	1.11
+++ modules/libpr0n/decoders/icon/nsIconModule.cpp	7 Dec 2007 20:08:06 -0000
@@ -114,15 +114,13 @@ PR_STATIC_CALLBACK(nsresult)
 IconDecoderModuleCtor(nsIModule* aSelf)
 {
   return NS_OK;
 }
 
 PR_STATIC_CALLBACK(void)
 IconDecoderModuleDtor(nsIModule* aSelf)
 {
-#ifdef MOZ_ENABLE_GNOMEUI
   nsIconChannel::Shutdown();
-#endif
 }
 
 NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsIconDecoderModule, components,
                                    IconDecoderModuleCtor, IconDecoderModuleDtor)
Index: modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp,v
retrieving revision 1.15
diff -u -8 -p -r1.15 nsIconChannel.cpp
--- modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp	5 Dec 2007 01:08:23 -0000	1.15
+++ modules/libpr0n/decoders/icon/gtk/nsIconChannel.cpp	7 Dec 2007 20:08:07 -0000
@@ -33,25 +33,27 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef MOZ_ENABLE_GNOMEUI
 // Older versions of these headers seem to be missing an extern "C"
 extern "C" {
 #include <libgnome/libgnome.h>
 #include <libgnomeui/gnome-icon-theme.h>
 #include <libgnomeui/gnome-icon-lookup.h>
 
 #include <libgnomevfs/gnome-vfs-file-info.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
 }
+#endif
 
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkiconfactory.h>
 #include <gtk/gtkimage.h>
 #include <gtk/gtkwindow.h>
 #include <gtk/gtkfixed.h>
 #include <gtk/gtkversion.h>
 
@@ -64,34 +66,44 @@ extern "C" {
 #include "prlink.h"
 
 #include "nsIconChannel.h"
 
 NS_IMPL_ISUPPORTS2(nsIconChannel,
                    nsIRequest,
                    nsIChannel)
 
+#ifdef MOZ_ENABLE_GNOMEUI
 // These let us have a soft dependency on libgnomeui rather than a hard one. These are just basically the prototypes
 // of the functions in the libraries.
 typedef char* (*_GnomeIconLookup_fn)(GtkIconTheme *icon_theme, GnomeThumbnailFactory *thumbnail_factory,
                                      const char *file_uri, const char *custom_icon, GnomeVFSFileInfo *file_info,
                                      const char *mime_type, GnomeIconLookupFlags flags, GnomeIconLookupResultFlags *result);
 typedef GnomeIconTheme* (*_GnomeIconThemeNew_fn)(void);
 typedef char* (*_GnomeIconThemeLookupIcon_fn)(GnomeIconTheme *theme, const char *icon_name, int size,
                                               const GnomeIconData **icon_data, int *base_size);
 typedef int (*_GnomeInit_fn)(const char *app_id, const char *app_version, int argc, char **argv, const struct poptOption *options,
                              int flags, poptContext *return_ctx);
+typedef GnomeProgram* (*_GnomeProgramGet_fn)(void);
+typedef GnomeVFSResult (*_GnomeVFSGetFileInfo_fn)(const gchar *text_uri, GnomeVFSFileInfo *info, GnomeVFSFileInfoOptions options);
+typedef void (*_GnomeVFSFileInfoClear_fn)(GnomeVFSFileInfo *info);
 
 static PRLibrary* gLibGnomeUI = nsnull;
-static PRBool gTriedToLoadLibGnomeUI = PR_FALSE;
+static PRLibrary* gLibGnome = nsnull;
+static PRLibrary* gLibGnomeVFS = nsnull;
+static PRBool gTriedToLoadGnomeLibs = PR_FALSE;
 
 static _GnomeIconLookup_fn _gnome_icon_lookup = nsnull;
 static _GnomeIconThemeNew_fn _gnome_icon_theme_new = nsnull;
 static _GnomeIconThemeLookupIcon_fn _gnome_icon_theme_lookup_icon = nsnull;
 static _GnomeInit_fn _gnome_init = nsnull;
+static _GnomeProgramGet_fn _gnome_program_get = nsnull;
+static _GnomeVFSGetFileInfo_fn _gnome_vfs_get_file_info = nsnull;
+static _GnomeVFSFileInfoClear_fn _gnome_vfs_file_info_clear = nsnull;
+#endif
 
 static nsresult
 moz_gdk_pixbuf_to_channel(GdkPixbuf* aPixbuf, nsIURI *aURI,
                           nsIChannel **aChannel)
 {
   int width = gdk_pixbuf_get_width(aPixbuf);
   int height = gdk_pixbuf_get_height(aPixbuf);
   NS_ENSURE_TRUE(height < 256 && width < 256 && height > 0 && width > 0 &&
@@ -149,17 +161,19 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPi
 
   rv = NS_NewInputStreamChannel(aChannel, aURI, stream,
                                 NS_LITERAL_CSTRING("image/icon"));
   return rv;
 }
 
 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()
 {
@@ -182,45 +196,91 @@ ensure_icon_factory()
   if (!gIconFactory) {
     gIconFactory = gtk_icon_factory_new();
     gtk_icon_factory_add_default(gIconFactory);
     g_object_unref(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 (!gTriedToLoadLibGnomeUI) {
+  if (!gTriedToLoadGnomeLibs) {
     gLibGnomeUI = PR_LoadLibrary("libgnomeui-2.so.0");
-    gTriedToLoadLibGnomeUI = PR_TRUE;
     if (!gLibGnomeUI)
       return NS_ERROR_NOT_AVAILABLE;
 
     _gnome_init = (_GnomeInit_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_init_with_popt_table");
     _gnome_icon_theme_new = (_GnomeIconThemeNew_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_icon_theme_new");
     _gnome_icon_lookup = (_GnomeIconLookup_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_icon_lookup");
     _gnome_icon_theme_lookup_icon = (_GnomeIconThemeLookupIcon_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_icon_theme_lookup_icon");
 
-    if (!_gnome_init || !_gnome_icon_theme_new || !gnome_icon_lookup || !_gnome_icon_theme_lookup_icon) {
+    if (!_gnome_init || !_gnome_icon_theme_new || !_gnome_icon_lookup || !_gnome_icon_theme_lookup_icon) {
       PR_UnloadLibrary(gLibGnomeUI);
       gLibGnomeUI = nsnull;
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
 
   if (!gLibGnomeUI)
     return NS_ERROR_NOT_AVAILABLE;
 
   return NS_OK;
 }
 
+static nsresult
+ensure_libgnome()
+{
+  if (!gTriedToLoadGnomeLibs) {
+    gLibGnome = PR_LoadLibrary("libgnome-2.so.0");
+    if (!gLibGnome)
+      return NS_ERROR_NOT_AVAILABLE;
+
+    _gnome_program_get = (_GnomeProgramGet_fn)PR_FindFunctionSymbol(gLibGnome, "gnome_program_get");
+    if (!_gnome_program_get) {
+      PR_UnloadLibrary(gLibGnome);
+      gLibGnome = nsnull;
+      return NS_ERROR_NOT_AVAILABLE;
+    }
+  }
+
+  if (!gLibGnome)
+    return NS_ERROR_NOT_AVAILABLE;
+
+  return NS_OK;
+}
+
+static nsresult
+ensure_libgnomevfs()
+{
+  if (!gTriedToLoadGnomeLibs) {
+    gLibGnomeVFS = PR_LoadLibrary("libgnomevfs-2.so.0");
+    if (!gLibGnomeVFS)
+      return NS_ERROR_NOT_AVAILABLE;
+
+    _gnome_vfs_get_file_info = (_GnomeVFSGetFileInfo_fn)PR_FindFunctionSymbol(gLibGnomeVFS, "gnome_vfs_get_file_info");
+    _gnome_vfs_file_info_clear = (_GnomeVFSFileInfoClear_fn)PR_FindFunctionSymbol(gLibGnomeVFS, "gnome_vfs_file_info_clear");
+    if (!_gnome_vfs_get_file_info || !_gnome_vfs_file_info_clear) {
+      PR_UnloadLibrary(gLibGnomeVFS);
+      gLibGnomeVFS = nsnull;
+      return NS_ERROR_NOT_AVAILABLE;
+    }
+  }
+
+  if (!gLibGnomeVFS)
+    return NS_ERROR_NOT_AVAILABLE;
+
+  return NS_OK;
+}
+#endif
+
 static GtkIconSize
 moz_gtk_icon_size(const char *name)
 {
   if (strcmp(name, "button") == 0)
     return GTK_ICON_SIZE_BUTTON;
 
   if (strcmp(name, "menu") == 0)
     return GTK_ICON_SIZE_MENU;
@@ -235,25 +295,30 @@ moz_gtk_icon_size(const char *name)
     return GTK_ICON_SIZE_DND;
 
   if (strcmp(name, "dialog") == 0)
     return GTK_ICON_SIZE_DIALOG;
 
   return GTK_ICON_SIZE_MENU;
 }
 
+#ifdef MOZ_ENABLE_GNOMEUI
 nsresult
 nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
 {
   nsresult rv;
 
-  if (NS_FAILED(ensure_libgnomeui()))
+  if (NS_FAILED(ensure_libgnomeui()) || NS_FAILED(ensure_libgnome()) || NS_FAILED(ensure_libgnomevfs())) {
+    gTriedToLoadGnomeLibs = PR_TRUE;
     return NS_ERROR_NOT_AVAILABLE;
-  
-  if (!gnome_program_get()) {
+  }
+
+  gTriedToLoadGnomeLibs = PR_TRUE;
+
+  if (!_gnome_program_get()) {
     // Get the brandShortName from the string bundle to pass to GNOME
     // as the application name.  This may be used for things such as
     // the title of grouped windows in the panel.
     nsCOMPtr<nsIStringBundleService> bundleService = 
       do_GetService(NS_STRINGBUNDLE_CONTRACTID);
 
     NS_ASSERTION(bundleService, "String bundle service must be present!");
 
@@ -300,17 +365,17 @@ nsIconChannel::InitWithGnome(nsIMozIconU
   nsCOMPtr<nsIURI> fileURI;
   rv = aIconURI->GetIconFile(getter_AddRefs(fileURI));
   if (fileURI) {
     fileURI->GetAsciiSpec(spec);
     // Only ask gnome-vfs for a GnomeVFSFileInfo for file: uris, to avoid a
     // network request
     PRBool isFile;
     if (NS_SUCCEEDED(fileURI->SchemeIs("file", &isFile)) && isFile) {
-      gnome_vfs_get_file_info(spec.get(), &fileInfo, GNOME_VFS_FILE_INFO_DEFAULT);
+      _gnome_vfs_get_file_info(spec.get(), &fileInfo, GNOME_VFS_FILE_INFO_DEFAULT);
     }
     else {
       // We have to get a leaf name from our uri...
       nsCOMPtr<nsIURL> url(do_QueryInterface(fileURI));
       if (url) {
         nsCAutoString name;
         // The filename we get is UTF-8-compatible, which matches gnome expectations.
         // See also: http://lists.gnome.org/archives/gnome-vfs-list/2004-March/msg00049.html
@@ -339,26 +404,26 @@ nsIconChannel::InitWithGnome(nsIMozIconU
     }
   }
 
   // Get the icon theme
   if (!gIconTheme) {
     gIconTheme = _gnome_icon_theme_new();
 
     if (!gIconTheme) {
-      gnome_vfs_file_info_clear(&fileInfo);
+      _gnome_vfs_file_info_clear(&fileInfo);
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
 
   char* name = _gnome_icon_lookup(gIconTheme, NULL, spec.get(), NULL, &fileInfo,
                                   type.get(), GNOME_ICON_LOOKUP_FLAGS_NONE,
                                   NULL);
 
-  gnome_vfs_file_info_clear(&fileInfo);
+  _gnome_vfs_file_info_clear(&fileInfo);
   if (!name)
     return NS_ERROR_NOT_AVAILABLE;
 
   char* file = _gnome_icon_theme_lookup_icon(gIconTheme, name, iconSize,
                                              NULL, NULL);
   g_free(name);
   if (!file)
     return NS_ERROR_NOT_AVAILABLE;
@@ -386,27 +451,32 @@ nsIconChannel::InitWithGnome(nsIMozIconU
 
   // XXX Respect icon state
   
   rv = moz_gdk_pixbuf_to_channel(scaled, aIconURI,
                                  getter_AddRefs(mRealChannel));
   gdk_pixbuf_unref(scaled);
   return rv;
 }
+#endif
 
 nsresult
 nsIconChannel::Init(nsIURI* aURI)
 {
   nsCOMPtr<nsIMozIconURI> iconURI = do_QueryInterface(aURI);
   NS_ASSERTION(iconURI, "URI is not an nsIMozIconURI");
 
   nsCAutoString stockIcon;
   iconURI->GetStockIcon(stockIcon);
   if (stockIcon.IsEmpty()) {
+#ifdef MOZ_ENABLE_GNOMEUI
     return InitWithGnome(iconURI);
+#else
+    return NS_ERROR_NOT_AVAILABLE;
+#endif
   }
 
   nsCAutoString iconSizeString;
   iconURI->GetIconSize(iconSizeString);
 
   nsCAutoString iconStateString;
   iconURI->GetIconState(iconStateString);
 
@@ -450,18 +520,28 @@ nsIconChannel::Init(nsIURI* aURI)
 
 void
 nsIconChannel::Shutdown() {
   if (gProtoWindow) {
     gtk_widget_destroy(gProtoWindow);
     gProtoWindow = nsnull;
     gStockImageWidget = nsnull;
   }
+#ifdef MOZ_ENABLE_GNOMEUI
   if (gIconTheme) {
     g_object_unref(G_OBJECT(gIconTheme));
     gIconTheme = nsnull;
   }
+  gTriedToLoadGnomeLibs = PR_FALSE;
   if (gLibGnomeUI) {
     PR_UnloadLibrary(gLibGnomeUI);
     gLibGnomeUI = nsnull;
-    gTriedToLoadLibGnomeUI = PR_FALSE;
   }
+  if (gLibGnome) {
+    PR_UnloadLibrary(gLibGnome);
+    gLibGnome = nsnull;
+  }
+  if (gLibGnomeVFS) {
+    PR_UnloadLibrary(gLibGnomeVFS);
+    gLibGnomeVFS = nsnull;
+  }
+#endif
 }
Index: modules/libpr0n/decoders/icon/gtk/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/decoders/icon/gtk/Makefile.in,v
retrieving revision 1.4
diff -u -8 -p -r1.4 Makefile.in
--- modules/libpr0n/decoders/icon/gtk/Makefile.in	27 Apr 2006 14:41:11 -0000	1.4
+++ modules/libpr0n/decoders/icon/gtk/Makefile.in	7 Dec 2007 20:08:07 -0000
@@ -49,17 +49,21 @@ REQUIRES	= xpcom \
 		  string \
 		  necko \
 		  intl \
 		  mimetype \
 		  $(NULL)
 
 CPPSRCS		= nsIconChannel.cpp
 
+ifdef MOZ_ENABLE_GNOMEUI
 LOCAL_INCLUDES += $(MOZ_GNOMEUI_CFLAGS)
+else
+LOCAL_INCLUDES += $(MOZ_GTK2_CFLAGS)
+endif
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 # This library is used by other shared libs in a static build
 FORCE_USE_PIC = 1
 
 include $(topsrcdir)/config/rules.mk
 
Index: toolkit/library/libxul-config.mk
===================================================================
RCS file: /cvsroot/mozilla/toolkit/library/libxul-config.mk,v
retrieving revision 1.54
diff -u -8 -p -r1.54 libxul-config.mk
--- toolkit/library/libxul-config.mk	16 Sep 2007 23:48:08 -0000	1.54
+++ toolkit/library/libxul-config.mk	7 Dec 2007 20:08:07 -0000
@@ -270,22 +270,16 @@ ifdef MOZ_IPCD
 DEFINES += -DMOZ_IPCD
 COMPONENT_LIBS += ipcdc
 endif
 
 ifdef MOZ_ENABLE_POSTSCRIPT
 DEFINES += -DMOZ_ENABLE_POSTSCRIPT
 STATIC_LIBS += gfxpsshar
 endif
-ifneq (,$(filter icon,$(MOZ_IMG_DECODERS)))
-ifndef MOZ_ENABLE_GNOMEUI
-DEFINES += -DICON_DECODER
-COMPONENT_LIBS += imgicon
-endif
-endif
 
 ifdef MOZ_ENABLE_CAIRO_GFX
 STATIC_LIBS += thebes
 COMPONENT_LIBS += gkgfxthebes
 
 else # Platform-specific GFX layer
   ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
   COMPONENT_LIBS += gkgfxwin
Index: modules/libpr0n/decoders/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/decoders/Makefile.in,v
retrieving revision 1.14
diff -u -8 -p -r1.14 Makefile.in
--- modules/libpr0n/decoders/Makefile.in	28 Jan 2006 14:25:10 -0000	1.14
+++ modules/libpr0n/decoders/Makefile.in	7 Dec 2007 20:08:07 -0000
@@ -38,17 +38,17 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifneq (,$(filter icon,$(MOZ_IMG_DECODERS)))
-ifdef MOZ_ENABLE_GNOMEUI
+ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 TOOL_DIRS = icon/gtk icon
 endif
 ifeq ($(OS_ARCH),WINNT)
 DIRS = icon/win icon
 endif
 ifeq ($(OS_ARCH),OS2)
 DIRS = icon/os2 icon
 endif
Index: configure.in
===================================================================
RCS file: /cvsroot/mozilla/configure.in,v
retrieving revision 1.1894
diff -u -8 -p -r1.1894 configure.in
--- configure.in	30 Nov 2007 20:34:50 -0000	1.1894
+++ configure.in	7 Dec 2007 20:08:11 -0000
@@ -5495,26 +5495,16 @@ for extension in $MOZ_EXTENSIONS; do
         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
     fi
 done
 
 
 dnl ========================================================
 dnl Image decoders
 dnl ========================================================
-case "$MOZ_WIDGET_TOOLKIT" in
-beos|windows|os2|mac|cocoa)
-    ;;
-*)
-    if test -z "$MOZ_ENABLE_GNOMEUI"; then
-       MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
-    fi
-    ;;
-esac
-
 MOZ_ARG_ENABLE_STRING(image-decoders,
 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
                           Enable specific image decoders],
 [ for option in `echo $enableval | sed 's/,/ /g'`; do
     if test "$option" = "yes" || test "$option" = "all"; then
         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
     elif test "$option" = "no" || test "$option" = "none"; then
         MOZ_IMG_DECODERS=""