[gnome-control-center/wip/libgnome-control-center: 2/6] shell: add a new settings shell



commit 4ea04c81dc1a1a61c4f117ac6a4af8d39eadceb5
Author: Thomas Wood <thomas wood intel com>
Date:   Wed May 19 11:11:26 2010 +0100

    shell: add a new settings shell
    
    The new shell provides an implementation of CcShell and also removes the
    dependency on libslab.

 configure.ac                                       |    4 +-
 shell/Makefile.am                                  |   79 ++-
 shell/cc-shell-category-view.c                     |  245 ++++++++
 shell/cc-shell-category-view.h                     |   76 +++
 shell/cc-shell-item-view.c                         |  194 ++++++
 shell/cc-shell-item-view.h                         |   72 +++
 shell/cc-shell-marshal.list                        |    1 +
 shell/cc-shell-model.c                             |  101 +++
 shell/cc-shell-model.h                             |   88 +++
 shell/control-center.c                             |  289 ++++-----
 shell/gnome-control-center.c                       |  660 ++++++++++++++++++++
 ...op.in.in => gnome-control-center.desktop.in.in} |    0
 shell/gnome-control-center.h                       |   75 +++
 shell/shell-search-renderer.c                      |  299 +++++++++
 shell/shell-search-renderer.h                      |   74 +++
 shell/shell.ui                                     |  169 +++++
 16 files changed, 2228 insertions(+), 198 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3f609ed..96390eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,7 +125,7 @@ COMMON_MODULES="gtk+-2.0 >= 2.20.0 dnl
  gnome-desktop-2.0 >= 2.29.4"
 PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
 PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1)
-PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnome-menu unique-1.0)
+PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnome-menu unique-1.0 gio-unix-2.0)
 PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
 PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-2.0)
 PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
@@ -368,7 +368,7 @@ libwindow-settings/gnome-window-settings-2.0.pc
 po/Makefile.in
 libslab/Makefile
 shell/Makefile
-shell/gnomecc.desktop.in
+shell/gnome-control-center.desktop.in
 typing-break/Makefile
 ])
 
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 915d75a..795c6ba 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,30 +1,61 @@
-if HAVE_LIBSLAB_DEPS
-REAL_LIBSLAB_CFLAGS = -I$(top_srcdir)/libslab
-REAL_LIBSLAB_LIBS = $(top_builddir)/libslab/libslab.la
-else
-REAL_LIBSLAB_CFLAGS = $(EXTERNAL_LIBSLAB_CFLAGS)
-REAL_LIBSLAB_LIBS = $(EXTERNAL_LIBSLAB_LIBS)
-endif
+NULL =
 
 INCLUDES =					\
 	-I$(top_srcdir)				\
-	$(REAL_LIBSLAB_CFLAGS)			\
-	$(GNOMECC_SHELL_CFLAGS)
+	-I$(top_srcdir)/libgnome-control-center \
+	$(GIO_CFLAGS)				\
+	$(GNOMECC_SHELL_CFLAGS)			\
+	$(NULL)
+
+bin_PROGRAMS = gnome-control-center
+
+MARSHAL_FILES = cc-shell-marshal.c cc-shell-marshal.h
+BUILT_SOURCES = $(MARSHAL_FILES)
 
-bin_PROGRAMS = gnome-control-center 
+cc-shell-marshal.h: cc-shell-marshal.list
+	@GLIB_GENMARSHAL@ --prefix=cc_shell_marshal $< --header > $@
 
-gnome_control_center_SOURCES =		\
-	control-center.c
+cc-shell-marshal.c: cc-shell-marshal.list
+	@GLIB_GENMARSHAL@ --prefix=cc_shell_marshal $< --body --header > $@
 
-gnome_control_center_LDADD =						\
-	$(GNOMECC_SHELL_LIBS)						\
-	$(REAL_LIBSLAB_LIBS)
+gnome_control_center_SOURCES =			\
+	control-center.c			\
+	control-center.h			\
+	gnome-control-center.c			\
+	gnome-control-center.h			\
+	shell-search-renderer.c			\
+	shell-search-renderer.h			\
+	cc-shell-category-view.c		\
+	cc-shell-category-view.h		\
+	cc-shell-item-view.c			\
+	cc-shell-item-view.h			\
+	cc-shell-model.c			\
+	cc-shell-model.h			\
+	$(MARSHAL_FILES)			\
+	$(NULL)
+
+gnome_control_center_LDADD =			\
+	$(top_builddir)/libgnome-control-center/libgnome-control-center.la \
+	$(GNOMECC_SHELL_LIBS)			\
+	$(GIO_LIBS)				\
+	$(NULL)
+
+gnome_control_center_LDFLAGS = -export-dynamic
 
 AM_CPPFLAGS =							\
-	-DGNOMELOCALEDIR="\"$(datadir)/locale\""
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\""		\
+	-DUIDIR="\"$(uidir)\""					\
+	-DMENUDIR="\"$(menudir)\""				\
+	$(NULL)
+
+menudir = $(sysconfdir)/xdg/menus
+menu_DATA = gnomecc.menu
+
+uidir = $(pkgdatadir)/ui
+ui_DATA = shell.ui
 
 sysdir = $(datadir)/applications
