Commit 192f597c authored by Gregory Merchan's avatar Gregory Merchan
Browse files

Modified Files: ChangeLog components/music/nautilus-music-view.c


Modified Files:
	ChangeLog components/music/nautilus-music-view.c
	components/news/nautilus-news.c
	libnautilus-private/nautilus-customization-data.c
	libnautilus-private/nautilus-directory-async.c
	libnautilus-private/nautilus-file-utilities.c
	libnautilus-private/nautilus-file-utilities.h
	libnautilus-private/nautilus-find-icon-image.c
	libnautilus-private/nautilus-icon-factory.c
	libnautilus-private/nautilus-link-historical.c
	libnautilus-private/nautilus-theme.c
	src/nautilus-application.c src/nautilus-bookmark-list.c
	src/nautilus-first-time-druid.c
	src/nautilus-property-browser.c src/nautilus-window-menus.c
	src/file-manager/fm-desktop-icon-view.c
Removed nautilus_make_path and calls to it. Fixes bug #42424
parent eae9b63d
2002-07-08 Gregory Merchan <merchan@phys.lsu.edu>
* components/music/nautilus-music-view.c
* components/news/nautilus-news.c
* libnautilus-private/nautilus-customization-data.c
* libnautilus-private/nautilus-directory-async.c
* libnautilus-private/nautilus-file-utilities.c
* libnautilus-private/nautilus-file-utilities.h
* libnautilus-private/nautilus-find-icon-image.c
* libnautilus-private/nautilus-icon-factory.c
* libnautilus-private/nautilus-link-historical.c
* libnautilus-private/nautilus-theme.c
* src/nautilus-application.c
* src/nautilus-bookmark-list.c
* src/nautilus-first-time-druid.c
* src/nautilus-property-browser.c
* src/nautilus-window-menus.c
* src/file-manager/fm-desktop-icon-view.c
Replace nautilus_make_path (dir, file) with
g_build_filename (dir, path, NULL).
Remove nautilus_make_path ().
Fixes bug #42424.
2002-07-08 Michael Meeks <michael@ximian.com>
* src/nautilus-property-browser.c
......
......@@ -1727,7 +1727,7 @@ nautilus_music_view_update (NautilusMusicView *music_view)
}
escaped_name = gnome_vfs_escape_string (current_file_info->name);
path_uri = nautilus_make_path (uri, escaped_name);
path_uri = g_build_filename (uri, escaped_name, NULL);
g_free (escaped_name);
/* fetch info and queue it if it's an mp3 file */
......
......@@ -1433,8 +1433,9 @@ get_xml_path (const char *file_name, gboolean force_local)
user_directory = nautilus_get_user_directory ();
/* first try the user's home directory */
xml_path = nautilus_make_path (user_directory,
file_name);
xml_path = g_build_filename (user_directory,
file_name,
NULL);
g_free (user_directory);
if (force_local || g_file_test (xml_path, G_FILE_TEST_EXISTS)) {
return xml_path;
......@@ -1442,8 +1443,9 @@ get_xml_path (const char *file_name, gboolean force_local)
g_free (xml_path);
/* next try the shared directory */
xml_path = nautilus_make_path (NAUTILUS_DATADIR,
file_name);
xml_path = g_build_filename (NAUTILUS_DATADIR,
file_name,
NULL);
if (g_file_test (xml_path, G_FILE_TEST_EXISTS)) {
return xml_path;
}
......
......@@ -295,8 +295,9 @@ get_global_customization_uri (const char *customization_name)
{
char *directory_path, *directory_uri;
directory_path = nautilus_make_path (NAUTILUS_DATADIR,
customization_name);
directory_path = g_build_filename (NAUTILUS_DATADIR,
customization_name,
NULL);
directory_uri = gnome_vfs_get_uri_from_local_path (directory_path);
g_free (directory_path);
......@@ -320,8 +321,9 @@ get_private_customization_uri (const char *customization_name)
char *directory_path, *directory_uri;
user_directory = nautilus_get_user_directory ();
directory_path = nautilus_make_path (user_directory,
customization_name);
directory_path = g_build_filename (user_directory,
customization_name,
NULL);
g_free (user_directory);
directory_uri = gnome_vfs_get_uri_from_local_path (directory_path);
g_free (directory_path);
......@@ -342,7 +344,7 @@ get_file_path_for_mode (const NautilusCustomizationData *data,
directory_uri = get_private_customization_uri (data->customization_name);
}
uri = nautilus_make_path (directory_uri, file_name);
uri = g_build_filename (directory_uri, file_name, NULL);
g_free (directory_uri);
directory_name = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
......@@ -468,7 +470,7 @@ load_name_map_hash_table (NautilusCustomizationData *data)
data->name_map_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
/* build the path name to the browser.xml file and load it */
xml_path = nautilus_make_path (NAUTILUS_DATADIR, "browser.xml");
xml_path = g_build_filename (NAUTILUS_DATADIR, "browser.xml", NULL);
if (xml_path) {
browser_data = xmlParseFile (xml_path);
g_free (xml_path);
......
......@@ -2195,7 +2195,7 @@ deep_count_one (NautilusDirectory *directory,
/* Record the fact that we have to descend into this directory. */
escaped_name = gnome_vfs_escape_string (info->name);
uri = nautilus_make_path (directory->details->deep_count_uri, escaped_name);
uri = g_build_filename (directory->details->deep_count_uri, escaped_name, NULL);
g_free (escaped_name);
directory->details->deep_count_subdirectories = g_list_prepend
(directory->details->deep_count_subdirectories, uri);
......
......@@ -59,35 +59,6 @@ nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
return eel_str_has_suffix (name_or_relative_uri, "~");
}
/**
* nautilus_make_path:
*
* Make a path name from a base path and name. The base path
* can end with or without a separator character.
*
* Return value: the combined path name.
**/
char *
nautilus_make_path (const char *path, const char* name)
{
gboolean insert_separator;
int path_length;
char *result;
path_length = strlen (path);
insert_separator = path_length > 0 &&
name[0] != '\0' &&
path[path_length - 1] != G_DIR_SEPARATOR;
if (insert_separator) {
result = g_strconcat (path, G_DIR_SEPARATOR_S, name, NULL);
} else {
result = g_strconcat (path, name, NULL);
}
return result;
}
/**
* nautilus_get_user_directory:
*
......@@ -100,8 +71,9 @@ nautilus_get_user_directory (void)
{
char *user_directory = NULL;
user_directory = nautilus_make_path (g_get_home_dir (),
NAUTILUS_USER_DIRECTORY_NAME);
user_directory = g_build_filename (g_get_home_dir (),
NAUTILUS_USER_DIRECTORY_NAME,
NULL);
if (!g_file_test (user_directory, G_FILE_TEST_EXISTS)) {
mkdir (user_directory, DEFAULT_NAUTILUS_DIRECTORY_MODE);
......@@ -158,7 +130,7 @@ nautilus_get_desktop_directory (void)
char *
nautilus_get_gmc_desktop_directory (void)
{
return nautilus_make_path (g_get_home_dir (), DESKTOP_DIRECTORY_NAME);
return g_build_filename (g_get_home_dir (), DESKTOP_DIRECTORY_NAME, NULL);
}
/**
......@@ -183,7 +155,7 @@ nautilus_pixmap_file (const char *partial_path)
{
char *path;
path = nautilus_make_path (DATADIR "/pixmaps/nautilus", partial_path);
path = g_build_filename (DATADIR "/pixmaps/nautilus", partial_path, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
return path;
}
......@@ -199,7 +171,7 @@ nautilus_get_data_file_path (const char *partial_path)
/* first try the user's home directory */
user_directory = nautilus_get_user_directory ();
path = nautilus_make_path (user_directory, partial_path);
path = g_build_filename (user_directory, partial_path, NULL);
g_free (user_directory);
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
return path;
......@@ -207,7 +179,7 @@ nautilus_get_data_file_path (const char *partial_path)
g_free (path);
/* next try the shared directory */
path = nautilus_make_path (NAUTILUS_DATADIR, partial_path);
path = g_build_filename (NAUTILUS_DATADIR, partial_path, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
return path;
}
......
......@@ -31,12 +31,6 @@
gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
/* FIXME bugzilla.gnome.org 42424:
* This is the same as gnome-libs g_concat_dir_and_file except
* for handling path == NULL.
*/
char * nautilus_make_path (const char *path,
const char *name);
/* These functions all return something something that needs to be
* freed with g_free, is not NULL, and is guaranteed to exist.
*/
......
......@@ -63,8 +63,8 @@ make_full_icon_path (const char *path,
/* Build a path for this icon, depending on the theme_is_in_user_directory boolean. */
if (theme_is_in_user_directory) {
user_directory = nautilus_get_user_directory ();
themes_directory = nautilus_make_path (user_directory, "themes");
full_path = nautilus_make_path (themes_directory, partial_path);
themes_directory = g_build_filename (user_directory, "themes", NULL);
full_path = g_build_filename (themes_directory, partial_path, NULL);
g_free (user_directory);
g_free (themes_directory);
......@@ -73,7 +73,7 @@ make_full_icon_path (const char *path,
full_path = NULL;
}
} else if (document_type_icon) {
full_path = nautilus_make_path (DATADIR "/pixmaps/document-icons/", partial_path);
full_path = g_build_filename (DATADIR "/pixmaps/document-icons/", partial_path, NULL);
if (!g_file_test (full_path, G_FILE_TEST_EXISTS)) {
g_free (full_path);
full_path = NULL;
......
......@@ -751,8 +751,8 @@ is_theme_in_user_directory (const char *theme_name)
}
user_directory = nautilus_get_user_directory ();
themes_directory = nautilus_make_path (user_directory, "themes");
this_theme_directory = nautilus_make_path (themes_directory, theme_name);
themes_directory = g_build_filename (user_directory, "themes", NULL);
this_theme_directory = g_build_filename (themes_directory, theme_name, NULL);
result = g_file_test (this_theme_directory, G_FILE_TEST_EXISTS);
......
......@@ -137,7 +137,7 @@ nautilus_link_historical_local_create (const char *directory_uri,
return FALSE;
}
path = nautilus_make_path (directory_path, name);
path = g_build_filename (directory_path, name, NULL);
g_free (directory_path);
result = xmlSaveFile (path, output_document);
......
......@@ -109,7 +109,7 @@ load_theme_document (const char *theme_name)
if (theme_path == NULL) {
user_themes_directory = nautilus_theme_get_user_themes_directory ();
temp_str = g_strdup_printf("%s/%s.xml", theme_name, theme_name);
theme_path = nautilus_make_path (user_themes_directory, temp_str);
theme_path = g_build_filename (user_themes_directory, temp_str, NULL);
g_free (user_themes_directory);
g_free (temp_str);
......@@ -209,7 +209,7 @@ nautilus_pixmap_file_may_be_local (const char *themed_image)
if (image_path == NULL) {
user_themes_directory = nautilus_theme_get_user_themes_directory ();
image_path = nautilus_make_path (user_themes_directory, themed_image);
image_path = g_build_filename (user_themes_directory, themed_image, NULL);
if (!g_file_test (image_path, G_FILE_TEST_EXISTS)) {
g_free (image_path);
image_path = NULL;
......@@ -306,7 +306,7 @@ nautilus_theme_make_preview_pixbuf (const char *theme_name)
} else {
/* try the user directory */
user_themes_directory = nautilus_theme_get_user_themes_directory ();
pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name);
pixbuf_file = g_build_filename (user_themes_directory, theme_preview_name, NULL);
g_free (user_themes_directory);
if (g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) {
......@@ -335,13 +335,13 @@ nautilus_theme_make_preview_pixbuf (const char *theme_name)
if (pixbuf_file == NULL) {
user_themes_directory = nautilus_theme_get_user_themes_directory ();
theme_preview_name = g_strdup_printf ("%s/i-directory.png", theme_name);
pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name);
pixbuf_file = g_build_filename (user_themes_directory, theme_preview_name, NULL);
g_free (theme_preview_name);
if (!g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) {
g_free (pixbuf_file);
theme_preview_name = g_strdup_printf ("%s/i-directory.svg", theme_name);
pixbuf_file = nautilus_make_path (user_themes_directory, theme_preview_name);
pixbuf_file = g_build_filename (user_themes_directory, theme_preview_name, NULL);
g_free (theme_preview_name);
if (!g_file_test (pixbuf_file, G_FILE_TEST_EXISTS)) {
......@@ -518,7 +518,7 @@ theme_list_prepend (GList *theme_list,
attributes = g_new0 (ThemeAttibutes, 1);
attributes->name = g_strdup (theme_name);
attributes->path = nautilus_make_path (themes_location_uri, theme_name);
attributes->path = g_build_filename (themes_location_uri, theme_name, NULL);
unscaled_preview_pixbuf = nautilus_theme_make_preview_pixbuf (theme_name);
attributes->preview_pixbuf = eel_gdk_pixbuf_scale_down_to_fit (unscaled_preview_pixbuf,
......@@ -682,7 +682,7 @@ nautilus_theme_get_user_themes_directory (void)
char *user_themes_directory;
user_directory = nautilus_get_user_directory ();
user_themes_directory = nautilus_make_path (user_directory, "themes");
user_themes_directory = g_build_filename (user_directory, "themes", NULL);
g_free (user_directory);
return user_themes_directory;
......@@ -700,7 +700,7 @@ nautilus_theme_remove_user_theme (const char *theme_to_remove_name)
g_return_val_if_fail (theme_to_remove_name != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
user_themes_directory = nautilus_theme_get_user_themes_directory ();
theme_to_remove_path = nautilus_make_path (user_themes_directory, theme_to_remove_name);
theme_to_remove_path = g_build_filename (user_themes_directory, theme_to_remove_name, NULL);
g_free (user_themes_directory);
uri_list = g_list_prepend (NULL, gnome_vfs_uri_new (theme_to_remove_path));
......@@ -809,7 +809,7 @@ nautilus_theme_install_user_theme (const char *theme_to_install_path)
theme_name = eel_uri_get_basename (theme_to_install_path);
g_return_val_if_fail (theme_name != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
theme_destination_path = nautilus_make_path (user_themes_directory, theme_name);
theme_destination_path = g_build_filename (user_themes_directory, theme_name, NULL);
theme_xml_path = g_strdup_printf ("%s/%s.xml",
theme_to_install_path,
theme_name);
......
......@@ -1032,7 +1032,7 @@ fm_desktop_icon_view_trash_state_changed_callback (NautilusTrashMonitor *trash_m
{
char *path;
path = nautilus_make_path (desktop_directory, TRASH_LINK_NAME);
path = g_build_filename (desktop_directory, TRASH_LINK_NAME, NULL);
nautilus_link_local_set_icon (path, state ? "trash-empty" : "trash-full");
......@@ -1080,7 +1080,7 @@ volume_unmounted_callback (NautilusVolumeMonitor *monitor,
return;
}
link_path = nautilus_make_path (desktop_directory, volume_name);
link_path = g_build_filename (desktop_directory, volume_name, NULL);
unlink_and_notify (link_path);
g_free (volume_name);
......@@ -1115,7 +1115,7 @@ update_link_and_delete_copies (gboolean (*is_link_function) (const char *path),
found_link = FALSE;
while ((dir_entry = readdir (dir)) != NULL) {
link_path = nautilus_make_path (desktop_directory, dir_entry->d_name);
link_path = g_build_filename (desktop_directory, dir_entry->d_name, NULL);
if ((* is_link_function) (link_path)) {
if (!found_link &&
(link_name == NULL || strcmp (dir_entry->d_name, link_name) == 0)) {
......
......@@ -338,8 +338,9 @@ create_starthere_link_callback (gpointer data)
/* Create default services icon on the desktop */
desktop_path = nautilus_get_desktop_directory ();
desktop_link_file = nautilus_make_path (desktop_path,
"starthere.desktop");
desktop_link_file = g_build_filename (desktop_path,
"starthere.desktop",
NULL);
cmd = g_strconcat ("/bin/cp ",
NAUTILUS_DATADIR,
......
......@@ -327,7 +327,7 @@ nautilus_bookmark_list_get_file_path (NautilusBookmarkList *bookmarks)
if (file_path == NULL) {
user_directory = nautilus_get_user_directory ();
file_path = nautilus_make_path (user_directory, "bookmarks.xml");
file_path = g_build_filename (user_directory, "bookmarks.xml", NULL);
g_free (user_directory);
}
......
......@@ -42,7 +42,7 @@ nautilus_set_first_time_file_flag (void)
"You can manually erase this file to present the druid again.\n");
user_directory = nautilus_get_user_directory ();
druid_flag_file_name = nautilus_make_path (user_directory, "first-time-flag");
druid_flag_file_name = g_build_filename (user_directory, "first-time-flag", NULL);
g_free (user_directory);
stream = fopen (druid_flag_file_name, "w");
......
......@@ -843,7 +843,7 @@ get_static_bookmarks_file_path (void)
g_free (user_directory_path);
/* get the mod date of the built-in static bookmarks file */
built_in_xml_file_path = nautilus_make_path (NAUTILUS_DATADIR, STATIC_BOOKMARKS_FILE_NAME);
built_in_xml_file_path = g_build_filename (NAUTILUS_DATADIR, STATIC_BOOKMARKS_FILE_NAME, NULL);
built_in_exists = g_file_test (built_in_xml_file_path, G_FILE_TEST_EXISTS);
/* if we only have one file, return its path as the one to use */
......
......@@ -828,7 +828,7 @@ write_browser_xml (NautilusPropertyBrowser *property_browser,
char *user_directory, *path;
user_directory = nautilus_get_user_directory ();
path = nautilus_make_path (user_directory, property_browser->details->path);
path = g_build_filename (user_directory, property_browser->details->path, NULL);
g_free (user_directory);
xmlSaveFile (path, document);
g_free (path);
......@@ -1125,10 +1125,10 @@ add_pattern_to_browser (const char *path_name, gpointer *data)
user_directory = nautilus_get_user_directory ();
/* copy the image file to the patterns directory */
directory_path = nautilus_make_path (user_directory, "patterns");
directory_path = g_build_filename (user_directory, "patterns", NULL);
g_free (user_directory);
source_file_name = strrchr (path_name, '/');
destination_name = nautilus_make_path (directory_path, source_file_name + 1);
destination_name = g_build_filename (directory_path, source_file_name + 1, NULL);
/* make the directory if it doesn't exist */
if (!g_file_test(directory_path, G_FILE_TEST_EXISTS)) {
......@@ -1392,8 +1392,9 @@ emblem_dialog_clicked (GtkWidget *dialog, int which_button, NautilusPropertyBrow
user_directory = nautilus_get_user_directory ();
/* get the path for emblems in the user's home directory */
directory_path = nautilus_make_path (user_directory,
"emblems");
directory_path = g_build_filename (user_directory,
"emblems",
NULL);
g_free (user_directory);
/* make the directory if it doesn't exist */
......
......@@ -843,7 +843,7 @@ get_static_bookmarks_file_path (void)
g_free (user_directory_path);
/* get the mod date of the built-in static bookmarks file */
built_in_xml_file_path = nautilus_make_path (NAUTILUS_DATADIR, STATIC_BOOKMARKS_FILE_NAME);
built_in_xml_file_path = g_build_filename (NAUTILUS_DATADIR, STATIC_BOOKMARKS_FILE_NAME, NULL);
built_in_exists = g_file_test (built_in_xml_file_path, G_FILE_TEST_EXISTS);
/* if we only have one file, return its path as the one to use */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment