diff --git a/configure.ac b/configure.ac
index eb521e0..9410710 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,6 +340,8 @@ panels/keyboard/gnome-keyboard-panel.desktop.in
 panels/keyboard/gnome-keybindings.pc
 panels/region/Makefile
 panels/region/gnome-region-panel.desktop.in
+panels/media/Makefile
+panels/media/gnome-media-panel.desktop.in
 panels/mouse/Makefile
 panels/mouse/gnome-mouse-panel.desktop.in
 panels/network/Makefile
diff --git a/panels/Makefile.am b/panels/Makefile.am
index 69bce7d..f616f48 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -2,6 +2,7 @@ SUBDIRS= \
 	background \
 	screen \
 	display \
+	media \
 	mouse \
 	region \
 	network \
diff --git a/panels/media/Makefile.am b/panels/media/Makefile.am
new file mode 100644
index 0000000..846879b
--- /dev/null
+++ b/panels/media/Makefile.am
@@ -0,0 +1,38 @@
+# This is used in GNOMECC_CAPPLETS_CFLAGS
+cappletname = media
+
+ccpanelsdir = $(PANELS_DIR)
+ccpanels_LTLIBRARIES = libmedia.la
+
+libmedia_la_SOURCES = \
+	media-module.c \
+	cc-media-panel.c \
+	cc-media-panel.h \
+	nautilus-open-with-dialog.c \
+	nautilus-open-with-dialog.h
+
+libmedia_la_LIBADD = \
+	$(PANEL_LIBS)
+
+libmedia_la_LDFLAGS = $(PANEL_LDFLAGS)
+
+@INTLTOOL_DESKTOP_RULE@
+
+uidir = $(pkgdatadir)/ui
+dist_ui_DATA = gnome-media-properties.ui
+
+desktopdir = $(datadir)/applications
+Desktop_in_files = gnome-media-panel.desktop.in
+desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
+
+INCLUDES   = 					\
+	$(GNOMECC_CAPPLETS_CFLAGS)		\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
+	-DGNOMECC_UI_DIR=\""$(uidir)"\"
+
+CLEANFILES = \
+	$(GNOMECC_CAPPLETS_CLEANFILES) \
+	$(Desktop_in_files) \
+	$(desktop_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/panels/media/cc-media-panel.c b/panels/media/cc-media-panel.c
new file mode 100644
index 0000000..622a268
--- /dev/null
+++ b/panels/media/cc-media-panel.c
@@ -0,0 +1,797 @@
+/*
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ *         Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-media-panel.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "nautilus-open-with-dialog.h"
+
+G_DEFINE_DYNAMIC_TYPE (CcMediaPanel, cc_media_panel, CC_TYPE_PANEL)
+
+#define MEDIA_PANEL_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_MEDIA_PANEL, CcMediaPanelPrivate))
+
+/* Autorun options */
+#define PREF_MEDIA_AUTORUN_NEVER                "autorun-never"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_START_APP  "autorun-x-content-start-app"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE     "autorun-x-content-ignore"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
+
+enum {
+  AUTORUN_ASK,
+  AUTORUN_IGNORE,
+  AUTORUN_APP,
+  AUTORUN_OPEN_FOLDER,
+  AUTORUN_SEP,
+  AUTORUN_OTHER_APP,
+};
+
+enum {
+  COLUMN_AUTORUN_GICON,
+  COLUMN_AUTORUN_NAME,
+  COLUMN_AUTORUN_APP_INFO,
+  COLUMN_AUTORUN_X_CONTENT_TYPE,
+  COLUMN_AUTORUN_ITEM_TYPE,
+};
+
+struct _CcMediaPanelPrivate {
+  GtkBuilder *builder;
+  GSettings *preferences;
+};
+
+typedef struct {
+  guint changed_signal_id;
+  GtkWidget *combo_box;
+
+  char *x_content_type;
+
+  gboolean other_application_selected;
+  CcMediaPanel *self;
+} AutorunComboBoxData;
+
+static void
+prepare_combo_box (CcMediaPanel *self,
+		   GtkWidget *combo_box,
+		   const char *x_content_type);
+
+static void
+cc_media_panel_dispose (GObject *object)
+{
+  CcMediaPanel *self = CC_MEDIA_PANEL (object);
+
+  if (self->priv->builder != NULL) {
+    g_object_unref (self->priv->builder);
+    self->priv->builder = NULL;
+  }
+
+  if (self->priv->preferences != NULL) {
+    g_object_unref (self->priv->preferences);
+    self->priv->preferences = NULL;
+  }
+  
+  G_OBJECT_CLASS (cc_media_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_media_panel_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (cc_media_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_media_panel_class_init (CcMediaPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcMediaPanelPrivate));
+
+  object_class->dispose = cc_media_panel_dispose;
+  object_class->finalize = cc_media_panel_finalize;
+}
+
+static void
+cc_media_panel_class_finalize (CcMediaPanelClass *klass)
+{
+}
+
+static void
+remove_elem_from_str_array (char **v, const char *s)
+{
+  int n, m;
+
+  if (v == NULL) {
+    return;
+  }
+
+  for (n = 0; v[n] != NULL; n++) {
+    if (g_strcmp0 (v[n], s) == 0) {
+      for (m = n + 1; v[m] != NULL; m++) {
+	v[m - 1] = v[m];
+      }
+      v[m - 1] = NULL;
+      n--;
+    }
+  }
+} 
+
+static char **
+add_elem_to_str_array (char **v, const char *s)
+{
+  guint len;
+  char **r;
+
+  len = v != NULL ? g_strv_length (v) : 0;
+  r = g_new0 (char *, len + 2);
+  memcpy (r, v, len * sizeof (char *));
+  r[len] = g_strdup (s);
+  r[len+1] = NULL;
+  g_free (v);
+
+  return r;
+}
+
+static void
+update_media_sensitivity (CcMediaPanel *self)
+{
+  gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_handling_vbox")),
+			    ! g_settings_get_boolean (self->priv->preferences, PREF_MEDIA_AUTORUN_NEVER));
+}
+
+static void
+autorun_set_preferences (CcMediaPanel *self,
+			 const char *x_content_type,
+			 gboolean pref_start_app,
+			 gboolean pref_ignore,
+			 gboolean pref_open_folder)
+{
+  char **x_content_start_app;
+  char **x_content_ignore;
+  char **x_content_open_folder;
+
+  g_assert (x_content_type != NULL);
+
+  x_content_start_app = g_settings_get_strv (self->priv->preferences,
+					     PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
+  x_content_ignore = g_settings_get_strv (self->priv->preferences,
+					  PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
+  x_content_open_folder = g_settings_get_strv (self->priv->preferences,
+					       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
+
+  remove_elem_from_str_array (x_content_start_app, x_content_type);
+  if (pref_start_app) {
+    x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type);
+  }
+  g_settings_set_strv (self->priv->preferences,
+		       PREF_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app);
+
+  remove_elem_from_str_array (x_content_ignore, x_content_type);
+  if (pref_ignore) {
+    x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type);
+  }
+  g_settings_set_strv (self->priv->preferences,
+		       PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore);
+
+  remove_elem_from_str_array (x_content_open_folder, x_content_type);
+  if (pref_open_folder) {
+    x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type);
+  }
+  g_settings_set_strv (self->priv->preferences,
+		       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) x_content_open_folder);
+
+  g_strfreev (x_content_open_folder);
+  g_strfreev (x_content_ignore);
+  g_strfreev (x_content_start_app);
+
+}
+
+static void
+autorun_rebuild_combo_box (AutorunComboBoxData *data)
+{
+  char *x_content_type;
+
+  x_content_type = g_strdup (data->x_content_type);
+  prepare_combo_box (data->self,
+		     data->combo_box,
+		     x_content_type);
+
+  g_free (x_content_type);
+}
+
+static void
+other_application_selected (NautilusOpenWithDialog *dialog,
+			    GAppInfo *app_info,
+			    AutorunComboBoxData *data)
+{
+  autorun_set_preferences (data->self, data->x_content_type, TRUE, FALSE, FALSE);
+  g_app_info_set_as_default_for_type (app_info,
+				      data->x_content_type,
+				      NULL);
+  data->other_application_selected = TRUE;
+
+  /* rebuild so we include and select the new application in the list */
+  autorun_rebuild_combo_box (data);
+}
+
+static void
+handle_dialog_closure (AutorunComboBoxData *data)
+{
+  if (!data->other_application_selected) {
+    /* reset combo box so we don't linger on "Open with other Application..." */
+    autorun_rebuild_combo_box (data);
+  }
+}
+
+static void 
+combo_box_changed (GtkComboBox *combo_box,
+                   AutorunComboBoxData *data)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  GAppInfo *app_info;
+  char *x_content_type;
+  int type;
+  CcMediaPanel *self = data->self;
+
+  model = NULL;
+  app_info = NULL;
+  x_content_type = NULL;
+
+  if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
+    goto out;
+  }
+
+  model = gtk_combo_box_get_model (combo_box);
+  if (model == NULL) {
+    goto out;
+  }
+
+  gtk_tree_model_get (model, &iter, 
+		      COLUMN_AUTORUN_APP_INFO, &app_info,
+		      COLUMN_AUTORUN_X_CONTENT_TYPE, &x_content_type,
+		      COLUMN_AUTORUN_ITEM_TYPE, &type,
+		      -1);
+
+  switch (type) {
+  case AUTORUN_ASK:
+    autorun_set_preferences (self, x_content_type,
+			     FALSE, FALSE, FALSE);
+    break;
+  case AUTORUN_IGNORE:
+    autorun_set_preferences (self, x_content_type,
+			     FALSE, TRUE, FALSE);
+    break;
+  case AUTORUN_OPEN_FOLDER:
+    autorun_set_preferences (self, x_content_type,
+			     FALSE, FALSE, TRUE);
+    break;
+
+  case AUTORUN_APP:
+    autorun_set_preferences (self, x_content_type,
+			     TRUE, FALSE, FALSE);
+    g_app_info_set_as_default_for_type (app_info,
+					x_content_type,
+					NULL);
+    break;
+
+  case AUTORUN_OTHER_APP:
+    {
+      GtkWidget *dialog;
+
+      data->other_application_selected = FALSE;
+
+      dialog = nautilus_add_application_dialog_new (NULL, x_content_type);
+      gtk_window_set_transient_for (GTK_WINDOW (dialog),
+				    GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (data->self))));
+      gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+      g_signal_connect (dialog, "application_selected",
+			G_CALLBACK (other_application_selected),
+			data);
+      g_signal_connect_swapped (dialog, "response",
+				G_CALLBACK (handle_dialog_closure), data);
+      g_signal_connect_swapped (dialog, "destroy",
+				G_CALLBACK (handle_dialog_closure), data);
+      gtk_widget_show (GTK_WIDGET (dialog));
+
+      break;
+    }
+  }
+ 
+ out:
+  if (app_info != NULL) {
+    g_object_unref (app_info);
+  }
+
+  g_free (x_content_type);
+}
+
+static void 
+other_type_combo_box_changed (GtkComboBox *combo_box,
+			      CcMediaPanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  char *x_content_type;
+  GtkWidget *action_combo_box;
+
+  x_content_type = NULL;
+
+  if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
+    goto out;
+  }
+
+  model = gtk_combo_box_get_model (combo_box);
+  if (model == NULL) {
+    goto out;
+  }
+
+  gtk_tree_model_get (model, &iter, 
+		      2, &x_content_type,
+		      -1);
+
+  action_combo_box = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
+							 "media_other_action_combobox"));
+
+  prepare_combo_box (self, action_combo_box,
+		     x_content_type);
+ out:
+  g_free (x_content_type);
+}
+
+static int
+eel_g_strv_find (char **strv,
+		 const char *find_me)
+{
+  int index;
+
+  g_return_val_if_fail (find_me != NULL, -1);
+	
+  for (index = 0; strv[index] != NULL; ++index) {
+    if (g_strcmp0 (strv[index], find_me) == 0) {
+      return index;
+    }
+  }
+
+  return -1;
+}
+
+static void
+autorun_get_preferences (CcMediaPanel *self,
+			 const char *x_content_type,
+			 gboolean *pref_start_app,
+			 gboolean *pref_ignore,
+			 gboolean *pref_open_folder)
+{
+  char **x_content_start_app;
+  char **x_content_ignore;
+  char **x_content_open_folder;
+
+  g_return_if_fail (pref_start_app != NULL);
+  g_return_if_fail (pref_ignore != NULL);
+  g_return_if_fail (pref_open_folder != NULL);
+
+  *pref_start_app = FALSE;
+  *pref_ignore = FALSE;
+  *pref_open_folder = FALSE;
+  x_content_start_app = g_settings_get_strv (self->priv->preferences,
+					     PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
+  x_content_ignore = g_settings_get_strv (self->priv->preferences,
+					  PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
+  x_content_open_folder = g_settings_get_strv (self->priv->preferences,
+					       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
+  if (x_content_start_app != NULL) {
+    *pref_start_app = eel_g_strv_find (x_content_start_app, x_content_type) != -1;
+  }
+  if (x_content_ignore != NULL) {
+    *pref_ignore = eel_g_strv_find (x_content_ignore, x_content_type) != -1;
+  }
+  if (x_content_open_folder != NULL) {
+    *pref_open_folder = eel_g_strv_find (x_content_open_folder, x_content_type) != -1;
+  }
+  g_strfreev (x_content_ignore);
+  g_strfreev (x_content_start_app);
+  g_strfreev (x_content_open_folder);
+}
+
+static gboolean
+combo_box_separator_func (GtkTreeModel *model,
+                          GtkTreeIter *iter,
+                          gpointer data)
+{
+  char *str;
+
+  gtk_tree_model_get (model, iter,
+		      1, &str,
+		      -1);
+
+  if (str != NULL) {
+    g_free (str);
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+static void 
+autorun_combobox_data_destroy (AutorunComboBoxData *data)
+{
+  /* signal handler may be automatically disconnected by destroying the widget */
+  if (g_signal_handler_is_connected (data->combo_box, data->changed_signal_id)) {
+    g_signal_handler_disconnect (data->combo_box, data->changed_signal_id);
+  }
+  g_free (data->x_content_type);
+  g_free (data);
+}
+
+static void
+prepare_combo_box (CcMediaPanel *self,
+		   GtkWidget *combo_box,
+		   const char *x_content_type)
+{
+  GList *l;
+  GList *app_info_list;
+  GAppInfo *default_app_info;
+  GtkListStore *list_store;
+  GtkTreeIter iter;
+  GIcon *icon;
+  int set_active;
+  int n;
+  int num_apps;
+  gboolean pref_ask;
+  gboolean pref_start_app;
+  gboolean pref_ignore;
+  gboolean pref_open_folder;
+  AutorunComboBoxData *data;
+  GtkCellRenderer *renderer;
+  gboolean new_data;
+
+  autorun_get_preferences (self, x_content_type,
+			   &pref_start_app, &pref_ignore, &pref_open_folder);
+  pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
+
+  set_active = -1;
+  data = NULL;
+  new_data = TRUE;
+
+  app_info_list = g_app_info_get_all_for_type (x_content_type);
+  default_app_info = g_app_info_get_default_for_type (x_content_type, FALSE);
+  num_apps = g_list_length (app_info_list);
+
+  list_store = gtk_list_store_new (5,
+				   G_TYPE_ICON,
+				   G_TYPE_STRING,
+				   G_TYPE_APP_INFO,
+				   G_TYPE_STRING,
+				   G_TYPE_INT);
+
+  /* no apps installed */
+  if (num_apps == 0) {
+    gtk_list_store_append (list_store, &iter);
+    icon = g_themed_icon_new (GTK_STOCK_DIALOG_ERROR);
+
+    /* TODO: integrate with PackageKit-gnome to find applications */
+
+    gtk_list_store_set (list_store, &iter,
+			COLUMN_AUTORUN_GICON, icon,
+			COLUMN_AUTORUN_NAME, _("No applications found"),
+			COLUMN_AUTORUN_APP_INFO, NULL,
+			COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+			COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
+			-1);
+    g_object_unref (icon);
+  } else {
+    gtk_list_store_append (list_store, &iter);
+    icon = g_themed_icon_new (GTK_STOCK_DIALOG_QUESTION);
+
+    gtk_list_store_set (list_store, &iter, 
+			COLUMN_AUTORUN_GICON, icon, 
+			COLUMN_AUTORUN_NAME, _("Ask what to do"), 
+			COLUMN_AUTORUN_APP_INFO, NULL, 
+			COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+			COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
+			-1);
+    g_object_unref (icon);
+
+    gtk_list_store_append (list_store, &iter);
+    icon = g_themed_icon_new (GTK_STOCK_CLOSE);
+
+    gtk_list_store_set (list_store, &iter, 
+			COLUMN_AUTORUN_GICON, icon,
+			COLUMN_AUTORUN_NAME, _("Do Nothing"), 
+			COLUMN_AUTORUN_APP_INFO, NULL, 
+			COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+			COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_IGNORE,
+			-1);
+    g_object_unref (icon);
+
+    gtk_list_store_append (list_store, &iter);
+    icon = g_themed_icon_new ("folder-open");
+
+    gtk_list_store_set (list_store, &iter, 
+			COLUMN_AUTORUN_GICON, icon,
+			COLUMN_AUTORUN_NAME, _("Open Folder"), 
+			COLUMN_AUTORUN_APP_INFO, NULL, 
+			COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+			COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OPEN_FOLDER,
+			-1);
+    g_object_unref (icon);	
+
+    gtk_list_store_append (list_store, &iter);
+    gtk_list_store_set (list_store, &iter, 
+			COLUMN_AUTORUN_GICON, NULL, 
+			COLUMN_AUTORUN_NAME, NULL, 
+			COLUMN_AUTORUN_APP_INFO, NULL, 
+			COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
+			COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_SEP,
+			-1);
+
+    for (l = app_info_list, n = 4; l != NULL; l = l->next, n++) {
+      char *open_string;
+      GAppInfo *app_info = l->data;
+			
+      /* we deliberately ignore should_show because some apps might want
+       * to install special handlers that should be hidden in the regular
+       * application launcher menus
+       */
+			
+      icon = g_app_info_get_icon (app_info);
+      open_string = g_strdup_printf (_("Open %s"), g_app_info_get_display_name (app_info));
+
+      gtk_list_store_append (list_store, &iter);
+      gtk_list_store_set (list_store, &iter, 
+			  COLUMN_AUTORUN_GICON, icon,
+			  COLUMN_AUTORUN_NAME, open_string, 
+			  COLUMN_AUTORUN_APP_INFO, app_info, 
+			  COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+			  COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_APP,
+			  -1);
+
+      g_free (open_string);
+			
+      if (g_app_info_equal (app_info, default_app_info)) {
+	set_active = n;
+      }
+    }
+  }
+
+  gtk_list_store_append (list_store, &iter);
+  gtk_list_store_set (list_store, &iter,
+		      COLUMN_AUTORUN_GICON, NULL,
+		      COLUMN_AUTORUN_NAME, NULL,
+		      COLUMN_AUTORUN_APP_INFO, NULL,
+		      COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
+		      COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_SEP,
+		      -1);
+
+  gtk_list_store_append (list_store, &iter);
+  icon = g_themed_icon_new ("application-x-executable");
+
+  gtk_list_store_set (list_store, &iter,
+		      COLUMN_AUTORUN_GICON, icon,
+		      COLUMN_AUTORUN_NAME, _("Open with other Application..."),
+		      COLUMN_AUTORUN_APP_INFO, NULL,
+		      COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
+		      COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OTHER_APP,
+		      -1);
+  g_object_unref (icon);
+
+  if (default_app_info != NULL) {
+    g_object_unref (default_app_info);
+  }
+  g_list_free_full (app_info_list, g_object_unref);
+
+  gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
+  g_object_unref (list_store);
+
+  gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box));
+
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
+				  "gicon", COLUMN_AUTORUN_GICON,
+				  NULL);
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
+				  "text", COLUMN_AUTORUN_NAME,
+				  NULL);
+  gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo_box), combo_box_separator_func, NULL, NULL);
+
+  if (num_apps == 0) {
+    gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
+    gtk_widget_set_sensitive (combo_box, FALSE);
+  } else {
+    gtk_widget_set_sensitive (combo_box, TRUE);
+    if (pref_ask) {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
+    } else if (pref_ignore) {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1);
+    } else if (pref_open_folder) {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 2);
+    } else if (set_active != -1) {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), set_active);
+    } else {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1);
+    }
+
+    /* See if we have an old data around */
+    data = g_object_get_data (G_OBJECT (combo_box), "autorun_combobox_data");
+    if (data) {
+      new_data = FALSE;
+      g_free (data->x_content_type);
+    } else {
+      data = g_new0 (AutorunComboBoxData, 1);
+    }
+	
+    data->x_content_type = g_strdup (x_content_type);
+    data->combo_box = combo_box;
+    data->self = self;
+
+    if (data->changed_signal_id == 0) {
+      data->changed_signal_id = g_signal_connect (combo_box,
+						  "changed",
+						  G_CALLBACK (combo_box_changed),
+						  data);
+    }
+  }
+
+  if (new_data) {
+    g_object_set_data_full (G_OBJECT (combo_box),
+			    "autorun_combobox_data",
+			    data,
+			    (GDestroyNotify) autorun_combobox_data_destroy);
+  }
+}
+
+static void
+media_panel_setup (CcMediaPanel *self)
+{
+  guint n;
+  GList *l, *content_types;
+  GtkWidget *other_type_combo_box;
+  GtkListStore *other_type_list_store;
+  GtkCellRenderer *renderer;
+  GtkTreeIter iter;
+  GtkBuilder *builder = self->priv->builder;
+  const char *s[] = {"media_audio_cdda_combobox",   "x-content/audio-cdda",
+		     "media_video_dvd_combobox",    "x-content/video-dvd",
+		     "media_music_player_combobox", "x-content/audio-player",
+		     "media_dcf_combobox",          "x-content/image-dcf",
+		     "media_software_combobox",     "x-content/software",
+		     NULL};
+
+  for (n = 0; s[n*2] != NULL; n++) {
+    prepare_combo_box (self,
+		       GTK_WIDGET (gtk_builder_get_object (builder, s[n*2])),
+		       s[n*2 + 1]);
+  }
+
+  other_type_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "media_other_type_combobox"));
+
+  other_type_list_store = gtk_list_store_new (3,
+					      G_TYPE_ICON,
+					      G_TYPE_STRING,
+					      G_TYPE_STRING);
+
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store),
+					1, GTK_SORT_ASCENDING);
+
+
+  content_types = g_content_types_get_registered ();
+
+  for (l = content_types; l != NULL; l = l->next) {
+    char *content_type = l->data;
+    char *description;
+    GIcon *icon;
+
+    if (!g_str_has_prefix (content_type, "x-content/"))
+      continue;
+    for (n = 0; s[n*2] != NULL; n++) {
+      if (strcmp (content_type, s[n*2 + 1]) == 0) {
+	goto skip;
+      }
+    }
+
+    description = g_content_type_get_description (content_type);
+    gtk_list_store_append (other_type_list_store, &iter);
+    icon = g_content_type_get_icon (content_type);
+
+    gtk_list_store_set (other_type_list_store, &iter,
+			0, icon,
+			1, description,
+			2, content_type,
+			-1);
+    g_free (description);
+    g_object_unref (icon);
+  skip:
+    ;
+  }
+
+  g_list_free_full (content_types, g_free);
+
+  gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box),
+			   GTK_TREE_MODEL (other_type_list_store));
+
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, FALSE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
+				  "gicon", 0,
+				  NULL);
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
+				  "text", 1,
+				  NULL);
+
+  g_signal_connect (other_type_combo_box,
+		    "changed",
+		    G_CALLBACK (other_type_combo_box_changed),
+		    self);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box), 0);
+
+  update_media_sensitivity (self);
+}
+
+static void
+cc_media_panel_init (CcMediaPanel *self)
+{
+  CcMediaPanelPrivate *priv;
+  GtkWidget *main_widget;
+  guint res;
+
+  priv = self->priv = MEDIA_PANEL_PRIVATE (self);
+  priv->builder = gtk_builder_new ();
+  priv->preferences = g_settings_new ("org.gnome.media-handling");
+
+  /* support developers that want to run from the current directory */
+  if (g_file_test (GNOMECC_UI_DIR "/gnome-media-properties.ui", G_FILE_TEST_EXISTS) != FALSE) {
+    res = gtk_builder_add_from_file (priv->builder, GNOMECC_UI_DIR "/gnome-media-properties.ui", NULL);
+  } else {
+    res = gtk_builder_add_from_file (priv->builder, "./gnome-media-properties.ui", NULL);
+  }
+
+  /* TODO: error */
+  if (res == 0) {
+    g_critical ("Unable to load the UI file!");
+  }
+
+  media_panel_setup (self);
+
+  main_widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+						    "media_preferences_vbox"));
+  gtk_widget_reparent (main_widget, (GtkWidget *) self);
+}
+
+void
+cc_media_panel_register (GIOModule *module)
+{
+  cc_media_panel_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+                                  CC_TYPE_MEDIA_PANEL,
+                                  "media", 0);
+}
+
diff --git a/panels/media/cc-media-panel.h b/panels/media/cc-media-panel.h
new file mode 100644
index 0000000..b69bc62
--- /dev/null
+++ b/panels/media/cc-media-panel.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ */
+
+#ifndef _CC_MEDIA_PANEL_H
+#define _CC_MEDIA_PANEL_H
+
+#include <libgnome-control-center/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_MEDIA_PANEL cc_media_panel_get_type()
+
+#define CC_MEDIA_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_MEDIA_PANEL, CcMediaPanel))
+
+#define CC_MEDIA_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_MEDIA_PANEL, CcMediaPanelClass))
+
+#define CC_IS_MEDIA_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_MEDIA_PANEL))
+
+#define CC_IS_MEDIA_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_MEDIA_PANEL))
+
+#define CC_MEDIA_PANEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_MEDIA_PANEL, CcMediaPanelClass))
+
+typedef struct _CcMediaPanel CcMediaPanel;
+typedef struct _CcMediaPanelClass CcMediaPanelClass;
+typedef struct _CcMediaPanelPrivate CcMediaPanelPrivate;
+
+struct _CcMediaPanel
+{
+  CcPanel parent;
+
+  CcMediaPanelPrivate *priv;
+};
+
+struct _CcMediaPanelClass
+{
+  CcPanelClass parent_class;
+};
+
+GType cc_media_panel_get_type (void) G_GNUC_CONST;
+
+void  cc_media_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_MEDIA_PANEL_H */
diff --git a/panels/media/gnome-media-panel.desktop.in.in b/panels/media/gnome-media-panel.desktop.in.in
new file mode 100644
index 0000000..5a8d256
--- /dev/null
+++ b/panels/media/gnome-media-panel.desktop.in.in
@@ -0,0 +1,15 @@
+[Desktop Entry]
+_Name=Media and Autorun
+_Comment=Configure media and autorun preferences
+Exec=gnome-control-center media
+Icon=drive-optical
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-PersonalSettings;X-GNOME-Settings-Panel;
+OnlyShowIn=GNOME;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-control-center
+X-GNOME-Bugzilla-Component=Media and autorun
+X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Settings-Panel=media
diff --git a/panels/media/gnome-media-properties.ui b/panels/media/gnome-media-properties.ui
new file mode 100644
index 0000000..e80be86
--- /dev/null
+++ b/panels/media/gnome-media-properties.ui
@@ -0,0 +1,384 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="media_preferences_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Media and Autorun</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="media_preferences_vbox">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkVBox" id="media_handling_vbox">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkVBox" id="vbox44">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label42">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Media Handling&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment18">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox52">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label60">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Choose what happens when inserting media or connecting devices to the system</property>
+                            <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkTable" id="table4">
+                            <property name="visible">True</property>
+                            <property name="n_rows">5</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_spacing">6</property>
+                            <child>
+                              <object class="GtkLabel" id="label44">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">CD _Audio:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_audio_cdda_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label50">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_DVD Video:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_video_dvd_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_audio_cdda_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_video_dvd_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label54">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Music Player:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_music_player_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_music_player_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label59">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Photos:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_dcf_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_dcf_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label57">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Software:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_software_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_software_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox50">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label61">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Other Media&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment20">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox51">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label65">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Less common media formats can be configured here</property>
+                            <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkTable" id="table5">
+                            <property name="visible">True</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_spacing">6</property>
+                            <child>
+                              <object class="GtkComboBox" id="media_other_type_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label64">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Acti_on:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_other_action_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="media_other_action_combobox">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label63">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Type:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_other_type_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="media_autorun_never_checkbutton">
+            <property name="label" translatable="yes">_Never prompt or start programs on media insertion</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="media_automount_open_checkbutton">
+            <property name="label" translatable="yes">B_rowse media when inserted</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1"/>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/panels/media/media-module.c b/panels/media/media-module.c
new file mode 100644
index 0000000..7526cda
--- /dev/null
+++ b/panels/media/media-module.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-media-panel.h"
+
+#include <glib/gi18n-lib.h>
+
+void
+g_io_module_load (GIOModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+  /* register the panel */
+  cc_media_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/panels/media/nautilus-open-with-dialog.c b/panels/media/nautilus-open-with-dialog.c
new file mode 100644
index 0000000..c3c4f96
--- /dev/null
+++ b/panels/media/nautilus-open-with-dialog.c
@@ -0,0 +1,1093 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+   nautilus-open-with-dialog.c: an open-with dialog
+
+   Copyright (C) 2004 Novell, Inc.
+   Copyright (C) 2007 Red Hat, Inc.
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Authors: Dave Camp <dave@novell.com>
+            Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <config.h>
+#include "nautilus-open-with-dialog.h"
+
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+
+#define sure_string(s)                    ((const char *)((s)!=NULL?(s):""))
+#define DESKTOP_ENTRY_GROUP		  "Desktop Entry"
+
+struct _NautilusOpenWithDialogDetails {
+	GAppInfo *selected_app_info;
+	
+	char *content_type;
+	char *extension;
+
+	GtkWidget *label;
+	GtkWidget *entry;
+	GtkWidget *button;
+	GtkWidget *checkbox;
+
+	GtkWidget *desc_label;
+
+	GtkWidget *open_label;
+
+	GtkWidget     *program_list;
+	GtkListStore  *program_list_store;
+	GSList	      *add_icon_paths;
+	gint	       add_items_idle_id;
+	gint	       add_icons_idle_id;
+
+	gboolean add_mode;
+};
+
+enum {
+        COLUMN_APP_INFO,
+        COLUMN_ICON,
+        COLUMN_GICON,
+        COLUMN_NAME,
+        COLUMN_COMMENT,
+        COLUMN_EXEC,
+        NUM_COLUMNS
+};
+
+enum {
+	RESPONSE_OPEN,
+	RESPONSE_REMOVE
+};
+
+enum {
+	APPLICATION_SELECTED,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (NautilusOpenWithDialog, nautilus_open_with_dialog, GTK_TYPE_DIALOG); 
+
+static void
+show_error_dialog (const gchar *primary,
+		   const gchar *secondary,
+		   GtkWindow *parent)
+{
+	GtkWidget *message_dialog;
+
+	message_dialog = gtk_message_dialog_new (parent, 0,
+						 GTK_MESSAGE_ERROR,
+						 GTK_BUTTONS_OK,
+						 NULL);
+	g_object_set (message_dialog,
+		      "text", primary,
+		      "secondary-text", secondary,
+		      NULL);
+	gtk_dialog_set_default_response (GTK_DIALOG (message_dialog), GTK_RESPONSE_OK);
+
+	gtk_widget_show (message_dialog);
+
+	g_signal_connect (message_dialog, "response",
+			  G_CALLBACK (gtk_widget_destroy), NULL);
+}
+
+static void
+nautilus_open_with_dialog_finalize (GObject *object)
+{
+	NautilusOpenWithDialog *dialog;
+
+	dialog = NAUTILUS_OPEN_WITH_DIALOG (object);
+
+	if (dialog->details->add_icons_idle_id) {
+		g_source_remove (dialog->details->add_icons_idle_id);
+	}
+
+	if (dialog->details->add_items_idle_id) {
+		g_source_remove (dialog->details->add_items_idle_id);
+	}
+
+	if (dialog->details->selected_app_info) {
+		g_object_unref (dialog->details->selected_app_info);
+	}
+	g_free (dialog->details->content_type);
+	g_free (dialog->details->extension);
+
+	g_free (dialog->details);
+
+	G_OBJECT_CLASS (nautilus_open_with_dialog_parent_class)->finalize (object);
+}
+
+/* An application is valid if:
+ *
+ * 1) The file exists
+ * 2) The user has permissions to run the file
+ */
+static gboolean
+check_application (NautilusOpenWithDialog *dialog)
+{
+	char *command;
+	char *path = NULL;
+	char **argv = NULL;
+	int argc;
+	GError *error = NULL;
+	gint retval = TRUE;
+
+	command = NULL;
+	if (dialog->details->selected_app_info != NULL) {
+		command = g_strdup (g_app_info_get_executable (dialog->details->selected_app_info));
+	}
+
+	if (command == NULL) {
+		command = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->details->entry)));
+	}
+	
+	g_shell_parse_argv (command, &argc, &argv, &error);
+	if (error) {
+		show_error_dialog (_("Could not run application"),
+				   error->message,
+				   GTK_WINDOW (dialog));
+		g_error_free (error);
+		retval = FALSE;
+		goto cleanup;
+	}
+
+	path = g_find_program_in_path (argv[0]);
+	if (!path) {
+		char *error_message;
+
+		error_message = g_strdup_printf (_("Could not find '%s'"),
+						 argv[0]);
+
+		show_error_dialog (_("Could not find application"),
+				   error_message,
+				   GTK_WINDOW (dialog));
+		g_free (error_message);
+		retval = FALSE;
+		goto cleanup;
+	}
+
+ cleanup:
+	g_strfreev (argv);
+	g_free (path);
+	g_free (command);
+
+	return retval;
+}
+
+/* Only called for non-desktop files */
+static char *
+get_app_name (const char *commandline, GError **error)
+{
+	char *basename;
+	char *unquoted;
+	char **argv;
+	int argc;
+
+	if (!g_shell_parse_argv (commandline,
+				 &argc, &argv, error)) {
+		return NULL;
+	}
+	
+	unquoted = g_shell_unquote (argv[0], NULL);
+	if (unquoted) {
+		basename = g_path_get_basename (unquoted);
+	} else {
+		basename = g_strdup (argv[0]);
+	}
+
+	g_free (unquoted);
+	g_strfreev (argv);
+
+	return basename;
+}
+
+/* This will check if the application the user wanted exists will return that
+ * application.  If it doesn't exist, it will create one and return that.
+ * It also sets the app info as the default for this type.
+ */
+static GAppInfo *
+add_or_find_application (NautilusOpenWithDialog *dialog)
+{
+	GAppInfo *app;
+	char *app_name;
+	const char *commandline;
+	GError *error;
+	gboolean success, should_set_default;
+	char *message;
+	GList *applications;
+
+	error = NULL;
+	app = NULL;
+	if (dialog->details->selected_app_info) {
+		app = g_object_ref (dialog->details->selected_app_info);
+	} else {
+		commandline = gtk_entry_get_text (GTK_ENTRY (dialog->details->entry));
+		app_name = get_app_name (commandline, &error);
+		if (app_name != NULL) {
+			app = g_app_info_create_from_commandline (commandline,
+								  app_name,
+								  G_APP_INFO_CREATE_NONE,
+								  &error);
+			g_free (app_name);
+		}
+	}
+
+	if (app == NULL) {
+		message = g_strdup_printf (_("Could not add application to the application database: %s"), error->message);
+		show_error_dialog (_("Could not add application"),
+				   message,
+				   GTK_WINDOW (dialog));
+		g_free (message);
+		g_error_free (error);
+		return NULL;
+	}
+
+	should_set_default = (dialog->details->add_mode) ||
+		(!dialog->details->add_mode &&
+		 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->details->checkbox)));
+	success = TRUE;
+
+	if (should_set_default) {
+		if (dialog->details->content_type) {
+			success = g_app_info_set_as_default_for_type (app,
+								      dialog->details->content_type,
+								      &error);
+		} else {
+			success = g_app_info_set_as_default_for_extension (app,
+									   dialog->details->extension,
+									   &error);
+		}
+	} else {
+		applications = g_app_info_get_all_for_type (dialog->details->content_type);
+		if (dialog->details->content_type && applications != NULL) {
+			/* we don't care about reporting errors here */
+			g_app_info_add_supports_type (app,
+						      dialog->details->content_type,
+						      NULL);
+		}
+
+		if (applications != NULL) {
+			g_list_free_full (applications, g_object_unref);
+		}
+	}
+
+	if (!success && should_set_default) {
+		message = g_strdup_printf (_("Could not set application as the default: %s"), error->message);
+		show_error_dialog (_("Could not set as default application"),
+				   message,
+				   GTK_WINDOW (dialog));
+		g_free (message);
+		g_error_free (error);
+	}
+
+	return app;
+}
+
+static void
+emit_application_selected (NautilusOpenWithDialog *dialog,
+			   GAppInfo *application)
+{
+	g_signal_emit (G_OBJECT (dialog), signals[APPLICATION_SELECTED], 0,
+		       application);
+}
+
+static void
+response_cb (NautilusOpenWithDialog *dialog,
+	     int response_id,
+	     gpointer data)
+{
+	GAppInfo *application;
+
+	switch (response_id) {
+	case RESPONSE_OPEN:
+		if (check_application (dialog)) {
+			application = add_or_find_application (dialog);
+
+			if (application) {
+				emit_application_selected (dialog, application);
+				g_object_unref (application);
+
+				gtk_widget_destroy (GTK_WIDGET (dialog));
+			}
+		}
+
+		break;
+	case RESPONSE_REMOVE:
+		if (dialog->details->selected_app_info != NULL) {
+			if (g_app_info_delete (dialog->details->selected_app_info)) {
+				GtkTreeModel *model;
+				GtkTreeIter iter;
+				GAppInfo *info, *selected;
+
+				selected = dialog->details->selected_app_info;
+				dialog->details->selected_app_info = NULL;
+
+				model = GTK_TREE_MODEL (dialog->details->program_list_store);
+				if (gtk_tree_model_get_iter_first (model, &iter)) {
+					do {
+						gtk_tree_model_get (model, &iter,
+			    					    COLUMN_APP_INFO, &info,
+			    					    -1);
+						if (g_app_info_equal (selected, info)) {
+							gtk_list_store_remove (dialog->details->program_list_store, &iter);
+							break;
+						}
+					} while (gtk_tree_model_iter_next (model, &iter));
+				}
+
+				g_object_unref (selected);
+			}
+		}
+		break;
+	case GTK_RESPONSE_NONE:
+	case GTK_RESPONSE_DELETE_EVENT:
+	case GTK_RESPONSE_CANCEL:
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+	default :
+		g_assert_not_reached ();
+	}
+
+}
+
+
+static void
+nautilus_open_with_dialog_class_init (NautilusOpenWithDialogClass *class)
+{
+	GObjectClass *gobject_class;
+
+	gobject_class = G_OBJECT_CLASS (class);
+	gobject_class->finalize = nautilus_open_with_dialog_finalize;
+
+	signals[APPLICATION_SELECTED] =
+		g_signal_new ("application_selected",
+			      G_TYPE_FROM_CLASS (class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (NautilusOpenWithDialogClass,
+					       application_selected),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE,
+			      1, G_TYPE_POINTER);
+}
+
+static void
+chooser_response_cb (GtkFileChooser *chooser,
+		     int response,
+		     gpointer user_data)
+{
+	NautilusOpenWithDialog *dialog;
+
+	dialog = NAUTILUS_OPEN_WITH_DIALOG (user_data);
+
+	if (response == GTK_RESPONSE_OK) {
+		char *filename;
+
+		filename = gtk_file_chooser_get_filename (chooser);
+
+		if (filename) {
+			char *quoted_text;
+
+			quoted_text = g_shell_quote (filename);
+
+			gtk_entry_set_text (GTK_ENTRY (dialog->details->entry),
+					    quoted_text);
+			gtk_editable_set_position (GTK_EDITABLE (dialog->details->entry), -1);
+			g_free (quoted_text);
+			g_free (filename);
+		}
+	}
+
+	gtk_widget_destroy (GTK_WIDGET (chooser));
+}
+
+static void
+browse_clicked_cb (GtkWidget *button,
+		   gpointer user_data)
+{
+	NautilusOpenWithDialog *dialog;
+	GtkWidget *chooser;
+
+	dialog = NAUTILUS_OPEN_WITH_DIALOG (user_data);
+
+	chooser = gtk_file_chooser_dialog_new (_("Select an Application"),
+					       GTK_WINDOW (dialog),
+					       GTK_FILE_CHOOSER_ACTION_OPEN,
+					       GTK_STOCK_CANCEL,
+					       GTK_RESPONSE_CANCEL,
+					       GTK_STOCK_OPEN,
+					       GTK_RESPONSE_OK,
+					       NULL);
+	gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
+	g_signal_connect (chooser, "response",
+			  G_CALLBACK (chooser_response_cb), dialog);
+	gtk_dialog_set_default_response (GTK_DIALOG (chooser),
+					 GTK_RESPONSE_OK);
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
+	gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser),
+					      FALSE);
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser),
+					     "/usr/bin");
+
+	gtk_widget_show (chooser);
+}
+
+static void
+entry_changed_cb (GtkWidget *entry,
+		  NautilusOpenWithDialog *dialog)
+{
+	/* We are writing in the entry, so we are not using a known appinfo anymore */
+	if (dialog->details->selected_app_info != NULL) {
+		g_object_unref (dialog->details->selected_app_info);
+		dialog->details->selected_app_info = NULL;
+	}
+
+	if (gtk_entry_get_text (GTK_ENTRY (dialog->details->entry))[0] == '\000') {
+		gtk_widget_set_sensitive (dialog->details->button, FALSE);
+	} else {
+		gtk_widget_set_sensitive (dialog->details->button, TRUE);
+	}
+}
+
+static GdkPixbuf *
+get_pixbuf_for_icon (GIcon *icon)
+{
+	GdkPixbuf  *pixbuf;
+	char *filename;
+
+	pixbuf = NULL;
+	if (G_IS_FILE_ICON (icon)) {
+		filename = g_file_get_path (g_file_icon_get_file (G_FILE_ICON (icon)));
+		if (filename) {
+			pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 24, 24, NULL);
+		}
+		g_free (filename);
+	} else if (G_IS_THEMED_ICON (icon)) {
+		const char * const *names;
+		char *icon_no_extension;
+		char *p;
+		
+		names = g_themed_icon_get_names (G_THEMED_ICON (icon));
+		
+		if (names != NULL && names[0] != NULL) {
+			icon_no_extension = g_strdup (names[0]);
+			p = strrchr (icon_no_extension, '.');
+			if (p &&
+			    (strcmp (p, ".png") == 0 ||
+			     strcmp (p, ".xpm") == 0 ||
+			     strcmp (p, ".svg") == 0)) {
+				*p = 0;
+			}
+			pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+							   icon_no_extension, 24, 0, NULL);
+			g_free (icon_no_extension);
+		}
+	}
+	return pixbuf;
+}
+
+static gboolean
+nautilus_open_with_dialog_add_icon_idle (NautilusOpenWithDialog *dialog)
+{
+	GtkTreeIter   iter;
+	GtkTreePath  *path;
+	GdkPixbuf    *pixbuf;
+	GIcon *icon;
+	gboolean      long_operation;
+
+	long_operation = FALSE;
+	do {
+		if (!dialog->details->add_icon_paths) {
+			dialog->details->add_icons_idle_id = 0;
+			return FALSE;
+		}
+
+		path = dialog->details->add_icon_paths->data;
+		dialog->details->add_icon_paths->data = NULL;
+		dialog->details->add_icon_paths = g_slist_delete_link (dialog->details->add_icon_paths,
+								       dialog->details->add_icon_paths);
+
+		if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->details->program_list_store),
+					      &iter, path)) {
+			gtk_tree_path_free (path);
+			continue;
+		}
+		
+		gtk_tree_path_free (path);
+
+		gtk_tree_model_get (GTK_TREE_MODEL (dialog->details->program_list_store), &iter,
+				    COLUMN_GICON, &icon, -1);
+
+		if (icon == NULL) {
+			continue;
+		}
+
+		pixbuf = get_pixbuf_for_icon (icon);
+		if (pixbuf) {
+			long_operation = TRUE;
+			gtk_list_store_set (dialog->details->program_list_store, &iter, COLUMN_ICON, pixbuf, -1);
+			g_object_unref (pixbuf);
+		}
+		
+	/* don't go back into the main loop if this wasn't very hard to do */
+	} while (!long_operation);
+
+	return TRUE;
+}
+
+
+static gboolean
+nautilus_open_with_search_equal_func (GtkTreeModel *model,
+				 int column,
+				 const char *key,
+				 GtkTreeIter *iter,
+				 gpointer user_data)
+{
+	char *normalized_key;
+	char *name, *normalized_name;
+	char *path, *normalized_path;
+	char *basename, *normalized_basename;
+	gboolean ret;
+
+	if (key != NULL) {
+		normalized_key = g_utf8_casefold (key, -1);
+		g_assert (normalized_key != NULL);
+
+		ret = TRUE;
+
+		gtk_tree_model_get (model, iter,
+				    COLUMN_NAME, &name,
+				    COLUMN_EXEC, &path,
+				    -1);
+
+		if (name != NULL) {
+			normalized_name = g_utf8_casefold (name, -1);
+			g_assert (normalized_name != NULL);
+
+			if (strncmp (normalized_name, normalized_key, strlen (normalized_key)) == 0) {
+				ret = FALSE;
+			}
+
+			g_free (normalized_name);
+		}
+
+		if (ret && path != NULL) {
+			normalized_path = g_utf8_casefold (path, -1);
+			g_assert (normalized_path != NULL);
+
+			basename = g_path_get_basename (path);
+			g_assert (basename != NULL);
+
+			normalized_basename = g_utf8_casefold (basename, -1);
+			g_assert (normalized_basename != NULL);
+
+			if (strncmp (normalized_path, normalized_key, strlen (normalized_key)) == 0 ||
+			    strncmp (normalized_basename, normalized_key, strlen (normalized_key)) == 0) {
+				ret = FALSE;
+			}
+
+			g_free (basename);
+			g_free (normalized_basename);
+			g_free (normalized_path);
+		}
+
+		g_free (name);
+		g_free (path);
+		g_free (normalized_key);
+
+		return ret;
+	} else {
+		return TRUE;
+	}
+}
+
+
+
+static gboolean
+nautilus_open_with_dialog_add_items_idle (NautilusOpenWithDialog *dialog)
+{
+	GtkCellRenderer   *renderer;
+	GtkTreeViewColumn *column;
+	GtkTreeModel      *sort;
+	GList             *all_applications;
+	GList             *l;
+
+	/* create list store */
+	dialog->details->program_list_store = gtk_list_store_new (NUM_COLUMNS,
+								  G_TYPE_APP_INFO,
+								  GDK_TYPE_PIXBUF,
+								  G_TYPE_ICON,
+								  G_TYPE_STRING,
+								  G_TYPE_STRING,
+								  G_TYPE_STRING);
+	sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (dialog->details->program_list_store));
+	all_applications = g_app_info_get_all ();
+	
+	for (l = all_applications; l; l = l->next) {
+		GAppInfo *app = l->data;
+		GtkTreeIter     iter;
+		GtkTreePath    *path;
+
+		if (!g_app_info_supports_uris (app) &&
+		    !g_app_info_supports_files (app))
+			continue;
+
+		gtk_list_store_append (dialog->details->program_list_store, &iter);
+		gtk_list_store_set (dialog->details->program_list_store, &iter,
+				    COLUMN_APP_INFO,  app,
+				    COLUMN_ICON,      NULL,
+				    COLUMN_GICON,     g_app_info_get_icon (app),
+				    COLUMN_NAME,      g_app_info_get_display_name (app),
+				    COLUMN_COMMENT,   g_app_info_get_description (app),
+				    COLUMN_EXEC,      g_app_info_get_executable,
+				    -1);
+
+		path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->details->program_list_store), &iter);
+		if (path != NULL) {
+			dialog->details->add_icon_paths = g_slist_prepend (dialog->details->add_icon_paths, path);
+		}
+	}
+	g_list_free (all_applications);
+
+	gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->details->program_list), 
+				 GTK_TREE_MODEL (sort));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort),
+					      COLUMN_NAME, GTK_SORT_ASCENDING);
+	gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (dialog->details->program_list),
+					     nautilus_open_with_search_equal_func,
+					     NULL, NULL);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+                                             "pixbuf", COLUMN_ICON,
+                                             NULL);
+        
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_tree_view_column_pack_start (column, renderer, TRUE);
+	gtk_tree_view_column_set_attributes (column, renderer,
+                                             "text", COLUMN_NAME,
+                                             NULL);
+	gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->details->program_list), column);
+
+	dialog->details->add_icon_paths = g_slist_reverse (dialog->details->add_icon_paths);
+
+	if (!dialog->details->add_icons_idle_id) {
+		dialog->details->add_icons_idle_id =
+			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) nautilus_open_with_dialog_add_icon_idle,
+					 dialog, NULL);
+	}
+
+	dialog->details->add_items_idle_id = 0;					 
+	return FALSE;
+}
+
+static void
+program_list_selection_changed (GtkTreeSelection  *selection,
+				NautilusOpenWithDialog *dialog)
+{
+	GtkTreeModel     *model;
+	GtkTreeIter       iter;
+	GAppInfo *info;
+		
+	if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
+		gtk_widget_set_sensitive (dialog->details->button, FALSE);
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+					   	   RESPONSE_REMOVE,
+					   	   FALSE);
+		return;
+	}
+
+	info = NULL;
+	gtk_tree_model_get (model, &iter,
+			    COLUMN_APP_INFO, &info,
+			    -1);
+				  
+	if (info == NULL) {
+		return;
+	}
+
+	gtk_entry_set_text (GTK_ENTRY (dialog->details->entry),
+			    sure_string (g_app_info_get_executable (info)));
+	gtk_label_set_text (GTK_LABEL (dialog->details->desc_label),
+			    sure_string (g_app_info_get_description (info)));
+	gtk_widget_set_sensitive (dialog->details->button, TRUE);
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+					   RESPONSE_REMOVE,
+					   g_app_info_can_delete (info));
+
+	if (dialog->details->selected_app_info) {
+		g_object_unref (dialog->details->selected_app_info);
+	}
+	
+	dialog->details->selected_app_info = info;
+}
+
+static void
+program_list_selection_activated (GtkTreeView       *view,
+				  GtkTreePath       *path,
+				  GtkTreeViewColumn *column,
+				  NautilusOpenWithDialog *dialog)
+{
+	GtkTreeSelection *selection;
+
+	/* update the entry with the info from the selection */
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->details->program_list));	
+	program_list_selection_changed (selection, dialog);
+	
+	gtk_dialog_response (GTK_DIALOG (&dialog->parent), RESPONSE_OPEN);
+}
+
+static void
+expander_toggled (GtkWidget *expander, NautilusOpenWithDialog *dialog)
+{
+	if (gtk_expander_get_expanded (GTK_EXPANDER (expander)) == TRUE) {
+		gtk_widget_grab_focus (dialog->details->entry);
+		gtk_window_resize (GTK_WINDOW (dialog), 400, 1);
+	} else {
+		GtkTreeSelection *selection;
+
+		gtk_widget_grab_focus (dialog->details->program_list);
+		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->details->program_list));
+		program_list_selection_changed (selection, dialog);
+	}
+}
+
+static void
+nautilus_open_with_dialog_init (NautilusOpenWithDialog *dialog)
+{
+	GtkWidget *hbox;
+	GtkWidget *vbox;
+	GtkWidget *vbox2;
+	GtkWidget *label;
+	GtkWidget *align;
+	GtkWidget *scrolled_window;
+	GtkWidget *expander;
+	GtkTreeSelection *selection;
+
+	dialog->details = g_new0 (NautilusOpenWithDialogDetails, 1);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Open With"));
+	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+	gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+
+	gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
+
+	vbox = gtk_vbox_new (FALSE, 12);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+	vbox2 = gtk_vbox_new (FALSE, 6);
+	gtk_box_pack_start (GTK_BOX (vbox), vbox2, TRUE, TRUE, 0);
+
+	dialog->details->label = gtk_label_new ("");
+	gtk_misc_set_alignment (GTK_MISC (dialog->details->label), 0.0, 0.5);
+	gtk_label_set_line_wrap (GTK_LABEL (dialog->details->label), TRUE);
+	gtk_box_pack_start (GTK_BOX (vbox2), dialog->details->label,
+			    FALSE, FALSE, 0);
+	gtk_widget_show (dialog->details->label);
+
+
+	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_widget_set_size_request (scrolled_window, 400, 300);
+	
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
+					     GTK_SHADOW_IN);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	dialog->details->program_list = gtk_tree_view_new ();
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->details->program_list),
+					   FALSE);
+	gtk_container_add (GTK_CONTAINER (scrolled_window), dialog->details->program_list);
+	
+	gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
+
+	dialog->details->desc_label = gtk_label_new (_("Select an application to view its description."));
+	gtk_misc_set_alignment (GTK_MISC (dialog->details->desc_label), 0.0, 0.5);
+	gtk_label_set_justify (GTK_LABEL (dialog->details->desc_label), GTK_JUSTIFY_LEFT);
+	gtk_label_set_line_wrap (GTK_LABEL (dialog->details->desc_label), TRUE);
+	gtk_label_set_single_line_mode (GTK_LABEL (dialog->details->desc_label), FALSE);
+	gtk_box_pack_start (GTK_BOX (vbox2), dialog->details->desc_label, FALSE, FALSE, 0);
+	
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->details->program_list));
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+	g_signal_connect (selection, "changed",
+			  G_CALLBACK (program_list_selection_changed),
+			  dialog);
+	g_signal_connect (dialog->details->program_list, "row-activated",
+			  G_CALLBACK (program_list_selection_activated),
+			  dialog);
+
+	dialog->details->add_items_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+						     (GSourceFunc) nautilus_open_with_dialog_add_items_idle,
+						      dialog, NULL);
+
+	
+	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0);
+	gtk_widget_show_all (vbox);
+
+
+	expander = gtk_expander_new_with_mnemonic (_("_Use a custom command"));
+	gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
+	g_signal_connect_after (expander, "activate", G_CALLBACK (expander_toggled), dialog);
+
+	gtk_widget_show (expander);
+
+	hbox = gtk_hbox_new (FALSE, 6);
+	gtk_container_add (GTK_CONTAINER (expander), hbox);
+	gtk_widget_show (hbox);
+
+	dialog->details->entry = gtk_entry_new ();
+	gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->entry), TRUE);
+
+	gtk_box_pack_start (GTK_BOX (hbox), dialog->details->entry,
+			    TRUE, TRUE, 0);
+	gtk_widget_show (dialog->details->entry);
+
+	dialog->details->button = gtk_button_new_with_mnemonic (_("_Browse..."));
+	g_signal_connect (dialog->details->button, "clicked",
+			  G_CALLBACK (browse_clicked_cb), dialog);
+	gtk_box_pack_start (GTK_BOX (hbox), dialog->details->button, FALSE, FALSE, 0);
+	gtk_widget_show (dialog->details->button);
+
+	/* Add remember this application checkbox - only visible in open mode */
+	dialog->details->checkbox = gtk_check_button_new ();
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->details->checkbox), TRUE);
+	gtk_button_set_use_underline (GTK_BUTTON (dialog->details->checkbox), TRUE);
+	gtk_widget_show (GTK_WIDGET (dialog->details->checkbox));
+	gtk_box_pack_start (GTK_BOX (vbox), dialog->details->checkbox, FALSE, FALSE, 0);
+
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                               GTK_STOCK_REMOVE,
+			       RESPONSE_REMOVE);
+	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+			       		   RESPONSE_REMOVE,
+					   FALSE);
+
+	gtk_dialog_add_button (GTK_DIALOG (dialog),
+			       GTK_STOCK_CANCEL,
+			       GTK_RESPONSE_CANCEL);
+
+
+	/* Create a custom stock icon */
+	dialog->details->button = gtk_button_new ();
+
+	/* Hook up the entry to the button */
+	gtk_widget_set_sensitive (dialog->details->button, FALSE);
+	g_signal_connect (G_OBJECT (dialog->details->entry), "changed",
+			  G_CALLBACK (entry_changed_cb), dialog);
+
+	hbox = gtk_hbox_new (FALSE, 2);
+	gtk_widget_show (hbox);
+
+	label = gtk_label_new_with_mnemonic (_("_Open"));
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (dialog->details->button));
+	gtk_widget_show (label);
+	dialog->details->open_label = label;
+
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+	align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+	gtk_widget_show (align);
+
+	gtk_widget_show (dialog->details->button);
+	gtk_widget_set_can_default (dialog->details->button, TRUE);
+
+
+	gtk_container_add (GTK_CONTAINER (align), hbox);
+	gtk_container_add (GTK_CONTAINER (dialog->details->button), align);
+
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+				      dialog->details->button, RESPONSE_OPEN);
+
+
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+					 RESPONSE_OPEN);
+
+	g_signal_connect (dialog, "response",
+			  G_CALLBACK (response_cb),
+			  dialog);
+}
+
+static char *
+get_extension (const char *basename)
+{
+	char *p;
+
+	p = strrchr (basename, '.');
+
+	if (p && *(p + 1) != '\0') {
+		return g_strdup (p + 1);
+	} else {
+		return NULL;
+	}
+}
+
+static void
+set_uri_and_type (NautilusOpenWithDialog *dialog,
+		  const char *uri,
+		  const char *mime_type,
+		  const char *passed_extension,
+		  gboolean add_mode)
+{
+	char *label;
+	char *emname;
+	char *name, *extension;
+	char *description;
+	char *checkbox_text;
+	
+	name = NULL;
+	extension = NULL;
+	
+	if (uri != NULL) {
+		GFile *file;
+
+		file = g_file_new_for_uri (uri);
+		name = g_file_get_basename (file);
+		g_object_unref (file);
+	}
+	if (passed_extension == NULL && name != NULL) {
+		extension = get_extension (name);
+	} else {
+		extension = g_strdup (passed_extension);
+	}
+
+	if (extension != NULL &&
+	    g_content_type_is_unknown (mime_type)) {
+		dialog->details->extension = g_strdup (extension);
+
+		if (name != NULL) {
+			emname = g_strdup_printf ("<i>%s</i>", name);
+			if (add_mode) {
+				/* first %s is a filename and second %s is a file extension */
+				label = g_strdup_printf (_("Open %s and other %s document with:"),
+							 emname, dialog->details->extension);
+			} else {
+				/* the %s here is a file name */
+				label = g_strdup_printf (_("Open %s with:"), emname);
+				checkbox_text = g_strdup_printf (_("_Remember this application for %s documents"), 
+								 dialog->details->extension);
+
+				gtk_button_set_label (GTK_BUTTON (dialog->details->checkbox), checkbox_text);
+				g_free (checkbox_text);
+			}
+			g_free (emname);
+		} else {
+			/* Only in add mode - the %s here is a file extension */
+			label = g_strdup_printf (_("Open all %s documents with:"),
+						 dialog->details->extension);
+		}
+		g_free (extension);
+	} else {
+		dialog->details->content_type = g_strdup (mime_type);
+		description = g_content_type_get_description (mime_type);
+
+		if (description == NULL) {
+			description = g_strdup (_("Unknown"));
+		}
+
+		if (name != NULL) {
+			emname = g_strdup_printf ("<i>%s</i>", name);
+			if (add_mode) {
+				/* First %s is a filename, second is a description
+				 * of the type, eg "plain text document" */
+				label = g_strdup_printf (_("Open %s and other \"%s\" files with:"), 
+							 emname, description);
+			} else {
+				/* %s is a filename */
+				label = g_strdup_printf (_("Open %s with:"), emname);
+				/* %s is a file type description */
+				checkbox_text = g_strdup_printf (_("_Remember this application for \"%s\" files"),
+								 description);
+
+				gtk_button_set_label (GTK_BUTTON (dialog->details->checkbox), checkbox_text);
+				g_free (checkbox_text);
+			}
+			g_free (emname);
+		} else {
+			/* Only in add mode */
+			label = g_strdup_printf (_("Open all \"%s\" files with:"), description);
+		}
+
+		g_free (description);
+	}
+
+	dialog->details->add_mode = add_mode;
+	if (add_mode) {
+		gtk_widget_hide (dialog->details->checkbox);
+
+		gtk_label_set_text_with_mnemonic (GTK_LABEL (dialog->details->open_label),
+						  _("_Add"));
+		gtk_window_set_title (GTK_WINDOW (dialog), _("Add Application"));
+	}
+
+	gtk_label_set_markup (GTK_LABEL (dialog->details->label), label);
+
+	g_free (label);
+	g_free (name);
+}
+
+
+static GtkWidget *
+real_nautilus_open_with_dialog_new (const char *uri,
+				    const char *mime_type,
+				    const char *extension,
+				    gboolean add_mode)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_widget_new (NAUTILUS_TYPE_OPEN_WITH_DIALOG, NULL);
+
+	set_uri_and_type (NAUTILUS_OPEN_WITH_DIALOG (dialog), uri, mime_type, extension, add_mode);
+
+	return dialog;
+}
+
+GtkWidget *
+nautilus_open_with_dialog_new (const char *uri,
+			       const char *mime_type,
+			       const char *extension)
+{
+	return real_nautilus_open_with_dialog_new (uri, mime_type, extension, FALSE);
+}
+
+GtkWidget * 
+nautilus_add_application_dialog_new (const char *uri,
+				     const char *mime_type)
+{
+	NautilusOpenWithDialog *dialog;
+	
+	dialog = NAUTILUS_OPEN_WITH_DIALOG (real_nautilus_open_with_dialog_new (uri, mime_type, NULL, TRUE));
+
+	return GTK_WIDGET (dialog);
+}
+
+GtkWidget * 
+nautilus_add_application_dialog_new_for_multiple_files (const char *extension,
+							const char *mime_type)
+{
+	NautilusOpenWithDialog *dialog;
+	
+	dialog = NAUTILUS_OPEN_WITH_DIALOG (real_nautilus_open_with_dialog_new (NULL, mime_type, extension, TRUE));
+	
+	return GTK_WIDGET (dialog);
+}
+
diff --git a/panels/media/nautilus-open-with-dialog.h b/panels/media/nautilus-open-with-dialog.h
new file mode 100644
index 0000000..e2bf4e7
--- /dev/null
+++ b/panels/media/nautilus-open-with-dialog.h
@@ -0,0 +1,64 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+   nautilus-open-with-dialog.c: an open-with dialog
+ 
+   Copyright (C) 2004 Novell, Inc.
+ 
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Authors: Dave Camp <dave@novell.com>
+*/
+
+#ifndef NAUTILUS_OPEN_WITH_DIALOG_H
+#define NAUTILUS_OPEN_WITH_DIALOG_H
+
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+
+#define NAUTILUS_TYPE_OPEN_WITH_DIALOG         (nautilus_open_with_dialog_get_type ())
+#define NAUTILUS_OPEN_WITH_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_OPEN_WITH_DIALOG, NautilusOpenWithDialog))
+#define NAUTILUS_OPEN_WITH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_OPEN_WITH_DIALOG, NautilusOpenWithDialogClass))
+#define NAUTILUS_IS_OPEN_WITH_DIALOG(obj)      (G_TYPE_INSTANCE_CHECK_TYPE ((obj), NAUTILUS_TYPE_OPEN_WITH_DIALOG)
+
+typedef struct _NautilusOpenWithDialog        NautilusOpenWithDialog;
+typedef struct _NautilusOpenWithDialogClass   NautilusOpenWithDialogClass;
+typedef struct _NautilusOpenWithDialogDetails NautilusOpenWithDialogDetails;
+
+struct _NautilusOpenWithDialog {
+	GtkDialog parent;
+	NautilusOpenWithDialogDetails *details;
+};
+
+struct _NautilusOpenWithDialogClass {
+	GtkDialogClass parent_class;
+
+	void (*application_selected) (NautilusOpenWithDialog *dialog,
+				      GAppInfo *application);
+};
+
+GType      nautilus_open_with_dialog_get_type (void);
+GtkWidget* nautilus_open_with_dialog_new      (const char *uri,
+					       const char *mime_type,
+					       const char *extension);
+GtkWidget* nautilus_add_application_dialog_new (const char *uri,
+						const char *mime_type);
+GtkWidget* nautilus_add_application_dialog_new_for_multiple_files (const char *extension,
+								   const char *mime_type);
+
+
+
+#endif /* NAUTILUS_OPEN_WITH_DIALOG_H */