-sys_in_files = gnomecc.desktop.in
+sys_in_files = gnome-control-center.desktop.in
 sys_DATA = $(sys_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
@@ -46,11 +77,15 @@ if GCONF_SCHEMAS_INSTALL
 	fi
 endif
 
-menudir = $(sysconfdir)/xdg/menus
-menu_DATA = gnomecc.menu
-
-EXTRA_DIST = gnomecc.desktop.in.in gnomecc.directory.in gnomecc.menu $(schemas_DATA).in
+EXTRA_DIST = 					\
+	$(ui_DATA)				\
+	gnome-control-center.desktop.in.in	\
+	gnomecc.directory.in			\
+	gnomecc.menu				\
+	cc-shell-marshal.list			\
+	$(schemas_DATA).in			\
+	$(NULL)
 
-DISTCLEANFILES = gnomecc.desktop gnomecc.desktop.in gnomecc.directory $(schemas_DATA)
+DISTCLEANFILES = gnome-control-center.desktop gnome-control-center.desktop.in gnomecc.directory $(schemas_DATA)
 
 -include $(top_srcdir)/git.mk
diff --git a/shell/cc-shell-category-view.c b/shell/cc-shell-category-view.c
new file mode 100644
index 0000000..298507c
--- /dev/null
+++ b/shell/cc-shell-category-view.c
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#include "cc-shell-category-view.h"
+#include "cc-shell-item-view.h"
+#include "cc-shell.h"
+#include "cc-shell-model.h"
+
+G_DEFINE_TYPE (CcShellCategoryView, cc_shell_category_view, GTK_TYPE_FRAME)
+
+#define SHELL_CATEGORY_VIEW_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewPrivate))
+
+enum
+{
+  PROP_NAME = 1,
+  PROP_MODEL
+};
+
+struct _CcShellCategoryViewPrivate
+{
+  gchar *name;
+  GtkTreeModel *model;
+
+  GtkWidget *header;
+  GtkWidget *iconview;
+};
+
+static void
+cc_shell_category_view_get_property (GObject    *object,
+                                     guint       property_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+  switch (property_id)
+    {
+    case PROP_NAME:
+      g_value_set_string (value, priv->name);
+      break;
+
+    case PROP_MODEL:
+      g_value_set_object (value, priv->model);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_shell_category_view_set_property (GObject      *object,
+                                     guint         property_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+  switch (property_id)
+    {
+    case PROP_NAME:
+      priv->name = g_value_dup_string (value);
+      break;
+
+    case PROP_MODEL:
+      priv->model = g_value_dup_object (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_shell_category_view_dispose (GObject *object)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+  if (priv->model)
+    {
+      g_object_unref (priv->model);
+      priv->model = NULL;
+    }
+
+  G_OBJECT_CLASS (cc_shell_category_view_parent_class)->dispose (object);
+}
+
+static void
+cc_shell_category_view_finalize (GObject *object)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+  if (priv->name)
+    {
+      g_free (priv->name);
+      priv->name = NULL;
+    }
+
+  G_OBJECT_CLASS (cc_shell_category_view_parent_class)->finalize (object);
+}
+
+static void
+cc_shell_category_view_constructed (GObject *object)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+  gchar *header_name;
+  GtkWidget *iconview, *vbox, *header, *self;
+
+  self = GTK_WIDGET (object);
+
+  iconview = cc_shell_item_view_new ();
+  gtk_icon_view_set_model (GTK_ICON_VIEW (iconview), priv->model);
+
+  vbox = gtk_vbox_new (FALSE, 0);
+
+  gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (iconview), COL_PIXBUF);
+  gtk_icon_view_set_text_column (GTK_ICON_VIEW (iconview), COL_NAME);
+  gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 120);
+
+  /* create the header if required */
+  if (priv->name)
+    {
+      header_name = g_strdup_printf ("<b>%s</b>", priv->name);
+
+      header = g_object_new (GTK_TYPE_LABEL,
+                             "use-markup", TRUE,
+                             "label", header_name,
+                             "wrap", TRUE,
+                             "xalign", 0.0,
+                             "xpad", 6,
+                             NULL);
+
+      g_free (header_name);
+      gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, TRUE, 3);
+
+      priv->header = header;
+    }
+
+  /* add the iconview to the vbox */
+  gtk_box_pack_start (GTK_BOX (vbox), iconview, FALSE, TRUE, 0);
+
+  /* add the main vbox to the view */
+  gtk_container_add (GTK_CONTAINER (object), vbox);
+  gtk_widget_show_all (vbox);
+
+  priv->iconview = iconview;
+}
+
+static void
+cc_shell_category_view_style_set (GtkWidget *widget,
+                                  GtkStyle  *old_style)
+{
+  CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (widget)->priv;
+
+  if (priv->header)
+    {
+      gtk_widget_modify_bg (priv->header, GTK_STATE_NORMAL,
+                            &widget->style->base[GTK_STATE_NORMAL]);
+      gtk_widget_modify_fg (priv->header, GTK_STATE_NORMAL,
+                            &widget->style->text[GTK_STATE_NORMAL]);
+    }
+
+  if (priv->iconview)
+    {
+      gtk_widget_modify_bg (priv->iconview, GTK_STATE_NORMAL,
+                            &widget->style->base[GTK_STATE_NORMAL]);
+      gtk_widget_modify_fg (priv->iconview, GTK_STATE_NORMAL,
+                            &widget->style->text[GTK_STATE_NORMAL]);
+    }
+}
+
+static void
+cc_shell_category_view_class_init (CcShellCategoryViewClass *klass)
+{
+  GParamSpec *pspec;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcShellCategoryViewPrivate));
+
+  object_class->get_property = cc_shell_category_view_get_property;
+  object_class->set_property = cc_shell_category_view_set_property;
+  object_class->dispose = cc_shell_category_view_dispose;
+  object_class->finalize = cc_shell_category_view_finalize;
+  object_class->constructed = cc_shell_category_view_constructed;
+
+  widget_class->style_set = cc_shell_category_view_style_set;
+
+  pspec = g_param_spec_string ("name",
+                               "Name",
+                               "Name of the category",
+                               NULL,
+                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
+                               | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_NAME, pspec);
+
+  pspec = g_param_spec_object ("model",
+                               "Model",
+                               "Model of the category",
+                               GTK_TYPE_TREE_MODEL,
+                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
+                               | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_MODEL, pspec);
+
+}
+
+static void
+cc_shell_category_view_init (CcShellCategoryView *self)
+{
+  self->priv = SHELL_CATEGORY_VIEW_PRIVATE (self);
+
+  gtk_frame_set_shadow_type (GTK_FRAME (self), GTK_SHADOW_NONE);
+}
+
+GtkWidget *
+cc_shell_category_view_new (const gchar  *name,
+                            GtkTreeModel *model)
+{
+  return g_object_new (CC_TYPE_SHELL_CATEGORY_VIEW,
+                       "name", name,
+                       "model", model, NULL);
+}
+
+CcShellItemView*
+cc_shell_category_view_get_item_view (CcShellCategoryView *self)
+{
+  return (CcShellItemView*) self->priv->iconview;
+}
diff --git a/shell/cc-shell-category-view.h b/shell/cc-shell-category-view.h
new file mode 100644
index 0000000..d434501
--- /dev/null
+++ b/shell/cc-shell-category-view.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+
+#ifndef _CC_SHELL_CATEGORY_VIEW_H
+#define _CC_SHELL_CATEGORY_VIEW_H
+
+#include <gtk/gtk.h>
+#include "cc-shell-item-view.h"
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_CATEGORY_VIEW cc_shell_category_view_get_type()
+
+#define CC_SHELL_CATEGORY_VIEW(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryView))
+
+#define CC_SHELL_CATEGORY_VIEW_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass))
+
+#define CC_IS_SHELL_CATEGORY_VIEW(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_SHELL_CATEGORY_VIEW))
+
+#define CC_IS_SHELL_CATEGORY_VIEW_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_SHELL_CATEGORY_VIEW))
+
+#define CC_SHELL_CATEGORY_VIEW_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass))
+
+typedef struct _CcShellCategoryView CcShellCategoryView;
+typedef struct _CcShellCategoryViewClass CcShellCategoryViewClass;
+typedef struct _CcShellCategoryViewPrivate CcShellCategoryViewPrivate;
+
+struct _CcShellCategoryView
+{
+  GtkFrame parent;
+
+  CcShellCategoryViewPrivate *priv;
+};
+
+struct _CcShellCategoryViewClass
+{
+  GtkFrameClass parent_class;
+};
+
+GType cc_shell_category_view_get_type (void) G_GNUC_CONST;
+
+GtkWidget *cc_shell_category_view_new (const gchar  *name,
+                                       GtkTreeModel *model);
+CcShellItemView* cc_shell_category_view_get_item_view (CcShellCategoryView *self);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_CATEGORY_VIEW_H */
diff --git a/shell/cc-shell-item-view.c b/shell/cc-shell-item-view.c
new file mode 100644
index 0000000..a1cd9d7
--- /dev/null
+++ b/shell/cc-shell-item-view.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#include "cc-shell-item-view.h"
+#include "cc-shell-model.h"
+#include "cc-shell-marshal.h"
+
+G_DEFINE_TYPE (CcShellItemView, cc_shell_item_view, GTK_TYPE_ICON_VIEW)
+
+#define SHELL_ITEM_VIEW_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewPrivate))
+
+struct _CcShellItemViewPrivate
+{
+  gboolean ignore_release;
+};
+
+
+enum
+{
+  DESKTOP_ITEM_ACTIVATED,
+
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = {0,};
+
+static void
+cc_shell_item_view_get_property (GObject    *object,
+                                 guint       property_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_shell_item_view_set_property (GObject      *object,
+                                 guint         property_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_shell_item_view_dispose (GObject *object)
+{
+  G_OBJECT_CLASS (cc_shell_item_view_parent_class)->dispose (object);
+}
+
+static void
+cc_shell_item_view_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (cc_shell_item_view_parent_class)->finalize (object);
+}
+
+static gboolean
+iconview_button_press_event_cb (GtkWidget       *widget,
+                                GdkEventButton  *event,
+                                CcShellItemView *cc_view)
+{
+  /* be sure to ignore double and triple clicks */
+  cc_view->priv->ignore_release = (event->type != GDK_BUTTON_PRESS);
+
+  return FALSE;
+}
+
+static gboolean
+iconview_button_release_event_cb (GtkWidget       *widget,
+                                  GdkEventButton  *event,
+                                  CcShellItemView *cc_view)
+{
+  CcShellItemViewPrivate *priv = cc_view->priv;
+
+  if (event->button == 1 && !priv->ignore_release)
+    {
+      GList *selection;
+
+      selection =
+        gtk_icon_view_get_selected_items (GTK_ICON_VIEW (cc_view));
+
+      if (!selection)
+        return TRUE;
+
+      gtk_icon_view_item_activated (GTK_ICON_VIEW (cc_view),
+                                    (GtkTreePath*) selection->data);
+
+      g_list_free (selection);
+    }
+
+  return TRUE;
+}
+
+static void
+iconview_item_activated_cb (GtkIconView     *icon_view,
+                            GtkTreePath     *path,
+                            CcShellItemView *cc_view)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  gchar *name, *desktop_file, *id;
+
+  model = gtk_icon_view_get_model (icon_view);
+
+  gtk_icon_view_unselect_all (icon_view);
+
+  /* get the iter and ensure it is valid */
+  if (!gtk_tree_model_get_iter (model, &iter, path))
+    return;
+
+  gtk_tree_model_get (model, &iter,
+                      COL_NAME, &name,
+                      COL_DESKTOP_FILE, &desktop_file,
+                      COL_ID, &id,
+                      -1);
+
+  g_signal_emit (cc_view, signals[DESKTOP_ITEM_ACTIVATED], 0,
+                 name, id, desktop_file);
+
+  g_free (desktop_file);
+  g_free (name);
+  g_free (id);
+}
+
+static void
+cc_shell_item_view_class_init (CcShellItemViewClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcShellItemViewPrivate));
+
+  object_class->get_property = cc_shell_item_view_get_property;
+  object_class->set_property = cc_shell_item_view_set_property;
+  object_class->dispose = cc_shell_item_view_dispose;
+  object_class->finalize = cc_shell_item_view_finalize;
+
+  signals[DESKTOP_ITEM_ACTIVATED] = g_signal_new ("desktop-item-activated",
+                                                  CC_TYPE_SHELL_ITEM_VIEW,
+                                                  G_SIGNAL_RUN_FIRST,
+                                                  0,
+                                                  NULL,
+                                                  NULL,
+                                                  cc_shell_marshal_VOID__STRING_STRING_STRING,
+                                                  G_TYPE_NONE,
+                                                  3,
+                                                  G_TYPE_STRING,
+                                                  G_TYPE_STRING,
+                                                  G_TYPE_STRING);
+}
+
+static void
+cc_shell_item_view_init (CcShellItemView *self)
+{
+  self->priv = SHELL_ITEM_VIEW_PRIVATE (self);
+
+  g_signal_connect (self, "item-activated",
+                    G_CALLBACK (iconview_item_activated_cb), self);
+  g_signal_connect (self, "button-press-event",
+                    G_CALLBACK (iconview_button_press_event_cb), self);
+  g_signal_connect (self, "button-release-event",
+                    G_CALLBACK (iconview_button_release_event_cb), self);
+}
+
+GtkWidget *
+cc_shell_item_view_new (void)
+{
+  return g_object_new (CC_TYPE_SHELL_ITEM_VIEW, NULL);
+}
diff --git a/shell/cc-shell-item-view.h b/shell/cc-shell-item-view.h
new file mode 100644
index 0000000..ec27f14
--- /dev/null
+++ b/shell/cc-shell-item-view.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#ifndef _CC_SHELL_ITEM_VIEW_H
+#define _CC_SHELL_ITEM_VIEW_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_ITEM_VIEW cc_shell_item_view_get_type()
+
+#define CC_SHELL_ITEM_VIEW(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_SHELL_ITEM_VIEW, CcShellItemView))
+
+#define CC_SHELL_ITEM_VIEW_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass))
+
+#define CC_IS_SHELL_ITEM_VIEW(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_SHELL_ITEM_VIEW))
+
+#define CC_IS_SHELL_ITEM_VIEW_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_SHELL_ITEM_VIEW))
+
+#define CC_SHELL_ITEM_VIEW_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass))
+
+typedef struct _CcShellItemView CcShellItemView;
+typedef struct _CcShellItemViewClass CcShellItemViewClass;
+typedef struct _CcShellItemViewPrivate CcShellItemViewPrivate;
+
+struct _CcShellItemView
+{
+  GtkIconView parent;
+
+  CcShellItemViewPrivate *priv;
+};
+
+struct _CcShellItemViewClass
+{
+  GtkIconViewClass parent_class;
+};
+
+GType cc_shell_item_view_get_type (void) G_GNUC_CONST;
+
+GtkWidget *cc_shell_item_view_new (void);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_ITEM_VIEW_H */
diff --git a/shell/cc-shell-marshal.list b/shell/cc-shell-marshal.list
new file mode 100644
index 0000000..41e4027
--- /dev/null
+++ b/shell/cc-shell-marshal.list
@@ -0,0 +1 @@
+VOID:STRING,STRING,STRING
diff --git a/shell/cc-shell-model.c b/shell/cc-shell-model.c
new file mode 100644
index 0000000..3bd4d31
--- /dev/null
+++ b/shell/cc-shell-model.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#include "cc-shell-model.h"
+#include <string.h>
+
+G_DEFINE_TYPE (CcShellModel, cc_shell_model, GTK_TYPE_LIST_STORE)
+
+static void
+cc_shell_model_class_init (CcShellModelClass *klass)
+{
+
+}
+
+static void
+cc_shell_model_init (CcShellModel *self)
+{
+  GType types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+      GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING};
+
+  gtk_list_store_set_column_types (GTK_LIST_STORE (self),
+                                   N_COLS, types);
+}
+
+CcShellModel *
+cc_shell_model_new (void)
+{
+  return g_object_new (CC_TYPE_SHELL_MODEL, NULL);
+}
+
+void
+cc_shell_model_add_item (CcShellModel   *model,
+                         const gchar    *category_name,
+                         GMenuTreeEntry *item)
+{
+  const gchar *icon = gmenu_tree_entry_get_icon (item);
+  const gchar *name = gmenu_tree_entry_get_name (item);
+  const gchar *id = gmenu_tree_entry_get_desktop_file_id (item);
+  const gchar *desktop = gmenu_tree_entry_get_desktop_file_path (item);
+  const gchar *comment = gmenu_tree_entry_get_comment (item);
+  GdkPixbuf *pixbuf = NULL;
+  gchar *icon2 = NULL;
+  GError *err = NULL;
+  gchar *search_target;
+
+  if (icon != NULL && *icon == '/')
+    {
+      pixbuf = gdk_pixbuf_new_from_file_at_scale (icon, 32, 32, TRUE, &err);
+    }
+  else
+    {
+      if (icon2 == NULL && icon != NULL && g_str_has_suffix (icon, ".png"))
+        icon2 = g_strndup (icon, strlen (icon) - strlen (".png"));
+
+      pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                         icon2 ? icon2 : icon, 32,
+                                         GTK_ICON_LOOKUP_FORCE_SIZE,
+                                         &err);
+    }
+
+  if (err)
+    {
+      g_warning ("Could not load icon '%s': %s", icon2 ? icon2 : icon,
+                 err->message);
+      g_error_free (err);
+    }
+
+  g_free (icon2);
+
+  search_target = g_strconcat (name, " - ", comment, NULL);
+
+  gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, 0,
+                                     COL_NAME, name,
+                                     COL_DESKTOP_FILE, desktop,
+                                     COL_ID, id,
+                                     COL_PIXBUF, pixbuf,
+                                     COL_CATEGORY, category_name,
+                                     COL_SEARCH_TARGET, search_target,
+                                     -1);
+
+  g_free (search_target);
+
+}
diff --git a/shell/cc-shell-model.h b/shell/cc-shell-model.h
new file mode 100644
index 0000000..851b7d2
--- /dev/null
+++ b/shell/cc-shell-model.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+
+#ifndef _CC_SHELL_MODEL_H
+#define _CC_SHELL_MODEL_H
+
+#include <gtk/gtk.h>
+#define GMENU_I_KNOW_THIS_IS_UNSTABLE
+#include <gmenu-tree.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_MODEL cc_shell_model_get_type()
+
+#define CC_SHELL_MODEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_SHELL_MODEL, CcShellModel))
+
+#define CC_SHELL_MODEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_SHELL_MODEL, CcShellModelClass))
+
+#define CC_IS_SHELL_MODEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_SHELL_MODEL))
+
+#define CC_IS_SHELL_MODEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_SHELL_MODEL))
+
+#define CC_SHELL_MODEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_SHELL_MODEL, CcShellModelClass))
+
+typedef struct _CcShellModel CcShellModel;
+typedef struct _CcShellModelClass CcShellModelClass;
+
+enum
+{
+  COL_NAME,
+  COL_DESKTOP_FILE,
+  COL_ID,
+  COL_PIXBUF,
+  COL_CATEGORY,
+  COL_SEARCH_TARGET,
+
+  N_COLS
+};
+
+struct _CcShellModel
+{
+  GtkListStore parent;
+};
+
+struct _CcShellModelClass
+{
+  GtkListStoreClass parent_class;
+};
+
+GType cc_shell_model_get_type (void) G_GNUC_CONST;
+
+CcShellModel *cc_shell_model_new (void);
+
+void cc_shell_model_add_item (CcShellModel   *model,
+                              const gchar    *category_name,
+                              GMenuTreeEntry *item);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_MODEL_H */
diff --git a/shell/control-center.c b/shell/control-center.c
index c9b6657..e000058 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -1,197 +1,138 @@
 /*
- * This file is part of the Control Center.
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
  *
- * Copyright (c) 2006 Novell, Inc.
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  *
- * The Control Center is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
  *
- * The Control Center is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
- * You should have received a copy of the GNU General Public License along with
- * the Control Center; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Author: Thomas Wood <thos gnome org>
  */
 
 #include "config.h"
 
