diff -up gnome-control-center-2.27.4/capplets/appearance/appearance-desktop.c.make-default gnome-control-center-2.27.4/capplets/appearance/appearance-desktop.c
--- gnome-control-center-2.27.4/capplets/appearance/appearance-desktop.c.make-default 2009-07-15 11:12:52.000000000 -0400
+++ gnome-control-center-2.27.4/capplets/appearance/appearance-desktop.c 2009-07-15 17:08:10.808068841 -0400
@@ -31,6 +31,9 @@
#include <libgnomeui/gnome-desktop-thumbnail.h>
#include <libgnomeui/gnome-bg.h>
+#include <dbus/dbus-glib.h>
+#include <polkit-gnome/polkit-gnome.h>
+
enum {
TARGET_URI_LIST,
TARGET_BGIMAGE
@@ -992,12 +995,61 @@ wp_select_after_realize (GtkWidget *widg
select_item (data, item, TRUE);
}
+static void
+set_background (GtkAction *action, gpointer data)
+{
+ AppearanceData *adata = (AppearanceData *)data;
+ DBusGProxy *proxy;
+ DBusGConnection *connection;
+ GError *error;
+ char *keys[7] = {
+ "/desktop/gnome/background/picture_filename",
+ "/desktop/gnome/background/picture_opacity",
+ "/desktop/gnome/background/picture_options",
+ "/desktop/gnome/background/color_shading_type",
+ "/desktop/gnome/background/primary_color",
+ "/desktop/gnome/background/secondary_color",
+ NULL
+ };
+
+ gconf_client_suggest_sync (adata->client, NULL);
+
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ g_warning ("failed to get system bus connection: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ proxy = dbus_g_proxy_new_for_name (connection,
+ "org.gnome.GConf.Defaults",
+ "/",
+ "org.gnome.GConf.Defaults");
+ if (proxy == NULL) {
+ g_warning ("Cannot connect to defaults mechanism");
+ return;
+ }
+
+ dbus_g_proxy_call (proxy, "SetSystem",
+ &error,
+ G_TYPE_STRV, keys,
+ G_TYPE_STRV, NULL,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ g_object_unref (proxy);
+}
+
void
desktop_init (AppearanceData *data,
const gchar **uris)
{
GtkWidget *add_button;
GtkCellRenderer *cr;
+ PolKitAction *pk_action;
+ PolKitGnomeAction *action;
+ GtkWidget *widget, *box, *button;
g_object_set (gtk_settings_get_default (), "gtk-tooltip-timeout", 500, NULL);
@@ -1118,6 +1170,24 @@ desktop_init (AppearanceData *data,
/* create the file selector later to save time on startup */
data->wp_filesel = NULL;
+ widget = appearance_capplet_get_widget (data, "background_vbox");
+ box = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (widget), box, FALSE, FALSE, 0);
+
+ pk_action = polkit_action_new ();
+ polkit_action_set_action_id (pk_action, "org.gnome.gconf.defaults.set-default-background");
+
+ action = polkit_gnome_action_new_default ("set-system",
+ pk_action,
+ _("Make Default"),
+ _("Set the current background as the system-wide default"));
+ g_object_set (action, "no-visible", FALSE, NULL);
+
+ polkit_action_unref (pk_action);
+ button = polkit_gnome_action_create_button (action);
+ gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
+
+ g_signal_connect (action, "activate", G_CALLBACK (set_background), data);
}
void