1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains implementation of the "unload studio" 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"
30 #include "../proxies/notify_proxy.h"
32 #define cmd_ptr ((struct ladish_command *)context)
34 static bool run(void * context
)
36 ASSERT(cmd_ptr
->state
== LADISH_COMMAND_STATE_PENDING
);
38 ladish_studio_clear();
40 cmd_ptr
->state
= LADISH_COMMAND_STATE_DONE
;
46 bool ladish_command_unload_studio(void * call_ptr
, struct ladish_cqueue
* queue_ptr
)
48 struct ladish_command
* cmd_ptr
;
50 if (!ladish_command_stop_studio(call_ptr
, queue_ptr
))
55 cmd_ptr
= ladish_command_new(sizeof(struct ladish_command
));
58 log_error("ladish_command_new() failed.");
59 goto fail_drop_stop_command
;
64 if (!ladish_cqueue_add_command(queue_ptr
, cmd_ptr
))
66 lash_dbus_error(call_ptr
, LASH_DBUS_ERROR_GENERIC
, "ladish_cqueue_add_command() failed.");
67 goto fail_destroy_command
;
75 fail_drop_stop_command
:
76 ladish_cqueue_drop_command(queue_ptr
);