Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
nsGNOMERegistry.cpp File Reference
#include "nsGNOMERegistry.h"
#include "prlink.h"
#include "prmem.h"
#include "nsString.h"
#include "nsIComponentManager.h"
#include "nsILocalFile.h"
#include "nsMIMEInfoImpl.h"
#include "nsAutoPtr.h"
#include <glib.h>
#include <glib-object.h>

Go to the source code of this file.

Classes

struct  GnomeVFSMimeApplication

Defines

#define DECL_FUNC_PTR(func)   static _##func##_fn _##func
#define ENSURE_LIB(lib)
#define GET_LIB_FUNCTION(lib, func)

Typedefs

typedef struct _GConfClient
typedef struct _GnomeProgram
typedef struct _GnomeModuleInfo
typedef GConfClient *(* _gconf_client_get_default_fn )()
typedef gchar *(* _gconf_client_get_string_fn )(GConfClient *, const char *, GError **)
typedef gboolean(* _gconf_client_get_bool_fn )(GConfClient *, const char *, GError **)
typedef gboolean(* _gnome_url_show_fn )(const char *, GError **)
typedef const char *(* _gnome_vfs_mime_type_from_name_fn )(const char *)
typedef GList *(* _gnome_vfs_mime_get_extensions_list_fn )(const char *)
typedef void(* _gnome_vfs_mime_extensions_list_free_fn )(GList *)
typedef const char *(* _gnome_vfs_mime_get_description_fn )(const char *)
typedef GnomeVFSMimeApplication *(* _gnome_vfs_mime_get_default_application_fn )(const char *)
typedef void(* _gnome_vfs_mime_application_free_fn )(GnomeVFSMimeApplication *)
typedef GnomeProgram *(* _gnome_program_init_fn )(const char *, const char *, const GnomeModuleInfo *, int, char **, const char *,...)
typedef const GnomeModuleInfo *(* _libgnome_module_info_get_fn )()
typedef GnomeProgram *(* _gnome_program_get_fn )()

Functions

 DECL_FUNC_PTR (gconf_client_get_default)
 DECL_FUNC_PTR (gconf_client_get_string)
 DECL_FUNC_PTR (gconf_client_get_bool)
 DECL_FUNC_PTR (gnome_url_show)
 DECL_FUNC_PTR (gnome_vfs_mime_type_from_name)
 DECL_FUNC_PTR (gnome_vfs_mime_get_extensions_list)
 DECL_FUNC_PTR (gnome_vfs_mime_extensions_list_free)
 DECL_FUNC_PTR (gnome_vfs_mime_get_description)
 DECL_FUNC_PTR (gnome_vfs_mime_get_default_application)
 DECL_FUNC_PTR (gnome_vfs_mime_application_free)
 DECL_FUNC_PTR (gnome_program_init)
 DECL_FUNC_PTR (libgnome_module_info_get)
 DECL_FUNC_PTR (gnome_program_get)
static void CleanUp ()
static PRLibraryLoadVersionedLibrary (const char *libName, const char *libVersion)
static gchar * getAppForScheme (const nsACString &aProtocolScheme)
 Finds the application for a given protocol.

Variables

static PRLibrarygconfLib
static PRLibrarygnomeLib
static PRLibraryvfsLib

Class Documentation

struct GnomeVFSMimeApplication

Definition at line 59 of file nsGNOMERegistry.cpp.

Class Members
char * command
char * id
char * name

Define Documentation

#define DECL_FUNC_PTR (   func)    static _##func##_fn _##func

Definition at line 85 of file nsGNOMERegistry.cpp.

Value:
PR_BEGIN_MACRO \
    if (!lib) { \
      CleanUp(); \
      return; \
    } \
    PR_END_MACRO
Value:
PR_BEGIN_MACRO \
    _##func = (_##func##_fn) PR_FindFunctionSymbol(lib##Lib, #func); \
    if (!_##func) { \
      CleanUp(); \
      return; \
    } \
    PR_END_MACRO

Typedef Documentation

typedef gboolean(* _gconf_client_get_bool_fn)(GConfClient *, const char *, GError **)

Definition at line 69 of file nsGNOMERegistry.cpp.

typedef GConfClient*(* _gconf_client_get_default_fn)()

Definition at line 66 of file nsGNOMERegistry.cpp.

