mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
changed the location of the novice home directory, and gave it a custom
changed the location of the novice home directory, and gave it a custom icon
This commit is contained in:
parent
f0480d0973
commit
9aad6753a6
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2000-04-24 Andy Hertzfeld <andy@eazel.com>
|
||||
|
||||
changed the location of the novice home directory, and gave it
|
||||
a custom icon
|
||||
|
||||
* libnautilus-extensions/nautilus-file-utilities.c:
|
||||
renamed routines from "top" to "main", and changed the install location
|
||||
from ~/.nautilus/top to ~/Nautilus, and set a custom icon for it
|
||||
* libnautilus-extensions/nautilus-file-utilities.h:
|
||||
changed nautilus_user_top_directory to nautilus_user_main_directory
|
||||
* libnautilus-extensions/nautilus-directory.c
|
||||
disabled assert that was firing due to async metadata reading, but
|
||||
tagged it with a FIXME so we can put it back when the framework is
|
||||
completed
|
||||
* libnautilus-extensions/nautilus-global-preferences.c:
|
||||
made it use newly renamed routine to access directory
|
||||
* icons/nautilus-logo.png:
|
||||
added new icon for the novice home directory
|
||||
* icons/Makefile.am:
|
||||
added new icon to build
|
||||
|
||||
2000-04-24 J. Shane Culpepper <pepper@eazel.com>
|
||||
*configure.in
|
||||
*components/services/install/Makefile.am
|
||||
|
|
|
@ -54,6 +54,7 @@ icon_DATA = \
|
|||
i-zipdisk2.png \
|
||||
loading.png \
|
||||
multi-ok.png \
|
||||
nautilus-logo.png \
|
||||
nautilus3.jpg \
|
||||
not.png \
|
||||
tableft.png \
|
||||
|
|
BIN
icons/nautilus-logo.png
Normal file
BIN
icons/nautilus-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5 KiB |
|
@ -446,7 +446,11 @@ metafile_read_complete (NautilusDirectory *directory)
|
|||
int size;
|
||||
|
||||
g_assert (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_assert (directory->details->metafile == NULL);
|
||||
|
||||
/* FIXME: the following assertion shouldn't be disabled, but it fires
|
||||
in the way when you set metadata before the metafile is completely read.
|
||||
Currently, the old metadata in the file will be lost */
|
||||
/* g_assert (directory->details->metafile == NULL); */
|
||||
|
||||
/* The gnome-xml parser requires a zero-terminated array.
|
||||
* Also, we don't want to allocate an empty buffer
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "nautilus-file.h"
|
||||
#include "nautilus-metadata.h"
|
||||
|
||||
const char* const nautilus_user_directory_name = ".nautilus";
|
||||
const char* const nautilus_user_top_directory_name = "top";
|
||||
const char* const nautilus_user_main_directory_name = "Nautilus";
|
||||
const unsigned default_nautilus_directory_mode = 0755;
|
||||
|
||||
|
||||
|
@ -103,19 +105,20 @@ nautilus_user_directory()
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_user_top_directory:
|
||||
* nautilus_user_main_directory:
|
||||
*
|
||||
* Get the path for the user's top directory.
|
||||
* Usually ~/.nautilus/top
|
||||
* Get the path for the user's main Nautilus directory.
|
||||
* Usually ~/Nautilus
|
||||
*
|
||||
* Return value: the directory path.
|
||||
**/
|
||||
const char *
|
||||
nautilus_user_top_directory (void)
|
||||
nautilus_user_main_directory (void)
|
||||
{
|
||||
static char *user_top_directory;
|
||||
|
||||
if (user_top_directory == NULL)
|
||||
static char *user_main_directory;
|
||||
NautilusFile *file;
|
||||
|
||||
if (user_main_directory == NULL)
|
||||
{
|
||||
const char * user_directory;
|
||||
|
||||
|
@ -123,18 +126,19 @@ nautilus_user_top_directory (void)
|
|||
|
||||
g_assert (user_directory != NULL);
|
||||
|
||||
user_top_directory = nautilus_make_path (user_directory,
|
||||
nautilus_user_top_directory_name);
|
||||
|
||||
if (!g_file_exists (user_top_directory))
|
||||
user_main_directory = g_strdup_printf ("%s/%s",
|
||||
g_get_home_dir(),
|
||||
nautilus_user_main_directory_name);
|
||||
|
||||
if (!g_file_exists (user_main_directory))
|
||||
{
|
||||
char *src;
|
||||
char *command;
|
||||
|
||||
char *file_uri, *image_uri, *temp_str;
|
||||
|
||||
src = gnome_datadir_file ("nautilus/top");
|
||||
|
||||
command = g_strdup_printf ("cp -R %s %s", src, user_top_directory);
|
||||
command = g_strdup_printf ("cp -R %s %s", src, user_main_directory);
|
||||
|
||||
if (system (command) != 0)
|
||||
{
|
||||
|
@ -144,10 +148,27 @@ nautilus_user_top_directory (void)
|
|||
|
||||
g_free (src);
|
||||
g_free (command);
|
||||
|
||||
/* assign a custom image for the directory icon */
|
||||
file_uri = g_strdup_printf("file://%s", user_main_directory);
|
||||
temp_str = gnome_pixmap_file ("nautilus/nautilus-logo.png");
|
||||
image_uri = g_strdup_printf("file://%s", temp_str);
|
||||
g_free(temp_str);
|
||||
|
||||
file = nautilus_file_get (file_uri);
|
||||
if (file != NULL) {
|
||||
nautilus_file_set_metadata (file,
|
||||
NAUTILUS_METADATA_KEY_CUSTOM_ICON,
|
||||
NULL,
|
||||
image_uri);
|
||||
nautilus_file_unref (file);
|
||||
}
|
||||
g_free(file_uri);
|
||||
g_free(image_uri);
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_file_test (user_top_directory, G_FILE_TEST_ISDIR))
|
||||
if (!g_file_test (user_main_directory, G_FILE_TEST_ISDIR))
|
||||
{
|
||||
/* Bad news, directory still isn't there.
|
||||
* FIXME: Report this to user somehow.
|
||||
|
@ -156,5 +177,5 @@ nautilus_user_top_directory (void)
|
|||
|
||||
}
|
||||
|
||||
return user_top_directory;
|
||||
return user_main_directory;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
char * nautilus_make_path (const char *path,
|
||||
const char *name);
|
||||
const char *nautilus_user_directory (void);
|
||||
const char *nautilus_user_top_directory (void);
|
||||
const char *nautilus_user_main_directory (void);
|
||||
|
||||
#endif /* NAUTILUS_FILE_UTILITIES_H */
|
||||
|
|
|
@ -360,7 +360,7 @@ user_level_changed_callback (gpointer user_data)
|
|||
gboolean show_hidden_files = FALSE;
|
||||
gboolean use_real_home = TRUE;
|
||||
|
||||
const char *user_top_directory;
|
||||
const char *user_main_directory;
|
||||
|
||||
preferences = nautilus_preferences_get_global_preferences ();
|
||||
|
||||
|
@ -394,12 +394,12 @@ user_level_changed_callback (gpointer user_data)
|
|||
show_hidden_files);
|
||||
|
||||
/* FIXME: This call needs to be spanked to conform. Should return a strduped string */
|
||||
user_top_directory = nautilus_user_top_directory ();
|
||||
user_main_directory = nautilus_user_main_directory ();
|
||||
|
||||
if (use_real_home)
|
||||
home_uri_string = g_strdup_printf ("file://%s", g_get_home_dir());
|
||||
else
|
||||
home_uri_string = g_strdup_printf ("file://%s", user_top_directory);
|
||||
home_uri_string = g_strdup_printf ("file://%s", user_main_directory);
|
||||
|
||||
g_assert (home_uri_string != NULL);
|
||||
|
||||
|
|
|
@ -446,7 +446,11 @@ metafile_read_complete (NautilusDirectory *directory)
|
|||
int size;
|
||||
|
||||
g_assert (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_assert (directory->details->metafile == NULL);
|
||||
|
||||
/* FIXME: the following assertion shouldn't be disabled, but it fires
|
||||
in the way when you set metadata before the metafile is completely read.
|
||||
Currently, the old metadata in the file will be lost */
|
||||
/* g_assert (directory->details->metafile == NULL); */
|
||||
|
||||
/* The gnome-xml parser requires a zero-terminated array.
|
||||
* Also, we don't want to allocate an empty buffer
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "nautilus-file.h"
|
||||
#include "nautilus-metadata.h"
|
||||
|
||||
const char* const nautilus_user_directory_name = ".nautilus";
|
||||
const char* const nautilus_user_top_directory_name = "top";
|
||||
const char* const nautilus_user_main_directory_name = "Nautilus";
|
||||
const unsigned default_nautilus_directory_mode = 0755;
|
||||
|
||||
|
||||
|
@ -103,19 +105,20 @@ nautilus_user_directory()
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_user_top_directory:
|
||||
* nautilus_user_main_directory:
|
||||
*
|
||||
* Get the path for the user's top directory.
|
||||
* Usually ~/.nautilus/top
|
||||
* Get the path for the user's main Nautilus directory.
|
||||
* Usually ~/Nautilus
|
||||
*
|
||||
* Return value: the directory path.
|
||||
**/
|
||||
const char *
|
||||
nautilus_user_top_directory (void)
|
||||
nautilus_user_main_directory (void)
|
||||
{
|
||||
static char *user_top_directory;
|
||||
|
||||
if (user_top_directory == NULL)
|
||||
static char *user_main_directory;
|
||||
NautilusFile *file;
|
||||
|
||||
if (user_main_directory == NULL)
|
||||
{
|
||||
const char * user_directory;
|
||||
|
||||
|
@ -123,18 +126,19 @@ nautilus_user_top_directory (void)
|
|||
|
||||
g_assert (user_directory != NULL);
|
||||
|
||||
user_top_directory = nautilus_make_path (user_directory,
|
||||
nautilus_user_top_directory_name);
|
||||
|
||||
if (!g_file_exists (user_top_directory))
|
||||
user_main_directory = g_strdup_printf ("%s/%s",
|
||||
g_get_home_dir(),
|
||||
nautilus_user_main_directory_name);
|
||||
|
||||
if (!g_file_exists (user_main_directory))
|
||||
{
|
||||
char *src;
|
||||
char *command;
|
||||
|
||||
char *file_uri, *image_uri, *temp_str;
|
||||
|
||||
src = gnome_datadir_file ("nautilus/top");
|
||||
|
||||
command = g_strdup_printf ("cp -R %s %s", src, user_top_directory);
|
||||
command = g_strdup_printf ("cp -R %s %s", src, user_main_directory);
|
||||
|
||||
if (system (command) != 0)
|
||||
{
|
||||
|
@ -144,10 +148,27 @@ nautilus_user_top_directory (void)
|
|||
|
||||
g_free (src);
|
||||
g_free (command);
|
||||
|
||||
/* assign a custom image for the directory icon */
|
||||
file_uri = g_strdup_printf("file://%s", user_main_directory);
|
||||
temp_str = gnome_pixmap_file ("nautilus/nautilus-logo.png");
|
||||
image_uri = g_strdup_printf("file://%s", temp_str);
|
||||
g_free(temp_str);
|
||||
|
||||
file = nautilus_file_get (file_uri);
|
||||
if (file != NULL) {
|
||||
nautilus_file_set_metadata (file,
|
||||
NAUTILUS_METADATA_KEY_CUSTOM_ICON,
|
||||
NULL,
|
||||
image_uri);
|
||||
nautilus_file_unref (file);
|
||||
}
|
||||
g_free(file_uri);
|
||||
g_free(image_uri);
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_file_test (user_top_directory, G_FILE_TEST_ISDIR))
|
||||
if (!g_file_test (user_main_directory, G_FILE_TEST_ISDIR))
|
||||
{
|
||||
/* Bad news, directory still isn't there.
|
||||
* FIXME: Report this to user somehow.
|
||||
|
@ -156,5 +177,5 @@ nautilus_user_top_directory (void)
|
|||
|
||||
}
|
||||
|
||||
return user_top_directory;
|
||||
return user_main_directory;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
char * nautilus_make_path (const char *path,
|
||||
const char *name);
|
||||
const char *nautilus_user_directory (void);
|
||||
const char *nautilus_user_top_directory (void);
|
||||
const char *nautilus_user_main_directory (void);
|
||||
|
||||
#endif /* NAUTILUS_FILE_UTILITIES_H */
|
||||
|
|
|
@ -360,7 +360,7 @@ user_level_changed_callback (gpointer user_data)
|
|||
gboolean show_hidden_files = FALSE;
|
||||
gboolean use_real_home = TRUE;
|
||||
|
||||
const char *user_top_directory;
|
||||
const char *user_main_directory;
|
||||
|
||||
preferences = nautilus_preferences_get_global_preferences ();
|
||||
|
||||
|
@ -394,12 +394,12 @@ user_level_changed_callback (gpointer user_data)
|
|||
show_hidden_files);
|
||||
|
||||
/* FIXME: This call needs to be spanked to conform. Should return a strduped string */
|
||||
user_top_directory = nautilus_user_top_directory ();
|
||||
user_main_directory = nautilus_user_main_directory ();
|
||||
|
||||
if (use_real_home)
|
||||
home_uri_string = g_strdup_printf ("file://%s", g_get_home_dir());
|
||||
else
|
||||
home_uri_string = g_strdup_printf ("file://%s", user_top_directory);
|
||||
home_uri_string = g_strdup_printf ("file://%s", user_main_directory);
|
||||
|
||||
g_assert (home_uri_string != NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue