ukeyboard updated to version 2.0
[slovak-l10n] / ukeyboard / cpanel / onscreen.c
1 /*
2  *  Copyright (c) 2008 Jiri Benc <jbenc@upir.cz>
3  *  Copyright (c) 2009 Roman Moravcik <roman.moravcik@gmail.com>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License version 2 as
7  *  published by the Free Software Foundation.
8  *
9  *  This program 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
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include <stdio.h>
20 #include <string.h>
21 #include <glib.h>
22 #include <gtk/gtk.h>
23 #include <hildon/hildon-caption.h>
24 #include <hildon/hildon-controlbar.h>
25 #include <hildon/hildon.h>
26 #include <device_symbols.h>
27 #include <libosso.h>
28 #include <gconf/gconf.h>
29 #include <gconf/gconf-client.h>
30 #include "prefs.h"
31 #include "onscreen.h"
32
33 #define GETTEXT_PACKAGE "osso-applet-textinput"
34 #include <glib/gi18n-lib.h>
35
36 struct data {
37         HildonCheckButton *use_finger;
38 };
39
40 static GtkWidget *start(GConfClient *client, GtkWidget *win, void **data)
41 {
42         struct data *d;
43         GtkWidget *vbox;
44
45         (void)win;
46         d = g_new0(struct data, 1);
47
48         vbox = gtk_vbox_new(FALSE, 0);
49
50         d->use_finger = HILDON_CHECK_BUTTON(hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT));
51         hildon_check_button_set_active(d->use_finger, get_bool(client, "use_finger_kb"));
52         gtk_button_set_label (GTK_BUTTON (d->use_finger), _("tein_fi_use_virtual_keyboard"));
53         gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(d->use_finger), TRUE, TRUE, 0);
54
55         *data = d;
56
57         gtk_widget_show_all(vbox);
58
59         return vbox;
60 }
61
62 static void action(GConfClient *client, void *data)
63 {
64         struct data *d = data;
65
66         set_bool(client, "use_finger_kb", hildon_check_button_get_active(d->use_finger));
67 }
68
69 void prefs_onscreen_init(struct prefs *prefs)
70 {
71         prefs->start = start;
72         prefs->action = action;
73         prefs->stop = NULL;
74         prefs->name = internal_kbd ? "On-screen" : "General";
75 }