Commit 3bce71a5 authored by Darin Adler's avatar Darin Adler

Hand tuned icons for multiple resolutions.

	So for example you can have an icon designed for the 96x96
	size, which is called i-directory-96.png, and it will be
	loaded instead of loading i-directory.png and scaling it.

	* libnautilus/nautilus-icon-factory.c:
	(nautilus_icon_factory_get_icon_name_for_regular_file),
	(add_size_to_icon_name), (nautilus_icon_factory_load_icon),
	(nautilus_icon_factory_create_image_for_item),
	(get_larger_icon_size), (get_smaller_icon_size),
	(get_next_icon_size_to_try), (load_specific_image),
	(load_image_for_scaling), (load_image_scale_if_necessary),
	(nautilus_icon_factory_mark_recently_used), (mark_recently_used),
	(nautilus_icon_factory_get_pixbuf_for_icon),
	(get_image_from_cache), (nautilus_icon_factory_scale): Changed the
	icon factory so it will look for icons of multiple resolutions and
	scale the nearest. Also made other improvements including sharing
	a single fallback icon instead of making multiple ones, using the
	"core-dump" icon for files named "core", adding some additional
	g_return_if_fail.

	* libnautilus/nautilus-icon-factory.c:
	(self_test_next_icon_size_to_try),
	(nautilus_self_check_icon_factory):
	* libnautilus/nautilus-lib-self-check-functions.h:
	The new code needed a bit of self-check code, so I added it.

	* libnautilus/nautilus-directory.c:
	(nautilus_directory_try_to_read_metafile),
	(nautilus_directory_construct_alternate_metafile_uri):
	Since "make check" was failing, I checked to see what was wrong.
	The code that was respecting the new "valid_fields" part of
	GnomeVFSFileInfo was looking at the wrong field (flags instead
	of valid_fields), which caused all metafile reading to fail.
	While debugging this, I noticed that the alternate metafiles
	had particularly bad long names, so I fixed that too.

	* libnautilus/nautilus-directory.c: (nautilus_file_ref):
	* libnautilus/nautilus-glib-extensions.c:
	(nautilus_strdup_strftime):
	* libnautilus/nautilus-string.c: (nautilus_string_to_int):
	Switched from using <limits.h> constants to the ones from
	<glib.h>. I have no idea why I made this change. All hail
	glib! C Standard be damned!

	* fm-directory-view.c:
	(use_eazel_theme_icons_cb), (add_menu_item),
	(fm_directory_view_real_append_background_context_menu_items):
	Started on a user interface to switch to the Eazel theme
	icons so you can see the multiple-resolution icons, but
	I wanted to check in, so I stopped before it was done.

	* src/nautilus-index-title.c:
	Reindented Andy's new code to match the emacs mode header.

	* configure.in:
	* icons/Makefile.am:
	* icons/eazel/.cvsignore:
	* icons/eazel/Makefile.am:
	* icons/eazel/i-directory-24.png:
	* icons/eazel/i-directory-36.png:
	* icons/eazel/i-directory-72.png:
	* icons/eazel/i-directory-96.png:
	* icons/eazel/i-directory.png:
	I needed some variable-size icons to demonstrate the multiple
	resolution support in the icon factory, so I added a few
	directory icons from gnomad. Since these don't match the other
	icons, I made them part of an "eazel" icons theme.

	* RENAMING: Some new name ideas.
