Good catch, I will write a EDBus_Connection_Event_Type for Disconnection.

On Sun, Nov 11, 2012 at 6:59 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> efreet: shutdown on error and disconnect
>
>   When bus stops it send Disconnect signal. Trap and die.
>
> Author:       englebass
> Date:         2012-11-11 12:59:03 -0800 (Sun, 11 Nov 2012)
> New Revision: 79122
> Trac:         http://trac.enlightenment.org/e/changeset/79122
>
> Modified:
>   trunk/efreet/src/bin/efreetd_dbus.c
>
> Modified: trunk/efreet/src/bin/efreetd_dbus.c
> ===================================================================
> --- trunk/efreet/src/bin/efreetd_dbus.c 2012-11-11 20:58:38 UTC (rev 79121)
> +++ trunk/efreet/src/bin/efreetd_dbus.c 2012-11-11 20:59:03 UTC (rev 79122)
> @@ -11,6 +11,9 @@
>  #define BUS "org.enlightenment.Efreet"
>  #define PATH "/org/enlightenment/Efreet"
>  #define INTERFACE "org.enlightenment.Efreet"
> +/* TODO: Get from dbus include */
> +#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
> +#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
>
>  /* internal */
>  enum
> @@ -32,6 +35,13 @@
>     return ECORE_CALLBACK_CANCEL;
>  }
>
> +static void
> +disconnected(void *context __UNUSED__, const EDBus_Message *msg __UNUSED__)
> +{
> +   INF("disconnected");
> +   quit();
> +}
> +
>  static EDBus_Message *
>  do_register(const EDBus_Service_Interface *ifc __UNUSED__, const 
> EDBus_Message *message)
>  {
> @@ -166,25 +176,29 @@
>  static void
>  on_name_request(void *data __UNUSED__, const EDBus_Message *msg, 
> EDBus_Pending *pending __UNUSED__)
>  {
> -   unsigned int flag;
> +   unsigned int reply;
>
>     if (edbus_message_error_get(msg, NULL, NULL))
>       {
>          ERR("error on on_name_request");
> +        quit();
>          return;
>       }
>
> -   if (!edbus_message_arguments_get(msg, "u", &flag))
> +   if (!edbus_message_arguments_get(msg, "u", &reply))
>       {
>          ERR("error getting arguments on on_name_request");
> +        quit();
>          return;
>       }
>
> -   if (!(flag & EDBUS_NAME_REQUEST_REPLY_PRIMARY_OWNER))
> +   if (reply != EDBUS_NAME_REQUEST_REPLY_PRIMARY_OWNER)
>       {
>          ERR("error name already in use");
> +        quit();
>          return;
>       }
> +   INF("name requested");
>  }
>
>  /* external */
> @@ -208,6 +222,7 @@
>     conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SESSION);
>     if (!conn) goto conn_error;
>
> +   edbus_signal_handler_add(conn, NULL, DBUS_PATH_LOCAL, 
> DBUS_INTERFACE_LOCAL, "Disconnected", disconnected, NULL);
>     iface = edbus_service_interface_register(conn, PATH, &desc);
>     edbus_name_request(conn, BUS, EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE,
>                        on_name_request, NULL);
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to