Index: gnome-screenshot/gnome-screenshot.c
===================================================================
--- gnome-screenshot/gnome-screenshot.c	(revision 7935)
+++ gnome-screenshot/gnome-screenshot.c	(working copy)
@@ -661,7 +661,7 @@
 }
 
 static void
-prepare_screenshot (void)
+prepare_screenshot (gchar *filename)
 {
   ScreenshotDialog *dialog;
   Window win;
@@ -719,7 +719,14 @@
                                     NULL);
       exit (1);
     }
+  if (filename)
+    {
+      GError *error = NULL;
 
+      /* No need for all those dialogs... */
+      gdk_pixbuf_save (screenshot, filename, "png", &error, "tEXt::CREATOR", "gnome-panel-screenshot", NULL);
+      return;
+    }
 
   /* If uri isn't local, we should do this async before taking the sshot */
   initial_uri = generate_filename_for_uri (last_save_dir);
@@ -755,7 +762,7 @@
 prepare_screenshot_timeout (gpointer data)
 {
   gtk_main_quit ();
-  prepare_screenshot ();
+  prepare_screenshot (NULL);
 
   return FALSE;
 }
@@ -867,6 +874,7 @@
   gboolean interactive_arg = FALSE;
   gchar *border_effect_arg = NULL;
   guint delay_arg = 0;
+  gchar *filename_arg = NULL;
 
   const GOptionEntry entries[] = {
     { "window", 'w', 0, G_OPTION_ARG_NONE, &window_arg, N_("Grab a window instead of the entire screen"), NULL },
@@ -874,6 +882,7 @@
     { "delay", 'd', 0, G_OPTION_ARG_INT, &delay_arg, N_("Take screenshot after specified delay [in seconds]"), N_("seconds") },
     { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border or none)"), N_("effect") },
     { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive_arg, N_("Interactively set options"), NULL },
+    { "filename", 'f', 0, G_OPTION_ARG_STRING, &filename_arg, N_("Filename to use"), NULL },
     { NULL },
   };
 
@@ -907,6 +916,11 @@
 
   load_options ();
   /* allow the command line to override options */
+  if (filename_arg)
+  {
+    printf ("filename = %s\n", filename_arg);
+  }
+
   if (window_arg)
     take_window_shot = TRUE;
 
@@ -955,7 +969,7 @@
     }
   else
     {
-      prepare_screenshot ();
+      prepare_screenshot (filename_arg);
     }
 
   g_object_unref (program);
