Commit a0095deb authored by Darin Adler's avatar Darin Adler

Small updates.

	* RENAMING: Small updates.

	* components/help/converters/gnome-info2html2/main.c: (main):
	* components/html/glibwww-init.c: (glibwww_parse_proxy_env):
	* components/html/ntl-web-browser.c: (main):
	* components/loser/content/nautilus-content-loser.c:
	(ensure_fail_env):
	* components/loser/sidebar/nautilus-sidebar-loser.c:
	(ensure_fail_env):
	* components/notes/nautilus-notes.c: (main):
	* libnautilus-extensions/nautilus-view-identifier.c:
	(get_lang_list):
	* src/nautilus-application.c: (nautilus_app_startup):
	* src/nautilus-main.c: (main):
	Changed from getenv to g_getenv, even though it makes no
	difference right now, because it's "the right thing to do (tm)".

	* components/services/time/nautilus-view/trilobite-eazel-time-view.h:
	Fixed include (the build was broken for me or anyone who doesn't
	have old .h files sitting around in their install directory).

	* libnautilus-extensions/nautilus-directory.c:
	(construct_alternate_metafile_uri):
	Use nautilus_get_user_directory instead of hard-coding the name
	of the user directory.

	* libnautilus-extensions/nautilus-file-utilities.h:
	* libnautilus-extensions/nautilus-file-utilities.c:
	(nautilus_get_user_directory), (nautilus_get_user_main_directory):
	Use #defines instead of global constants since these are things
	that do not change and this is not C++ :-) Added "get_" to the
	names of these functions so they would be verbs instead of nouns.
	(nautilus_get_desktop_directory): Added this new function for use
	by the desktop code.

	* libnautilus-extensions/nautilus-global-preferences.c:
	(global_preferences_create_dialog),
	(nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers),
	(nautilus_global_preferences_get_disabled_sidebar_panel_view_identifiers),
	(global_preferences_register_sidebar_panels_preferences_for_ui):
	* libnautilus-extensions/nautilus-view-identifier.h:
	* libnautilus-extensions/nautilus-view-identifier.c:
	(nautilus_view_identifier_list_free):
	* src/nautilus-applicable-views.c: (nautilus_navigation_info_free):
	Changed nautilus_view_identifier_free_list to *_list_free to match
	other calls with similar names.

	* libnautilus-extensions/nautilus-global-preferences.c:
	(user_level_changed_callback):
	* libnautilus-extensions/nautilus-icon-factory.c:
	(get_themed_icon_file_path):
	* src/file-manager/fm-properties-window.c: (get_property_names):
	* src/nautilus-bookmark-list.c:
	(nautilus_bookmark_list_get_file_path):
	* src/nautilus-property-browser.c:
	(nautilus_property_browser_drag_data_get), (make_drag_image),
	(remove_color), (remove_background), (remove_emblem),
	(get_xml_path), (add_background_to_browser), (add_color_to_file),
	(emblem_dialog_clicked), (make_properties_from_directory):
	Change to use directory calls by new "get_" names.

	* src/Makefile.am: Removed nautilus.h since it is long gone,
	and fixed spelling of nautlus-window-state.h.

	* src/file-manager/.cvsignore: Stop ignoring things that we
	no longer generated.

	* src/file-manager/desktop-item.c: [removed]
	* src/file-manager/desktop-item.h: [removed]
	* src/file-manager/desktop-layout.c: [removed]
	* src/file-manager/desktop-layout.h: [removed]
	* src/file-manager/desktop-window.c: [removed]
	* src/file-manager/desktop-window.h: [removed]
	The rest of the code has been harvested from the desktop
	implementation. As I said before we can always recover it if we
	decide we want to reuse it.

	* src/file-manager/fm-main.c: [removed]
	This was no longer used and was getting out of date. The file manager
	is now compiled in rather than being a separate process.

	* src/nautilus-desktop-window.c:
	(nautilus_desktop_window_initialize_class),
	(nautilus_desktop_window_initialize),
	(nautilus_desktop_window_new), (realize):
	Another cut at the desktop code. Still not working too well,
	but way further along.

	* src/nautilus-sidebar.h:
	* src/nautilus-sidebar.c:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_handle_client_destroy_2):
	* src/nautilus-window-manage-views.c:
	* src/nautilus-window.h:
	* src/nautilus-window.c:
	* src/nautilus-window-private.h:
	Changed the names to use Sidebar instead of IndexPanel.
	Also changed to say sidebar panel instead of meta view in many
	places.
