1.1 --- a/gmyth-dbus/configure.ac Thu Feb 07 19:36:22 2008 +0000
1.2 +++ b/gmyth-dbus/configure.ac Fri Feb 08 00:03:03 2008 +0000
1.3 @@ -67,7 +67,7 @@
1.4
1.5 PKG_CHECK_MODULES(GMYTH, gmyth >= 0.7, HAVE_GMYTH=yes, HAVE_GMYTH=no)
1.6 if test "x$HAVE_GMYTH" = "xno"; then
1.7 - AC_MSG_ERROR(you need libgmyth-dev installed)
1.8 + AC_MSG_ERROR(you need libgmyth-dev >= 0.7 installed)
1.9 fi
1.10 AC_SUBST(GMYTH_CFLAGS)
1.11 AC_SUBST(GMYTH_LIBS)
2.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c Thu Feb 07 19:36:22 2008 +0000
2.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Fri Feb 08 00:03:03 2008 +0000
2.3 @@ -92,7 +92,11 @@
2.4 const gchar *user,
2.5 const gchar *password,
2.6 GError **error);
2.7 -
2.8 +static gboolean
2.9 +gmyth_dbus_server_check_server_connection (GObject *obj,
2.10 + const gchar *host,
2.11 + gint port,
2.12 + GError **error);
2.13 static gboolean gmyth_dbus_server_get_channel_list (GObject *obj,
2.14 GPtrArray **channels,
2.15 GError **error);
2.16 @@ -1313,6 +1317,32 @@
2.17
2.18 if (!ret) {
2.19 g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION,
2.20 + _("Fail to connect with backend database"));
2.21 + }
2.22 +
2.23 + return ret;
2.24 +}
2.25 +
2.26 +static gboolean
2.27 +gmyth_dbus_server_check_server_connection (GObject *obj,
2.28 + const gchar *host,
2.29 + gint port,
2.30 + GError **error)
2.31 +{
2.32 + GMythSocket *msocket = gmyth_socket_new ();
2.33 + gboolean ret;
2.34 +
2.35 + gmyth_debug ("");
2.36 +
2.37 + g_debug ("Checking server connection");
2.38 + ret = gmyth_socket_connect_with_timeout (msocket, host, port, 2);
2.39 + g_debug ("Return %s", ret ? "ok" : "bad");
2.40 + gmyth_socket_close_connection (msocket);
2.41 +
2.42 + g_object_unref (msocket);
2.43 +
2.44 + if (!ret) {
2.45 + g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION,
2.46 _("Fail to connect with backend"));
2.47 }
2.48
3.1 --- a/gmyth-dbus/src/gmyth-dbus-server.xml Thu Feb 07 19:36:22 2008 +0000
3.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.xml Fri Feb 08 00:03:03 2008 +0000
3.3 @@ -18,6 +18,11 @@
3.4 <arg type="s" name="password" direction="in" />
3.5 </method>
3.6
3.7 + <method name="CheckServerConnection">
3.8 + <arg type="s" name="host" direction="in" />
3.9 + <arg type="i" name="port" direction="in" />
3.10 + </method>
3.11 +
3.12 <method name="Connected">
3.13 <arg type="b" name="status" direction="out" />
3.14 </method>