Index: eog-gtk-ui.xml
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-gtk-ui.xml,v
retrieving revision 1.4
diff -u -r1.4 eog-gtk-ui.xml
--- eog-gtk-ui.xml	24 Oct 2004 11:50:41 -0000	1.4
+++ eog-gtk-ui.xml	6 Feb 2005 09:12:21 -0000
@@ -37,6 +37,15 @@
       <menuitem action="ViewZoomOut"/>
       <menuitem action="ViewZoomNormal"/>
       <menuitem action="ViewZoomFit"/>
+      <separator/>
+      <placeholder name="SetAsWallpaper">
+      	<menu action = "SetAsWallpaper">
+      		<menuitem action="Centered"/>
+      		<menuitem action="Tiled"/>
+      		<menuitem action="Scaled"/>
+      		<menuitem action="Stretched"/>
+	</menu>
+      </placeholder>
     </menu>
     <menu action="HelpMenu">
       <menuitem action="HelpManual"/>
Index: eog-window.c
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-window.c,v
retrieving revision 1.125
diff -u -r1.125 eog-window.c
--- eog-window.c	29 Nov 2004 20:53:13 -0000	1.125
+++ eog-window.c	6 Feb 2005 09:13:05 -0000
@@ -123,6 +123,13 @@
 	SIGNAL_LAST
 };
 
+typedef enum {
+	WALLPAPER_ALIGN_TILED     = 0,
+	WALLPAPER_ALIGN_CENTERED  = 1,
+	WALLPAPER_ALIGN_STRETCHED = 2,
+	WALLPAPER_ALIGN_SCALED    = 3
+} WallpaperAlign;
+
 static int eog_window_signals [SIGNAL_LAST];
 
 static void eog_window_class_init (EogWindowClass *class);
@@ -368,6 +375,124 @@
 		g_error_free (error);
 	}
 }
+static void set_as_wallpaper (EogWindow *window, EogImage *image,WallpaperAlign align)
+{
+	EogWindowPrivate *priv;
+	char *filename = NULL;
+	GnomeVFSURI *img_uri;
+	GConfClient *client;
+	char *options = NULL;
+
+	g_return_if_fail (EOG_IS_WINDOW (window));
+	g_return_if_fail (EOG_IS_IMAGE (image));
+
+	priv = window->priv;
+
+	img_uri = eog_image_get_uri (image);
+	filename= gnome_vfs_uri_to_string(img_uri,GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD);  
+
+	client = gconf_client_get_default();
+	gconf_client_set_string (client, "/desktop/gnome/background/picture_filename",filename, NULL);
+	switch (align) {
+	case WALLPAPER_ALIGN_TILED:
+		options = "wallpaper";
+		break;
+	case WALLPAPER_ALIGN_CENTERED:
+		options = "centered";
+		break;
+	case WALLPAPER_ALIGN_STRETCHED:
+		options = "stretched";
+		break;
+	case WALLPAPER_ALIGN_SCALED:
+		options = "scaled";
+		break;
+	}
+	gconf_client_set_string (client, 
+				 "/desktop/gnome/background/picture_options", 
+				 options,
+				 NULL);
+        g_object_unref (G_OBJECT (client));
+}
+
+
+static void
+Centered_cb (GtkAction *action, gpointer data)
+{
+	EogWindowPrivate *priv;
+	EogWindow *window;
+	int n_images;
+
+	window = EOG_WINDOW (data);
+	priv = window->priv;
+
+
+	n_images = eog_wrap_list_get_n_selected (EOG_WRAP_LIST (priv->wraplist));
+
+	if (n_images == 1) {
+		EogImage *image;
+		image = eog_wrap_list_get_first_selected_image (EOG_WRAP_LIST (priv->wraplist));
+       set_as_wallpaper (window, image,WALLPAPER_ALIGN_CENTERED);
+	}
+}
+static void
+Tiled_cb (GtkAction *action, gpointer data)
+{
+EogWindowPrivate *priv;
+	EogWindow *window;
+	int n_images;
+
+	window = EOG_WINDOW (data);
+	priv = window->priv;
+
+
+	n_images = eog_wrap_list_get_n_selected (EOG_WRAP_LIST (priv->wraplist));
+
+	if (n_images == 1) {
+		EogImage *image;
+		image = eog_wrap_list_get_first_selected_image (EOG_WRAP_LIST (priv->wraplist));
+       set_as_wallpaper (window, image,WALLPAPER_ALIGN_TILED);
+	}
+}
+static void
+Stretched_cb (GtkAction *action, gpointer data)
+{
+EogWindowPrivate *priv;
+	EogWindow *window;
+	int n_images;
+
+	window = EOG_WINDOW (data);
+	priv = window->priv;
+
+
+	n_images = eog_wrap_list_get_n_selected (EOG_WRAP_LIST (priv->wraplist));
+
+	if (n_images == 1) {
+		EogImage *image;
+		image = eog_wrap_list_get_first_selected_image (EOG_WRAP_LIST (priv->wraplist));
+       set_as_wallpaper (window, image,WALLPAPER_ALIGN_STRETCHED);
+	}
+}
+
+static void
+Scaled_cb (GtkAction *action, gpointer data)
+{
+	EogWindowPrivate *priv;
+	EogWindow *window;
+	int n_images;
+
+	window = EOG_WINDOW (data);
+	priv = window->priv;
+
+
+	n_images = eog_wrap_list_get_n_selected (EOG_WRAP_LIST (priv->wraplist));
+
+	if (n_images == 1) {
+		EogImage *image;
+		image = eog_wrap_list_get_first_selected_image (EOG_WRAP_LIST (priv->wraplist));
+       set_as_wallpaper (window, image,WALLPAPER_ALIGN_SCALED);
+	}
+}
+
 
 static void
 verb_ZoomIn_cb (GtkAction *action, gpointer data)
@@ -2307,6 +2432,13 @@
   { "EditDelete", GTK_STOCK_DELETE, N_("Delete"), "Delete", NULL, G_CALLBACK (verb_Delete_cb) },
  
   { "ViewFullscreen", NULL, N_("_Full Screen"), "F11", NULL, G_CALLBACK (verb_FullScreen_cb) },
+
+  { "SetAsWallpaper", NULL, N_("Set Image As _Wallpaper"), NULL, NULL, NULL },
+  { "Tiled", NULL, N_("_Tiled"), NULL, NULL, G_CALLBACK (Tiled_cb) },
+  { "Scaled", NULL, N_("_Scaled"), NULL, NULL, G_CALLBACK (Scaled_cb) },
+  { "Centered", NULL, N_("_Centered"), NULL, NULL, G_CALLBACK (Centered_cb) },
+  { "Stretched", NULL, N_("Str_etched"), NULL, NULL, G_CALLBACK (Stretched_cb) },
+
   { "ViewZoomIn", GTK_STOCK_ZOOM_IN, N_("_Zoom In"), "<control>plus", NULL, G_CALLBACK (verb_ZoomIn_cb) },
   { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "<control>minus", NULL, G_CALLBACK (verb_ZoomOut_cb) },
   { "ViewZoomNormal", GTK_STOCK_ZOOM_100, N_("_Normal Size"), "<control>equal", NULL, G_CALLBACK (verb_ZoomNormal_cb) },
