Commit 6ba4e1e5 authored by Darin Adler's avatar Darin Adler

Broke the file part of nautilus-directory.[ch] into nautilus-file.[ch].

	* components/music/nautilus-music-view.c,
	components/notes/ntl-notes.c, libnautilus/Makefile.am,
	libnautilus/nautilus-directory-private.h,
	libnautilus/nautilus-directory.h,
	libnautilus/nautilus-directory.c,
	libnautilus/nautilus-file-private.h, libnautilus/nautilus-file.h,
	libnautilus/nautilus-file.c, libnautilus/nautilus-icon-factory.h,
	src/ntl-index-panel.c, src/file-manager/fm-directory-view.h:
	Broke the file part of nautilus-directory.[ch] into
	nautilus-file.[ch].

	* libnautilus/nautilus-string.c (nautilus_strstrip): Added more
	tests. Changed algorithm on strstrip so it's linear instead of
	n^2.

	* libnautilus/gnome-icon-container.c
	(gnome_icon_container_initialize): Fixed font for "larger" zoom
	level. Also made it assert if the font can't be loaded.

	* components/help/hyperbola-nav-index.c (despace):
	Fixed warning.

	* libnautilus/gnome-icon-container-dnd.c,
	libnautilus/nautilus-string.h: Whitespace.

	* src/file-manager/Makefile.am,
	src/file-manager/fm-directory-view.c,
	src/file-manager/fm-properties-window.h,
	src/file-manager/fm-properties-window.c: Added properties window
	hook, but no window yet. The menu item still needs to be added to
	the main menus as well as the context menus.

	* src/file-manager/fm-directory-view.c,
	src/file-manager/fm-directory-view-icons.c,
	src/file-manager/fm-icon-text-window.h,
	src/file-manager/fm-icon-text-window.c: A little cleanup. Shorter
	names.
