gmyth-dbus/src/gmyth-dbus-server.c
branchtrunk
changeset 878 016b3410871d
parent 877 7fd8198b93aa
child 879 16c33370755e
     1.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c	Mon Oct 29 19:56:35 2007 +0000
     1.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c	Mon Oct 29 20:13:33 2007 +0000
     1.3 @@ -37,6 +37,12 @@
     1.4  
     1.5  enum
     1.6  {
     1.7 +    DISCONNECTED,
     1.8 +    LAST_SIGNAL
     1.9 +};
    1.10 +
    1.11 +enum
    1.12 +{
    1.13      GMYTH_DBUS_ERROR_MYTHTV,
    1.14      GMYTH_DBUS_ERROR_CONNECTION,
    1.15      GMYTH_DBUS_ERROR_EPG,
    1.16 @@ -109,6 +115,9 @@
    1.17                                                       GError **error);
    1.18  static gboolean gmyth_dbus_server_disconnect        (GObject *obj,
    1.19                                                       GError **error);
    1.20 +static void     gmyth_dbus_server_internal_disconnect
    1.21 +                                                    (GObject *obj,
    1.22 +                                                     GError **error);
    1.23  static gboolean gmyth_dbus_server_get_server_info   (GObject *obj,
    1.24                                                       guint64 *total_space,
    1.25                                                       guint64 *used_space,
    1.26 @@ -151,6 +160,8 @@
    1.27  #include "gmyth-dbus-server-glue.h"
    1.28  
    1.29  
    1.30 +static guint  signals[LAST_SIGNAL] = { 0 };
    1.31 +
    1.32  G_DEFINE_TYPE (GMythDbusServer, gmyth_dbus_server, G_TYPE_OBJECT);
    1.33  
    1.34  static void
    1.35 @@ -163,6 +174,15 @@
    1.36      object_class->dispose = gmyth_dbus_server_dispose;
    1.37      object_class->finalize = gmyth_dbus_server_finalize;
    1.38  
    1.39 +    signals[DISCONNECTED] = 
    1.40 +            g_signal_new ("disconnected",
    1.41 +                          G_OBJECT_CLASS_TYPE (object_class),
    1.42 +                          G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
    1.43 +                          0,
    1.44 +                          NULL, NULL,
    1.45 +                          g_cclosure_marshal_VOID__VOID,
    1.46 +                          G_TYPE_NONE, 0, G_TYPE_NONE);
    1.47 +
    1.48      dbus_g_object_type_install_info (GMYTH_DBUS_SERVER_TYPE,
    1.49                                       &dbus_glib_gmyth_dbus_server_object_info);
    1.50  }
    1.51 @@ -276,7 +296,7 @@
    1.52  
    1.53      if (priv->connected)
    1.54      {
    1.55 -        gmyth_dbus_server_disconnect (obj, NULL);
    1.56 +        gmyth_dbus_server_internal_disconnect (obj, error);
    1.57      }
    1.58  
    1.59      priv->myth_backend = gmyth_backend_info_new_full (host,
    1.60 @@ -329,6 +349,17 @@
    1.61  gmyth_dbus_server_disconnect (GObject *obj,
    1.62                                GError **error)
    1.63  {
    1.64 +
    1.65 +    gmyth_dbus_server_internal_disconnect (obj, error);
    1.66 +    g_signal_emit (obj, signals[DISCONNECTED], 0);
    1.67 +
    1.68 +    return TRUE;
    1.69 +}
    1.70 +
    1.71 +static void
    1.72 +gmyth_dbus_server_internal_disconnect (GObject *obj,
    1.73 +                                       GError **error)
    1.74 +{
    1.75      GMythDbusServerPrivate *priv;
    1.76  
    1.77      g_debug ("%s:%d", __FUNCTION__, __LINE__);
    1.78 @@ -353,9 +384,6 @@
    1.79          g_object_unref (priv->myth_scheduler);
    1.80          priv->myth_scheduler = NULL;
    1.81      }
    1.82 -
    1.83 -
    1.84 -    return TRUE;
    1.85  }
    1.86  
    1.87  static gboolean