parent 21faf543
2000-05-31 Darin Adler <darin@eazel.com>
* RENAMING: Small updates.
* components/help/converters/gnome-info2html2/main.c: (main):
* components/html/glibwww-init.c: (glibwww_parse_proxy_env):
* components/html/ntl-web-browser.c: (main):
* components/loser/content/nautilus-content-loser.c:
(ensure_fail_env):
* components/loser/sidebar/nautilus-sidebar-loser.c:
(ensure_fail_env):
* components/notes/nautilus-notes.c: (main):
* libnautilus-extensions/nautilus-view-identifier.c:
(get_lang_list):
* src/nautilus-application.c: (nautilus_app_startup):
* src/nautilus-main.c: (main):
Changed from getenv to g_getenv, even though it makes no
difference right now, because it's "the right thing to do (tm)".
* components/services/time/nautilus-view/trilobite-eazel-time-view.h:
Fixed include (the build was broken for me or anyone who doesn't
have old .h files sitting around in their install directory).
* libnautilus-extensions/nautilus-directory.c:
(construct_alternate_metafile_uri):
Use nautilus_get_user_directory instead of hard-coding the name
of the user directory.
* libnautilus-extensions/nautilus-file-utilities.h:
* libnautilus-extensions/nautilus-file-utilities.c:
(nautilus_get_user_directory), (nautilus_get_user_main_directory):
Use #defines instead of global constants since these are things
that do not change and this is not C++ :-) Added "get_" to the
names of these functions so they would be verbs instead of nouns.
(nautilus_get_desktop_directory): Added this new function for use
by the desktop code.
* libnautilus-extensions/nautilus-global-preferences.c:
(global_preferences_create_dialog),
(nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers),
(nautilus_global_preferences_get_disabled_sidebar_panel_view_identifiers),
(global_preferences_register_sidebar_panels_preferences_for_ui):
* libnautilus-extensions/nautilus-view-identifier.h:
* libnautilus-extensions/nautilus-view-identifier.c:
(nautilus_view_identifier_list_free):
* src/nautilus-applicable-views.c: (nautilus_navigation_info_free):
Changed nautilus_view_identifier_free_list to *_list_free to match
other calls with similar names.
* libnautilus-extensions/nautilus-global-preferences.c:
(user_level_changed_callback):
* libnautilus-extensions/nautilus-icon-factory.c:
(get_themed_icon_file_path):
* src/file-manager/fm-properties-window.c: (get_property_names):
* src/nautilus-bookmark-list.c:
(nautilus_bookmark_list_get_file_path):
* src/nautilus-property-browser.c:
(nautilus_property_browser_drag_data_get), (make_drag_image),
(remove_color), (remove_background), (remove_emblem),
(get_xml_path), (add_background_to_browser), (add_color_to_file),
(emblem_dialog_clicked), (make_properties_from_directory):
Change to use directory calls by new "get_" names.
* src/Makefile.am: Removed nautilus.h since it is long gone,
and fixed spelling of nautlus-window-state.h.
* src/file-manager/.cvsignore: Stop ignoring things that we
no longer generated.
* src/file-manager/desktop-item.c: [removed]
* src/file-manager/desktop-item.h: [removed]
* src/file-manager/desktop-layout.c: [removed]
* src/file-manager/desktop-layout.h: [removed]
* src/file-manager/desktop-window.c: [removed]
* src/file-manager/desktop-window.h: [removed]
The rest of the code has been harvested from the desktop
implementation. As I said before we can always recover it if we
decide we want to reuse it.
* src/file-manager/fm-main.c: [removed]
This was no longer used and was getting out of date. The file manager
is now compiled in rather than being a separate process.
* src/nautilus-desktop-window.c:
(nautilus_desktop_window_initialize_class),
(nautilus_desktop_window_initialize),
(nautilus_desktop_window_new), (realize):
Another cut at the desktop code. Still not working too well,
but way further along.
* src/nautilus-sidebar.h:
* src/nautilus-sidebar.c:
* src/nautilus-view-frame.c:
(nautilus_view_frame_handle_client_destroy_2):
* src/nautilus-window-manage-views.c:
* src/nautilus-window.h:
* src/nautilus-window.c:
* src/nautilus-window-private.h:
Changed the names to use Sidebar instead of IndexPanel.
Also changed to say sidebar panel instead of meta view in many
places.
2000-05-31 Ramiro Estrugo <ramiro@eazel.com>
* nautilus-widgets/nautilus-user-level-manager.c:
......@@ -384,7 +486,7 @@ Tue May 30 11:21:31 2000 Raph Levien <raph@acm.org>
(nautilus_user_level_manager_get_num_user_levels),
(nautilus_user_level_manager_get_user_level_names):
* nautilus-widgets/nautilus-user-level-manager.h:
New class to manager user level stuff.
New class to manage user level stuff.
* libnautilus-extensions/nautilus-global-preferences.c:
(nautilus_global_preferences_startup):
......@@ -636,7 +738,7 @@ Tue May 30 11:21:31 2000 Raph Levien <raph@acm.org>
2000-05-29 Ramiro Estrugo <ramiro@eazel.com>
* nautilus-clean.sh:
Update for latest ntl-* -> nautilus-* renaming. Keeo the old ntl-
Update for latest ntl-* -> nautilus-* renaming. Keep the old ntl-
names as well to prevent stale component braindamage.
2000-05-29 Ramiro Estrugo <ramiro@eazel.com>
......@@ -644,7 +746,6 @@ Tue May 30 11:21:31 2000 Raph Levien <raph@acm.org>
* components/history/.cvsignore:
* components/notes/.cvsignore:
* components/services/time/command-line/.cvsignore:
Ignore generated files.
2000-05-29 Ramiro Estrugo <ramiro@eazel.com>
......@@ -673,11 +774,9 @@ Tue May 30 11:21:31 2000 Raph Levien <raph@acm.org>
2000-05-28 Ramiro Estrugo <ramiro@eazel.com>
* libnautilus-extensions/nautilus-global-preferences.h:
Remove unneeded inclusion of nautilus-string-list.h
* libnautilus-extensions/nautilus-global-preferences.c:
Fix a user visible typo in appearance/graphics.
Add a better description for the sidebar panels pane (bug 304)
......
......@@ -5,9 +5,8 @@ some functions and files too.
----------
file names
----------
components/html/ntl-web-browser.c -> ?
components/websearch/ntl-web-search.c -> nautilus-web-search.c
components/websearch/ntl-web-search.c -> components/websearch/nautilus-web-search.c?
----------------------------
classes and other data types
......@@ -24,6 +23,3 @@ NautilusApp -> NautilusApplication
--------------
function names
--------------
nautilus_index_panel_add_meta_view -> nautilus_sidebar_add_panel
nautilus_index_panel_remove_meta_view -> nautilus_sidebar_remove_panel
......@@ -69,7 +69,7 @@ main(int argc, char **argv)
for(n = 0; args[n]; n++) /* */;
if(n == 1 && !file_exists(args[0]))
{
char *ctmp, *infopath = getenv("INFOPATH");
char *ctmp, *infopath = g_getenv("INFOPATH");
char *dirs[64], *ext;
int ndirs;
char buf[PATH_MAX];
......
......@@ -220,19 +220,19 @@ glibwww_parse_proxy_env(void)
for (prot = protocollist; *prot != NULL; prot++) {
gchar *var = g_strconcat(*prot, "_proxy", NULL);
gchar *proxy = getenv(var);
gchar *proxy = g_getenv(var);
if (proxy && proxy[0])
glibwww_add_proxy(*prot, proxy);
else {
gchar *up = var;
while ((*up = TOUPPER(*up))) up++;
if ((proxy = getenv(var)) != NULL && proxy[0])
if ((proxy = g_getenv(var)) != NULL && proxy[0])
glibwww_add_proxy(*prot, proxy);
}
g_free(var);
}
nop = getenv("no_proxy");
nop = g_getenv("no_proxy");
if (nop && nop[0]) {
char *str = g_strdup(nop);
char *ptr = str;
......
......@@ -618,7 +618,7 @@ int main(int argc, char *argv[])
BonoboGenericFactory *factory;
CORBA_ORB orb;
if (getenv("NAUTILUS_DEBUG") != NULL)
if (g_getenv("NAUTILUS_DEBUG") != NULL)
nautilus_make_warnings_and_criticals_stop_in_debugger
(G_LOG_DOMAIN, g_log_domain_glib, "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo",
"Nautilus-HTML", "gtkhtml", NULL);
......
......@@ -339,12 +339,12 @@ static void
ensure_fail_env (void)
{
if (!env_checked) {
failure_mode = getenv ("NAUTILUS_CONTENT_LOSER_MODE");
failure_mode = g_getenv ("NAUTILUS_CONTENT_LOSER_MODE");
if (failure_mode == NULL) {
failure_mode = "";
}
failure_point = getenv ("NAUTILUS_CONTENT_LOSER_PLACE");
failure_point = g_getenv ("NAUTILUS_CONTENT_LOSER_PLACE");
if (failure_point == NULL) {
failure_point = "";
}
......
......@@ -347,12 +347,12 @@ static void
ensure_fail_env (void)
{
if (!env_checked) {
failure_mode = getenv ("NAUTILUS_SIDEBAR_LOSER_MODE");
failure_mode = g_getenv ("NAUTILUS_SIDEBAR_LOSER_MODE");
if (failure_mode == NULL) {
failure_mode = "";
}
failure_point = getenv ("NAUTILUS_SIDEBAR_LOSER_PLACE");
failure_point = g_getenv ("NAUTILUS_SIDEBAR_LOSER_PLACE");
if (failure_point == NULL) {
failure_point = "";
}
......
......@@ -189,7 +189,7 @@ main(int argc, char *argv[])
/* Make criticals and warnings stop in the debugger if NAUTILUS_DEBUG is set.
* Unfortunately, this has to be done explicitly for each domain.
*/
if (getenv("NAUTILUS_DEBUG") != NULL) {
if (g_getenv("NAUTILUS_DEBUG") != NULL) {
nautilus_make_warnings_and_criticals_stop_in_debugger
(G_LOG_DOMAIN, g_log_domain_glib, "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo", NULL);
}
......
......@@ -26,7 +26,7 @@
#ifndef TRILOBITE_EAZEL_TIME_VIEW_H
#define TRILOBITE_EAZEL_TIME_VIEW_H
#include <libnautilus/nautilus-view-frame.h>
#include <libnautilus/nautilus-view.h>
#include <gtk/gtkeventbox.h>
#define OAFIID_TRILOBITE_EAZEL_TIME_VIEW "OAFIID:trilobite_eazel_time_view:de32d812-af19-4359-9902-42318e0089b3"
......
......@@ -34,6 +34,7 @@
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-file-private.h"
#include "nautilus-directory-metafile.h"
#include "nautilus-file-utilities.h"
enum {
FILES_ADDED,
......@@ -48,7 +49,6 @@ static guint signals[LAST_SIGNAL];
#define METAFILE_NAME ".nautilus-metafile.xml"
/* Specifications for parallel-directory metafile. */
#define NAUTILUS_DIRECTORY_NAME ".nautilus"
#define METAFILES_DIRECTORY_NAME "metafiles"
#define METAFILE_SUFFIX ".xml"
#define METAFILES_DIRECTORY_PERMISSIONS \
......@@ -346,16 +346,16 @@ static GnomeVFSURI *
construct_alternate_metafile_uri (GnomeVFSURI *uri)
{
GnomeVFSResult result;
GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
GnomeVFSURI *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
char *uri_as_string, *escaped_uri, *file_name;
/* Ensure that the metafiles directory exists. */
home_uri = gnome_vfs_uri_new (g_get_home_dir ());
nautilus_directory_uri = gnome_vfs_uri_append_path (home_uri, NAUTILUS_DIRECTORY_NAME);
gnome_vfs_uri_unref (home_uri);
metafiles_directory_uri = gnome_vfs_uri_append_path (nautilus_directory_uri, METAFILES_DIRECTORY_NAME);
nautilus_directory_uri = gnome_vfs_uri_new (nautilus_get_user_directory ());
metafiles_directory_uri = gnome_vfs_uri_append_path (nautilus_directory_uri,
METAFILES_DIRECTORY_NAME);
gnome_vfs_uri_unref (nautilus_directory_uri);
result = nautilus_make_directory_and_parents (metafiles_directory_uri, METAFILES_DIRECTORY_PERMISSIONS);
result = nautilus_make_directory_and_parents (metafiles_directory_uri,
METAFILES_DIRECTORY_PERMISSIONS);
if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_FILEEXISTS) {
gnome_vfs_uri_unref (metafiles_directory_uri);
return NULL;
......
......@@ -33,9 +33,13 @@
#include "nautilus-file.h"
#include "nautilus-metadata.h"
const char* const nautilus_user_directory_name = ".nautilus";
const char* const nautilus_user_main_directory_name = "Nautilus";
const unsigned default_nautilus_directory_mode = 0755;
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"
#define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755)
#define DESKTOP_DIRECTORY_NAME "desktop"
#define DEFAULT_DESKTOP_DIRECTORY_MODE (0755)
#define NAUTILUS_USER_MAIN_DIRECTORY_NAME "Nautilus"
......@@ -78,24 +82,21 @@ nautilus_make_path(const char *path, const char* name)
* Return value: the directory path.
**/
const char *
nautilus_user_directory()
nautilus_get_user_directory (void)
{
static char *user_directory;
if (user_directory == NULL)
{
user_directory = nautilus_make_path (g_get_home_dir(),
nautilus_user_directory_name);
if (user_directory == NULL) {
user_directory = nautilus_make_path (g_get_home_dir (),
NAUTILUS_USER_DIRECTORY_NAME);
if (!g_file_exists (user_directory))
{
mkdir (user_directory, default_nautilus_directory_mode);
if (!g_file_exists (user_directory)) {
mkdir (user_directory, DEFAULT_NAUTILUS_DIRECTORY_MODE);
}
}
if (!g_file_test (user_directory, G_FILE_TEST_ISDIR))
{
if (!g_file_test (user_directory, G_FILE_TEST_ISDIR)) {
/* Bad news, directory still isn't there.
* FIXME bugzilla.eazel.com 647: Report this to user somehow.
*/
......@@ -105,6 +106,37 @@ nautilus_user_directory()
return user_directory;
}
/**
* nautilus_desktop_directory:
*
* Get the path for the directory containing files on the desktop.
*
* Return value: the directory path.
**/
const char *
nautilus_get_desktop_directory (void)
{
static char *desktop_directory;
if (desktop_directory == NULL) {
desktop_directory = nautilus_make_path (nautilus_get_user_directory (),
DESKTOP_DIRECTORY_NAME);
if (!g_file_exists (desktop_directory)) {
mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
}
}
if (!g_file_test (desktop_directory, G_FILE_TEST_ISDIR)) {
/* Bad news, directory still isn't there.
* FIXME bugzilla.eazel.com 647: Report this to user somehow.
*/
g_assert_not_reached();
}
return desktop_directory;
}
/**
* nautilus_user_main_directory:
*
......@@ -114,35 +146,29 @@ nautilus_user_directory()
* Return value: the directory path.
**/
const char *
nautilus_user_main_directory (void)
nautilus_get_user_main_directory (void)
{
static char *user_main_directory;
NautilusFile *file;
if (user_main_directory == NULL)
{
const char * user_directory;
user_directory = nautilus_user_directory ();
g_assert (user_directory != NULL);
user_main_directory = g_strdup_printf ("%s/%s",
g_get_home_dir(),
nautilus_user_main_directory_name);
NAUTILUS_USER_MAIN_DIRECTORY_NAME);
if (!g_file_exists (user_main_directory))
{
if (!g_file_exists (user_main_directory)) {
char *src;
char *command;
char *file_uri, *image_uri, *temp_str;
src = gnome_datadir_file ("nautilus/top");
/* FIXME: Is it OK to use cp like this? What about quoting the parameters? */
command = g_strdup_printf ("cp -R %s %s", src, user_main_directory);
if (system (command) != 0)
{
/* FIXME: Is a g_warning good enough here? This seems like a big problem. */
if (system (command) != 0) {
g_warning ("could not execute '%s'. Make sure you typed 'make install'",
command);
}
......@@ -164,7 +190,7 @@ nautilus_user_main_directory (void)
image_uri);
nautilus_file_unref (file);
}
g_free(file_uri);
g_free (file_uri);
/* now do the same for the about file */
file_uri = g_strdup_printf("file://%s/About.html", user_main_directory);
......@@ -177,8 +203,8 @@ nautilus_user_main_directory (void)
image_uri);
nautilus_file_unref (file);
}
g_free(file_uri);
g_free(image_uri);
g_free (file_uri);
g_free (image_uri);
}
}
......
......@@ -25,11 +25,10 @@
#ifndef NAUTILUS_FILE_UTILITIES_H
#define NAUTILUS_FILE_UTILITIES_H
#include <glib.h>
char * nautilus_make_path (const char *path,
const char *name);
const char *nautilus_user_directory (void);
const char *nautilus_user_main_directory (void);
char * nautilus_make_path (const char *path,
const char *name);
const char *nautilus_get_user_directory (void);
const char *nautilus_get_user_main_directory (void);
const char *nautilus_get_desktop_directory (void);
#endif /* NAUTILUS_FILE_UTILITIES_H */
......@@ -136,7 +136,7 @@ global_preferences_create_dialog (void)
}
nautilus_view_identifier_free_list (view_identifiers);
nautilus_view_identifier_list_free (view_identifiers);
}
......@@ -229,7 +229,7 @@ nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers (void)
NULL,
&disabled_view_identifiers);
nautilus_view_identifier_free_list (disabled_view_identifiers);
nautilus_view_identifier_list_free (disabled_view_identifiers);
return enabled_view_identifiers;
}
......@@ -247,7 +247,7 @@ nautilus_global_preferences_get_disabled_sidebar_panel_view_identifiers (void)
NULL,
&disabled_view_identifiers);
nautilus_view_identifier_free_list (enabled_view_identifiers);
nautilus_view_identifier_list_free (enabled_view_identifiers);
return disabled_view_identifiers;
}
......@@ -293,7 +293,7 @@ global_preferences_register_sidebar_panels_preferences_for_ui (void)
g_free (preference_key);
}
nautilus_view_identifier_free_list (view_identifiers);
nautilus_view_identifier_list_free (view_identifiers);
}
static char *
......@@ -453,7 +453,7 @@ user_level_changed_callback (GtkObject *user_level_manager,
can_add_content);
/* FIXME bugzilla.eazel.com 715: This call needs to be spanked to conform. Should return a strduped string */
user_main_directory = nautilus_user_main_directory ();
user_main_directory = nautilus_get_user_main_directory ();
if (use_real_home)
home_uri_string = g_strdup_printf ("file://%s", g_get_home_dir());
......
......@@ -591,16 +591,18 @@ get_themed_icon_file_path (const char *theme_name,
check out the user's home directory, since it might be an emblem
that they've added there */
if (path == NULL && nautilus_str_has_prefix(icon_name, "emblem-")) {
if (path == NULL && nautilus_str_has_prefix (icon_name, "emblem-")) {
for (i = 0; i < NAUTILUS_N_ELEMENTS (icon_file_name_suffixes); i++) {
path = g_strdup_printf("%s/emblems/%s%s",
nautilus_user_directory(), icon_name + 7,
icon_file_name_suffixes[i]);
path = g_strdup_printf ("%s/emblems/%s%s",
nautilus_get_user_directory(),
icon_name + 7,
icon_file_name_suffixes[i]);
if (g_file_exists(path))
if (g_file_exists (path)) {
break;
}
g_free(path);
g_free (path);
path = NULL;
}
}
......
......@@ -55,10 +55,10 @@ get_lang_list (void)
retval = NULL;
lang = getenv ("LANGUAGE");
lang = g_getenv ("LANGUAGE");
if (!lang) {
lang = getenv ("LANG");
lang = g_getenv ("LANG");
}
......@@ -139,12 +139,16 @@ nautilus_view_identifier_free (NautilusViewIdentifier *identifier)
static void
nautilus_view_identifier_free_callback (NautilusViewIdentifier *identifier, gpointer ignore)
{
g_assert (ignore == NULL);
nautilus_view_identifier_free (identifier);
}
void
nautilus_view_identifier_free_list (GList *identifiers)
nautilus_view_identifier_list_free (GList *identifiers)
{
nautilus_g_list_free_deep_custom (identifiers, (GFunc) nautilus_view_identifier_free_callback, NULL);
nautilus_g_list_free_deep_custom
(identifiers,
(GFunc) nautilus_view_identifier_free_callback,
NULL);
}
......@@ -40,6 +40,6 @@ NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (OAF_S
NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (OAF_ServerInfo *server);
void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
void nautilus_view_identifier_free_list (GList *identifiers);
void nautilus_view_identifier_list_free (GList *identifiers);
#endif
......@@ -34,6 +34,7 @@
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-file-private.h"
#include "nautilus-directory-metafile.h"
#include "nautilus-file-utilities.h"
enum {
FILES_ADDED,
......@@ -48,7 +49,6 @@ static guint signals[LAST_SIGNAL];
#define METAFILE_NAME ".nautilus-metafile.xml"
/* Specifications for parallel-directory metafile. */
#define NAUTILUS_DIRECTORY_NAME ".nautilus"
#define METAFILES_DIRECTORY_NAME "metafiles"
#define METAFILE_SUFFIX ".xml"
#define METAFILES_DIRECTORY_PERMISSIONS \
......@@ -346,16 +346,16 @@ static GnomeVFSURI *
construct_alternate_metafile_uri (GnomeVFSURI *uri)
{
GnomeVFSResult result;
GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
GnomeVFSURI *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
char *uri_as_string, *escaped_uri, *file_name;
/* Ensure that the metafiles directory exists. */
home_uri = gnome_vfs_uri_new (g_get_home_dir ());
nautilus_directory_uri = gnome_vfs_uri_append_path (home_uri, NAUTILUS_DIRECTORY_NAME);
gnome_vfs_uri_unref (home_uri);
metafiles_directory_uri = gnome_vfs_uri_append_path (nautilus_directory_uri, METAFILES_DIRECTORY_NAME);
nautilus_directory_uri = gnome_vfs_uri_new (nautilus_get_user_directory ());
metafiles_directory_uri = gnome_vfs_uri_append_path (nautilus_directory_uri,
METAFILES_DIRECTORY_NAME);
gnome_vfs_uri_unref (nautilus_directory_uri);
result = nautilus_make_directory_and_parents (metafiles_directory_uri, METAFILES_DIRECTORY_PERMISSIONS);
result = nautilus_make_directory_and_parents (metafiles_directory_uri,
METAFILES_DIRECTORY_PERMISSIONS);
if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_FILEEXISTS) {
gnome_vfs_uri_unref (metafiles_directory_uri);
return NULL;
......
......@@ -33,9 +33,13 @@
#include "nautilus-file.h"
#include "nautilus-metadata.h"
const char* const nautilus_user_directory_name = ".nautilus";
const char* const nautilus_user_main_directory_name = "Nautilus";
const unsigned default_nautilus_directory_mode = 0755;
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"
#define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755)
#define DESKTOP_DIRECTORY_NAME "desktop"
#define DEFAULT_DESKTOP_DIRECTORY_MODE (0755)
#define NAUTILUS_USER_MAIN_DIRECTORY_NAME "Nautilus"
......@@ -78,24 +82,21 @@ nautilus_make_path(const char *path, const char* name)
* Return value: the directory path.
**/
const char *
nautilus_user_directory()
nautilus_get_user_directory (void)
{
static char *user_directory;
if (user_directory == NULL)
{
user_directory = nautilus_make_path (g_get_home_dir(),
nautilus_user_directory_name);
if (user_directory == NULL) {
user_directory = nautilus_make_path (g_get_home_dir (),
NAUTILUS_USER_DIRECTORY_NAME);
if (!g_file_exists (user_directory))
{
mkdir (user_directory, default_nautilus_directory_mode);
if (!g_file_exists (user_directory)) {
mkdir (user_directory, DEFAULT_NAUTILUS_DIRECTORY_MODE);
}
}
if (!g_file_test (user_directory, G_FILE_TEST_ISDIR))
{
if (!g_file_test (user_directory, G_FILE_TEST_ISDIR)) {
/* Bad news, directory still isn't there.
* FIXME bugzilla.eazel.com 647: Report this to user somehow.
*/
......@@ -105,6 +106,37 @@ nautilus_user_directory()
return user_directory;
}
/**
* nautilus_desktop_directory:
*
* Get the path for the directory containing files on the desktop.
*
* Return value: the directory path.
**/
const char *
nautilus_get_desktop_directory (void)
{
static char *desktop_directory;
if (desktop_directory == NULL) {
desktop_directory = nautilus_make_path (nautilus_get_user_directory (),
DESKTOP_DIRECTORY_NAME);
if (!g_file_exists (desktop_directory)) {
mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
}
}
if (!g_file_test (desktop_directory, G_FILE_TEST_ISDIR)) {
/* Bad news, directory still isn't there.
* FIXME bugzilla.eazel.com 647: Report this to user somehow.
*/
g_assert_not_reached();
}
return desktop_directory;
}
/**
* nautilus_user_main_directory:
*
......@@ -114,35 +146,29 @@ nautilus_user_directory()
* Return value: the directory path.
**/
const char *
nautilus_user_main_directory (void)
nautilus_get_user_main_directory (void)
{
static char *user_main_directory;
NautilusFile *file;
if (user_main_directory == NULL)
{
const char * user_directory;
user_directory = nautilus_user_directory ();
g_assert (user_directory != NULL);
user_main_directory = g_strdup_printf ("%s/%s",
g_get_home_dir(),
nautilus_user_main_directory_name);
NAUTILUS_USER_MAIN_DIRECTORY_NAME);
if (!g_file_exists (user_main_directory))
{
if (!g_file_exists (user_main_directory)) {
char *src;
char *command;