tizen 2.3.1 release
[apps/home/starter.git] / test / set_theme.c
1 /*
2  *  starter
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <string.h>
23
24 #include <X11/Xlib.h>
25 #include <X11/Xatom.h>
26 #include <X11/Xutil.h>
27
28 void set_elm_theme(void)
29 {
30         char *theme;
31         Display *d;
32         Atom a_e17;
33         Atom a_UTF8;
34         XTextProperty xtp;
35
36         theme = "beat:kessler";
37
38         d = XOpenDisplay(NULL);
39         if (d == NULL)
40                 return;
41
42         a_e17 = XInternAtom(d, "ENLIGHTENMENT_THEME", False);
43         if (a_e17 == None)
44                 goto exit;
45
46         a_UTF8 = XInternAtom(d, "UTF8_STRING", False);
47         if (a_UTF8 == None)
48                 goto exit;
49
50         xtp.value = (unsigned char *)theme;
51         xtp.format = 8;
52         xtp.encoding = a_UTF8;
53         xtp.nitems = strlen(theme);
54
55         XSetTextProperty(d, DefaultRootWindow(d), &xtp, a_e17);
56
57  exit:
58         XCloseDisplay(d);
59 }
60
61 int main(int argc, char *argv[])
62 {
63         set_elm_theme();
64         return 0;
65 }