diff -r 7fd8198b93aa -r 016b3410871d gmyth-dbus/src/gmyth-dbus-server.c --- a/gmyth-dbus/src/gmyth-dbus-server.c Mon Oct 29 19:56:35 2007 +0000 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Mon Oct 29 20:13:33 2007 +0000 @@ -37,6 +37,12 @@ enum { + DISCONNECTED, + LAST_SIGNAL +}; + +enum +{ GMYTH_DBUS_ERROR_MYTHTV, GMYTH_DBUS_ERROR_CONNECTION, GMYTH_DBUS_ERROR_EPG, @@ -109,6 +115,9 @@ GError **error); static gboolean gmyth_dbus_server_disconnect (GObject *obj, GError **error); +static void gmyth_dbus_server_internal_disconnect + (GObject *obj, + GError **error); static gboolean gmyth_dbus_server_get_server_info (GObject *obj, guint64 *total_space, guint64 *used_space, @@ -151,6 +160,8 @@ #include "gmyth-dbus-server-glue.h" +static guint signals[LAST_SIGNAL] = { 0 }; + G_DEFINE_TYPE (GMythDbusServer, gmyth_dbus_server, G_TYPE_OBJECT); static void @@ -163,6 +174,15 @@ object_class->dispose = gmyth_dbus_server_dispose; object_class->finalize = gmyth_dbus_server_finalize; + signals[DISCONNECTED] = + g_signal_new ("disconnected", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); + dbus_g_object_type_install_info (GMYTH_DBUS_SERVER_TYPE, &dbus_glib_gmyth_dbus_server_object_info); } @@ -276,7 +296,7 @@ if (priv->connected) { - gmyth_dbus_server_disconnect (obj, NULL); + gmyth_dbus_server_internal_disconnect (obj, error); } priv->myth_backend = gmyth_backend_info_new_full (host, @@ -329,6 +349,17 @@ gmyth_dbus_server_disconnect (GObject *obj, GError **error) { + + gmyth_dbus_server_internal_disconnect (obj, error); + g_signal_emit (obj, signals[DISCONNECTED], 0); + + return TRUE; +} + +static void +gmyth_dbus_server_internal_disconnect (GObject *obj, + GError **error) +{ GMythDbusServerPrivate *priv; g_debug ("%s:%d", __FUNCTION__, __LINE__); @@ -353,9 +384,6 @@ g_object_unref (priv->myth_scheduler); priv->myth_scheduler = NULL; } - - - return TRUE; } static gboolean