From e28787d37f3a709974a90cf2ca84edc09e6c1ffd Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 4 Feb 2010 01:20:30 +0200 Subject: [PATCH] tp-haze: add gconf stuff Signed-off-by: Felipe Contreras --- tp-haze/Makefile | 7 +++++-- tp-haze/main.c | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/tp-haze/Makefile b/tp-haze/Makefile index 5aa5174..aac853c 100644 --- a/tp-haze/Makefile +++ b/tp-haze/Makefile @@ -12,6 +12,9 @@ GOBJECT_LIBS := $(shell pkg-config --libs gobject-2.0) DBUS_GLIB_CFLAGS := $(shell pkg-config --cflags dbus-glib-1) DBUS_GLIB_LIBS := $(shell pkg-config --libs dbus-glib-1) +GCONF_CFLAGS := $(shell pkg-config --cflags gconf-2.0) +GCONF_LIBS := $(shell pkg-config --libs gconf-2.0) + CFLAGS := -O2 -ggdb -Wall prefix := /usr @@ -50,9 +53,9 @@ QUIET_CLEAN = $(Q:@=@echo ' CLEAN '$@;) D = $(DESTDIR) $(app): $(objects) -$(app): CFLAGS := $(CFLAGS) $(PURPLE_CFLAGS) $(TP_CFLAGS) $(GOBJECT_CFLAGS) $(DBUS_GLIB_CFLAGS) \ +$(app): CFLAGS := $(CFLAGS) $(PURPLE_CFLAGS) $(TP_CFLAGS) $(GOBJECT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(GCONF_CFLAGS) \ -DG_LOG_DOMAIN='"pecan"' -DPACKAGE_VERSION='"0.3.2"' -$(app): LIBS := $(LIBS) $(PURPLE_LIBS) $(TP_LIBS) $(GOBJECT_LIBS) $(DBUS_GLIB_LIBS) +$(app): LIBS := $(LIBS) $(PURPLE_LIBS) $(TP_LIBS) $(GOBJECT_LIBS) $(DBUS_GLIB_LIBS) $(GCONF_LIBS) $(app): LDFLAGS := $(LDFLAGS) -Wl,--no-undefined all: $(app) diff --git a/tp-haze/main.c b/tp-haze/main.c index 69391ea..0149eff 100644 --- a/tp-haze/main.c +++ b/tp-haze/main.c @@ -39,6 +39,8 @@ #include #include +#include + #ifdef HAVE_PURPLE_DBUS_UNINIT #include #endif @@ -205,6 +207,31 @@ init_libpurple (void) purple_prefs_load(); + { + GConfClient *c; + GConfValue *v; + c = gconf_client_get_default(); + v = gconf_client_get(c, "/system/http_proxy/use_http_proxy", NULL); + if (gconf_value_get_bool(v)) { + PurpleProxyInfo *info; + const char *host; + int port; + + v = gconf_client_get(c, "/system/http_proxy/host", NULL); + host = gconf_value_get_string(v); + v = gconf_client_get(c, "/system/http_proxy/port", NULL); + port = gconf_value_get_int(v); + + info = purple_proxy_info_new(); + purple_proxy_info_set_type(info, PURPLE_PROXY_HTTP); + purple_proxy_info_set_host(info, host); + purple_proxy_info_set_port(info, port); + purple_global_proxy_set_info(info); + purple_proxy_info_destroy(info); + } + g_object_unref(c); + } + DEBUG ("libpurple %d.%d.%d loaded (compiled against %d.%d.%d)", purple_major_version, purple_minor_version, purple_micro_version, PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION); -- 1.6.6.1