src/api/: Use intended license header
[libquvi.git] / src / api / set.c
blob705db6e92bddd97cafe17979fa41c20162c5dcbc
1 /* libquvi
2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA
20 /** @file set.c */
22 #include "config.h"
24 #include <glib.h>
26 #include "quvi.h"
27 /* -- */
28 #include "_quvi_s.h"
30 static QuviError _set(_quvi_t q, QuviOption o, va_list arg)
32 switch (o)
34 case QUVI_OPTION_MEDIA_SCRIPT_PROTOCOL_CATEGORY:
35 q->opt.scripts.category = va_arg(arg, glong);
36 break;
37 case QUVI_OPTION_AUTOPROXY:
38 q->opt.autoproxy = (gboolean) va_arg(arg, glong) >0;
39 break;
41 /* Callback */
43 case QUVI_OPTION_CALLBACK_STATUS:
44 q->cb.status = va_arg(arg, quvi_callback_status);
45 break;
47 /* Default */
49 default:
50 return (QUVI_ERROR_INVALID_ARG);
53 return (QUVI_OK);
56 /** @brief Set library handle option
57 @sa @ref getting_started
58 @ingroup lib
60 void quvi_set(quvi_t handle, QuviOption option, ...)
62 va_list arg;
63 _quvi_t q;
65 /* If G_DISABLE_CHECKS is defined then the check is not performed. */
66 g_return_if_fail(handle != NULL);
68 q = (_quvi_t) handle;
70 va_start(arg, option);
71 q->status.rc = _set(handle, option, arg);
72 va_end(arg);
75 /* vim: set ts=2 sw=2 tw=72 expandtab: */