1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains implementation of the "deactivate daemon" command
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "studio_internal.h"
31 #define cmd_ptr ((struct ladish_command *)context)
33 static bool run(void * context
)
35 ASSERT(cmd_ptr
->state
== LADISH_COMMAND_STATE_PENDING
);
36 cmd_ptr
->state
= LADISH_COMMAND_STATE_DONE
;
37 g_quit
= true; /* cause main loop quit */
38 return false; /* cause command queue clear */
43 bool ladish_command_exit(void * call_ptr
, struct ladish_cqueue
* queue_ptr
)
45 struct ladish_command
* cmd_ptr
;
47 if (!ladish_command_unload_studio(call_ptr
, queue_ptr
))
52 cmd_ptr
= ladish_command_new(sizeof(struct ladish_command
));
55 log_error("ladish_command_new() failed.");
56 goto fail_drop_unload_command
;
61 if (!ladish_cqueue_add_command(queue_ptr
, cmd_ptr
))
63 lash_dbus_error(call_ptr
, LASH_DBUS_ERROR_GENERIC
, "ladish_cqueue_add_command() failed.");
64 goto fail_destroy_command
;
72 fail_drop_unload_command
:
73 ladish_cqueue_drop_command(queue_ptr
);