Index: nautilus-share/src/nautilus-share.c
===================================================================
--- nautilus-share.orig/src/nautilus-share.c	2011-09-23 00:00:15.658603671 +0900
+++ nautilus-share/src/nautilus-share.c	2011-09-23 00:00:43.718603857 +0900
@@ -643,7 +643,7 @@
 }
 
 static gboolean
-spawn_synaptic (GtkWidget *window, const gchar *path, gint *child_pid)
+spawn_apturl (GtkWidget *window, const gchar *packages, gint *child_pid)
 {
   GError *error = NULL;
   gboolean retval = TRUE;
@@ -651,23 +651,12 @@
   gchar *display;
 
   { /* generate argv */
-    gchar *synaptic_path = g_find_program_in_path ("synaptic");
     gint i = 0;
 
-    argv = g_new0 (gchar*, 5);
-    argv[i++] = g_find_program_in_path ("gksu");
-    argv[i++] = g_strdup ("--desktop");
-    argv[i++] = g_strdup ("/usr/share/applications/synaptic.desktop");
-    argv[i++] = g_strdup_printf ("%s --hide-main-window "
-        "--set-selections-file %s "
-        "--non-interactive "
-        "--parent-window-id %d",
-        synaptic_path,
-        path,
-        GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window))));
+    argv = g_new0 (gchar*, 3);
+    argv[i++] = g_find_program_in_path ("apturl");
+    argv[i++] = g_strdup_printf ("apt:%s", packages);
     argv[i++] = NULL;
-
-    g_free (synaptic_path);
   }
 
   display =
@@ -678,7 +667,7 @@
                       NULL,     /* envp */
                       G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
                       set_environment, display, child_pid, &error))
-  {    fprintf (stderr, "synaptic spawn failed; %s", (error) ? error->message : "");
+  {    fprintf (stderr, "apturl spawn failed; %s", (error) ? error->message : "");
     g_error_free (error);
     retval = FALSE;
   }
@@ -708,7 +697,7 @@
 }
 
 static gboolean
-wait_for_synaptic (GtkWindow *window, pid_t pid)
+wait_for_apturl (GtkWindow *window, pid_t pid)
 {
   gint timer;
 
@@ -717,7 +706,7 @@
   gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
   gtk_widget_set_sensitive (GTK_WIDGET (window), FALSE);
 
-  /* wait until synaptic is done */
+  /* wait until apturl is done */
   timer = g_timeout_add (500, on_wait_timeout, GINT_TO_POINTER (pid));
   gtk_main ();
   g_source_remove (timer);
@@ -731,43 +720,14 @@
   return check_samba_installed ();
 }
 
-static gchar*
-create_temp_file (const gchar *packages[])
-{
-  int fd;
-  gchar *path, *str;
-
-  path = g_strdup_printf ("/tmp/packages.XXXXXX");
-  fd = mkstemp (path);
-
-  while (*packages)
-    {
-      str = g_strdup_printf ("%s\ti\n", *packages);
-      write (fd, str, strlen (str));
-      g_free (str);
-      packages++;
-    }
-
-  close (fd);
-  return path;
-}
-
 static void
-run_synaptic (GtkWidget *window)
+run_apturl (GtkWidget *window)
 {
-  gchar *path;
   GtkWidget* dialog_ask_retry;
   gboolean success = FALSE;
 
   /* generate list of packages for installing */
-  {
-    const gchar *packages[] = {
-      "samba",
-      "libpam-smbpass",
-      NULL
-    };
-    path = create_temp_file (packages);
-  }
+  const gchar *packages = "samba,libpam-smbpass";
 
   /* generate dialog_ask_retry */
   dialog_ask_retry  = gtk_message_dialog_new (NULL,
@@ -787,10 +747,10 @@
   for (;;) 
   {
     gint response; /* response from dialog */
-    pid_t pid; /* synaptic's pid */
+    pid_t pid; /* apturl's pid */
 
-    if (spawn_synaptic (window, path, &pid))
-      if ((success = wait_for_synaptic (GTK_WINDOW (window), pid)))
+    if (spawn_apturl (window, packages, &pid))
+      if ((success = wait_for_apturl (GTK_WINDOW (window), pid)))
         break;
     
     response = gtk_dialog_run (GTK_DIALOG (dialog_ask_retry));
@@ -831,7 +791,7 @@
   else
   {
     is_installing_samba = TRUE;
-    run_synaptic (dialog);
+    run_apturl (dialog);
   }
   gtk_widget_destroy (dialog);
 }
