--- gnome-panel-screenshot.c.orig	2004-10-14 12:17:08.800515496 +0200
+++ gnome-panel-screenshot.c	2004-10-14 16:35:52.647532032 +0200
@@ -37,6 +37,7 @@
 #include <errno.h>
 #include <locale.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-mime-handlers.h>
 #include <X11/Xutil.h>
 #include <X11/cursorfont.h>
 #include <X11/Xmu/WinUtil.h>
@@ -61,6 +62,7 @@
 static char *web_dir;
 static char *desktop_dir;
 static const char *home_dir;
+static GList *applications;
 static char *class_name = NULL;
 static pid_t temporary_pid = 0;
 static char *temporary_file = NULL;
@@ -71,6 +73,7 @@
 	  { "text/uri-list", 0, 0 } };
 
 /* some prototypes for the glade autoconnecting sutff */
+void on_open_rbutton_toggled (GtkWidget *toggle, gpointer data);
 void on_save_rbutton_toggled (GtkWidget *toggle, gpointer data);
 void on_preview_expose_event (GtkWidget *drawing_area,
 			      GdkEventExpose *event,
@@ -473,6 +476,21 @@
 }
 
 void
+on_open_rbutton_toggled (GtkWidget *toggle, gpointer data)
+{
+	GtkWidget *ok_button = glade_xml_get_widget (xml, "ok_button");
+	GtkWidget *open_combo = glade_xml_get_widget (xml, "open_combo");
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))) {
+		gtk_button_set_label (GTK_BUTTON (ok_button), "gtk-open");
+		gtk_widget_set_sensitive (open_combo, TRUE);
+	} else {
+		gtk_button_set_label (GTK_BUTTON (ok_button), "gtk-save");
+		gtk_widget_set_sensitive (open_combo, FALSE);
+	}
+}
+
+void
 on_preview_expose_event (GtkWidget      *drawing_area,
 			 GdkEventExpose *event,
 			 gpointer        data)
@@ -627,7 +645,11 @@
 		      gpointer   data)
 {
 	GtkWidget *button;
+	GtkWidget *combo;
 	gchar *file;
+	gint app_id;
+	GnomeVFSMimeApplication *app;
+	
 
 	setup_busy (TRUE);
 
@@ -669,11 +691,34 @@
 		return;
 	}
 
-	file = add_file_to_path (web_dir);
-	if ( ! gimme_file (file)) {
-		g_free (file);
-		setup_busy (FALSE);
-		return;
+	button = glade_xml_get_widget (xml, "web_rbutton");
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
+		file = add_file_to_path (web_dir);
+		if ( ! gimme_file (file)) {
+			g_free (file);
+			setup_busy (FALSE);
+			return;
+		}
+		gtk_main_quit ();
+	}
+	combo = glade_xml_get_widget (xml, "open_combo");
+	app_id = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+	app = (GnomeVFSMimeApplication*) g_list_nth_data (applications, app_id);
+	if (app != NULL) {
+		file = add_file_to_path (desktop_dir);
+		if (gimme_file (file)) {
+			char *command_line;
+			GError *error = NULL;
+			
+			command_line = g_strdup_printf ("%s %s", app->command, file);
+			if (!g_spawn_command_line_async (command_line, &error)) {
+				g_print (_("Unable to launch the application:%s\n"), error->message);
+                		g_error_free (error);
+			}
+			g_free (command_line);
+
+			gtk_main_quit ();
+		}
 	}
 
 	g_free (file);
@@ -1156,11 +1201,16 @@
 {
 	GtkWidget *save_entry;
 	GtkWidget *frame;
+	GtkWidget *open_combo;
+	GtkCellRenderer *cell;
 	GConfClient *gconf_client;
 	struct stat s;
 	gchar *file;
 	gint width, height; 
 	gchar *utf8_name;
+	GtkListStore *store;
+	GList *p;
+	GnomeVFSMimeApplication *application;
 
 	if (!get_lock ()) {
 		g_printerr ("gnome-panel-screenshot is already running\n");
@@ -1219,6 +1269,7 @@
 	frame = glade_xml_get_widget (xml, "aspect_frame");
 	preview = glade_xml_get_widget (xml, "preview");
 	save_entry = glade_xml_get_widget (xml, "save_entry");
+	open_combo = glade_xml_get_widget (xml, "open_combo");
 
 	set_window_icon (GTK_WINDOW (toplevel));
 
@@ -1269,6 +1320,26 @@
 		g_free (escaped);
 	}
 
+	store = gtk_list_store_new (1, G_TYPE_STRING);
+	gtk_combo_box_set_model (GTK_COMBO_BOX (open_combo), GTK_TREE_MODEL (store));
+	cell = gtk_cell_renderer_text_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (open_combo), cell, TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (open_combo), cell, "text", 0, NULL);
+
+
+	applications = gnome_vfs_mime_get_all_applications  ("image/png");
+	if (applications != NULL) {
+		for (p = applications; p != NULL; p = p->next) {
+			application = p->data;
+			gtk_combo_box_append_text (GTK_COMBO_BOX (open_combo), application->name);
+		}
+		gtk_combo_box_set_active (GTK_COMBO_BOX (open_combo), 0);
+	} else {
+		GtkWidget *open_box = glade_xml_get_widget (xml, "open_box");
+		gtk_widget_hide (open_box);
+	}
+		
+	
 	/* setup dnd */
 	/* just in case some wanker like nautilus took our image */
 	g_signal_connect (G_OBJECT (preview), "drag_begin",
--- gnome-panel-screenshot.glade.orig	2004-10-14 12:09:54.343562992 +0200
+++ gnome-panel-screenshot.glade	2004-10-14 16:27:55.150122672 +0200
@@ -266,8 +266,8 @@
 			      <property name="max_saved">10</property>
 			      <property name="directory_entry">False</property>
 			      <property name="modal">False</property>
-                              <property name="use_filechooser">True</property>
-                              <property name="filechooser_action">save</property>
+			      <property name="use_filechooser">True</property>
+			      <property name="filechooser_action">save</property>
 
 			      <child internal-child="entry">
 				<widget class="GtkEntry" id="save_entry">
@@ -333,6 +333,52 @@
 			  <property name="fill">False</property>
 			</packing>
 		      </child>
+
+		      <child>
+			<widget class="GtkHBox" id="open_box">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">12</property>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="open_rbuton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Save screenshot to desktop and _open with:</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">save_rbutton</property>
+			      <signal name="toggled" handler="on_open_rbutton_toggled"/>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkComboBox" id="open_combo">
+			      <property name="visible">True</property>
+			      <property name="sensitive">False</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
+			    </packing>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
