2001-07-25 17:26:17 +00:00
|
|
|
/* -*- mode: c; style: linux -*- */
|
|
|
|
|
2001-12-18 19:46:26 +00:00
|
|
|
/* background-properties-capplet.c
|
2001-07-25 17:26:17 +00:00
|
|
|
* Copyright (C) 2000-2001 Ximian, Inc.
|
|
|
|
*
|
2001-11-10 20:51:12 +00:00
|
|
|
* Written by: Bradford Hovinen <hovinen@ximian.com>,
|
2001-07-25 17:26:17 +00:00
|
|
|
* Richard Hestilow <hestilow@ximian.com>
|
2001-11-10 20:51:12 +00:00
|
|
|
*
|
2001-07-25 17:26:17 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gnome.h>
|
2001-12-18 19:46:26 +00:00
|
|
|
#include <gconf/gconf-client.h>
|
2001-07-25 17:26:17 +00:00
|
|
|
#include <glade/glade.h>
|
2001-12-18 19:46:26 +00:00
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
#include "capplet-util.h"
|
2001-11-10 20:51:12 +00:00
|
|
|
#include "gconf-property-editor.h"
|
2001-07-25 17:26:17 +00:00
|
|
|
#include "applier.h"
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Retrieve legacy gnome_config settings and store them in the GConf
|
|
|
|
* database. This involves some translation of the settings' meanings.
|
|
|
|
*/
|
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
static void
|
2001-11-10 20:51:12 +00:00
|
|
|
get_legacy_settings (void)
|
2001-07-25 17:26:17 +00:00
|
|
|
{
|
2001-12-20 15:46:08 +00:00
|
|
|
int val_int;
|
|
|
|
char *val_string;
|
|
|
|
gboolean val_boolean;
|
|
|
|
gboolean def;
|
|
|
|
gchar *val_filename;
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
GConfClient *client;
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
client = gconf_client_get_default ();
|
2001-11-10 20:51:12 +00:00
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_bool (client, "/desktop/gnome/background/enabled",
|
2001-11-10 20:51:12 +00:00
|
|
|
gnome_config_get_bool ("/Background/Default/Enabled=true"), NULL);
|
|
|
|
|
|
|
|
val_filename = gnome_config_get_string ("/Background/Default/wallpaper=(none)");
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_string (client, "/desktop/gnome/background/wallpaper-filename",
|
2001-11-10 20:51:12 +00:00
|
|
|
val_filename, NULL);
|
2001-09-14 16:52:52 +00:00
|
|
|
|
|
|
|
if (val_filename != NULL && strcmp (val_filename, "(none)"))
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_bool (client, "/desktop/gnome/background/wallpaper-enabled", TRUE, NULL);
|
2001-09-14 16:52:52 +00:00
|
|
|
else
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_bool (client, "/desktop/gnome/background/wallpaper-enabled", FALSE, NULL);
|
2001-11-10 20:51:12 +00:00
|
|
|
|
|
|
|
g_free (val_filename);
|
2001-08-28 13:45:20 +00:00
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_int (client, "/desktop/gnome/background/wallpaper-type",
|
2001-11-10 20:51:12 +00:00
|
|
|
gnome_config_get_int ("/Background/Default/wallpaperAlign=0"), NULL);
|
2001-08-28 13:45:20 +00:00
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_string (client, "/desktop/gnome/background/color1",
|
2001-11-10 20:51:12 +00:00
|
|
|
gnome_config_get_string ("/Background/Default/color1"), NULL);
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_string (client, "/desktop/gnome/background/color2",
|
2001-11-10 20:51:12 +00:00
|
|
|
gnome_config_get_string ("/Background/Default/color2"), NULL);
|
2001-07-25 17:26:17 +00:00
|
|
|
|
|
|
|
/* Code to deal with new enum - messy */
|
2001-11-10 20:51:12 +00:00
|
|
|
val_int = -1;
|
2001-07-25 17:26:17 +00:00
|
|
|
val_string = gnome_config_get_string_with_default ("/Background/Default/simple=solid", &def);
|
2001-07-27 01:48:44 +00:00
|
|
|
if (!def) {
|
|
|
|
if (!strcmp (val_string, "solid")) {
|
2001-11-10 20:51:12 +00:00
|
|
|
val_int = ORIENTATION_SOLID;
|
2001-07-27 01:48:44 +00:00
|
|
|
} else {
|
2001-07-25 17:26:17 +00:00
|
|
|
g_free (val_string);
|
|
|
|
val_string = gnome_config_get_string_with_default ("/Background/Default/gradient=vertical", &def);
|
|
|
|
if (!def)
|
2001-11-10 20:51:12 +00:00
|
|
|
val_int = (!strcmp (val_string, "vertical")) ? ORIENTATION_VERT : ORIENTATION_HORIZ;
|
2001-07-25 17:26:17 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-27 01:48:44 +00:00
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
g_free (val_string);
|
2001-07-27 01:48:44 +00:00
|
|
|
|
2001-11-10 20:51:12 +00:00
|
|
|
if (val_int != -1)
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_int (client, "/desktop/gnome/background/orientation", val_int, NULL);
|
2001-07-27 01:48:44 +00:00
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
val_boolean = gnome_config_get_bool_with_default ("/Background/Default/adjustOpacity=true", &def);
|
2001-07-27 01:48:44 +00:00
|
|
|
|
2001-08-28 13:01:54 +00:00
|
|
|
if (!def && val_boolean)
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_set_int (client, "/desktop/gnome/background/opacity",
|
2001-11-10 20:51:12 +00:00
|
|
|
gnome_config_get_int ("/Background/Default/opacity=100"), NULL);
|
2001-07-25 17:26:17 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Initial apply to the preview, and setting of the color frame's sensitivity.
|
|
|
|
*
|
|
|
|
* We use a double-delay mechanism: first waiting 100 ms, then working in an
|
|
|
|
* idle handler so that the preview gets rendered after the rest of the dialog
|
|
|
|
* is displayed. This prevents the program from appearing to stall on startup,
|
|
|
|
* making it feel more natural to the user.
|
|
|
|
*/
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-08-28 13:01:54 +00:00
|
|
|
static gboolean
|
2001-12-20 14:24:56 +00:00
|
|
|
real_realize_cb (BGPreferences *prefs)
|
2001-07-25 17:26:17 +00:00
|
|
|
{
|
2001-12-18 16:01:47 +00:00
|
|
|
GtkWidget *color_frame;
|
2001-12-20 15:46:08 +00:00
|
|
|
BGApplier *bg_applier;
|
2001-09-08 00:42:11 +00:00
|
|
|
|
2001-08-28 13:01:54 +00:00
|
|
|
g_return_val_if_fail (prefs != NULL, TRUE);
|
2001-12-20 14:24:56 +00:00
|
|
|
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), TRUE);
|
2001-08-28 13:01:54 +00:00
|
|
|
|
2001-11-10 20:51:12 +00:00
|
|
|
if (G_OBJECT (prefs)->ref_count == 0)
|
2001-08-28 13:01:54 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
|
2001-12-18 16:01:47 +00:00
|
|
|
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
|
2001-09-08 00:42:11 +00:00
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
bg_applier_apply_prefs (bg_applier, prefs);
|
2001-08-28 13:01:54 +00:00
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
|
2001-09-08 00:42:11 +00:00
|
|
|
|
2001-08-28 13:01:54 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2001-12-20 14:24:56 +00:00
|
|
|
realize_2_cb (BGPreferences *prefs)
|
2001-08-28 13:01:54 +00:00
|
|
|
{
|
|
|
|
gtk_idle_add ((GtkFunction) real_realize_cb, prefs);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-20 14:24:56 +00:00
|
|
|
realize_cb (GtkWidget *widget, BGPreferences *prefs)
|
2001-08-28 13:01:54 +00:00
|
|
|
{
|
|
|
|
gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs);
|
2001-07-25 17:26:17 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Callback issued when some value changes in a property editor. This merges the
|
|
|
|
* value with the preferences object and applies the settings to the preview. It
|
|
|
|
* also sets the sensitivity of the color frame depending on whether the base
|
|
|
|
* colors are visible through the wallpaper (or whether the wallpaper is
|
|
|
|
* enabled). This cannot be done with a guard as it depends on a much more
|
|
|
|
* complex criterion than a simple boolean configuration property.
|
|
|
|
*/
|
|
|
|
|
2001-12-17 18:17:57 +00:00
|
|
|
static void
|
2001-12-20 14:24:56 +00:00
|
|
|
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, BGPreferences *prefs)
|
2001-12-17 18:17:57 +00:00
|
|
|
{
|
|
|
|
GConfEntry *entry;
|
2001-12-20 15:46:08 +00:00
|
|
|
BGApplier *bg_applier;
|
2001-12-18 16:01:47 +00:00
|
|
|
GtkWidget *color_frame;
|
2001-12-17 18:17:57 +00:00
|
|
|
|
|
|
|
entry = gconf_entry_new (key, value);
|
2001-12-20 14:24:56 +00:00
|
|
|
bg_preferences_merge_entry (prefs, entry);
|
2001-12-17 18:17:57 +00:00
|
|
|
gconf_entry_free (entry);
|
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
|
2001-12-17 18:17:57 +00:00
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (bg_applier)))
|
|
|
|
bg_applier_apply_prefs (bg_applier, BG_PREFERENCES (prefs));
|
2001-12-17 20:01:22 +00:00
|
|
|
|
2001-12-18 16:17:44 +00:00
|
|
|
if (!strcmp (key, "/desktop/gnome/background/wallpaper-enabled") ||
|
|
|
|
!strcmp (key, "/desktop/gnome/background/wallpaper-filename") ||
|
|
|
|
!strcmp (key, "/desktop/gnome/background/wallpaper-type"))
|
2001-12-17 20:01:22 +00:00
|
|
|
{
|
2001-12-18 16:01:47 +00:00
|
|
|
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
|
2001-12-20 15:46:08 +00:00
|
|
|
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
|
2001-12-17 20:01:22 +00:00
|
|
|
}
|
2001-12-17 18:17:57 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Set up the property editors in the dialog. This also loads the preferences
|
|
|
|
* and sets up the callbacks.
|
|
|
|
*/
|
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
static void
|
2001-12-20 15:46:08 +00:00
|
|
|
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, BGApplier *bg_applier)
|
2001-07-25 17:26:17 +00:00
|
|
|
{
|
2001-12-20 15:46:08 +00:00
|
|
|
GObject *prefs;
|
|
|
|
GObject *peditor;
|
|
|
|
GConfClient *client;
|
2001-12-18 16:01:47 +00:00
|
|
|
|
|
|
|
/* Override the enabled setting to make sure background is enabled */
|
2001-12-18 16:39:30 +00:00
|
|
|
client = gconf_client_get_default ();
|
|
|
|
gconf_client_set_bool (client, "/desktop/gnome/background/enabled", TRUE, NULL);
|
2001-11-10 20:51:12 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Load preferences */
|
2001-12-20 14:24:56 +00:00
|
|
|
prefs = bg_preferences_new ();
|
|
|
|
bg_preferences_load (BG_PREFERENCES (prefs));
|
2001-12-17 18:17:57 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* We need to be able to retrieve the applier and the color frame in
|
|
|
|
callbacks */
|
|
|
|
g_object_set_data (prefs, "color-frame", WID ("color_frame"));
|
2001-12-20 15:46:08 +00:00
|
|
|
g_object_set_data (prefs, "applier", bg_applier);
|
2001-12-18 16:01:47 +00:00
|
|
|
|
|
|
|
peditor = gconf_peditor_new_select_menu
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/orientation", WID ("color_option"), NULL);
|
2001-12-17 18:17:57 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-12-18 16:01:47 +00:00
|
|
|
|
|
|
|
peditor = gconf_peditor_new_color
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/color1", WID ("colorpicker1"), NULL);
|
2001-12-17 18:17:57 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-12-18 16:01:47 +00:00
|
|
|
|
|
|
|
peditor = gconf_peditor_new_color
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/color2", WID ("colorpicker2"), NULL);
|
2001-12-17 18:17:57 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-12-18 16:01:47 +00:00
|
|
|
|
|
|
|
peditor = gconf_peditor_new_filename
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/wallpaper-filename", WID ("image_fileentry"), NULL);
|
2001-12-17 18:17:57 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-11-10 20:51:12 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
peditor = gconf_peditor_new_select_menu
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/wallpaper-type", WID ("image_option"), NULL);
|
2001-12-18 16:01:47 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-11-10 20:51:12 +00:00
|
|
|
peditor = gconf_peditor_new_boolean
|
2001-12-20 20:14:59 +00:00
|
|
|
(changeset, "/desktop/gnome/background/wallpaper-enabled", WID ("picture_enabled_check"), NULL);
|
2001-12-17 18:33:12 +00:00
|
|
|
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
|
2001-09-08 00:42:11 +00:00
|
|
|
|
2001-12-17 19:33:12 +00:00
|
|
|
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("picture_frame"));
|
2001-09-12 15:35:23 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Make sure preferences get applied to the preview */
|
2001-12-20 15:46:08 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (bg_applier)))
|
|
|
|
bg_applier_apply_prefs (bg_applier, BG_PREFERENCES (prefs));
|
2001-09-12 15:35:23 +00:00
|
|
|
else
|
2001-12-20 15:46:08 +00:00
|
|
|
g_signal_connect_after (G_OBJECT (bg_applier_get_preview_widget (bg_applier)), "realize",
|
2001-11-10 20:51:12 +00:00
|
|
|
(GCallback) realize_cb, prefs);
|
2001-08-28 13:01:54 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Make sure the preferences object gets destroyed when the dialog is
|
|
|
|
closed */
|
|
|
|
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, prefs);
|
2001-07-25 17:26:17 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Construct the dialog */
|
|
|
|
|
|
|
|
static GladeXML *
|
2001-12-20 15:46:08 +00:00
|
|
|
create_dialog (BGApplier *bg_applier)
|
2001-07-25 17:26:17 +00:00
|
|
|
{
|
|
|
|
GtkWidget *holder;
|
|
|
|
GtkWidget *widget;
|
2001-09-17 13:31:43 +00:00
|
|
|
GladeXML *dialog;
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-11-10 20:51:12 +00:00
|
|
|
/* FIXME: What the hell is domain? */
|
2001-12-20 18:52:39 +00:00
|
|
|
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/background-properties.glade", "prefs_widget", NULL);
|
2001-07-25 17:26:17 +00:00
|
|
|
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
|
|
|
|
|
|
|
/* Minor GUI addition */
|
2001-12-17 16:23:10 +00:00
|
|
|
holder = WID ("prefs_widget");
|
2001-12-20 15:46:08 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (holder), bg_applier_get_preview_widget (bg_applier), TRUE, TRUE, 0);
|
2001-07-25 17:26:17 +00:00
|
|
|
gtk_widget_show_all (holder);
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
g_object_weak_ref (G_OBJECT (widget), (GWeakNotify) g_object_unref, dialog);
|
2001-07-25 17:26:17 +00:00
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
return dialog;
|
2001-07-25 17:26:17 +00:00
|
|
|
}
|
|
|
|
|
2001-12-18 16:01:47 +00:00
|
|
|
/* Callback issued when a button is clicked on the dialog */
|
|
|
|
|
2001-12-07 17:29:43 +00:00
|
|
|
static void
|
2001-12-20 18:21:12 +00:00
|
|
|
dialog_button_clicked_cb (GnomeDialog *dialog, gint response_id, GConfChangeSet *changeset)
|
2001-12-07 17:29:43 +00:00
|
|
|
{
|
2001-12-20 18:21:12 +00:00
|
|
|
switch (response_id) {
|
|
|
|
case GTK_RESPONSE_APPLY:
|
2001-12-18 16:39:30 +00:00
|
|
|
gconf_client_commit_change_set (gconf_client_get_default (), changeset, TRUE, NULL);
|
2001-12-20 18:21:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_RESPONSE_CLOSE:
|
|
|
|
gtk_main_quit ();
|
|
|
|
break;
|
|
|
|
}
|
2001-12-07 17:29:43 +00:00
|
|
|
}
|
|
|
|
|
2001-07-25 17:26:17 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2001-12-18 16:39:30 +00:00
|
|
|
GConfClient *client;
|
2001-12-07 17:29:43 +00:00
|
|
|
GConfChangeSet *changeset;
|
2001-12-18 16:01:47 +00:00
|
|
|
GladeXML *dialog;
|
|
|
|
GtkWidget *dialog_win;
|
2001-12-20 15:46:08 +00:00
|
|
|
GObject *bg_applier;
|
2001-12-07 17:29:43 +00:00
|
|
|
|
|
|
|
static gboolean get_legacy;
|
|
|
|
static struct poptOption cap_options[] = {
|
|
|
|
{ "get-legacy", '\0', POPT_ARG_NONE, &get_legacy, 0,
|
|
|
|
N_("Retrieve and store legacy settings"), NULL },
|
|
|
|
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
2001-12-09 12:23:40 +00:00
|
|
|
bind_textdomain_codeset (PACKAGE, "UTF-8");
|
2001-12-07 17:29:43 +00:00
|
|
|
textdomain (PACKAGE);
|
|
|
|
|
|
|
|
gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv,
|
|
|
|
GNOME_PARAM_POPT_TABLE, cap_options,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
setup_session_mgmt (argv[0]);
|
|
|
|
|
2001-12-18 16:39:30 +00:00
|
|
|
client = gconf_client_get_default ();
|
|
|
|
gconf_client_add_dir (client, "/desktop/gnome/background", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
|
|
|
|
2001-12-20 14:11:59 +00:00
|
|
|
if (get_legacy) {
|
2001-12-07 17:29:43 +00:00
|
|
|
get_legacy_settings ();
|
|
|
|
} else {
|
|
|
|
changeset = gconf_change_set_new ();
|
2001-12-20 15:46:08 +00:00
|
|
|
bg_applier = bg_applier_new (BG_APPLIER_PREVIEW);
|
|
|
|
dialog = create_dialog (BG_APPLIER (bg_applier));
|
|
|
|
setup_dialog (dialog, changeset, BG_APPLIER (bg_applier));
|
2001-12-18 16:01:47 +00:00
|
|
|
|
2001-12-20 18:21:12 +00:00
|
|
|
dialog_win = gtk_dialog_new_with_buttons
|
|
|
|
(_("Background properties"), NULL, -1,
|
|
|
|
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
|
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback) dialog_button_clicked_cb, changeset);
|
|
|
|
|
2001-12-20 15:46:08 +00:00
|
|
|
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) g_object_unref, bg_applier);
|
2001-12-20 18:21:12 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
|
2001-12-18 16:01:47 +00:00
|
|
|
gtk_widget_show_all (dialog_win);
|
2001-12-07 17:29:43 +00:00
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
gconf_change_set_unref (changeset);
|
|
|
|
}
|
2001-07-25 17:26:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|