From c277216befdc3438e717ea55539f49f7ffae107c Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Wed, 9 Feb 2011 19:51:59 +0000 Subject: indent -kr *.c *.h --- src/trg-client.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/trg-client.c') diff --git a/src/trg-client.c b/src/trg-client.c index 71b365b..35915b4 100644 --- a/src/trg-client.c +++ b/src/trg-client.c @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include @@ -34,9 +35,9 @@ trg_client *trg_init_client() return client; } -#define check_for_error(error) if (error) { g_error_free(error); return FALSE; } +#define check_for_error(error) if (error) { g_error_free(error); return TRG_GCONF_SCHEMA_ERROR; } -gboolean trg_client_populate_with_settings(trg_client * tc, +int trg_client_populate_with_settings(trg_client * tc, GConfClient * gconf) { gint port; @@ -57,15 +58,19 @@ gboolean trg_client_populate_with_settings(trg_client * tc, host = gconf_client_get_string(gconf, TRG_GCONF_KEY_HOSTNAME, &error); check_for_error(error); + if (!host || strlen(host) < 1) + return TRG_NO_HOSTNAME_SET; - tc->url = g_strdup_printf("http://%s:%d/transmission/rpc", host, port); - g_free(host); + tc->url = g_strdup_printf("http://%s:%d/transmission/rpc", host, port); + g_free(host); - tc->username = gconf_client_get_string(gconf, TRG_GCONF_KEY_USERNAME, &error); + tc->username = + gconf_client_get_string(gconf, TRG_GCONF_KEY_USERNAME, &error); check_for_error(error); - tc->password = gconf_client_get_string(gconf, TRG_GCONF_KEY_PASSWORD, &error); + tc->password = + gconf_client_get_string(gconf, TRG_GCONF_KEY_PASSWORD, &error); check_for_error(error); - return TRUE; + return 0; } -- cgit v1.2.3