summaryrefslogtreecommitdiff
path: root/src/trg-client.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-09 19:51:59 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-09 19:51:59 +0000
commitc277216befdc3438e717ea55539f49f7ffae107c (patch)
treea039f7547786c0cf3f103a6879285b067f7a7cdf /src/trg-client.c
parent1cd35ab86d03cb76152363e33a2b85a1484c44e5 (diff)
indent -kr *.c *.h
Diffstat (limited to 'src/trg-client.c')
-rw-r--r--src/trg-client.c19
1 files changed, 12 insertions, 7 deletions
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 <string.h>
#include <glib-object.h>
#include <gconf/gconf-client.h>
@@ -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;
}