-#include <glib/gi18n.h>
+#include "gnome-control-center.h"
+
 #include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
-#include <unique/unique.h>
+#include <string.h>
 
-#include <libslab/slab.h>
 
-void handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data);
-static GSList *get_actions_list ();
+#include <unique/unique.h>
 
-#define CONTROL_CENTER_PREFIX             "/apps/control-center/cc_"
-#define CONTROL_CENTER_ACTIONS_LIST_KEY   (CONTROL_CENTER_PREFIX  "actions_list")
-#define CONTROL_CENTER_ACTIONS_SEPARATOR  ";"
-#define EXIT_SHELL_ON_STATIC_ACTION       "exit_shell_on_static_action"
 
-static GSList *
-get_actions_list (void)
+enum
 {
-	GSList *l;
-	GSList *key_list;
-	GSList *actions_list = NULL;
-	AppAction *action;
-
-	key_list = get_slab_gconf_slist (CONTROL_CENTER_ACTIONS_LIST_KEY);
-	if (!key_list)
-	{
-		g_warning (_("key not found [%s]\n"), CONTROL_CENTER_ACTIONS_LIST_KEY);
-		return NULL;
-	}
-
-	for (l = key_list; l != NULL; l = l->next)
-	{
-		gchar *entry = (gchar *) l->data;
-		gchar **temp;
-
-		action = g_new (AppAction, 1);
-		temp = g_strsplit (entry, CONTROL_CENTER_ACTIONS_SEPARATOR, 2);
-		action->name = g_strdup (temp[0]);
-		if ((action->item = load_desktop_item_from_unknown (temp[1])) == NULL)
-		{
-			g_warning ("get_actions_list() - PROBLEM - Can't load %s\n", temp[1]);
-		}
-		else
-		{
-			actions_list = g_slist_prepend (actions_list, action);
-		}
-		g_strfreev (temp);
-		g_free (entry);
-	}
-
-	g_slist_free (key_list);
-
-	return g_slist_reverse (actions_list);
-}
+  CC_SHELL_RAISE_COMMAND = 1
+};
 