parent 886358c4
2000-03-07 Darin Adler <darin@eazel.com>
* components/music/nautilus-music-view.c,
components/notes/ntl-notes.c, libnautilus/Makefile.am,
libnautilus/nautilus-directory-private.h,
libnautilus/nautilus-directory.h,
libnautilus/nautilus-directory.c,
libnautilus/nautilus-file-private.h, libnautilus/nautilus-file.h,
libnautilus/nautilus-file.c, libnautilus/nautilus-icon-factory.h,
src/ntl-index-panel.c, src/file-manager/fm-directory-view.h:
Broke the file part of nautilus-directory.[ch] into
nautilus-file.[ch].
* libnautilus/nautilus-string.c (nautilus_strstrip): Added more
tests. Changed algorithm on strstrip so it's linear instead of
n^2.
* libnautilus/gnome-icon-container.c
(gnome_icon_container_initialize): Fixed font for "larger" zoom
level. Also made it assert if the font can't be loaded.
* components/help/hyperbola-nav-index.c (despace):
Fixed warning.
* libnautilus/gnome-icon-container-dnd.c,
libnautilus/nautilus-string.h: Whitespace.
* src/file-manager/Makefile.am,
src/file-manager/fm-directory-view.c,
src/file-manager/fm-properties-window.h,
src/file-manager/fm-properties-window.c: Added properties window
hook, but no window yet. The menu item still needs to be added to
the main menus as well as the context menus.
* src/file-manager/fm-directory-view.c,
src/file-manager/fm-directory-view-icons.c,
src/file-manager/fm-icon-text-window.h,
src/file-manager/fm-icon-text-window.c: A little cleanup. Shorter
names.
2000-03-08 Ramiro Estrugo <ramiro@eazel.com>
* src/nautilus-prefs-group-radio.h,
src/nautilus-prefs-group-radio.h: Make the radio group emit proper
signals on changes.
signals on changes.
* src/nautilus-prefs-pane.c, src/nautilus-prefs-group.c
src/nautilus-prefs-box.c: Make everything prettier by using nice
offsets.
* src/nautilus-prefs-pane.c,
src/nautilus-prefs-group.c
src/nautilus-prefs-box.c: Make everything prettier by using nice offsets.
2000-03-08 Ramiro Estrugo <ramiro@eazel.com>
Added macros to check, assert and invoke class methods
......@@ -17,9 +57,10 @@
(NAUTILUS_KLASS) Access the class for a given object
(NAUTILUS_INVOKE_METHOD) Invoke a method for a given object
(NAUTILUS_ACCESS_METHOD) Access a method.
(NAUTILUS_ASSERT_METHOD) Assert the non-nullness of a method for a given object
(NAUTILUS_ASSERT_METHOD) Assert the non-nullness of a method
for a given object
(NAUTILUS_INVOKE_METHOD_IF) Invoke a method if it aint null.
2000-03-08 Ramiro Estrugo <ramiro@eazel.com>
First whack at having a better preferences ui.
......
......@@ -366,7 +366,7 @@ despace(GString *s)
ctmp = ctmp_s + 2;
i--;
if(i != strlen(ctmp))
g_error("i (%d) != strlen(ctmp) (%ld)", i, strlen(ctmp));
g_error("i (%d) != strlen(ctmp) (%ld)", i, (long)strlen(ctmp));
}
ctmp_s = NULL;
}
......
......@@ -33,6 +33,7 @@
#include <libnautilus/libnautilus.h>
#include <libnautilus/nautilus-background.h>
#include <libnautilus/nautilus-file.h>
#include <libnautilus/nautilus-file-utilities.h>
#include <libnautilus/nautilus-glib-extensions.h>
#include <libnautilus/nautilus-gtk-macros.h>
......
......@@ -24,7 +24,8 @@
*/
/* annotation metaview - allows you to annotate a directory or file */
#include "config.h"
#include <config.h>
#include <libnautilus/libnautilus.h>
#include <libnautilus/nautilus-metadata.h>
......@@ -34,8 +35,9 @@
#include <limits.h>
#include <ctype.h>
#include <libnautilus/nautilus-background.h>
#include <libnautilus/nautilus-file.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
typedef struct {
......
......@@ -24,7 +24,8 @@
*/
/* annotation metaview - allows you to annotate a directory or file */
#include "config.h"
#include <config.h>
#include <libnautilus/libnautilus.h>
#include <libnautilus/nautilus-metadata.h>
......@@ -34,8 +35,9 @@
#include <limits.h>
#include <ctype.h>
#include <libnautilus/nautilus-background.h>
#include <libnautilus/nautilus-file.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
typedef struct {
......
......@@ -27,8 +27,6 @@ libnautilusincludedir=$(includedir)/libnautilus
libnautilusinclude_HEADERS= \
bonobo-stream-vfs.h \
gdk-extensions.h \
gnome-icon-container-dnd.h \
gnome-icon-container-private.h \
gnome-icon-container.h \
gtkflist.h \
gtkscrollframe.h \
......@@ -38,13 +36,13 @@ libnautilusinclude_HEADERS= \
nautilus-bookmark.h \
nautilus-debug.h \
nautilus-directory.h \
nautilus-file.h \
nautilus-file-utilities.h \
nautilus-glib-extensions.h \
nautilus-gtk-extensions.h \
nautilus-icon-factory.h \
nautilus-icons-controller.h \
nautilus-icons-view-icon-item.h \
nautilus-lib-self-check-functions.h \
nautilus-metadata.h \
nautilus-mime-type.h \
nautilus-self-checks.h \
......@@ -68,6 +66,7 @@ libnautilus_la_SOURCES=$(nautilus_idl_sources) \
nautilus-default-file-icon.c \
nautilus-default-file-icon.h \
nautilus-directory.c \
nautilus-file.c \
nautilus-file-utilities.c \
nautilus-glib-extensions.c \
nautilus-gtk-extensions.c \
......
......@@ -816,12 +816,12 @@ gnome_icon_container_dnd_begin_drag (GnomeIconContainer *container,
gtk_object_getv (GTK_OBJECT (item), 1, &pixbuf_arg);
pixbuf = GTK_VALUE_BOXED (pixbuf_arg);
transparent_pixbuf = make_semi_transparent(pixbuf);
transparent_pixbuf = make_semi_transparent (pixbuf);
gdk_pixbuf_render_pixmap_and_mask (transparent_pixbuf,
&pixmap_for_dragged_file,
&mask_for_dragged_file,
128);
gdk_pixbuf_unref(transparent_pixbuf);
gdk_pixbuf_unref (transparent_pixbuf);
/* compute the image's offset */
nautilus_icons_view_icon_item_get_icon_window_rectangle
......
......@@ -724,15 +724,17 @@ make_icon_visible (GnomeIconContainer *container,
icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
if (y1 < vadj->value)
if (y1 < vadj->value) {
gtk_adjustment_set_value (vadj, y1);
else if (y2 > vadj->value + allocation->height)
} else if (y2 > vadj->value + allocation->height) {
gtk_adjustment_set_value (vadj, y2 - allocation->height);
}
if (x1 < hadj->value)
if (x1 < hadj->value) {
gtk_adjustment_set_value (hadj, x1);
else if (x2 > hadj->value + allocation->width)
} else if (x2 > hadj->value + allocation->width) {
gtk_adjustment_set_value (hadj, x2 - allocation->width);
}
}
static gboolean
......@@ -2145,6 +2147,17 @@ gnome_icon_container_initialize_class (GnomeIconContainerClass *class)
stipple = gdk_bitmap_create_from_data (NULL, stipple_bits, 2, 2);
}
static GdkFont *
load_font (const char *name)
{
GdkFont *font;
/* FIXME: Eventually we need a runtime check, but an assert is better than nothing. */
font = gdk_font_load (name);
g_assert (font != NULL);
return font;
}
static void
gnome_icon_container_initialize (GnomeIconContainer *container)
{
......@@ -2159,15 +2172,15 @@ gnome_icon_container_initialize (GnomeIconContainer *container)
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
/* font table - this isnt exactly proportional, but it looks better than computed */
/* font table - this isn't exactly proportional, but it looks better than computed */
/* FIXME: read font from metadata and/or preferences */
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = gdk_font_load("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = gdk_font_load("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = gdk_font_load("-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = gdk_font_load("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = gdk_font_load("-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = gdk_font_load("-*-helveticar-medium-r-normal-*-18-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = gdk_font_load("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLEST] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALLER] = load_font ("-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_SMALL] = load_font ("-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_STANDARD] = load_font ("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGE] = load_font ("-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGER] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
details->label_font[NAUTILUS_ZOOM_LEVEL_LARGEST] = load_font ("-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*");
/* FIXME: Read these from preferences. */
details->linger_selection_mode = FALSE;
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-directory.c: Nautilus directory model.
Copyright (C) 1999, 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#include "nautilus-directory.h"
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <gnome-xml/tree.h>
#include "nautilus-file.h"
struct NautilusDirectoryDetails
{
char *uri_text;
GnomeVFSURI *uri;
GnomeVFSURI *metafile_uri;
GnomeVFSURI *alternate_metafile_uri;
gboolean use_alternate_metafile;
xmlDoc *metafile_tree;
guint write_metafile_idle_id;
GnomeVFSAsyncHandle *directory_load_in_progress;
GnomeVFSDirectoryListPosition directory_load_list_last_handled;
GList *pending_file_info;
guint dequeue_pending_idle_id;
gboolean directory_loaded;
GList *files;
};
NautilusFile *nautilus_directory_new_file (NautilusDirectory *directory,
GnomeVFSFileInfo *info);
char * nautilus_directory_get_file_metadata (NautilusDirectory *directory,
const char *file_name,
const char *tag,
const char *default_metadata);
void nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *file_name,
const char *tag,
const char *default_metadata,
const char *metadata);
xmlNode * nautilus_directory_get_file_metadata_node (NautilusDirectory *directory,
const char *file_name);
void nautilus_directory_files_removed (NautilusDirectory *directory,
GList *removed_files);
This diff is collapsed.
......@@ -26,7 +26,6 @@
#define NAUTILUS_DIRECTORY_H
#include <gtk/gtkobject.h>
#include <libgnomevfs/gnome-vfs-types.h>
/* NautilusDirectory is a class that manages the model for a directory,
real or virtual, for Nautilus, mainly the file-manager component. The directory is
......@@ -57,21 +56,6 @@ typedef struct NautilusDirectoryClass NautilusDirectoryClass;
#define NAUTILUS_IS_DIRECTORY_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_DIRECTORY))
#define NAUTILUS_IS_FILE(object) \
((object) != NULL)
typedef enum {
NAUTILUS_FILE_SORT_NONE,
NAUTILUS_FILE_SORT_BY_NAME,
NAUTILUS_FILE_SORT_BY_SIZE,
NAUTILUS_FILE_SORT_BY_TYPE,
NAUTILUS_FILE_SORT_BY_MTIME
} NautilusFileSortType;
typedef struct NautilusFile NautilusFile;
#define NAUTILUS_FILE(file) ((NautilusFile *)(file))
typedef void (*NautilusFileListCallback) (NautilusDirectory *directory,
GList *files,
gpointer callback_data);
......@@ -124,61 +108,6 @@ void nautilus_directory_stop_monitoring (NautilusDirectory
*/
gboolean nautilus_directory_are_all_files_seen (NautilusDirectory *directory);
/* Getting at a single file. */
NautilusFile * nautilus_file_get (const char *uri);
/* Basic operations on file objects. */
void nautilus_file_ref (NautilusFile *file);
void nautilus_file_unref (NautilusFile *file);
void nautilus_file_delete (NautilusFile *file);
/* Basic attributes for file objects. */
char * nautilus_file_get_name (NautilusFile *file);
char * nautilus_file_get_uri (NautilusFile *file);
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_type (NautilusFile *file);
const char * nautilus_file_get_mime_type (NautilusFile *file);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
gboolean nautilus_file_is_executable (NautilusFile *file);
gboolean nautilus_file_is_directory (NautilusFile *file);
guint nautilus_file_get_directory_item_count (NautilusFile *file,
gboolean ignore_invisible_items);
GList * nautilus_file_get_keywords (NautilusFile *file);
void nautilus_file_set_keywords (NautilusFile *file,
GList *keywords);
/* Simple getting and setting top-level metadata. */
char * nautilus_file_get_metadata (NautilusFile *file,
const char *tag,
const char *default_metadata);
void nautilus_file_set_metadata (NautilusFile *file,
const char *tag,
const char *default_metadata,
const char *metadata);
/* Attributes for file objects as user-displayable strings. */
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
NautilusFile *file_2,
NautilusFileSortType sort_type);
int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
NautilusFile *file_2,
NautilusFileSortType sort_type);
/* Convenience functions for dealing with a list of NautilusFile objects that each have a ref. */
void nautilus_file_list_ref (GList *file_list);
void nautilus_file_list_unref (GList *file_list);
void nautilus_file_list_free (GList *file_list);
/* Return true if this file has already been deleted.
This object will be unref'd after sending the files_removed signal,
but it could hang around longer if someone ref'd it.
*/
gboolean nautilus_file_is_gone (NautilusFile *file);
typedef struct NautilusDirectoryDetails NautilusDirectoryDetails;
struct NautilusDirectory
......@@ -201,10 +130,10 @@ struct NautilusDirectoryClass
this is the last chance to forget about these file objects
which are about to be unref'd.
*/
void (* files_added) (NautilusDirectory *directory,
GList *added_files);
void (* files_removed) (NautilusDirectory *directory,
GList *removed_files);
void (* files_added) (NautilusDirectory *directory,
GList *added_files);
void (* files_removed) (NautilusDirectory *directory,
GList *removed_files);
/* The files_changed signal is emitted as changes occur to
existing files that are noticed by the synchronization framework.
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-directory.c: Nautilus directory model.
Copyright (C) 1999, 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#include "nautilus-file.h"
#include "nautilus-directory.h"
struct NautilusFile
{
guint ref_count;
NautilusDirectory *directory;
GnomeVFSFileInfo *info;
gboolean is_gone;
};
void nautilus_file_free (NautilusFile *);
This diff is collapsed.
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-file.h: Nautilus file model.
Copyright (C) 1999, 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#ifndef NAUTILUS_FILE_H
#define NAUTILUS_FILE_H
#include <glib.h> /* gnome-vfs-types.h requires glib.h but doesn't include it */
#include <libgnomevfs/gnome-vfs-types.h>
/* NautilusFile is an object used to represent a single element of a
* NautilusDirectory. It's lightweight and relies on NautilusDirectory
* to do most of the work.
*/
typedef enum {
NAUTILUS_FILE_SORT_NONE,
NAUTILUS_FILE_SORT_BY_NAME,
NAUTILUS_FILE_SORT_BY_SIZE,
NAUTILUS_FILE_SORT_BY_TYPE,
NAUTILUS_FILE_SORT_BY_MTIME
} NautilusFileSortType;
typedef struct NautilusFile NautilusFile;
#define NAUTILUS_IS_FILE(object) \
((object) != NULL)
#define NAUTILUS_FILE(file) \
((NautilusFile *)(file))
/* Getting at a single file. */
NautilusFile * nautilus_file_get (const char *uri);
/* Basic operations on file objects. */
void nautilus_file_ref (NautilusFile *file);
void nautilus_file_unref (NautilusFile *file);
void nautilus_file_delete (NautilusFile *file);
/* Basic attributes for file objects. */
char * nautilus_file_get_name (NautilusFile *file);
char * nautilus_file_get_uri (NautilusFile *file);
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_type (NautilusFile *file);
const char * nautilus_file_get_mime_type (NautilusFile *file);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
gboolean nautilus_file_is_executable (NautilusFile *file);
gboolean nautilus_file_is_directory (NautilusFile *file);
guint nautilus_file_get_directory_item_count (NautilusFile *file,
gboolean ignore_invisible_items);
GList * nautilus_file_get_keywords (NautilusFile *file);
void nautilus_file_set_keywords (NautilusFile *file,
GList *keywords);
/* Simple getting and setting top-level metadata. */
char * nautilus_file_get_metadata (NautilusFile *file,
const char *tag,
const char *default_metadata);
void nautilus_file_set_metadata (NautilusFile *file,
const char *tag,
const char *default_metadata,
const char *metadata);
/* Attributes for file objects as user-displayable strings. */
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
NautilusFile *file_2,
NautilusFileSortType sort_type);
int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
NautilusFile *file_2,
NautilusFileSortType sort_type);
/* Convenience functions for dealing with a list of NautilusFile objects that each have a ref. */
void nautilus_file_list_ref (GList *file_list);
void nautilus_file_list_unref (GList *file_list);
void nautilus_file_list_free (GList *file_list);
/* Return true if this file has already been deleted.
This object will be unref'd after sending the files_removed signal,
but it could hang around longer if someone ref'd it.
*/
gboolean nautilus_file_is_gone (NautilusFile *file);
#endif /* NAUTILUS_FILE_H */
......@@ -2,7 +2,7 @@
nautilus-icon-factory.h: Class for obtaining icons for files and other objects.
* Copyright (C) 1999, 2000 Red Hat Inc.
Copyright (C) 1999, 2000 Red Hat Inc.
Copyright (C) 1999, 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
......@@ -27,7 +27,8 @@
#define NAUTILUS_ICON_FACTORY_H
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-directory.h>
#include <libnautilus/nautilus-file.h>
#include <gtk/gtkobject.h>
/* NautilusIconFactory is a class that knows how to hand out icons to be
* used for representing files and some other objects. It was designed
......@@ -97,8 +98,8 @@ char * nautilus_icon_factory_get_theme (void);
void nautilus_icon_factory_set_theme (const char *theme_name);
/* Choose the appropriate icon, but don't render it yet. */
NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
void *controller);
NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
void *controller);
NautilusScalableIcon *nautilus_icon_factory_get_icon_by_name (const char *icon_name);
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file);
......
......@@ -69,10 +69,12 @@ nautilus_has_prefix (const char *haystack_null_allowed, const char *needle_null_
h = haystack_null_allowed == NULL ? "" : haystack_null_allowed;
n = needle_null_allowed == NULL ? "" : needle_null_allowed;
do {
if (*n == '\0')
if (*n == '\0') {
return TRUE;
if (*h == '\0')
}
if (*h == '\0') {
return FALSE;
}
} while (*h++ == *n++);
return FALSE;
}
......@@ -82,19 +84,23 @@ nautilus_has_suffix (const char *haystack_null_allowed, const char *needle_null_
{
const char *h, *n;
if (haystack_null_allowed == NULL)
if (needle_null_allowed == NULL) {
return TRUE;
if (needle_null_allowed == NULL)
return FALSE;
}
if (haystack_null_allowed == NULL) {
return needle_null_allowed[0] == '\0';
}
/* Eat one character at a time. */
h = haystack_null_allowed + strlen(haystack_null_allowed);
n = needle_null_allowed + strlen(needle_null_allowed);
do {
if (n == needle_null_allowed)
if (n == needle_null_allowed) {
return TRUE;
if (h == haystack_null_allowed)
}
if (h == haystack_null_allowed) {
return FALSE;
}
} while (*--h == *--n);
return FALSE;
}
......@@ -144,23 +150,28 @@ nautilus_string_to_int (const char *string, int *integer)
char *parse_end;
/* Check for the case of an empty string. */
if (string == NULL || *string == '\0')
if (string == NULL || *string == '\0') {
return FALSE;
}
/* Call the standard library routine to do the conversion. */
errno = 0;
result = strtol (string, &parse_end, 0);
/* Check that the result is in range. */
if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE)
if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE) {
return FALSE;
if (result < G_MININT || result > G_MAXINT)
}
if (result < G_MININT || result > G_MAXINT) {