2005-05-22 Sebastien Bacher <seb128@debian.org> * ChangeLog capplets/about-me/e-image-chooser.c capplets/accessibility/at-properties/at-startup-session.h capplets/accessibility/keyboard/accessibility-keyboard.c capplets/background/gnome-wp-info.c capplets/common/gconf-property-editor.c capplets/common/gnome-theme-apply.c capplets/default-applications/gnome-default-applications-properties.c capplets/keybindings/gnome-keybinding-properties.c capplets/keyboard/gnome-keyboard-properties.c capplets/mouse/gnome-mouse-properties.c capplets/network/gnome-network-preferences.c capplets/sound/sound-properties-capplet.c capplets/theme-switcher/gnome-theme-details.c capplets/theme-switcher/gnome-theme-manager.c capplets/ui-properties/gnome-ui-properties.c capplets/windows/gnome-window-properties.c gnome-settings-daemon/factory.c gnome-settings-daemon/gnome-settings-accessibility-keyboard.c gnome-settings-daemon/gnome-settings-background.c gnome-settings-daemon/gnome-settings-daemon.c gnome-settings-daemon/gnome-settings-daemon.h gnome-settings-daemon/gnome-settings-font.c gnome-settings-daemon/gnome-settings-keybindings.c gnome-settings-daemon/gnome-settings-keybindings.h gnome-settings-daemon/gnome-settings-keyboard-xkb.c gnome-settings-daemon/gnome-settings-keyboard.c gnome-settings-daemon/gnome-settings-locate-pointer.h gnome-settings-daemon/gnome-settings-mouse.c gnome-settings-daemon/gnome-settings-multimedia-keys.c gnome-settings-daemon/gnome-settings-screensaver.c gnome-settings-daemon/gnome-settings-sound.c gnome-settings-daemon/gnome-settings-xmodmap.c gnome-settings-daemon/gnome-settings-xrdb.c gnome-settings-daemon/gnome-settings-xsettings.c libbackground/applier.c libbackground/applier.h libbackground/preferences.c libsounds/sound-properties.c libsounds/sound-view.h libwindow-settings/gnome-wm-manager.c libwindow-settings/metacity-window-manager.c typing-break/drw-break-window.c typing-break/drw-utils.h typing-break/drwright.c vfs-methods/fontilus/font-view.c vfs-methods/themus/themus-theme-applier.c: Cleanup of gconf and a few other things, patch from Kjartan Maraas <kmaraas@gnome.org> (Closes: #301945).
114 lines
2.9 KiB
C
114 lines
2.9 KiB
C
/*
|
|
* Authors: Rodney Dawes <dobey@ximian.com>
|
|
*
|
|
* Copyright 2003-2005 Novell, Inc. (www.novell.com)
|
|
*
|
|
* 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 <config.h>
|
|
#include <gnome.h>
|
|
#include "gnome-wp-info.h"
|
|
|
|
GnomeWPInfo * gnome_wp_info_new (const gchar * uri,
|
|
GnomeThumbnailFactory * thumbs) {
|
|
GnomeWPInfo * new;
|
|
GnomeVFSFileInfo * info;
|
|
GnomeVFSResult result;
|
|
|
|
gchar *escaped_uri = gnome_vfs_escape_path_string (uri);
|
|
|
|
info = gnome_vfs_file_info_new ();
|
|
result = gnome_vfs_get_file_info (escaped_uri, info,
|
|
GNOME_VFS_FILE_INFO_DEFAULT |
|
|
GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
|
|
GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
|
|
g_free (escaped_uri);
|
|
|
|
if (info == NULL || info->mime_type == NULL || result != GNOME_VFS_OK) {
|
|
if (!strcmp (uri, "(none)")) {
|
|
new = g_new0 (GnomeWPInfo, 1);
|
|
|
|
new->mime_type = g_strdup ("image/x-no-data");
|
|
new->uri = g_strdup (uri);
|
|
|
|
new->thumburi = g_strconcat (g_get_home_dir (),
|
|
"/.thumbnails/normal/",
|
|
gnome_thumbnail_md5 (gnome_vfs_escape_path_string (uri)),
|
|
".png",
|
|
NULL);
|
|
|
|
new->name = g_strdup (_("No Wallpaper"));
|
|
|
|
new->size = 0;
|
|
} else {
|
|
new = NULL;
|
|
}
|
|
} else {
|
|
new = g_new0 (GnomeWPInfo, 1);
|
|
|
|
new->uri = g_strdup (uri);
|
|
|
|
new->thumburi = gnome_thumbnail_factory_lookup (thumbs,
|
|
gnome_vfs_escape_path_string (new->uri),
|
|
info->mtime);
|
|
if (new->thumburi == NULL) {
|
|
new->thumburi = g_strconcat (g_get_home_dir (),
|
|
"/.thumbnails/normal/",
|
|
gnome_thumbnail_md5 (gnome_vfs_escape_path_string (uri)),
|
|
".png",
|
|
NULL);
|
|
}
|
|
new->name = g_strdup (info->name);
|
|
new->mime_type = g_strdup (info->mime_type);
|
|
|
|
new->size = info->size;
|
|
new->mtime = info->mtime;
|
|
}
|
|
gnome_vfs_file_info_unref (info);
|
|
|
|
return new;
|
|
}
|
|
|
|
GnomeWPInfo * gnome_wp_info_dup (const GnomeWPInfo * info) {
|
|
GnomeWPInfo * new;
|
|
|
|
new = g_new0 (GnomeWPInfo, 1);
|
|
|
|
new->uri = g_strdup (info->uri);
|
|
new->thumburi = g_strdup (info->uri);
|
|
|
|
new->name = g_strdup (info->name);
|
|
new->mime_type = g_strdup (info->mime_type);
|
|
|
|
new->size = info->size;
|
|
new->mtime = info->mtime;
|
|
|
|
return new;
|
|
}
|
|
|
|
void gnome_wp_info_free (GnomeWPInfo * info) {
|
|
if (info == NULL) {
|
|
return;
|
|
}
|
|
|
|
g_free (info->uri);
|
|
g_free (info->thumburi);
|
|
g_free (info->name);
|
|
g_free (info->mime_type);
|
|
|
|
info = NULL;
|
|
}
|
|
|