Make -desktop a -module.
authorsalva <salva@salva-desktop.(none)>
Sat, 5 Dec 2009 20:16:41 +0000 (22:16 +0200)
committersalva <salva@salva-desktop.(none)>
Sat, 5 Dec 2009 20:16:41 +0000 (22:16 +0200)
maemo-tweaks-desktop.c
maemo-tweaks-desktop.h

index 7de99d9..a896a63 100644 (file)
@@ -2,10 +2,12 @@
  * vim:ts=4:sw=4:et:cindent:cino=(0
  */ 
 
-#include <gtk/gtk.h>
+#include "maemo-tweaks-module.h"
+#include "maemo-tweaks-desktop.h"
+
 #include <hildon/hildon-picker-button.h>
 
-GtkWidget * maemo_tweaks_desktop_create_snap_to_grid (void)
+GtkWidget * _build_snap_to_grid (void)
 {
     const gchar *options[] = {"Default", "Small grid", "Large grid", NULL};
     gint i = 0;
@@ -31,3 +33,44 @@ GtkWidget * maemo_tweaks_desktop_create_snap_to_grid (void)
     return button;
 }
 
+static void _build (MaemoTweaksModule *self)
+{
+}
+
+static void module_interface_init (gpointer g_iface, gpointer iface_data)
+{
+    MaemoTweaksModuleInterface *iface =
+        (MaemoTweaksModuleInterface *) g_iface;
+    iface->build = _build;
+}
+
+GType maemo_tweaks_desktop_get_type (void)
+{
+    static GType type = 0;
+    if (type == 0) {
+        static const GTypeInfo info = {
+            sizeof (MaemoTweaksModuleInterface),
+            NULL,   /* base_init */
+            NULL,   /* base_finalize */
+            NULL,   /* class_init */
+            NULL,   /* class_finalize */
+            NULL,   /* class_data */
+            sizeof (MaemoTweaksDesktop),
+            0,      /* n_preallocs */
+            NULL    /* instance_init */
+        };
+        static const GInterfaceInfo maemo_tweaks_module_info = {
+            (GInterfaceInitFunc) module_interface_init, /* interface_init */
+            NULL,         /* interface_finalize */
+            NULL          /* interface_data */
+        };
+        type = g_type_register_static (G_TYPE_OBJECT,
+                                       "MaemoTweaksDesktopType",
+                                       &info, 0);
+        g_type_add_interface_static (type,
+                                     MAEMO_TWEAKS_MODULE_TYPE,
+                                     &maemo_tweaks_module_info);
+    }
+    return type;
+}
+
index 4a918ba..3e0f4f4 100644 (file)
@@ -5,9 +5,41 @@
 #ifndef __MAEMO_TWEAKS_DESKTOP_H__
 #define __MAEMO_TWEAKS_DESKTOP_H__
 
+#include <glib-object.h>
 #include <gtk/gtk.h>
 
-GtkWidget * maemo_tweaks_desktop_create_snap_to_grid (void);
+/*
+ * Type macros.
+ */
+#define MAEMO_TWEAKS_TYPE_DESKTOP \
+    (maemo_tweaks_desktop_get_type ())
+#define MAEMO_TWEAKS_DESKTOP(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAEMO_TWEAKS_TYPE_DESKTOP, \
+                                 MaemoTweaksDesktop))
+#define MAEMO_TWEAKS_IS_DESKTOP(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAEMO_TWEAKS_TYPE_DESKTOP))
+#define MAEMO_TWEAKS_DESKTOP_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST ((klass), MAEMO_TWEAKS_TYPE_DESKTOP,\
+                              MaemoTweaksDesktopClass))
+#define MAEMO_TWEAKS_IS_DESKTOP_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE ((klass), MAEMO_TWEAKS_TYPE_DESKTOP))
+#define MAEMO_TWEAKS_DESKTOP_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS ((obj), MAEMO_TWEAKS_TYPE_DESKTOP, \
+                                MaemoTweaksDesktopClass))
+
+typedef struct _MaemoTweaksDesktop MaemoTweaksDesktop;
+struct _MaemoTweaksDesktop
+{
+    GObject parent_instance;
+};
+
+typedef struct _MaemoTweaksDesktopClass MaemoTweaksDesktopClass;
+struct _MaemoTweaksDesktopClass
+{
+    GObjectClass parent_class;
+};
+
+GType maemo_tweaks_desktop_get_type (void);
 
 #endif /* __MAEMO_TWEAKS_DESKTOP_H__ */