7c72c86b90a59ff6de7d1dfd01c1a59816eef3f6
[tweakr] / maemo-tweaks-desktop.c
1 /*
2  * vim:ts=4:sw=4:et:cindent:cino=(0
3  */ 
4
5 #include "maemo-tweaks-module.h"
6 #include "maemo-tweaks-desktop.h"
7
8 #include <hildon/hildon-picker-button.h>
9
10 GtkWidget * _build_snap_to_grid (void)
11 {
12     const gchar *options[] = {"Default", "Small grid", "Large grid", NULL};
13     gint i = 0;
14     GtkWidget *button, *selector;
15
16     selector = hildon_touch_selector_new_text ();
17     while (options[i] && options[i] != '\0')
18     {
19         hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
20                                            options [i++]);
21     }
22
23     button = hildon_picker_button_new (HILDON_SIZE_AUTO,
24                                        HILDON_BUTTON_ARRANGEMENT_VERTICAL);
25
26     hildon_button_set_title (HILDON_BUTTON (button),
27                              "Snap desktop icons to grid");
28
29     hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
30                                        HILDON_TOUCH_SELECTOR (selector));
31
32     gtk_widget_show (button);
33     return button;
34 }
35
36 static void _build (MaemoTweaksModule *self)
37 {
38 }
39
40 static GtkWidget * _get_widget (MaemoTweaksModule *self)
41 {
42     return NULL;
43 }
44
45 static void module_interface_init (gpointer g_iface, gpointer iface_data)
46 {
47     MaemoTweaksModuleInterface *iface =
48         (MaemoTweaksModuleInterface *) g_iface;
49
50     iface->build = _build;
51     iface->get_widget = _get_widget;
52 }
53
54 GType maemo_tweaks_desktop_get_type (void)
55 {
56     static GType type = 0;
57     if (type == 0) {
58         static const GTypeInfo info = {
59             sizeof (MaemoTweaksModuleInterface),
60             NULL,   /* base_init */
61             NULL,   /* base_finalize */
62             NULL,   /* class_init */
63             NULL,   /* class_finalize */
64             NULL,   /* class_data */
65             sizeof (MaemoTweaksDesktop),
66             0,      /* n_preallocs */
67             NULL    /* instance_init */
68         };
69         static const GInterfaceInfo maemo_tweaks_module_info = {
70             (GInterfaceInitFunc) module_interface_init, /* interface_init */
71             NULL,         /* interface_finalize */
72             NULL          /* interface_data */
73         };
74         type = g_type_register_static (G_TYPE_OBJECT,
75                                        "MaemoTweaksDesktopType",
76                                        &info, 0);
77         g_type_add_interface_static (type,
78                                      MAEMO_TWEAKS_MODULE_TYPE,
79                                      &maemo_tweaks_module_info);
80     }
81     return type;
82 }
83