-void
-handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data)
-{
-	gchar *temp;
-	AppShellData *app_data = (AppShellData *) data;
-	GnomeDesktopItem *item =
-		(GnomeDesktopItem *) g_object_get_data (G_OBJECT (tile), APP_ACTION_KEY);
-
-	if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
-		return;
-	open_desktop_item_exec (item);
-
-	temp = g_strdup_printf("%s%s", app_data->gconf_prefix, EXIT_SHELL_ON_STATIC_ACTION);
-	if (get_slab_gconf_bool(temp))
-	{
-		if (app_data->exit_on_close)
-			gtk_main_quit ();
-		else
-			hide_shell (app_data);
-	}
-	g_free (temp);
-}
 
 static UniqueResponse
-message_received_cb (UniqueApp         *app,
-		     UniqueCommand      command,
-		     UniqueMessageData *message,
-		     guint              time,
-		     gpointer           user_data)
+message_received (UniqueApp          *app,
+                  gint                command,
+                  UniqueMessageData  *message_data,
+                  guint               time_,
+                  GnomeControlCenter *shell)
 {
-	UniqueResponse  res;
-	AppShellData   *app_data = user_data;
-
-	switch (command) {
-	case UNIQUE_ACTIVATE:
-		/* move the main window to the screen that sent us the command */
-		gtk_window_set_screen (GTK_WINDOW (app_data->main_app),
-				       unique_message_data_get_screen (message));
-		if (!app_data->main_app_window_shown_once)
-			show_shell (app_data);
-
-		gtk_window_present_with_time (GTK_WINDOW (app_data->main_app),
-					      time);
-
-		gtk_widget_grab_focus (SLAB_SECTION (app_data->filter_section)->contents);
-
-		res = UNIQUE_RESPONSE_OK;
-		break;
-	default:
-		res = UNIQUE_RESPONSE_PASSTHROUGH;
-		break;
-	}
-
-	return res;
+  const gchar *id;
+  gsize len;
+
+  gnome_control_center_present (shell);
+
+  id = (gchar*) unique_message_data_get (message_data, &len);
+
+  if (id)
+    {
+      GError *err = NULL;
+
+      if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, &err))
+        {
+          if (err)
+            {
+              g_warning ("Could not load setting panel \"%s\": %s", id,
+                         err->message);
+              g_error_free (err);
+              err = NULL;
+            }
+        }
+    }
+
+  return GTK_RESPONSE_OK;
 }
 
 int
