bug 434997 remove gconf dependency from crashreporter client r=ted

--HG--
extra : rebase_source : ae12628ee2e5d9f5f4452b1dc2570de7248c9f4a
This commit is contained in:
Karl Tomlinson 2009-08-26 09:25:17 -07:00
parent 0beee44e9d
commit c29f78adfb
2 changed files with 34 additions and 15 deletions

View File

@ -83,10 +83,6 @@ LIBS += \
LOCAL_INCLUDES += -I$(srcdir)
OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS)
ifdef MOZ_ENABLE_GCONF
OS_CXXFLAGS += $(MOZ_GCONF_CFLAGS)
OS_LIBS += $(MOZ_GCONF_LIBS)
endif
CPPSRCS += http_upload.cc
FORCE_USE_PIC=1
endif
@ -99,10 +95,6 @@ LIBS += \
LOCAL_INCLUDES += -I$(srcdir)
OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS)
ifdef MOZ_ENABLE_GCONF
OS_CXXFLAGS += $(MOZ_GCONF_CFLAGS)
OS_LIBS += $(MOZ_GCONF_LIBS)
endif
CPPSRCS += http_upload.cc
FORCE_USE_PIC=1
endif

View File

@ -51,10 +51,6 @@
#include <signal.h>
#ifdef MOZ_ENABLE_GCONF
#include <gconf/gconf-client.h>
#endif
#include <gtk/gtk.h>
#include <glib.h>
#include <string.h>
@ -200,10 +196,39 @@ static gboolean ReportCompleted(gpointer success)
static void LoadProxyinfo()
{
class GConfClient;
typedef GConfClient * (*_gconf_default_fn)();
typedef gboolean (*_gconf_bool_fn)(GConfClient *, const gchar *, GError **);
typedef gint (*_gconf_int_fn)(GConfClient *, const gchar *, GError **);
typedef gchar * (*_gconf_string_fn)(GConfClient *, const gchar *, GError **);
if (getenv ("http_proxy"))
return; // libcurl can use the value from the environment
static void* gconfLib = dlopen("libgconf-2.so.4", RTLD_LAZY);
if (!gconfLib)
return;
_gconf_default_fn gconf_client_get_default =
(_gconf_default_fn)dlsym(gconfLib, "gconf_client_get_default");
_gconf_bool_fn gconf_client_get_bool =
(_gconf_bool_fn)dlsym(gconfLib, "gconf_client_get_bool");
_gconf_int_fn gconf_client_get_int =
(_gconf_int_fn)dlsym(gconfLib, "gconf_client_get_int");
_gconf_string_fn gconf_client_get_string =
(_gconf_string_fn)dlsym(gconfLib, "gconf_client_get_string");
if(!(gconf_client_get_default &&
gconf_client_get_bool &&
gconf_client_get_int &&
gconf_client_get_string)) {
dlclose(gconfLib);
return;
}
GConfClient *conf = gconf_client_get_default();
if (!getenv ("http_proxy") &&
gconf_client_get_bool(conf, HTTP_PROXY_DIR "/use_http_proxy", NULL)) {
if (gconf_client_get_bool(conf, HTTP_PROXY_DIR "/use_http_proxy", NULL)) {
gint port;
gchar *host = NULL, *httpproxy = NULL;
@ -229,7 +254,7 @@ static void LoadProxyinfo()
"/authentication_password",
NULL);
if (user != "\0") {
if (user && password) {
auth = g_strdup_printf("%s:%s", user, password);
gAuth = auth;
}
@ -241,6 +266,8 @@ static void LoadProxyinfo()
}
g_object_unref(conf);
dlclose(gconfLib);
}
#endif