2004-01-12 05:10:40 +00:00
|
|
|
/*
|
|
|
|
* Authors: Rodney Dawes <dobey@ximian.com>
|
|
|
|
*
|
2005-02-26 19:15:58 +00:00
|
|
|
* Copyright 2003-2005 Novell, Inc. (www.novell.com)
|
2004-01-12 05:10:40 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation
|
|
|
|
*
|
|
|
|
* 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 Street #330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gnome-wp-capplet.h"
|
|
|
|
|
|
|
|
static gboolean gnome_wp_xml_get_bool (const xmlNode * parent,
|
|
|
|
const gchar * prop_name) {
|
|
|
|
gchar * prop;
|
|
|
|
gboolean ret_val = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (parent != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (prop_name != NULL, FALSE);
|
|
|
|
|
|
|
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
|
|
|
if (prop != NULL) {
|
|
|
|
if (!g_strcasecmp (prop, "true") || !g_strcasecmp (prop, "1")) {
|
|
|
|
ret_val = TRUE;
|
|
|
|
} else {
|
|
|
|
ret_val = FALSE;
|
|
|
|
}
|
|
|
|
g_free (prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_xml_set_bool (const xmlNode * parent,
|
|
|
|
const gchar * prop_name, gboolean value) {
|
|
|
|
g_return_if_fail (parent != NULL);
|
|
|
|
g_return_if_fail (prop_name != NULL);
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
xmlSetProp ((xmlNode *) parent, prop_name, "true");
|
|
|
|
} else {
|
|
|
|
xmlSetProp ((xmlNode *) parent, prop_name, "false");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_load_legacy (GnomeWPCapplet * capplet) {
|
|
|
|
FILE * fp;
|
|
|
|
gchar * foo, * filename;
|
|
|
|
|
|
|
|
filename = g_build_filename (g_get_home_dir (), ".gnome2",
|
|
|
|
"wallpapers.list", NULL);
|
|
|
|
|
|
|
|
if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
|
|
|
|
if ((fp = fopen (filename, "r")) != NULL) {
|
|
|
|
foo = (gchar *) g_malloc (sizeof (gchar) * 4096);
|
|
|
|
while (fgets (foo, 4096, fp)) {
|
|
|
|
GnomeWPItem * item;
|
|
|
|
|
|
|
|
if (foo[strlen (foo) - 1] == '\n') {
|
|
|
|
foo[strlen (foo) - 1] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, foo);
|
|
|
|
if (item != NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-02-24 19:49:58 +00:00
|
|
|
if (!g_file_test (foo, G_FILE_TEST_EXISTS)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-06-28 18:51:21 +00:00
|
|
|
item = gnome_wp_item_new (foo, capplet->wphash, capplet->thumbs);
|
|
|
|
if (item != NULL && item->fileinfo == NULL) {
|
2004-01-12 05:10:40 +00:00
|
|
|
gnome_wp_item_free (item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose (fp);
|
|
|
|
g_free (foo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_xml_load_xml (GnomeWPCapplet * capplet,
|
|
|
|
const gchar * filename) {
|
|
|
|
xmlDoc * wplist;
|
|
|
|
xmlNode * root, * list, * wpa;
|
2005-01-09 01:21:07 +00:00
|
|
|
gchar * nodelang;
|
2005-01-10 15:46:00 +00:00
|
|
|
const gchar * const * syslangs;
|
2004-01-12 05:10:40 +00:00
|
|
|
GdkColor color1, color2;
|
2004-09-22 15:07:01 +00:00
|
|
|
GnomeWPItem * item;
|
2005-01-09 01:21:07 +00:00
|
|
|
gint i;
|
|
|
|
|
2005-01-10 15:46:00 +00:00
|
|
|
#if GLIB_CHECK_VERSION (2, 6, 0)
|
2005-01-09 01:21:07 +00:00
|
|
|
syslangs = g_get_language_names ();
|
2005-01-10 15:46:00 +00:00
|
|
|
#endif
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
wplist = xmlParseFile (filename);
|
|
|
|
|
2005-07-15 04:41:53 +00:00
|
|
|
if (!wplist)
|
|
|
|
return;
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
root = xmlDocGetRootElement (wplist);
|
|
|
|
|
|
|
|
for (list = root->children; list != NULL; list = list->next) {
|
|
|
|
if (!strcmp (list->name, "wallpaper")) {
|
|
|
|
GnomeWPItem * wp;
|
|
|
|
|
|
|
|
wp = g_new0 (GnomeWPItem, 1);
|
|
|
|
|
|
|
|
wp->deleted = gnome_wp_xml_get_bool (list, "deleted");
|
|
|
|
|
|
|
|
for (wpa = list->children; wpa != NULL; wpa = wpa->next) {
|
|
|
|
if (!strcmp (wpa->name, "filename")) {
|
2005-02-26 19:00:19 +00:00
|
|
|
if (wpa->last != NULL && wpa->last->content != NULL) {
|
2004-01-12 05:10:40 +00:00
|
|
|
wp->filename = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "name")) {
|
2005-02-26 19:00:19 +00:00
|
|
|
if (wpa->last != NULL && wpa->last->content != NULL) {
|
2005-01-09 01:21:07 +00:00
|
|
|
nodelang = xmlNodeGetLang (wpa->last);
|
|
|
|
|
|
|
|
if (wp->name == NULL && nodelang == NULL) {
|
|
|
|
wp->name = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
} else {
|
|
|
|
for (i = 0; syslangs[i] != NULL; i++) {
|
|
|
|
if (!strcmp (syslangs[i], nodelang)) {
|
|
|
|
wp->name = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
xmlFree (nodelang);
|
2005-02-26 19:00:19 +00:00
|
|
|
} else {
|
|
|
|
break;
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "imguri")) {
|
|
|
|
if (wpa->last != NULL) {
|
|
|
|
wp->imguri = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "options")) {
|
|
|
|
if (wpa->last != NULL) {
|
|
|
|
wp->options = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
} else {
|
|
|
|
wp->options = gconf_client_get_string (capplet->client,
|
|
|
|
WP_OPTIONS_KEY, NULL);
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "shade_type")) {
|
|
|
|
if (wpa->last != NULL) {
|
|
|
|
wp->shade_type = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "pcolor")) {
|
|
|
|
if (wpa->last != NULL) {
|
|
|
|
wp->pri_color = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "scolor")) {
|
|
|
|
if (wpa->last != NULL) {
|
|
|
|
wp->sec_color = g_strdup (g_strstrip (wpa->last->content));
|
|
|
|
}
|
|
|
|
} else if (!strcmp (wpa->name, "text")) {
|
|
|
|
/* Do nothing here, libxml2 is being weird */
|
|
|
|
} else {
|
|
|
|
g_warning ("Unknown Tag: %s\n", wpa->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-26 19:00:19 +00:00
|
|
|
/* Make sure we don't already have this one and that filename exists */
|
|
|
|
if (wp->filename != NULL) {
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wp->filename);
|
2004-09-22 15:07:01 +00:00
|
|
|
|
2005-02-26 19:00:19 +00:00
|
|
|
if (item != NULL) {
|
|
|
|
gnome_wp_item_free (wp);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2004-09-22 15:07:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
/* Verify the colors and alloc some GdkColors here */
|
|
|
|
if (wp->shade_type == NULL) {
|
|
|
|
wp->shade_type = gconf_client_get_string (capplet->client,
|
|
|
|
WP_SHADING_KEY, NULL);
|
|
|
|
}
|
|
|
|
if (wp->pri_color == NULL) {
|
|
|
|
wp->pri_color = gconf_client_get_string (capplet->client,
|
|
|
|
WP_PCOLOR_KEY, NULL);
|
|
|
|
}
|
|
|
|
if (wp->sec_color == NULL) {
|
|
|
|
wp->sec_color = gconf_client_get_string (capplet->client,
|
|
|
|
WP_SCOLOR_KEY, NULL);
|
|
|
|
}
|
|
|
|
gdk_color_parse (wp->pri_color, &color1);
|
|
|
|
gdk_color_parse (wp->sec_color, &color2);
|
|
|
|
|
|
|
|
wp->pcolor = gdk_color_copy (&color1);
|
|
|
|
wp->scolor = gdk_color_copy (&color2);
|
|
|
|
|
|
|
|
if ((wp->filename != NULL &&
|
|
|
|
g_file_test (wp->filename, G_FILE_TEST_EXISTS)) ||
|
|
|
|
!strcmp (wp->filename, "(none)")) {
|
|
|
|
wp->fileinfo = gnome_wp_info_new (wp->filename, capplet->thumbs);
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
|
|
|
|
if (wp->name == NULL || !strcmp (wp->filename, "(none)")) {
|
2004-01-12 05:10:40 +00:00
|
|
|
wp->name = g_strdup (wp->fileinfo->name);
|
|
|
|
}
|
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gnome_wp_item_update_description (wp);
|
2004-01-12 05:10:40 +00:00
|
|
|
g_hash_table_insert (capplet->wphash, g_strdup (wp->filename), wp);
|
|
|
|
} else {
|
|
|
|
gnome_wp_item_free (wp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xmlFreeDoc (wplist);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_file_changed (GnomeVFSMonitorHandle * handle,
|
|
|
|
const gchar * monitor_uri,
|
|
|
|
const gchar * info_uri,
|
|
|
|
GnomeVFSMonitorEventType event_type,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
gchar * filename;
|
|
|
|
|
|
|
|
switch (event_type) {
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_CHANGED:
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_CREATED:
|
|
|
|
filename = gnome_vfs_get_local_path_from_uri (info_uri);
|
|
|
|
gnome_wp_xml_load_xml (capplet, filename);
|
|
|
|
g_free (filename);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gnome_wp_xml_load_list (GnomeWPCapplet * capplet) {
|
|
|
|
GnomeVFSMonitorHandle * handle;
|
|
|
|
GList * list, * l;
|
|
|
|
gchar * wpdbfile, * xdgdirslist;
|
|
|
|
gchar ** xdgdirs;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
wpdbfile = g_build_filename (g_get_home_dir (),
|
|
|
|
".gnome2",
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
"backgrounds.xml",
|
2004-01-12 05:10:40 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (g_file_test (wpdbfile, G_FILE_TEST_EXISTS)) {
|
|
|
|
gnome_wp_xml_load_xml (capplet, wpdbfile);
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
} else {
|
|
|
|
wpdbfile = g_build_filename (g_get_home_dir (),
|
|
|
|
".gnome2",
|
|
|
|
"wp-list.xml",
|
|
|
|
NULL);
|
|
|
|
if (g_file_test (wpdbfile, G_FILE_TEST_EXISTS)) {
|
|
|
|
gnome_wp_xml_load_xml (capplet, wpdbfile);
|
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
g_free (wpdbfile);
|
|
|
|
|
|
|
|
xdgdirslist = g_strdup (g_getenv ("XDG_DATA_DIRS"));
|
|
|
|
if (xdgdirslist == NULL || strlen (xdgdirslist) == 0)
|
|
|
|
xdgdirslist = g_strdup ("/usr/local/share:/usr/share");
|
|
|
|
|
|
|
|
xdgdirs = g_strsplit (xdgdirslist, ":", -1);
|
|
|
|
for (i = 0; xdgdirs && xdgdirs[i]; i++) {
|
|
|
|
gchar * datadir;
|
|
|
|
|
2004-09-22 15:07:01 +00:00
|
|
|
datadir = g_build_filename (xdgdirs[i], "gnome-background-properties",
|
2004-01-12 05:10:40 +00:00
|
|
|
NULL);
|
|
|
|
if (g_file_test (datadir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
|
|
|
|
gnome_vfs_directory_list_load (&list, datadir,
|
|
|
|
GNOME_VFS_FILE_INFO_DEFAULT |
|
|
|
|
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
|
|
|
|
|
|
|
|
for (l = list; l != NULL; l = l->next) {
|
|
|
|
GnomeVFSFileInfo * info = l->data;
|
|
|
|
|
|
|
|
if (strcmp (".", info->name) != 0 && strcmp ("..", info->name) != 0) {
|
|
|
|
gchar * filename;
|
|
|
|
|
|
|
|
filename = g_build_filename (datadir, info->name, NULL);
|
|
|
|
gnome_wp_xml_load_xml (capplet, filename);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
|
|
|
|
gnome_vfs_monitor_add (&handle, datadir, GNOME_VFS_MONITOR_DIRECTORY,
|
|
|
|
(GnomeVFSMonitorCallback) gnome_wp_file_changed,
|
|
|
|
capplet);
|
|
|
|
}
|
|
|
|
g_free (datadir);
|
|
|
|
}
|
|
|
|
g_strfreev (xdgdirs);
|
|
|
|
g_free (xdgdirslist);
|
|
|
|
|
2004-01-12 06:35:57 +00:00
|
|
|
if (g_file_test (WALLPAPER_DATADIR, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
|
|
|
|
gnome_vfs_directory_list_load (&list, WALLPAPER_DATADIR,
|
2004-01-12 05:10:40 +00:00
|
|
|
GNOME_VFS_FILE_INFO_DEFAULT |
|
|
|
|
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
|
|
|
|
|
|
|
|
for (l = list; l != NULL; l = l->next) {
|
|
|
|
GnomeVFSFileInfo * info = l->data;
|
|
|
|
|
|
|
|
if (strcmp (".", info->name) != 0 && strcmp ("..", info->name) != 0) {
|
|
|
|
gchar * filename;
|
|
|
|
|
2004-01-12 06:35:57 +00:00
|
|
|
filename = g_build_filename (WALLPAPER_DATADIR, info->name, NULL);
|
2004-01-12 05:10:40 +00:00
|
|
|
gnome_wp_xml_load_xml (capplet, filename);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
|
2004-01-12 06:35:57 +00:00
|
|
|
gnome_vfs_monitor_add (&handle, WALLPAPER_DATADIR, GNOME_VFS_MONITOR_DIRECTORY,
|
2004-01-12 05:10:40 +00:00
|
|
|
(GnomeVFSMonitorCallback) gnome_wp_file_changed,
|
|
|
|
capplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
gnome_wp_load_legacy (capplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_list_flatten (const gchar * key, GnomeWPItem * item,
|
|
|
|
GList ** list) {
|
|
|
|
g_return_if_fail (key != NULL);
|
|
|
|
g_return_if_fail (item != NULL);
|
|
|
|
|
|
|
|
*list = g_list_append (*list, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
void gnome_wp_xml_save_list (GnomeWPCapplet * capplet) {
|
|
|
|
xmlDoc * wplist;
|
|
|
|
xmlNode * root, * wallpaper, * item;
|
|
|
|
GList * list = NULL, * wp = NULL;
|
|
|
|
gchar * wpfile;
|
|
|
|
|
|
|
|
g_hash_table_foreach (capplet->wphash,
|
|
|
|
(GHFunc) gnome_wp_list_flatten, &list);
|
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
wpfile = g_build_filename (g_get_home_dir (),
|
|
|
|
"/.gnome2",
|
|
|
|
"backgrounds.xml",
|
|
|
|
NULL);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
xmlKeepBlanksDefault (0);
|
|
|
|
|
|
|
|
wplist = xmlNewDoc ("1.0");
|
|
|
|
xmlCreateIntSubset (wplist, "wallpapers", NULL, "gnome-wp-list.dtd");
|
|
|
|
root = xmlNewNode (NULL, "wallpapers");
|
|
|
|
xmlDocSetRootElement (wplist, root);
|
|
|
|
|
|
|
|
for (wp = list; wp != NULL; wp = wp->next) {
|
|
|
|
GnomeWPItem * wpitem = wp->data;
|
|
|
|
|
|
|
|
wallpaper = xmlNewChild (root, NULL, "wallpaper", NULL);
|
|
|
|
gnome_wp_xml_set_bool (wallpaper, "deleted", wpitem->deleted);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "name", wpitem->name);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "filename", wpitem->filename);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "options", wpitem->options);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "shade_type", wpitem->shade_type);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "pcolor", wpitem->pri_color);
|
|
|
|
item = xmlNewTextChild (wallpaper, NULL, "scolor", wpitem->sec_color);
|
|
|
|
}
|
|
|
|
xmlSaveFormatFile (wpfile, wplist, 1);
|
|
|
|
xmlFreeDoc (wplist);
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
|