Edit Authors.
[tweakr] / maemo-tweaks.c
1 /*
2  * vim:ts=4:sw=4:et:cindent:cino=(0
3  */ 
4
5 #include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
6 #include <gtk/gtk.h>
7 #include <hildon/hildon-picker-button.h>
8
9 GtkWidget * create_desktop_snap_to_grid (void)
10 {
11     const gchar *options[] = {"Default", "Small grid", "Large grid", NULL};
12     gint i = 0;
13     GtkWidget *button, *selector;
14
15     selector = hildon_touch_selector_new_text ();
16     while (options[i] && options[i] != '\0')
17     {
18         hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
19                                            options [i++]);
20     }
21
22     button = hildon_picker_button_new (HILDON_SIZE_AUTO,
23                                        HILDON_BUTTON_ARRANGEMENT_VERTICAL);
24
25     hildon_button_set_title (HILDON_BUTTON (button),
26                              "Snap desktop icons to grid");
27
28     hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
29                                        HILDON_TOUCH_SELECTOR (selector));
30
31     gtk_widget_show (button);
32     return button;
33 }
34
35 GtkWidget *create_dialog (GtkWindow *parent)
36 {
37     GtkWidget *dialog;
38     GtkWidget *box;
39
40     dialog = gtk_dialog_new_with_buttons
41         ("Maemo 5 Tweaks",
42          parent,
43          GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
44          GTK_STOCK_OK,
45          GTK_RESPONSE_OK,
46          GTK_STOCK_CANCEL,
47          GTK_RESPONSE_CANCEL,
48          NULL);
49
50     box = GTK_DIALOG (dialog)->vbox;
51     gtk_box_pack_start (GTK_BOX (box), create_desktop_snap_to_grid (),
52                         TRUE, TRUE, 0);
53
54     return dialog;
55 }
56
57
58 osso_return_t execute (osso_context_t *osso, gpointer data,
59                        gboolean user_activated)
60 {
61     GtkWidget *dialog;
62     gint response;
63
64     dialog = create_dialog (GTK_WINDOW (data));
65     response = gtk_dialog_run (GTK_DIALOG (dialog));
66     if (response == GTK_RESPONSE_OK)
67     {
68     }
69
70     gtk_widget_destroy (GTK_WIDGET (dialog));
71     return OSSO_OK;
72 }
73