-main (int argc, char *argv[])
+main (int argc, char **argv)
 {
-	gboolean hidden = FALSE;
-	UniqueApp *unique_app;
-	AppShellData *app_data;
-	GSList *actions;
-	GError *error;
-	GOptionEntry options[] = {
-	  { "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
-	  { NULL }
-	};
-
-#ifdef ENABLE_NLS
-	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-	textdomain (GETTEXT_PACKAGE);
-#endif
-
-	error = NULL;
-	if (!gtk_init_with_args (&argc, &argv,
-				 NULL, options, GETTEXT_PACKAGE, &error)) {
-		g_printerr ("%s\n", error->message);
-		g_error_free (error);
-		return 1;
-	}
-
-	unique_app = unique_app_new ("org.gnome.gnome-control-center.shell", NULL);
-	if (unique_app_is_running (unique_app)) {
-		int retval = 0;
-
-		if (!hidden) {
-			UniqueResponse response;
-			response = unique_app_send_message (unique_app,
-							    UNIQUE_ACTIVATE,
-							    NULL);
-			retval = (response != UNIQUE_RESPONSE_OK);
-		}
-
-		g_object_unref (unique_app);
-		return retval;
-	}
-
-	app_data = appshelldata_new ("gnomecc.menu", NULL, CONTROL_CENTER_PREFIX,
-				     GTK_ICON_SIZE_DND, FALSE, TRUE);
-	generate_categories (app_data);
-
-	actions = get_actions_list ();
-	layout_shell (app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions,
-		handle_static_action_clicked);
-
-	create_main_window (app_data, "MyControlCenter", _("Control Center"),
-		"gnome-control-center", 975, 600, hidden);
-
-	unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
-	g_signal_connect (unique_app, "message-received",
-			  G_CALLBACK (message_received_cb), app_data);
-
-	gtk_main ();
-
-	g_object_unref (unique_app);
-
-	return 0;
-};
+  GnomeControlCenter *shell;
+  UniqueApp *unique;
+
+  g_thread_init (NULL);
+  gtk_init (&argc, &argv);
+
+  /* use Unique to enforce single instance of this application */
+  unique = unique_app_new_with_commands ("org.gnome.ControlCenter",
+                                         NULL,
+                                         "raise",
+                                         CC_SHELL_RAISE_COMMAND,
+                                         NULL);
+
+  /* check if the application is already running */
+  if (unique_app_is_running (unique))
+    {
+      UniqueMessageData *data;
+
+      if (argc == 2)
+        {
+          data = unique_message_data_new ();
+          unique_message_data_set (data, (guchar*) argv[1],
+                                   strlen(argv[1]) + 1);
+        }
+      else
+        data = NULL;
+
+      unique_app_send_message (unique, 1, data);
+
+      gdk_notify_startup_complete ();
+      return 0;
+    }
+
+
+  shell = gnome_control_center_new ();
+
+  g_signal_connect (unique, "message-received", G_CALLBACK (message_received),
+                    shell);
+
+  if (argc == 2)
+    {
+      gchar *start_id;
+      GError *err = NULL;
+
+      start_id = argv[1];
+
+      if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), start_id, &err))
+        {
+          g_warning ("Could not load setting panel \"%s\": %s", start_id,
+                     (err) ? err->message : "Unknown error");
+          if (err)
+            {
+              g_error_free (err);
+              err = NULL;
+            }
+        }
+    }
+
+  gtk_main ();
+
+  g_object_unref (shell);
+
+  return 0;
+}
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
new file mode 100644
index 0000000..06b83a6
--- /dev/null
+++ b/shell/gnome-control-center.c
@@ -0,0 +1,660 @@
+/*
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+
+#include "gnome-control-center.h"
+
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <string.h>
+#define GMENU_I_KNOW_THIS_IS_UNSTABLE
+#include <gmenu-tree.h>
+
+#include "cc-panel.h"
+#include "cc-shell.h"
+#include "shell-search-renderer.h"
+#include "cc-shell-category-view.h"
+#include "cc-shell-model.h"
+
+G_DEFINE_TYPE (GnomeControlCenter, gnome_control_center, CC_TYPE_SHELL)
+
+#define CONTROL_CENTER_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterPrivate))
+
+#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
+
+enum
+{
+  OVERVIEW_PAGE,
+  SEARCH_PAGE,
+  CAPPLET_PAGE
+};
+
+
+struct _GnomeControlCenterPrivate
+{
+  GtkBuilder *builder;
+  GtkWidget  *notebook;
+  GtkWidget  *window;
+  GtkWidget  *search_entry;
+
+  GtkListStore *store;
+
+  GtkTreeModel *search_filter;
+  GtkWidget *search_view;
+  GtkCellRenderer *search_renderer;
+  gchar *filter_string;
+
+  guint32 last_time;
+};
+
+
+static void
+activate_panel (GnomeControlCenter *shell,
+                const gchar *id,
+                const gchar *desktop_file)
+{
+  GnomeControlCenterPrivate *priv = shell->priv;
+  GAppInfo *appinfo;
+  GError *err = NULL;
+  GdkAppLaunchContext *ctx;
+  GKeyFile *key_file;
+
+  /* start app directly */
+
+  if (!desktop_file)
+    return;
+
+  key_file = g_key_file_new ();
+  g_key_file_load_from_file (key_file, desktop_file, 0, &err);
+
+  if (err)
+    {
+      g_warning ("Error starting \"%s\": %s", id, err->message);
+
+      g_error_free (err);
+      err = NULL;
+      return;
+    }
+
+  appinfo = (GAppInfo*) g_desktop_app_info_new_from_keyfile (key_file);
+
+  g_key_file_free (key_file);
+
+
+  ctx = gdk_app_launch_context_new ();
+  gdk_app_launch_context_set_screen (ctx, gdk_screen_get_default ());
+  gdk_app_launch_context_set_timestamp (ctx, priv->last_time);
+
+  g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (ctx), &err);
+
+  g_object_unref (appinfo);
+  g_object_unref (ctx);
+
+  if (err)
+    {
+      g_warning ("Error starting \"%s\": %s", id, err->message);
+      g_error_free (err);
+      err = NULL;
+    }
+}
+
+static void
+shell_show_overview_page (GnomeControlCenterPrivate *priv)
+{
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), OVERVIEW_PAGE);
+
+  gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), CAPPLET_PAGE);
+
+  gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->builder,
+                                                         "label-title")), "");
+  gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                                       "title-alignment")));
+
+  /* clear the search text */
+  g_free (priv->filter_string);
+  priv->filter_string = g_strdup ("");
+  gtk_entry_set_text (GTK_ENTRY (priv->search_entry), "");
+}
+
+
+
+static void
+item_activated_cb (CcShellCategoryView *view,
+                   gchar               *name,
+                   gchar               *id,
+                   gchar               *desktop_file,
+                   GnomeControlCenter  *shell)
+{
+  GError *err = NULL;
+
+  if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, &err))
+    {
+      /* TODO: show message to user */
+      if (err)
+        {
+          g_warning ("Could not active panel \"%s\": %s", id, err->message);
+          g_error_free (err);
+        }
+    }
+}
+
+static gboolean
+model_filter_func (GtkTreeModel              *model,
+                   GtkTreeIter               *iter,
+                   GnomeControlCenterPrivate *priv)
+{
+  gchar *name, *target;
+  gchar *needle, *haystack;
+  gboolean result;
+
+  gtk_tree_model_get (model, iter, COL_NAME, &name,
+                      COL_SEARCH_TARGET, &target, -1);
+
+  if (!priv->filter_string || !name || !target)
+    {
+      g_free (name);
+      g_free (target);
+      return FALSE;
+    }
+
+  needle = g_utf8_casefold (priv->filter_string, -1);
+  haystack = g_utf8_casefold (target, -1);
+
+  result = (strstr (haystack, needle) != NULL);
+
+  g_free (name);
+  g_free (target);
+  g_free (haystack);
+  g_free (needle);
+
+  return result;
+}
+
+static gboolean
+category_filter_func (GtkTreeModel *model,
+                      GtkTreeIter  *iter,
+                      gchar        *filter)
+{
+  gchar *category;
+  gboolean result;
+
+  gtk_tree_model_get (model, iter, COL_CATEGORY, &category, -1);
+
+  result = (g_strcmp0 (category, filter) == 0);
+
+  g_free (category);
+
+  return result;
+}
+
+static void
+search_entry_changed_cb (GtkEntry                  *entry,
+                         GnomeControlCenterPrivate *priv)
+{
+
+  /* if the entry text was set manually (not by the user) */
+  if (!g_strcmp0 (priv->filter_string, gtk_entry_get_text (entry)))
+    return;
+
+  g_free (priv->filter_string);
+  priv->filter_string = g_strdup (gtk_entry_get_text (entry));
+
+  g_object_set (priv->search_renderer,
+                "search-string", priv->filter_string,
+                NULL);
+
+  if (!g_strcmp0 (priv->filter_string, ""))
+    {
+      shell_show_overview_page (priv);
+    }
+  else
+    {
+      gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->search_filter));
+      gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), SEARCH_PAGE);
+
+      gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->builder,
+                                                             "label-title")),
+                          "");
+      gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                                           "title-alignment")));
+    }
+}
+
+static gboolean
+search_entry_key_press_event_cb (GtkEntry    *entry,
+                                 GdkEventKey *event,
+                                 GnomeControlCenterPrivate   *priv)
+{
+  if (event->keyval == GDK_Return)
+    {
+      GtkTreePath *path;
+
+      path = gtk_tree_path_new_first ();
+
+      priv->last_time = event->time;
+
+      gtk_icon_view_item_activated (GTK_ICON_VIEW (priv->search_view), path);
+
+      gtk_tree_path_free (path);
+      return TRUE;
+    }
+
+  if (event->keyval == GDK_Escape)
+    {
+      gtk_entry_set_text (entry, "");
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+search_entry_clear_cb (GtkEntry *entry)
+{
+  gtk_entry_set_text (entry, "");
+}
+
+
+static void
+setup_search (GnomeControlCenter *shell)
+{
+  GtkWidget *search_scrolled, *search_view, *widget;
+  GnomeControlCenterPrivate *priv = shell->priv;
+
+  g_return_if_fail (priv->store != NULL);
+
+  /* create the search filter */
+  priv->search_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store),
+                                                   NULL);
+
+  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->search_filter),
+                                          (GtkTreeModelFilterVisibleFunc)
+                                            model_filter_func,
+                                          priv, NULL);
+
+  /* set up the search view */
+  priv->search_view = search_view = cc_shell_item_view_new ();
+  gtk_icon_view_set_orientation (GTK_ICON_VIEW (search_view),
+                                 GTK_ORIENTATION_HORIZONTAL);
+  gtk_icon_view_set_spacing (GTK_ICON_VIEW (search_view), 6);
+  gtk_icon_view_set_model (GTK_ICON_VIEW (search_view),
+                           GTK_TREE_MODEL (priv->search_filter));
+  gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (search_view), COL_PIXBUF);
+
+  search_scrolled = W (priv->builder, "search-scrolled-window");
+  gtk_container_add (GTK_CONTAINER (search_scrolled), search_view);
+
+
+  /* add the custom renderer */
+  priv->search_renderer = (GtkCellRenderer*) shell_search_renderer_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (search_view),
+                              priv->search_renderer, TRUE);
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (search_view),
+                                 priv->search_renderer,
+                                 "title", COL_NAME);
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (search_view),
+                                 priv->search_renderer,
+                                 "search-target", COL_SEARCH_TARGET);
+
+  /* connect the activated signal */
+  g_signal_connect (search_view, "desktop-item-activated",
+                    G_CALLBACK (item_activated_cb), shell);
+
+  /* setup the search entry widget */
+  widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "search-entry");
+  priv->search_entry = widget;
+
+  g_signal_connect (widget, "changed", G_CALLBACK (search_entry_changed_cb),
+                    priv);
+  g_signal_connect (widget, "key-press-event",
+                    G_CALLBACK (search_entry_key_press_event_cb), priv);
+
+  g_signal_connect (widget, "icon-release", G_CALLBACK (search_entry_clear_cb),
+                    priv);
+}
+
+static void
+fill_model (GnomeControlCenter *shell)
+{
+  GSList *list, *l;
+  GMenuTreeDirectory *d;
+  GMenuTree *tree;
+  GtkWidget *vbox;
+
+  GnomeControlCenterPrivate *priv = shell->priv;
+
+  vbox = W (priv->builder, "main-vbox");
+
+  tree = gmenu_tree_lookup (MENUDIR "/gnomecc.menu", 0);
+
+  if (!tree)
+    {
+      g_warning ("Could not find control center menu");
+      return;
+    }
+
+  d = gmenu_tree_get_root_directory (tree);
+
+  list = gmenu_tree_directory_get_contents (d);
+
+  priv->store = (GtkListStore *) cc_shell_model_new ();
+
+  for (l = list; l; l = l->next)
+    {
+      GMenuTreeItemType type;
+      type = gmenu_tree_item_get_type (l->data);
+
+      if (type == GMENU_TREE_ITEM_DIRECTORY)
+        {
+          GtkTreeModel *filter;
+          GtkWidget *categoryview;
+          GSList *contents, *f;
+          const gchar *dir_name;
+
+          contents = gmenu_tree_directory_get_contents (l->data);
+          dir_name = gmenu_tree_directory_get_name (l->data);
+
+          /* create new category view for this category */
+          filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store),
+                                              NULL);
+          gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
+                                                  (GtkTreeModelFilterVisibleFunc) category_filter_func,
+                                                  g_strdup (dir_name), g_free);
+
+          categoryview = cc_shell_category_view_new (dir_name, filter);
+          gtk_box_pack_start (GTK_BOX (vbox), categoryview, FALSE, TRUE, 6);
+          g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
+                            "desktop-item-activated",
+                            G_CALLBACK (item_activated_cb), shell);
+          gtk_widget_show (categoryview);
+
+          /* add the items from this category to the model */
+          for (f = contents; f; f = f->next)
+            {
+              if (gmenu_tree_item_get_type (f->data) == GMENU_TREE_ITEM_ENTRY)
+                {
+                  cc_shell_model_add_item (CC_SHELL_MODEL (priv->store),
+                                           dir_name,
+                                           f->data);
+                }
+            }
+        }
+    }
+
+  g_slist_free (list);
+
+}
+
+
+static void
+home_button_clicked_cb (GtkButton *button,
+                        GnomeControlCenter *shell)
+{
+  shell_show_overview_page (shell->priv);
+}
+
+static void
+notebook_switch_page_cb (GtkNotebook               *book,
+                         GtkNotebookPage           *page,
+                         gint                       page_num,
+                         GnomeControlCenterPrivate *priv)
+{
+  /* make sure the home button is shown on all pages except the overview page */
+
+  if (page_num == OVERVIEW_PAGE)
+    gtk_widget_hide (W (priv->builder, "home-button"));
+  else
+    gtk_widget_show (W (priv->builder, "home-button"));
+
+  if (page_num == CAPPLET_PAGE)
+    gtk_widget_hide (W (priv->builder, "search-entry"));
+  else
+    gtk_widget_show (W (priv->builder, "search-entry"));
+}
+
+/* CcShell implementation */
+static gboolean
+_shell_set_active_panel_from_id (CcShell      *shell,
+                                 const gchar  *start_id,
+                                 GError      **err)
+{
+  GtkTreeIter iter;
+  gboolean iter_valid;
+  gchar *name = NULL;
+  gchar *desktop;
+  GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (shell)->priv;
+
+
+  iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store),
+                                              &iter);
+
+  /* find the details for this item */
+  while (iter_valid)
+    {
+      gchar *id;
+
+      gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+                          COL_NAME, &name,
+                          COL_ID, &id,
+                          COL_DESKTOP_FILE, &desktop,
+                          -1);
+      if (id && !strcmp (id, start_id))
+        {
+          g_free (id);
+          break;
+        }
+      else
+        {
+          g_free (id);
+          g_free (name);
+          g_free (desktop);
+
+          name = NULL;
+          id = NULL;
+        }
+
+      iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store),
+                                             &iter);
+    }
+
+  if (!name)
+    {
+      g_warning ("Could not find settings panel \"%s\"", start_id);
+      return FALSE;
+    }
+  else
+    {
+      activate_panel (GNOME_CONTROL_CENTER (shell), start_id, desktop);
+
+      g_free (name);
+      g_free (desktop);
+
+      return TRUE;
+    }
+}
+
+
+
+
+/* GObject Implementation */
+static void
+gnome_control_center_get_property (GObject    *object,
+                                   guint       property_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+gnome_control_center_set_property (GObject      *object,
+                                   guint         property_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+gnome_control_center_dispose (GObject *object)
+{
+  GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
+
+  if (priv->window)
+    {
+      gtk_widget_destroy (priv->window);
+      priv->window = NULL;
+
+      /* destroying the window will destroy its children */
+      priv->notebook = NULL;
+      priv->search_entry = NULL;
+      priv->search_view = NULL;
+      priv->search_renderer = NULL;
+    }
+
+  if (priv->builder)
+    {
+      g_object_unref (priv->builder);
+      priv->builder = NULL;
+    }
+
+  if (priv->store)
+    {
+      g_object_unref (priv->store);
+      priv->store = NULL;
+    }
+
+  if (priv->search_filter)
+    {
+      g_object_unref (priv->search_filter);
+      priv->search_filter = NULL;
+    }
+
+
+  G_OBJECT_CLASS (gnome_control_center_parent_class)->dispose (object);
+}
+
+static void
+gnome_control_center_finalize (GObject *object)
+{
+  GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
+
+
+  if (priv->filter_string)
+    {
+      g_free (priv->filter_string);
+      priv->filter_string = NULL;
+    }
+
+  G_OBJECT_CLASS (gnome_control_center_parent_class)->finalize (object);
+}
+
+static void
+gnome_control_center_class_init (GnomeControlCenterClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  CcShellClass *shell_class = CC_SHELL_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GnomeControlCenterPrivate));
+
+  object_class->get_property = gnome_control_center_get_property;
+  object_class->set_property = gnome_control_center_set_property;
+  object_class->dispose = gnome_control_center_dispose;
+  object_class->finalize = gnome_control_center_finalize;
+
+  shell_class->set_active_panel_from_id = _shell_set_active_panel_from_id;
+}
+
+static void
+gnome_control_center_init (GnomeControlCenter *self)
+{
+  GError *err = NULL;
+  GtkWidget *vbox;
+  GnomeControlCenterPrivate *priv;
+
+  priv = self->priv = CONTROL_CENTER_PRIVATE (self);
+
+  /* load the user interface */
+  priv->builder = gtk_builder_new ();
+
+  if (!gtk_builder_add_from_file (priv->builder, UIDIR "/shell.ui", &err))
+    {
+      g_critical ("Could not build interface: %s", err->message);
+      g_error_free (err);
+
+      return;
+    }
+
+  /* connect various signals */
+  priv->window = W (priv->builder, "main-window");
+  g_signal_connect (priv->window, "delete-event", G_CALLBACK (gtk_main_quit),
+                    NULL);
+
+  priv->notebook = W (priv->builder, "notebook");
+
+  g_signal_connect (priv->notebook, "switch-page",
+                    G_CALLBACK (notebook_switch_page_cb), priv);
+
+  g_signal_connect (gtk_builder_get_object (priv->builder, "home-button"),
+                    "clicked", G_CALLBACK (home_button_clicked_cb), self);
+
+
+  /* setup background colours */
+  vbox = W (priv->builder, "main-vbox");
+  gtk_widget_set_size_request (vbox, 0, -1);
+
+  gtk_widget_modify_bg (vbox->parent, GTK_STATE_NORMAL,
+                        &vbox->style->base[GTK_STATE_NORMAL]);
+  gtk_widget_modify_fg (vbox->parent, GTK_STATE_NORMAL,
+                        &vbox->style->text[GTK_STATE_NORMAL]);
+
+  /* load the available settings panels */
+  fill_model (self);
+
+  /* setup search functionality */
+  setup_search (self);
+
+  gtk_widget_show_all (priv->window);
+}
+
+GnomeControlCenter *
+gnome_control_center_new (void)
+{
+  return g_object_new (GNOME_TYPE_CONTROL_CENTER, NULL);
+}
+
+void
+gnome_control_center_present (GnomeControlCenter *center)
+{
+  gtk_window_present (GTK_WINDOW (center->priv->window));
+}
diff --git a/shell/gnomecc.desktop.in.in b/shell/gnome-control-center.desktop.in.in
similarity index 100%
rename from shell/gnomecc.desktop.in.in
rename to shell/gnome-control-center.desktop.in.in
diff --git a/shell/gnome-control-center.h b/shell/gnome-control-center.h
new file mode 100644
index 0000000..09ba5de
--- /dev/null
+++ b/shell/gnome-control-center.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#ifndef _GNOME_CONTROL_CENTER_H
+#define _GNOME_CONTROL_CENTER_H
+
+#include <glib-object.h>
+#include <libgnome-control-center/cc-shell.h>
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_CONTROL_CENTER gnome_control_center_get_type()
+
+#define GNOME_CONTROL_CENTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  GNOME_TYPE_CONTROL_CENTER, GnomeControlCenter))
+
+#define GNOME_CONTROL_CENTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
+
+#define GNOME_IS_CONTROL_CENTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  GNOME_TYPE_CONTROL_CENTER))
+
+#define GNOME_IS_CONTROL_CENTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  GNOME_TYPE_CONTROL_CENTER))
+
+#define GNOME_CONTROL_CENTER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
+
+typedef struct _GnomeControlCenter GnomeControlCenter;
+typedef struct _GnomeControlCenterClass GnomeControlCenterClass;
+typedef struct _GnomeControlCenterPrivate GnomeControlCenterPrivate;
+
+struct _GnomeControlCenter
+{
+  CcShell parent;
+
+  GnomeControlCenterPrivate *priv;
+};
+
+struct _GnomeControlCenterClass
+{
+  CcShellClass parent_class;
+};
+
+GType gnome_control_center_get_type (void) G_GNUC_CONST;
+
+GnomeControlCenter *gnome_control_center_new (void);
+
+void gnome_control_center_present (GnomeControlCenter *center);
+
+G_END_DECLS
+
+#endif /* _GNOME_CONTROL_CENTER_H */
diff --git a/shell/shell-search-renderer.c b/shell/shell-search-renderer.c
new file mode 100644
index 0000000..08cada5
--- /dev/null
+++ b/shell/shell-search-renderer.c
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#include "shell-search-renderer.h"
+#include <string.h>
+
+G_DEFINE_TYPE (ShellSearchRenderer, shell_search_renderer, GTK_TYPE_CELL_RENDERER)
+
+#define SEARCH_RENDERER_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererPrivate))
+
+struct _ShellSearchRendererPrivate
+{
+  gchar *title;
+  gchar *search_target;
+  gchar *search_string;
+
+  PangoLayout *layout;
+};
+
+enum
+{
+  PROP_TITLE = 1,
+  PROP_SEARCH_TARGET,
+  PROP_SEARCH_STRING
+};
+
+
+static void
+shell_search_renderer_get_property (GObject    *object,
+                                    guint       property_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+  case PROP_TITLE:
+  case PROP_SEARCH_TARGET:
+  case PROP_SEARCH_STRING:
+    break;
+
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+shell_search_renderer_set_property (GObject      *object,
+                                    guint         property_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+  switch (property_id)
+    {
+  case PROP_TITLE:
+    g_free (priv->title);
+    priv->title = g_value_dup_string (value);
+    break;
+
+  case PROP_SEARCH_TARGET:
+    g_free (priv->search_target);
+    priv->search_target = g_value_dup_string (value);
+    break;
+
+  case PROP_SEARCH_STRING:
+    g_free (priv->search_string);
+    priv->search_string = g_value_dup_string (value);
+    break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+shell_search_renderer_dispose (GObject *object)
+{
+  ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+  if (priv->layout)
+    {
+      g_object_unref (priv->layout);
+      priv->layout = NULL;
+    }
+
+  G_OBJECT_CLASS (shell_search_renderer_parent_class)->dispose (object);
+}
+
+static void
+shell_search_renderer_finalize (GObject *object)
+{
+  ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+  if (priv->title)
+    {
+      g_free (priv->title);
+      priv->title = NULL;
+    }
+
+  if (priv->search_target)
+    {
+      g_free (priv->search_target);
+      priv->search_target = NULL;
+    }
+
+  if (priv->search_string)
+    {
+      g_free (priv->search_string);
+      priv->search_string = NULL;
+    }
+
+  G_OBJECT_CLASS (shell_search_renderer_parent_class)->finalize (object);
+}
+
+static void
+shell_search_renderer_set_layout (ShellSearchRenderer *cell, GtkWidget *widget)
+{
+  gchar *display_string;
+  ShellSearchRendererPrivate *priv = cell->priv;
+  gchar *needle, *haystack;
+  gchar *full_string;
+
+  if (!priv->layout)
+    {
+      priv->layout = pango_layout_new (gtk_widget_get_pango_context (widget));
+      pango_layout_set_ellipsize (priv->layout, PANGO_ELLIPSIZE_END);
+    }
+
+  full_string = priv->search_target;
+
+  needle = g_utf8_casefold (priv->search_string, -1);
+  haystack = g_utf8_casefold (full_string, -1);
+
+  /* clear any previous attributes */
+  pango_layout_set_attributes (priv->layout, NULL);
+
+  if (priv->search_string && priv->title
+      && (strstr (haystack, needle)))
+    {
+      gchar *start;
+      gchar *lead, *trail, *leaddot;
+      gint count;
+#define CONTEXT 10
+
+      count = strlen (needle);
+      start = strstr (haystack, needle);
+
+      lead = MAX (start - CONTEXT, haystack);
+      trail = start + count;
+
+      if (lead == haystack)
+        leaddot = "";
+      else
+        leaddot = "...";
+
+      lead = g_strndup (lead, start - lead);
+
+      display_string = g_markup_printf_escaped ("%s\n"
+                                                "<small>%s%s<b>%s</b>%s</small>",
+                                                priv->title, leaddot, lead,
+                                                needle, trail);
+
+      g_free (lead);
+    }
+  else
+    display_string = g_markup_escape_text (priv->title, -1);
+
+
+  pango_layout_set_markup (priv->layout, display_string, -1);
+  g_free (display_string);
+  g_free (needle);
+  g_free (haystack);
+}
+
+static void
+shell_search_renderer_get_size (GtkCellRenderer    *cell,
+                                GtkWidget          *widget,
+                                GdkRectangle       *cell_area,
+                                gint               *x_offset,
+                                gint               *y_offset,
+                                gint               *width,
+                                gint               *height)
+{
+  ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (cell)->priv;
+  PangoRectangle rect;
+
+  shell_search_renderer_set_layout (SHELL_SEARCH_RENDERER (cell), widget);
+
+  pango_layout_set_width (priv->layout, PANGO_SCALE * 180);
+  pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
+
+  if (width) *width = rect.width;
+  if (height) *height = rect.height;
+
+  if (x_offset) *x_offset = 0;
+  if (y_offset) *y_offset = 0;
+
+}
+
+static void
+shell_search_renderer_render (GtkCellRenderer      *cell,
+                              GdkDrawable          *window,
+                              GtkWidget            *widget,
+                              GdkRectangle         *background_area,
+                              GdkRectangle         *cell_area,
+                              GdkRectangle         *expose_area,
+                              GtkCellRendererState  flags)
+{
+  ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (cell)->priv;
+  cairo_t *cr;
+  PangoRectangle rect;
+
+  shell_search_renderer_set_layout (SHELL_SEARCH_RENDERER (cell), widget);
+
+  cr = gdk_cairo_create (window);
+
+  pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
+
+  cairo_move_to (cr, cell_area->x, cell_area->y);
+
+  /* FIXME: get the correct colour from the theme */
+  cairo_set_source_rgb (cr, 0, 0, 0);
+  if (priv->layout)
+    pango_cairo_layout_path (cr, priv->layout);
+  cairo_fill (cr);
+
+  cairo_destroy (cr);
+}
+
+static void
+shell_search_renderer_class_init (ShellSearchRendererClass *klass)
+{
+  GParamSpec *pspec;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkCellRendererClass *cell_renderer = GTK_CELL_RENDERER_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (ShellSearchRendererPrivate));
+
+  object_class->get_property = shell_search_renderer_get_property;
+  object_class->set_property = shell_search_renderer_set_property;
+  object_class->dispose = shell_search_renderer_dispose;
+  object_class->finalize = shell_search_renderer_finalize;
+
+  cell_renderer->get_size = shell_search_renderer_get_size;
+  cell_renderer->render = shell_search_renderer_render;
+
+  pspec = g_param_spec_string ("title",
+                               "Title",
+                               "Item title",
+                               "",
+                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_TITLE, pspec);
+
+  pspec = g_param_spec_string ("search-target",
+                               "Search Target",
+                               "The string that will be searched",
+                               "",
+                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_SEARCH_TARGET, pspec);
+
+  pspec = g_param_spec_string ("search-string",
+                               "Search String",
+                               "Current search string",
+                               "",
+                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_SEARCH_STRING, pspec);
+}
+
+static void
+shell_search_renderer_init (ShellSearchRenderer *self)
+{
+  self->priv = SEARCH_RENDERER_PRIVATE (self);
+}
+
+ShellSearchRenderer *
+shell_search_renderer_new (void)
+{
+  return g_object_new (SHELL_TYPE_SEARCH_RENDERER, NULL);
+}
diff --git a/shell/shell-search-renderer.h b/shell/shell-search-renderer.h
new file mode 100644
index 0000000..d0dfd82
--- /dev/null
+++ b/shell/shell-search-renderer.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Thomas Wood <thos gnome org>
+ */
+
+#ifndef _SHELL_SEARCH_RENDERER_H
+#define _SHELL_SEARCH_RENDERER_H
+
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define SHELL_TYPE_SEARCH_RENDERER shell_search_renderer_get_type()
+
+#define SHELL_SEARCH_RENDERER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  SHELL_TYPE_SEARCH_RENDERER, ShellSearchRenderer))
+
+#define SHELL_SEARCH_RENDERER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererClass))
+
+#define SHELL_IS_SEARCH_RENDERER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  SHELL_TYPE_SEARCH_RENDERER))
+
+#define SHELL_IS_SEARCH_RENDERER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  SHELL_TYPE_SEARCH_RENDERER))
+
+#define SHELL_SEARCH_RENDERER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererClass))
+
+typedef struct _ShellSearchRenderer ShellSearchRenderer;
+typedef struct _ShellSearchRendererClass ShellSearchRendererClass;
+typedef struct _ShellSearchRendererPrivate ShellSearchRendererPrivate;
+
+struct _ShellSearchRenderer
+{
+  GtkCellRenderer parent;
+
+  ShellSearchRendererPrivate *priv;
+};
+
+struct _ShellSearchRendererClass
+{
+  GtkCellRendererClass parent_class;
+};
+
+GType shell_search_renderer_get_type (void) G_GNUC_CONST;
+
+ShellSearchRenderer *shell_search_renderer_new (void);
+
+G_END_DECLS
+
+#endif /* _SHELL_SEARCH_RENDERER_H */
diff --git a/shell/shell.ui b/shell/shell.ui
new file mode 100644
index 0000000..57ce5f9
--- /dev/null
+++ b/shell/shell.ui
@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="main-window">
+    <property name="title" translatable="yes">System Settings</property>
+    <property name="default_width">800</property>
+    <property name="default_height">500</property>
+    <property name="icon_name">gnome-control-center</property>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkToolbar" id="toolbar1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkToolItem" id="toolbutton1">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="border_width">5</property>
+                    <child>
+                      <object class="GtkButton" id="home-button">
+                        <property name="label">_All Settings</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="no_show_all">True</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="entry-alignment">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="xscale">0</property>
+                        <child>
+                          <object class="GtkEntry" id="search-entry">
+                            <property name="width_request">210</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">&#x25CF;</property>
+                            <property name="primary_icon_stock">gtk-find</property>
+                            <property name="secondary_icon_stock">gtk-clear</property>
+                            <property name="secondary_icon_activatable">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="title-alignment">
+            <property name="no_show_all">True</property>
+            <property name="top_padding">12</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkLabel" id="label-title">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkNotebook" id="notebook">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="show_tabs">False</property>
+            <property name="show_border">False</property>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <child>
+                  <object class="GtkViewport" id="viewport1">
+                    <property name="visible">True</property>
+                    <property name="resize_mode">queue</property>
+                    <child>
+                      <object class="GtkVBox" id="main-vbox">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="search-scrolled-window">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkListStore" id="liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name exec -->
+      <column type="gchararray"/>
+      <!-- column-name icon -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkSizeGroup" id="sizegroup">
+    <property name="mode">vertical</property>
+    <widgets>
+      <widget name="home-button"/>
+      <widget name="entry-alignment"/>
+    </widgets>
+  </object>
+</interface>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]