2 * vim:ts=4:sw=4:et:cindent:cino=(0
8 #include <hildon/hildon-picker-button.h>
9 #include <hildon/hildon-touch-selector.h>
11 #include "libmaemo-tweaks-section/maemo-tweaks-section.h"
12 #include "libmaemo-tweaks-section/maemo-tweaks-module.h"
15 #define MAEMO_TWEAKS_TYPE_DESKTOP_SECTION \
16 (maemo_tweaks_desktop_section_type)
17 #define MAEMO_TWEAKS_DESKTOP_SECTION(obj) \
18 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
19 MAEMO_TWEAKS_TYPE_DESKTOP_SECTION, \
20 MaemoTweaksDesktopSection))
21 #define MAEMO_TWEAKS_DESKTOP_SECTION_CLASS(k) \
22 (G_TYPE_CHECK_CLASS_CAST((k), \
23 MAEMO_TWEAKS_TYPE_DESKTOP_SECTION, \
24 MaemoTweaksDesktopSectionClass))
25 #define MAEMO_TWEAKS_IS_DESKTOP_SECTION(obj) \
26 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
27 MAEMO_TWEAKS_TYPE_DESKTOP_SECTION))
30 typedef struct _MaemoTweaksDesktopSection MaemoTweaksDesktopSection;
31 typedef struct _MaemoTweaksDesktopSectionClass
32 MaemoTweaksDesktopSectionClass;
34 struct _MaemoTweaksDesktopSection
36 MaemoTweaksSection parent_instance;
39 struct _MaemoTweaksDesktopSectionClass
41 MaemoTweaksSectionClass parent_class;
45 static GType maemo_tweaks_desktop_section_get_type (GTypeModule *module);
46 static void maemo_tweaks_desktop_section_class_init
47 (MaemoTweaksDesktopSectionClass *class);
48 static void maemo_tweaks_desktop_section_init
49 (MaemoTweaksDesktopSection *section);
51 static void maemo_tweaks_desktop_section_build (MaemoTweaksSection *section);
53 static GType maemo_tweaks_desktop_section_type = 0;
54 static MaemoTweaksSectionClass *
55 maemo_tweaks_desktop_section_parent_class = NULL;
59 maemo_tweaks_module_load (MaemoTweaksModule *module)
61 maemo_tweaks_desktop_section_get_type (G_TYPE_MODULE (module));
65 maemo_tweaks_module_unload (MaemoTweaksModule *module)
70 maemo_tweaks_desktop_section_get_type (GTypeModule *module)
72 if (!maemo_tweaks_desktop_section_type)
74 static const GTypeInfo section_info =
76 sizeof (MaemoTweaksDesktopSectionClass),
78 (GBaseFinalizeFunc) NULL,
79 (GClassInitFunc) maemo_tweaks_desktop_section_class_init,
80 NULL, /* class_finalize */
81 NULL, /* class_data */
82 sizeof (MaemoTweaksDesktopSection),
84 (GInstanceInitFunc) maemo_tweaks_desktop_section_init
87 maemo_tweaks_desktop_section_type =
88 g_type_module_register_type (module, MAEMO_TWEAKS_TYPE_SECTION,
89 "MaemoTweaksDesktopSection",
93 return maemo_tweaks_desktop_section_type;
97 maemo_tweaks_desktop_section_class_init
98 (MaemoTweaksDesktopSectionClass *klass)
100 MaemoTweaksSectionClass *section_class =
101 MAEMO_TWEAKS_SECTION_CLASS (klass);
103 maemo_tweaks_desktop_section_parent_class =
104 g_type_class_peek_parent (klass);
106 section_class->name = "_Desktop";
107 section_class->build = maemo_tweaks_desktop_section_build;
111 maemo_tweaks_desktop_section_init (MaemoTweaksDesktopSection *section)
115 GtkWidget * _build_snap_to_grid (void)
117 const gchar *options[] = {"Default", "Small grid", "Large grid", NULL};
119 GtkWidget *button, *selector;
121 selector = hildon_touch_selector_new_text ();
122 while (options[i] && options[i] != '\0')
124 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
128 button = hildon_picker_button_new (HILDON_SIZE_AUTO,
129 HILDON_BUTTON_ARRANGEMENT_VERTICAL);
131 hildon_button_set_title (HILDON_BUTTON (button),
132 "Snap desktop icons to grid");
134 hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
135 HILDON_TOUCH_SELECTOR (selector));
137 gtk_widget_show (button);
142 maemo_tweaks_desktop_section_build (MaemoTweaksSection *section)