Add stubs for profile module.
authorSalvatore Iovene <salvatore@iovene.com>
Thu, 17 Dec 2009 21:22:22 +0000 (23:22 +0200)
committerSalvatore Iovene <salvatore@iovene.com>
Thu, 17 Dec 2009 21:27:46 +0000 (23:27 +0200)
configure.ac
debian/control
modules/Makefile.am
modules/tweakr-desktop.c
modules/tweakr-profile.c [new file with mode: 0644]

index 2f53c2d..ddacac5 100644 (file)
@@ -40,6 +40,10 @@ PKG_CHECK_MODULES(GCONF2, gconf-2.0)
 AC_SUBST(GCONF2_LIBS)
 AC_SUBST(GCONF2_CFLAGS)
 
+PKG_CHECK_MODULES(PROFILE, profile >= 0.0.16)
+AC_SUBST(PROFILE_LIBS)
+AC_SUBST(PROFILE_CFLAGS)
+
 AC_ARG_ENABLE(cast-checks,  [  --disable-cast-checks   compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes)
 if test "x$cchecks" = "xno"; then
     CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
index 154aa2c..0d41c08 100644 (file)
@@ -1,7 +1,7 @@
 Source: tweakr
 Priority: optional
 Maintainer: Salvatore Iovene <salvatore@iovene.com>
-Build-Depends: debhelper (>= 4.1.0), cdbs, libgtk2.0-dev, libhildon1-dev, libosso-dev, libglib2.0-dev, hildon-control-panel-dev, libgconf2-dev
+Build-Depends: debhelper (>= 4.1.0), cdbs, libgtk2.0-dev, libhildon1-dev, libosso-dev, libglib2.0-dev, hildon-control-panel-dev, libgconf2-dev, libprofile-dev (>= 0.0.16)
 Standards-Version: 3.6.0
 
 Package: tweakr
index ce5e1c2..ce6043d 100644 (file)
@@ -6,6 +6,7 @@ AM_CPPFLAGS = \
        $(GTK_CFLAGS)   \
        $(HILDON_CFLAGS)        \
        $(GCONF2_CFLAGS)        \
+       $(PROFILE_CFLAGS)       \
        -DTRANSITIONS=\"/usr/share/hildon-desktop/transitions.ini\"     \
        -DMCE=\"/etc/mce/mce.ini\"
 
@@ -13,7 +14,8 @@ modulesdir = $(libdir)/tweakr/modules
 
 modules_LTLIBRARIES = \
        libtweakr-desktop.la \
-       libtweakr-mce.la
+       libtweakr-mce.la \
+       libtweakr-profile.la
 
 libtweakr_desktop_la_SOURCES = tweakr-desktop.c
 libtweakr_desktop_la_LDFLAGS = -avoid-version -module
@@ -30,6 +32,14 @@ libtweakr_mce_la_LIBADD = \
        $(GTK_LIBS)     \
        $(HILDON_LIBS)
 
+libtweakr_profile_la_SOURCES = tweakr-profile.c
+libtweakr_profile_la_LDFLAGS = -avoid-version -module
+libtweakr_profile_la_LIBADD = \
+       $(libtweakr_section)    \
+       $(GTK_LIBS)     \
+       $(HILDON_LIBS)  \
+       $(PROFILE_LIBS)
+
 bin_PROGRAMS = \
        tweakr-desktop-save     \
        tweakr-mce-save
index b012091..de1de77 100644 (file)
@@ -383,8 +383,6 @@ tweakr_desktop_section_init (TweakrDesktopSection *section)
 
     gint snap_value = SNAP_NONE_VALUE;
 
-    section->snap_button = _build_snap_to_grid ();
-
     section->ini = g_key_file_new ();
 
     if (!g_key_file_load_from_file (section->ini, TRANSITIONS,
@@ -394,38 +392,47 @@ tweakr_desktop_section_init (TweakrDesktopSection *section)
         return;
     }
 
-    snap_value = g_key_file_get_integer (section->ini, "edit_mode",
-                                         "snap_grid_size", NULL);
-
-    if (snap_value < SNAP_SMALL_VALUE)
-    {
-        hildon_picker_button_set_active
-            (HILDON_PICKER_BUTTON (section->snap_button), SNAP_NONE);
-    }
-    else if (snap_value < SNAP_LARGE_VALUE)
-    {
-        hildon_picker_button_set_active
-            (HILDON_PICKER_BUTTON (section->snap_button), SNAP_SMALL);
-    }
-    else if (snap_value < SNAP_HUGE_VALUE)
+    if (g_key_file_has_key (section->ini, "edit_mode", "snap_grid_size",
+                            NULL))
     {
-        hildon_picker_button_set_active
-            (HILDON_PICKER_BUTTON (section->snap_button), SNAP_LARGE);
-    }
-    else
-    {
-        hildon_picker_button_set_active
-            (HILDON_PICKER_BUTTON (section->snap_button), SNAP_HUGE);
-    }
+        section->snap_button = _build_snap_to_grid ();
+
+        snap_value = g_key_file_get_integer (section->ini, "edit_mode",
+                                             "snap_grid_size", NULL);
 
+        if (snap_value < SNAP_SMALL_VALUE)
+        {
+            hildon_picker_button_set_active
+                (HILDON_PICKER_BUTTON (section->snap_button), SNAP_NONE);
+        }
+        else if (snap_value < SNAP_LARGE_VALUE)
+        {
+            hildon_picker_button_set_active
+                (HILDON_PICKER_BUTTON (section->snap_button), SNAP_SMALL);
+        }
+        else if (snap_value < SNAP_HUGE_VALUE)
+        {
+            hildon_picker_button_set_active
+                (HILDON_PICKER_BUTTON (section->snap_button), SNAP_LARGE);
+        }
+        else
+        {
+            hildon_picker_button_set_active
+                (HILDON_PICKER_BUTTON (section->snap_button), SNAP_HUGE);
+        }
+    }
     section->gconf = gconf_client_get_default ();
     section->bookmarks_button = _build_bookmarks_button (section);
 
     iface = TWEAKR_SECTION (section);
     iface->name = _("Desktop");
     iface->widget = gtk_vbox_new (FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (iface->widget), section->snap_button,
-                        FALSE, FALSE, 0);
+
+    if (section->snap_button)
+    {
+        gtk_box_pack_start (GTK_BOX (iface->widget), section->snap_button,
+                            FALSE, FALSE, 0);
+    }
     if (section->bookmarks_button)
     {
         gtk_box_pack_start (GTK_BOX (iface->widget),
diff --git a/modules/tweakr-profile.c b/modules/tweakr-profile.c
new file mode 100644 (file)
index 0000000..749d018
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * vim:ts=4:sw=4:et:cindent:cino=(0
+ */ 
+
+#include <config.h>
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+#include <hildon/hildon-picker-button.h>
+#include <hildon/hildon-touch-selector.h>
+#include <hildon/hildon-button.h>
+#include <hildon/hildon-entry.h>
+#include <hildon/hildon-pannable-area.h>
+#include <hildon/hildon-defines.h>
+#include <gconf/gconf-client.h>
+
+#include "libtweakr-section/tweakr-section.h"
+#include "libtweakr-section/tweakr-module.h"
+
+
+#define TWEAKR_TYPE_PROFILE_SECTION \
+        (tweakr_profile_section_type)
+#define TWEAKR_PROFILE_SECTION(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+        TWEAKR_TYPE_PROFILE_SECTION, \
+        TweakrProfileSection))
+#define TWEAKR_PROFILE_SECTION_CLASS(k) \
+        (G_TYPE_CHECK_CLASS_CAST((k), \
+        TWEAKR_TYPE_PROFILE_SECTION, \
+        TweakrProfileSectionClass))
+#define TWEAKR_IS_PROFILE_SECTION(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+        TWEAKR_TYPE_PROFILE_SECTION))
+
+typedef struct _TweakrProfileSection TweakrProfileSection;
+typedef struct _TweakrProfileSectionClass
+               TweakrProfileSectionClass;
+
+struct _TweakrProfileSection
+{
+    TweakrSection parent_instance;
+};
+
+struct _TweakrProfileSectionClass
+{
+    TweakrSectionClass parent_class;
+};
+
+
+static GType tweakr_profile_section_get_type (GTypeModule *module);
+static void tweakr_profile_section_class_init
+    (TweakrProfileSectionClass *class);
+static void tweakr_profile_section_init
+    (TweakrProfileSection *section);
+static void tweakr_profile_section_dispose (GObject *obj);
+
+static gboolean _save (TweakrSection *section,
+                       gboolean *requires_restart);
+
+static GType tweakr_profile_section_type = 0;
+static TweakrSectionClass *
+    tweakr_profile_section_parent_class = NULL;
+
+
+G_MODULE_EXPORT void
+tweakr_module_load (TweakrModule *module)
+{
+    tweakr_profile_section_get_type (G_TYPE_MODULE (module));
+}
+
+G_MODULE_EXPORT void
+tweakr_module_unload (TweakrModule *module)
+{
+}
+
+static GType
+tweakr_profile_section_get_type (GTypeModule *module)
+{
+    if (!tweakr_profile_section_type)
+    {
+        static const GTypeInfo section_info =
+        {
+            sizeof (TweakrProfileSectionClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) tweakr_profile_section_class_init,
+            NULL,           /* class_finalize */
+            NULL,           /* class_data     */
+            sizeof (TweakrProfileSection),
+            0,              /* n_preallocs    */
+            (GInstanceInitFunc) tweakr_profile_section_init
+        };
+
+        tweakr_profile_section_type =
+            g_type_module_register_type (module, TWEAKR_TYPE_SECTION,
+                                         "TweakrProfileSection",
+                                         &section_info, 0);
+    }
+
+    return tweakr_profile_section_type;
+}
+
+static void
+tweakr_profile_section_class_init
+    (TweakrProfileSectionClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    TweakrSectionClass *section_class =
+        TWEAKR_SECTION_CLASS (klass);
+
+    tweakr_profile_section_parent_class =
+        g_type_class_peek_parent (klass);
+
+    section_class->name   = "_Profile";
+    section_class->save = _save;
+
+    object_class->dispose = tweakr_profile_section_dispose;
+}
+
+static void
+tweakr_profile_section_init (TweakrProfileSection *section)
+{
+    TweakrSection *iface;
+
+    iface = TWEAKR_SECTION (section);
+    iface->name = _("Profile");
+}
+
+static void
+tweakr_profile_section_dispose (GObject *obj)
+{
+    G_OBJECT_CLASS (tweakr_profile_section_parent_class)->dispose (obj);
+}
+
+static gboolean _save (TweakrSection *section, gboolean *requires_restart)
+{
+    return TRUE;
+}
+