move function here from common/

2007-10-27  Jens Granseuer  <jensgr@gmx.net>

	* theme-util.c: (theme_is_writable):
	* theme-util.h: move function here from common/

	* appearance-style.c: (gtk_theme_changed), (window_theme_changed),
	(icon_theme_changed), (cursor_theme_changed):
	* appearance-themes.c: (theme_selection_changed_cb): adapt callers

2007-10-27  Jens Granseuer  <jensgr@gmx.net>

	* gnome-theme-info.c (gnome_theme_is_writable):
	* gnome-theme-info.h: move this function to the appearance capplet

svn path=/trunk/; revision=8211
This commit is contained in:
Jens Granseuer 2007-10-27 11:29:11 +00:00 committed by Jens Granseuer
parent 21b740a43f
commit 2ba498e0c2
8 changed files with 67 additions and 52 deletions

View file

@ -25,6 +25,52 @@
#include <glib/gi18n.h>
#include <string.h>
gboolean
theme_is_writable (const gpointer theme, ThemeType type)
{
GnomeVFSResult vfs_result;
GnomeVFSFileInfo *vfs_info;
const gchar *theme_path;
gboolean writable;
if (theme == NULL)
return FALSE;
switch (type) {
case THEME_TYPE_GTK:
case THEME_TYPE_WINDOW:
theme_path = ((const GnomeThemeInfo *) theme)->path;
break;
case THEME_TYPE_ICON:
theme_path = ((const GnomeThemeIconInfo *) theme)->path;
break;
case THEME_TYPE_CURSOR:
theme_path = ((const GnomeThemeCursorInfo *) theme)->path;
break;
case THEME_TYPE_META:
theme_path = ((const GnomeThemeMetaInfo *) theme)->path;
break;
default:
g_assert_not_reached ();
break;
}
if (theme_path == NULL)
return FALSE;
vfs_info = gnome_vfs_file_info_new ();
vfs_result = gnome_vfs_get_file_info (theme_path,
vfs_info,
GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS);
writable = ((vfs_result == GNOME_VFS_OK) &&
(vfs_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ACCESS) &&
(vfs_info->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE));
gnome_vfs_file_info_unref (vfs_info);
return writable;
}
gboolean
theme_delete (const gchar *name, ThemeType type)