parent f32e59de
2000-02-17 Darin Adler <darin@eazel.com>
Hand tuned icons for multiple resolutions.
So for example you can have an icon designed for the 96x96
size, which is called i-directory-96.png, and it will be
loaded instead of loading i-directory.png and scaling it.
* libnautilus/nautilus-icon-factory.c:
(nautilus_icon_factory_get_icon_name_for_regular_file),
(add_size_to_icon_name), (nautilus_icon_factory_load_icon),
(nautilus_icon_factory_create_image_for_item),
(get_larger_icon_size), (get_smaller_icon_size),
(get_next_icon_size_to_try), (load_specific_image),
(load_image_for_scaling), (load_image_scale_if_necessary),
(nautilus_icon_factory_mark_recently_used), (mark_recently_used),
(nautilus_icon_factory_get_pixbuf_for_icon),
(get_image_from_cache), (nautilus_icon_factory_scale): Changed the
icon factory so it will look for icons of multiple resolutions and
scale the nearest. Also made other improvements including sharing
a single fallback icon instead of making multiple ones, using the
"core-dump" icon for files named "core", adding some additional
g_return_if_fail.
* libnautilus/nautilus-icon-factory.c:
(self_test_next_icon_size_to_try),
(nautilus_self_check_icon_factory):
* libnautilus/nautilus-lib-self-check-functions.h:
The new code needed a bit of self-check code, so I added it.
* libnautilus/nautilus-directory.c:
(nautilus_directory_try_to_read_metafile),
(nautilus_directory_construct_alternate_metafile_uri):
Since "make check" was failing, I checked to see what was wrong.
The code that was respecting the new "valid_fields" part of
GnomeVFSFileInfo was looking at the wrong field (flags instead
of valid_fields), which caused all metafile reading to fail.
While debugging this, I noticed that the alternate metafiles
had particularly bad long names, so I fixed that too.
* libnautilus/nautilus-directory.c: (nautilus_file_ref):
* libnautilus/nautilus-glib-extensions.c:
(nautilus_strdup_strftime):
* libnautilus/nautilus-string.c: (nautilus_string_to_int):
Switched from using <limits.h> constants to the ones from
<glib.h>. I have no idea why I made this change. All hail
glib! C Standard be damned!
* fm-directory-view.c:
(use_eazel_theme_icons_cb), (add_menu_item),
(fm_directory_view_real_append_background_context_menu_items):
Started on a user interface to switch to the Eazel theme
icons so you can see the multiple-resolution icons, but
I wanted to check in, so I stopped before it was done.
* src/nautilus-index-title.c:
Reindented Andy's new code to match the emacs mode header.
* configure.in:
* icons/Makefile.am:
* icons/eazel/.cvsignore:
* icons/eazel/Makefile.am:
* icons/eazel/i-directory-24.png:
* icons/eazel/i-directory-36.png:
* icons/eazel/i-directory-72.png:
* icons/eazel/i-directory-96.png:
* icons/eazel/i-directory.png:
I needed some variable-size icons to demonstrate the multiple
resolution support in the icon factory, so I added a few
directory icons from gnomad. Since these don't match the other
icons, I made them part of an "eazel" icons theme.
* RENAMING: Some new name ideas.
2000-02-17 Jonathan Blandford <jrb@redhat.com> 2000-02-17 Jonathan Blandford <jrb@redhat.com>
* src/nautilus-index-title.c (nautilus_index_title_set_up_label): * src/nautilus-index-title.c (nautilus_index_title_set_up_label):
......
...@@ -11,3 +11,6 @@ GtkFList -> NautilusList ...@@ -11,3 +11,6 @@ GtkFList -> NautilusList
FMDirectoryViewIcons -> FMDirectoryIconView FMDirectoryViewIcons -> FMDirectoryIconView
FMDirectoryViewList -> FMDirectoryListView FMDirectoryViewList -> FMDirectoryListView
NautilusBookmarklist -> NautilusBookmarkList
nautilus-bookmarklist* -> nautilus-bookmark-list*
...@@ -99,6 +99,7 @@ AC_C_CONST ...@@ -99,6 +99,7 @@ AC_C_CONST
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
icons/Makefile icons/Makefile
icons/eazel/Makefile
idl/Makefile idl/Makefile
libnautilus/Makefile libnautilus/Makefile
src/Makefile src/Makefile
......
SUBDIRS = eazel
icondir = $(datadir)/pixmaps/nautilus icondir = $(datadir)/pixmaps/nautilus
icon_DATA = \ icon_DATA = \
......
Makefile
Makefile.in
eazeldir = $(datadir)/pixmaps/nautilus/eazel
eazel_DATA = \
i-directory.png \
i-directory-24.png \
i-directory-36.png \
i-directory-72.png \
i-directory-96.png
EXTRA_DIST = $(eazel_DATA)
...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU ...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU
if (result == GNOME_VFS_OK) { if (result == GNOME_VFS_OK) {
/* Check for the case where the info doesn't give the file size. */ /* Check for the case where the info doesn't give the file size. */
if ((metafile_info.flags & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0) if ((metafile_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0)
result = GNOME_VFS_ERROR_GENERIC; result = GNOME_VFS_ERROR_GENERIC;
} }
...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions) ...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions)
} }
static GnomeVFSURI * static GnomeVFSURI *
nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *uri)
{ {
GnomeVFSResult result; GnomeVFSResult result;
GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri; GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) ...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri)
} }
/* Construct a file name from the URI. */ /* Construct a file name from the URI. */
uri_as_string = gnome_vfs_uri_to_string (metafile_uri, uri_as_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
GNOME_VFS_URI_HIDE_NONE);
escaped_uri = nautilus_directory_escape_slashes (uri_as_string); escaped_uri = nautilus_directory_escape_slashes (uri_as_string);
g_free (uri_as_string); g_free (uri_as_string);
file_name = g_strconcat (escaped_uri, ".xml", NULL); file_name = g_strconcat (escaped_uri, ".xml", NULL);
...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri) ...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri)
return NULL; return NULL;
metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME); metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME);
alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (metafile_uri); alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (vfs_uri);
directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY); directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY);
...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file) ...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file)
{ {
g_return_if_fail (file != NULL); g_return_if_fail (file != NULL);
g_assert (file->ref_count < UINT_MAX); g_assert (file->ref_count < G_MAXINT);
g_assert (file->directory != NULL); g_assert (file->directory != NULL);
/* Increment the ref count. */ /* Increment the ref count. */
......
...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces) ...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces)
char *result; char *result;
size_t string_length; size_t string_length;
string_length = strftime (NULL, UINT_MAX, format, time_pieces); string_length = strftime (NULL, G_MAXINT, format, time_pieces);
result = g_malloc (string_length + 1); result = g_malloc (string_length + 1);
strftime (result, string_length + 1, format, time_pieces); strftime (result, string_length + 1, format, time_pieces);
......
...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void); ...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_gdk_extensions) \ macro (nautilus_self_check_gdk_extensions) \
macro (nautilus_self_check_glib_extensions) \ macro (nautilus_self_check_glib_extensions) \
macro (nautilus_self_check_gnome_icon_container) \ macro (nautilus_self_check_gnome_icon_container) \
macro (nautilus_self_check_icon_factory) \
macro (nautilus_self_check_string) \ macro (nautilus_self_check_string) \
/* Add new self-check functions to the list above this line. */ /* Add new self-check functions to the list above this line. */
......
...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer) ...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer)
result = strtol (string, &parse_end, 0); result = strtol (string, &parse_end, 0);
/* Check that the result is in range. */ /* Check that the result is in range. */
if ((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE) if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE)
return FALSE; return FALSE;
if (result < INT_MIN || result > INT_MAX) if (result < G_MININT || result > G_MAXINT)
return FALSE; return FALSE;
/* Check that all the trailing characters are spaces. */ /* Check that all the trailing characters are spaces. */
......
...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU ...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU
if (result == GNOME_VFS_OK) { if (result == GNOME_VFS_OK) {
/* Check for the case where the info doesn't give the file size. */ /* Check for the case where the info doesn't give the file size. */
if ((metafile_info.flags & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0) if ((metafile_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0)
result = GNOME_VFS_ERROR_GENERIC; result = GNOME_VFS_ERROR_GENERIC;
} }
...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions) ...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions)
} }
static GnomeVFSURI * static GnomeVFSURI *
nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *uri)
{ {
GnomeVFSResult result; GnomeVFSResult result;
GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri; GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) ...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri)
} }
/* Construct a file name from the URI. */ /* Construct a file name from the URI. */
uri_as_string = gnome_vfs_uri_to_string (metafile_uri, uri_as_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
GNOME_VFS_URI_HIDE_NONE);
escaped_uri = nautilus_directory_escape_slashes (uri_as_string); escaped_uri = nautilus_directory_escape_slashes (uri_as_string);
g_free (uri_as_string); g_free (uri_as_string);
file_name = g_strconcat (escaped_uri, ".xml", NULL); file_name = g_strconcat (escaped_uri, ".xml", NULL);
...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri) ...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri)
return NULL; return NULL;
metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME); metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME);
alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (metafile_uri); alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (vfs_uri);
directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY); directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY);
...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file) ...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file)
{ {
g_return_if_fail (file != NULL); g_return_if_fail (file != NULL);
g_assert (file->ref_count < UINT_MAX); g_assert (file->ref_count < G_MAXINT);
g_assert (file->directory != NULL); g_assert (file->directory != NULL);
/* Increment the ref count. */ /* Increment the ref count. */
......
...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces) ...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces)
char *result; char *result;
size_t string_length; size_t string_length;
string_length = strftime (NULL, UINT_MAX, format, time_pieces); string_length = strftime (NULL, G_MAXINT, format, time_pieces);
result = g_malloc (string_length + 1); result = g_malloc (string_length + 1);
strftime (result, string_length + 1, format, time_pieces); strftime (result, string_length + 1, format, time_pieces);
......
This diff is collapsed.
...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void); ...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_gdk_extensions) \ macro (nautilus_self_check_gdk_extensions) \
macro (nautilus_self_check_glib_extensions) \ macro (nautilus_self_check_glib_extensions) \
macro (nautilus_self_check_gnome_icon_container) \ macro (nautilus_self_check_gnome_icon_container) \
macro (nautilus_self_check_icon_factory) \
macro (nautilus_self_check_string) \ macro (nautilus_self_check_string) \
/* Add new self-check functions to the list above this line. */ /* Add new self-check functions to the list above this line. */
......
...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer) ...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer)
result = strtol (string, &parse_end, 0); result = strtol (string, &parse_end, 0);
/* Check that the result is in range. */ /* Check that the result is in range. */
if ((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE) if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE)
return FALSE; return FALSE;
if (result < INT_MIN || result > INT_MAX) if (result < G_MININT || result > G_MAXINT)
return FALSE; return FALSE;
/* Check that all the trailing characters are spaces. */ /* Check that all the trailing characters are spaces. */
......
...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU ...@@ -296,7 +296,7 @@ nautilus_directory_try_to_read_metafile (NautilusDirectory *directory, GnomeVFSU
if (result == GNOME_VFS_OK) { if (result == GNOME_VFS_OK) {
/* Check for the case where the info doesn't give the file size. */ /* Check for the case where the info doesn't give the file size. */
if ((metafile_info.flags & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0) if ((metafile_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0)
result = GNOME_VFS_ERROR_GENERIC; result = GNOME_VFS_ERROR_GENERIC;
} }
...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions) ...@@ -534,7 +534,7 @@ nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions)
} }
static GnomeVFSURI * static GnomeVFSURI *
nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *uri)
{ {
GnomeVFSResult result; GnomeVFSResult result;
GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri; GnomeVFSURI *home_uri, *nautilus_directory_uri, *metafiles_directory_uri, *alternate_uri;
...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri) ...@@ -553,8 +553,7 @@ nautilus_directory_construct_alternate_metafile_uri (GnomeVFSURI *metafile_uri)
} }
/* Construct a file name from the URI. */ /* Construct a file name from the URI. */
uri_as_string = gnome_vfs_uri_to_string (metafile_uri, uri_as_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
GNOME_VFS_URI_HIDE_NONE);
escaped_uri = nautilus_directory_escape_slashes (uri_as_string); escaped_uri = nautilus_directory_escape_slashes (uri_as_string);
g_free (uri_as_string); g_free (uri_as_string);
file_name = g_strconcat (escaped_uri, ".xml", NULL); file_name = g_strconcat (escaped_uri, ".xml", NULL);
...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri) ...@@ -594,7 +593,7 @@ nautilus_directory_new (const char* uri)
return NULL; return NULL;
metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME); metafile_uri = gnome_vfs_uri_append_path (vfs_uri, METAFILE_NAME);
alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (metafile_uri); alternate_metafile_uri = nautilus_directory_construct_alternate_metafile_uri (vfs_uri);
directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY); directory = gtk_type_new (NAUTILUS_TYPE_DIRECTORY);
...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file) ...@@ -1155,7 +1154,7 @@ nautilus_file_ref (NautilusFile *file)
{ {
g_return_if_fail (file != NULL); g_return_if_fail (file != NULL);
g_assert (file->ref_count < UINT_MAX); g_assert (file->ref_count < G_MAXINT);
g_assert (file->directory != NULL); g_assert (file->directory != NULL);
/* Increment the ref count. */ /* Increment the ref count. */
......
...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces) ...@@ -68,7 +68,7 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces)
char *result; char *result;
size_t string_length; size_t string_length;
string_length = strftime (NULL, UINT_MAX, format, time_pieces); string_length = strftime (NULL, G_MAXINT, format, time_pieces);
result = g_malloc (string_length + 1); result = g_malloc (string_length + 1);
strftime (result, string_length + 1, format, time_pieces); strftime (result, string_length + 1, format, time_pieces);
......
This diff is collapsed.
...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void); ...@@ -44,6 +44,7 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_gdk_extensions) \ macro (nautilus_self_check_gdk_extensions) \
macro (nautilus_self_check_glib_extensions) \ macro (nautilus_self_check_glib_extensions) \
macro (nautilus_self_check_gnome_icon_container) \ macro (nautilus_self_check_gnome_icon_container) \
macro (nautilus_self_check_icon_factory) \
macro (nautilus_self_check_string) \ macro (nautilus_self_check_string) \
/* Add new self-check functions to the list above this line. */ /* Add new self-check functions to the list above this line. */
......
...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer) ...@@ -92,9 +92,9 @@ nautilus_string_to_int (const char *string, int *integer)
result = strtol (string, &parse_end, 0); result = strtol (string, &parse_end, 0);
/* Check that the result is in range. */ /* Check that the result is in range. */
if ((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE) if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE)
return FALSE; return FALSE;
if (result < INT_MIN || result > INT_MAX) if (result < G_MININT || result > G_MAXINT)
return FALSE; return FALSE;
/* Check that all the trailing characters are spaces. */ /* Check that all the trailing characters are spaces. */
......
...@@ -393,17 +393,23 @@ select_all_cb(GtkMenuItem *item, FMDirectoryView *directory_view) ...@@ -393,17 +393,23 @@ select_all_cb(GtkMenuItem *item, FMDirectoryView *directory_view)
/* handle the zoom in/out menu items */ /* handle the zoom in/out menu items */
static void static void
zoom_in_cb(GtkMenuItem *item, FMDirectoryView *directory_view) zoom_in_cb (GtkMenuItem *item, FMDirectoryView *directory_view)
{ {
fm_directory_view_bump_zoom_level (directory_view, 1); fm_directory_view_bump_zoom_level (directory_view, 1);
} }
static void static void
zoom_out_cb(GtkMenuItem *item, FMDirectoryView *directory_view) zoom_out_cb (GtkMenuItem *item, FMDirectoryView *directory_view)
{ {
fm_directory_view_bump_zoom_level (directory_view, -1); fm_directory_view_bump_zoom_level (directory_view, -1);
} }
static void
use_eazel_theme_icons_cb (GtkMenuItem *item, FMDirectoryView *directory_view)
{
/* FIXME: This isn't implemented yet. */
}
static gboolean static gboolean
display_pending_files (FMDirectoryView *view) display_pending_files (FMDirectoryView *view)
{ {
...@@ -788,36 +794,29 @@ open_in_new_window_cb (GtkMenuItem *item, NautilusFile *file) ...@@ -788,36 +794,29 @@ open_in_new_window_cb (GtkMenuItem *item, NautilusFile *file)
fm_directory_view_activate_entry (directory_view, file, TRUE); fm_directory_view_activate_entry (directory_view, file, TRUE);
} }
static void static void
fm_directory_view_real_append_background_context_menu_items (FMDirectoryView *view, add_menu_item (FMDirectoryView *view, GtkMenu *menu, const char *label,
GtkMenu *menu) void (*activate_handler) (GtkMenuItem *, FMDirectoryView *),
gboolean sensitive)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
menu_item = gtk_menu_item_new_with_label ("Select all"); menu_item = gtk_menu_item_new_with_label (label);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (activate_handler), view);
gtk_widget_set_sensitive (menu_item, sensitive);
gtk_widget_show (menu_item); gtk_widget_show (menu_item);
gtk_signal_connect(GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (select_all_cb), view);
gtk_menu_append (menu, menu_item); gtk_menu_append (menu, menu_item);
}
static void
menu_item = gtk_menu_item_new_with_label ("Zoom in"); fm_directory_view_real_append_background_context_menu_items (FMDirectoryView *view,
gtk_signal_connect(GTK_OBJECT (menu_item), "activate", GtkMenu *menu)
GTK_SIGNAL_FUNC (zoom_in_cb), view); {
add_menu_item (view, menu, _("Select All"), select_all_cb, TRUE);
gtk_widget_show (menu_item); add_menu_item (view, menu, _("Zoom In"), zoom_in_cb, fm_directory_view_can_zoom_in (view));
gtk_menu_append (menu, menu_item); add_menu_item (view, menu, _("Zoom Out"), zoom_out_cb, fm_directory_view_can_zoom_out (view));
gtk_widget_set_sensitive (menu_item, fm_directory_view_can_zoom_in (view)); add_menu_item (view, menu, _("Use Eazel Theme Icons"), use_eazel_theme_icons_cb, FALSE);
menu_item = gtk_menu_item_new_with_label ("Zoom out");
gtk_signal_connect(GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (zoom_out_cb), view);
gtk_widget_show (menu_item);
gtk_menu_append (menu, menu_item);
gtk_widget_set_sensitive (menu_item, fm_directory_view_can_zoom_out (view));
} }
static void static void
......
...@@ -216,38 +216,36 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title, const char * ...@@ -216,38 +216,36 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title, const char *
/* split the filename into two lines if necessary */ /* split the filename into two lines if necessary */
if (strlen(file_name) >= 16) if (strlen(file_name) >= 16) {
{ /* find an appropriate split point if we can */
/* find an appropriate split point if we can */ gint index;
gint index; gint mid_point = strlen(file_name) >> 1;
gint mid_point = strlen(file_name) >> 1; gint quarter_point = mid_point >> 1;
gint quarter_point = mid_point >> 1; for (index = 0; index < quarter_point; index++) {
for (index = 0; index < quarter_point; index++) gint split_offset = 0;
{
gint split_offset = 0; if (!isalnum(file_name[mid_point + index]))
split_offset = mid_point + index;
if (!isalnum(file_name[mid_point + index])) else if (!isalnum(file_name[mid_point - index]))
split_offset = mid_point + index; split_offset = mid_point - index;
else if (!isalnum(file_name[mid_point - index]))
split_offset = mid_point - index; if (split_offset != 0) {
char *buffer = (char *) g_malloc(strlen(file_name) + 2);
if (split_offset != 0) {
char *buffer = (char *) g_malloc(strlen(file_name) + 2); /* build the new string, with a CR inserted, also remembering them separately for measuring */
/* build the new string, with a CR inserted, also remembering them separately for measuring */ memcpy(buffer, file_name, split_offset);
buffer[split_offset] = '\n';
memcpy(buffer, file_name, split_offset); strcpy(&buffer[split_offset + 1], &file_name[split_offset]);
buffer[split_offset] = '\n';
strcpy(&buffer[split_offset + 1], &file_name[split_offset]); /* free up the old string and replace it with the new one with the return inserted */
/* free up the old string and replace it with the new one with the return inserted */ g_free(file_name);
file_name = buffer;
g_free(file_name); }
file_name = buffer; }
} }
}
}
if (index_title->details->title != NULL) if (index_title->details->title != NULL)
gtk_label_set_text (GTK_LABEL (index_title->details->title), file_name); gtk_label_set_text (GTK_LABEL (index_title->details->title), file_name);
else { else {
......
...@@ -216,38 +216,36 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title, const char * ...@@ -216,38 +216,36 @@ nautilus_index_title_set_up_label (NautilusIndexTitle *index_title, const char *
/* split the filename into two lines if necessary */ /* split the filename into two lines if necessary */
if (strlen(file_name) >= 16) if (strlen(file_name) >= 16) {
{ /* find an appropriate split point if we can */
/* find an appropriate split point if we can */ gint index;
gint index; gint mid_point = strlen(file_name) >> 1;
gint mid_point = strlen(file_name) >> 1; gint quarter_point = mid_point >> 1;
gint quarter_point = mid_point >> 1; for (index = 0; index < quarter_point; index++) {
for (index = 0; index < quarter_point; index++) gint split_offset = 0;
{
gint split_offset = 0; if (!isalnum(file_name[mid_point + index]))
split_offset = mid_point + index;
if (!isalnum(file_name[mid_point + index])) else if (!isalnum(file_name[mid_point - index]))
split_offset = mid_point + index; split_offset = mid_point - index;
else if (!isalnum(file_name[mid_point - index]))
split_offset = mid_point - index; if (split_offset != 0) {
char *buffer = (char *) g_malloc(strlen(file_name) + 2);
if (split_offset != 0) {
char *buffer = (char *) g_malloc(strlen(file_name) + 2); /* build the new string, with a CR inserted, also remembering them separately for measuring */
/* build the new string, with a CR inserted, also remembering them separately for measuring */ memcpy(buffer, file_name, split_offset);
buffer[split_offset] = '\n';
memcpy(buffer, file_name, split_offset); strcpy(&buffer[split_offset + 1], &file_name[split_offset]);
buffer[split_offset] = '\n';
strcpy(&buffer[split_offset + 1], &file_name[split_offset]); /* free up the old string and replace it with the new one with the return inserted */
/* free up the old string and replace it with the new one with the return inserted */ g_free(file_name);
file_name = buffer;
g_free(file_name); }
file_name = buffer;