typedef gchar*(* _gconf_client_get_string_fn)(GConfClient *, const char *, GError **)

Definition at line 67 of file nsGNOMERegistry.cpp.

typedef struct _GConfClient

Definition at line 55 of file nsGNOMERegistry.cpp.

typedef GnomeProgram*(* _gnome_program_get_fn)()

Definition at line 83 of file nsGNOMERegistry.cpp.

typedef GnomeProgram*(* _gnome_program_init_fn)(const char *, const char *, const GnomeModuleInfo *, int, char **, const char *,...)

Definition at line 79 of file nsGNOMERegistry.cpp.

typedef gboolean(* _gnome_url_show_fn)(const char *, GError **)

Definition at line 71 of file nsGNOMERegistry.cpp.

Definition at line 78 of file nsGNOMERegistry.cpp.

Definition at line 74 of file nsGNOMERegistry.cpp.

Definition at line 77 of file nsGNOMERegistry.cpp.

Definition at line 75 of file nsGNOMERegistry.cpp.

typedef GList*(* _gnome_vfs_mime_get_extensions_list_fn)(const char *)

Definition at line 73 of file nsGNOMERegistry.cpp.

typedef const char*(* _gnome_vfs_mime_type_from_name_fn)(const char *)

Definition at line 72 of file nsGNOMERegistry.cpp.

typedef struct _GnomeModuleInfo

Definition at line 57 of file nsGNOMERegistry.cpp.

typedef struct _GnomeProgram

Definition at line 56 of file nsGNOMERegistry.cpp.

typedef const GnomeModuleInfo*(* _libgnome_module_info_get_fn)()

Definition at line 82 of file nsGNOMERegistry.cpp.


Function Documentation

static void CleanUp ( ) [static]

Definition at line 102 of file nsGNOMERegistry.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DECL_FUNC_PTR ( gconf_client_get_default  )
DECL_FUNC_PTR ( gconf_client_get_string  )
DECL_FUNC_PTR ( gconf_client_get_bool  )
DECL_FUNC_PTR ( gnome_url_show  )
DECL_FUNC_PTR ( gnome_vfs_mime_type_from_name  )
DECL_FUNC_PTR ( gnome_vfs_mime_get_extensions_list  )
DECL_FUNC_PTR ( gnome_vfs_mime_extensions_list_free  )
DECL_FUNC_PTR ( gnome_vfs_mime_get_description  )
DECL_FUNC_PTR ( gnome_vfs_mime_get_default_application  )
DECL_FUNC_PTR ( gnome_vfs_mime_application_free  )
DECL_FUNC_PTR ( gnome_program_init  )
DECL_FUNC_PTR ( libgnome_module_info_get  )
DECL_FUNC_PTR ( gnome_program_get  )
static gchar* getAppForScheme ( const nsACString &  aProtocolScheme) [static]

Finds the application for a given protocol.

Parameters:
aProtocolSchemeProtocol to look up. For example, "ghelp" or "mailto".
Returns:
UTF-8 string identifying the application. Must be freed with g_free. NULL on error.

Definition at line 197 of file nsGNOMERegistry.cpp.

{
  if (!gconfLib)
    return nsnull;

  GConfClient *client = _gconf_client_get_default();
  NS_ASSERTION(client, "no gconf client");

  nsCAutoString gconfPath(NS_LITERAL_CSTRING("/desktop/gnome/url-handlers/") +
                          aProtocolScheme +
                          NS_LITERAL_CSTRING("/command"));

  gchar *app = _gconf_client_get_string(client, gconfPath.get(), NULL);
  g_object_unref(G_OBJECT(client));

  return app;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRLibrary* LoadVersionedLibrary ( const char *  libName,
const char *  libVersion 
) [static]

Definition at line 116 of file nsGNOMERegistry.cpp.

{
  char *platformLibName = PR_GetLibraryName(nsnull, libName);
  nsCAutoString versionLibName(platformLibName);
  versionLibName.Append(libVersion);
  PR_Free(platformLibName);
  return PR_LoadLibrary(versionLibName.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

PRLibrary* gconfLib [static]

Definition at line 51 of file nsGNOMERegistry.cpp.

PRLibrary* gnomeLib [static]

Definition at line 52 of file nsGNOMERegistry.cpp.

PRLibrary* vfsLib [static]

Definition at line 53 of file nsGNOMERegistry.cpp.