From 90d606a4962ebd87ffabf0e3eb64781cd34cf1a1 Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Sat, 24 May 2008 17:19:26 +0000 Subject: [PATCH] return to using paths instead of URIs since most of the code using them 2008-05-24 Jens Granseuer * gnome-theme-info.c: (gnome_theme_read_meta_theme), (read_icon_theme), (read_cursor_theme), (read_cursor_fonts), (update_theme_index): return to using paths instead of URIs since most of the code using them expects paths 2008-05-24 Jens Granseuer * theme-util.c: (theme_is_writable), (theme_delete): expect a path instead of an URI in theme_info->path svn path=/trunk/; revision=8724 --- capplets/appearance/ChangeLog | 5 +++++ capplets/appearance/theme-util.c | 4 ++-- capplets/common/ChangeLog | 7 +++++++ capplets/common/gnome-theme-info.c | 27 ++++++++++++--------------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/capplets/appearance/ChangeLog b/capplets/appearance/ChangeLog index 8022a3258..0c0422514 100644 --- a/capplets/appearance/ChangeLog +++ b/capplets/appearance/ChangeLog @@ -1,3 +1,8 @@ +2008-05-24 Jens Granseuer + + * theme-util.c: (theme_is_writable), (theme_delete): expect + a path instead of an URI in theme_info->path + 2008-05-24 Jens Granseuer * theme-util.c: (directory_delete_recursive): also delete the diff --git a/capplets/appearance/theme-util.c b/capplets/appearance/theme-util.c index dc88683ad..51372a784 100644 --- a/capplets/appearance/theme-util.c +++ b/capplets/appearance/theme-util.c @@ -100,7 +100,7 @@ theme_is_writable (const gpointer theme) if (info == NULL || info->path == NULL) return FALSE; - file = g_file_new_for_uri (info->path); + file = g_file_new_for_path (info->path); file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, G_FILE_QUERY_INFO_NONE, @@ -168,7 +168,7 @@ theme_delete (const gchar *name, ThemeType type) return FALSE; } - dir = g_file_new_for_uri (theme_dir); + dir = g_file_new_for_path (theme_dir); g_free (theme_dir); if (!file_delete_recursive (dir, NULL)) { diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index 4b6ed325e..4e7e51cf1 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,10 @@ +2008-05-24 Jens Granseuer + + * gnome-theme-info.c: (gnome_theme_read_meta_theme), + (read_icon_theme), (read_cursor_theme), (read_cursor_fonts), + (update_theme_index): return to using paths instead of URIs since + most of the code using them expects paths + 2008-05-18 Thomas Wood * gconf-property-editor.c: (gconf_property_editor_class_init), diff --git a/capplets/common/gnome-theme-info.c b/capplets/common/gnome-theme-info.c index b9edbcdf1..98941ad4f 100644 --- a/capplets/common/gnome-theme-info.c +++ b/capplets/common/gnome-theme-info.c @@ -269,14 +269,14 @@ gnome_theme_read_meta_theme (GFile *meta_theme_uri) meta_theme_file = g_file_get_uri (meta_theme_uri); meta_theme_ditem = gnome_desktop_item_new_from_uri (meta_theme_file, 0, NULL); - if (meta_theme_ditem == NULL) { - g_free (meta_theme_file); + g_free (meta_theme_file); + + if (meta_theme_ditem == NULL) return NULL; - } common_theme_dir_uri = g_file_get_parent (meta_theme_uri); meta_theme_info = gnome_theme_meta_info_new (); - meta_theme_info->path = meta_theme_file; + meta_theme_info->path = g_file_get_path (meta_theme_uri); meta_theme_info->name = g_file_get_basename (common_theme_dir_uri); g_object_unref (common_theme_dir_uri); @@ -390,15 +390,14 @@ read_icon_theme (GFile *icon_theme_uri) icon_theme_file = g_file_get_uri (icon_theme_uri); icon_theme_ditem = gnome_desktop_item_new_from_uri (icon_theme_file, 0, NULL); - if (icon_theme_ditem == NULL) { - g_free (icon_theme_file); + g_free (icon_theme_file); + + if (icon_theme_ditem == NULL) return NULL; - } name = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Name"); if (name == NULL) { gnome_desktop_item_unref (icon_theme_ditem); - g_free (icon_theme_file); return NULL; } @@ -406,7 +405,6 @@ read_icon_theme (GFile *icon_theme_uri) directories = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Directories"); if (directories == NULL) { gnome_desktop_item_unref (icon_theme_ditem); - g_free (icon_theme_file); return NULL; } @@ -416,13 +414,12 @@ read_icon_theme (GFile *icon_theme_uri) gchar *dir_name; icon_theme_info = gnome_theme_icon_info_new (); icon_theme_info->readable_name = g_strdup (name); - icon_theme_info->path = icon_theme_file; - dir_name = g_path_get_dirname (icon_theme_file); + icon_theme_info->path = g_file_get_path (icon_theme_uri); + dir_name = g_path_get_dirname (icon_theme_info->path); icon_theme_info->name = g_path_get_basename (dir_name); g_free (dir_name); } else { icon_theme_info = NULL; - g_free (icon_theme_file); } gnome_desktop_item_unref (icon_theme_ditem); @@ -538,7 +535,7 @@ read_cursor_theme (GFile *cursor_theme_uri) } cursor_theme_info = gnome_theme_cursor_info_new (); - cursor_theme_info->path = g_file_get_uri (parent_uri); + cursor_theme_info->path = g_file_get_path (parent_uri); cursor_theme_info->name = name; cursor_theme_info->sizes = sizes; cursor_theme_info->thumbnail = thumbnail; @@ -664,7 +661,7 @@ read_cursor_fonts (void) theme_info->thumbnail = gdk_pixbuf_new_from_file (filename, NULL); g_free (filename); - theme_info->path = g_build_filename ("file://" GNOMECC_DATA_DIR, builtins[i][0], NULL); + theme_info->path = g_build_filename (GNOMECC_DATA_DIR, builtins[i][0], NULL); theme_info->name = g_strdup (theme_info->path); if (!strcmp (theme_info->path, cursor_font)) @@ -759,7 +756,7 @@ update_theme_index (GFile *index_uri, /* Next, we see what currently exists */ parent = g_file_get_parent (index_uri); common_theme_dir_uri = g_file_get_parent (parent); - common_theme_dir = g_file_get_uri (common_theme_dir_uri); + common_theme_dir = g_file_get_path (common_theme_dir_uri); theme_info = g_hash_table_lookup (theme_hash_by_uri, common_theme_dir); if (theme_info == NULL) {