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

Added commands for Auto vs. Manual layout, but the guts behind

	them is not yet implemented.

	Did some cleanup on the new renaming code.

	* nautilus-glib-extensions.c:
	* nautilus-glib-extensions.h:
	Added nautilus_g_list_exactly_one_item and
	nautilus_g_list_more_than_one_item. These are more-efficient
	versions of g_list_length (x) == 1 and g_list_length (x) > 1.

	* nautilus-icon-canvas-item.c:
	(draw_or_measure_label_text): Add a line break between the
	editable text and the additional text.
	(nautilus_icon_canvas_get_text_bounds),
	(nautilus_icon_canvas_get_editable_text_bounds),
	(nautilus_icon_canvas_get_editable_text),
	(nautilus_icon_canvas_set_renaming):
	Replaced g_assert with g_return_if_fail calls, and added the
	complete set of g_return_if_fail.
	(nautilus_icon_canvas_set_renaming): Don't update the item
	unless the renaming state has actually changed.

	* nautilus-icon-canvas-item.h: Fixed formatting.

	* nautilus-icon-container.c:
	* nautilus-icon-container.h:
	Added nautilus_icon_container_set_auto_layout and
	nautilus_icon_container_is_auto_layout. For now they are
	placeholders that just modify a boolean.

	* nautilus-icon-private.h:
	Added the auto_layout boolean.

	* nautilus-icon-text-item.c:
	* nautilus-icon-text-item.h:
	Just some formatting and other minor cleanup.

	* nautilus-metadata.h:
	Added NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT.

	* nautilus-location-bar.c (drag_data_received_cb): Use the new
	nautilus_g_list_more_than_one_item function.

	* fm-directory-view.c (bonobo_menu_open_cb), (open_cb): Use the
	new nautilus_g_list_exactly_one_item.

	* fm-icon-text-window.c (attribute_names_string_is_good),
	(set_preference_string), (synch_menus_with_preference),
	(preference_changed_callback),
	(changed_attributes_option_menu_cb): Got rid of the hard-coded
	first item "name" which is no longer needed.  Also changed to
	handle bad data in the preferences.

	* fm-icon-view.c (fm_icon_view_initialize_class): Updated since
	there's no "name" item needed any more.
	(fm_icon_view_compute_menu_item_info): Merged MENU_PATH_RENAME
	with MENU_RENAME_TEXT and simplified the logic.
	(fm_icon_view_append_selection_context_menu_items): Merged
	MENU_PATH_RENAME with MENU_RENAME_TEXT.
	(update_layout_menus), (auto_layout_callback),
	(manual_layout_callback), (fm_icon_view_merge_menus): Added menu
	items for auto layout and for manual layout.
	(fm_icon_view_begin_loading): Load setting for auto layout from
	metadata.
	(fm_icon_view_get_icon_text_attribute_names): Changed to get rid
	of the "name" first item from the list of text attributes.
	(get_icon_editable_text_callback): Simplified since the editable text
	is always the icon name. Also got rid of copied and pasted code that's
	no longer needed for this case.
	(get_icon_additional_text_callback): Got rid of special case for name,
	since the name is no longer treated as an attribute.
parent 33d686a3
2000-04-19 Andy Hertzfeld <andy@eazel.com>
added a new, xml-based type of link file that can specify it's own icon and
other behavior. Soon they will be used for the novice home directory.
2000-04-17 Darin Adler <darin@eazel.com>
Added commands for Auto vs. Manual layout, but the guts behind
them is not yet implemented.
Did some cleanup on the new renaming code.
* nautilus-glib-extensions.c:
* nautilus-glib-extensions.h:
Added nautilus_g_list_exactly_one_item and
nautilus_g_list_more_than_one_item. These are more-efficient
versions of g_list_length (x) == 1 and g_list_length (x) > 1.
* nautilus-icon-canvas-item.c:
(draw_or_measure_label_text): Add a line break between the
editable text and the additional text.
(nautilus_icon_canvas_get_text_bounds),
(nautilus_icon_canvas_get_editable_text_bounds),
(nautilus_icon_canvas_get_editable_text),
(nautilus_icon_canvas_set_renaming):
Replaced g_assert with g_return_if_fail calls, and added the
complete set of g_return_if_fail.
(nautilus_icon_canvas_set_renaming): Don't update the item
unless the renaming state has actually changed.
* nautilus-icon-canvas-item.h: Fixed formatting.
* nautilus-icon-container.c:
* nautilus-icon-container.h:
Added nautilus_icon_container_set_auto_layout and
nautilus_icon_container_is_auto_layout. For now they are
placeholders that just modify a boolean.
* nautilus-icon-private.h:
Added the auto_layout boolean.
* nautilus-icon-text-item.c:
* nautilus-icon-text-item.h:
Just some formatting and other minor cleanup.
* nautilus-metadata.h:
Added NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT.
* nautilus-location-bar.c (drag_data_received_cb): Use the new
nautilus_g_list_more_than_one_item function.
* fm-directory-view.c (bonobo_menu_open_cb), (open_cb): Use the
new nautilus_g_list_exactly_one_item.
* fm-icon-text-window.c (attribute_names_string_is_good),
(set_preference_string), (synch_menus_with_preference),
(preference_changed_callback),
(changed_attributes_option_menu_cb): Got rid of the hard-coded
first item "name" which is no longer needed. Also changed to
handle bad data in the preferences.
* fm-icon-view.c (fm_icon_view_initialize_class): Updated since
there's no "name" item needed any more.
(fm_icon_view_compute_menu_item_info): Merged MENU_PATH_RENAME
with MENU_RENAME_TEXT and simplified the logic.
(fm_icon_view_append_selection_context_menu_items): Merged
MENU_PATH_RENAME with MENU_RENAME_TEXT.
(update_layout_menus), (auto_layout_callback),
(manual_layout_callback), (fm_icon_view_merge_menus): Added menu
items for auto layout and for manual layout.
(fm_icon_view_begin_loading): Load setting for auto layout from
metadata.
(fm_icon_view_get_icon_text_attribute_names): Changed to get rid
of the "name" first item from the list of text attributes.
(get_icon_editable_text_callback): Simplified since the editable text
is always the icon name. Also got rid of copied and pasted code that's
no longer needed for this case.
(get_icon_additional_text_callback): Got rid of special case for name,
since the name is no longer treated as an attribute.
2000-04-19 Andy Hertzfeld <andy@eazel.com>
Added a new, xml-based type of link file that can specify it's own
icon and other behavior. Soon they will be used for the novice
home directory.
* libnautilus-extensions.nautilus-file.c:
check for the new file type in nautilus_directory_mapped_uri, and
Check for the new file type in nautilus_directory_mapped_uri, and
return the link contained in the file if present.
* libnautilus-icon-factory.c:
check for the new file type in nautilus_icon_factory_get_icon_for_file
and return the specified image as appropriate.
Check for the new file type in
nautilus_icon_factory_get_icon_for_file and return the specified
image as appropriate.
2000-04-18 Shane Culpepper <pepper@eazel.com>
2000-04-18 Shane Culpepper <pepper@eazel.com>
adding the eazel-installer skelton. very rough prototype right now
but it works with my local configuration data. Will be updated alot
......@@ -18,7 +95,7 @@
Location is components/services/install. It is not part of the default
build right now.
2000-04-18 Andy Hertzfeld <andy@eazel.com>
2000-04-18 Andy Hertzfeld <andy@eazel.com>
made clicking on gmc-style URL files redirect to the specified URL.
......@@ -36,17 +113,19 @@
* configure.in: Added "no" to ALL_LINGUAS.
2000-04-18 Gene Z. Ragan <gzr@eazel.com>
Added functionality to allow files to be renamed in icov view. This feature is
available by either context click on the icon or selecting a single file and choosing "Rename" form the File menu.
2000-04-18 Gene Z. Ragan <gzr@eazel.com>
Added functionality to allow files to be renamed in icon view.
This feature is available by either context click on the icon or
selecting a single file and choosing "Rename" form the File menu.
* libnautilus-extensions/nautilus-icon-text-item.c
* libnautilus-extensions/nautilus-icon-text-item.h: New files.
This is an editable icon text item used in the renaming feature.
It is based on GnomeIconTextItem but modified to fix bugs in the
original code and add extended functionality need by nautilus. If
thse changes were rolled into the current GnomeIconTextItem, it would
break gmc.
It is based on GnomeIconTextItem but modified to fix bugs in the
original code and add extended functionality need by nautilus. If
thse changes were rolled into the current GnomeIconTextItem, it
would break gmc.
* libnautilus-extensions/Makefile.am
Modified file so that the two new files listed above would properly
......@@ -54,85 +133,105 @@
* libnautilus-extensions/nautilus-icon-canvas-item.c
Split text class variable into two variables, editable_text and
additonal_text. editable_text refers to attributes that the user can change
via rename in place. additional_text is any other text that the user cannot
edit via the rename in place feature. Added a boolean flag, is_renaming, to
check against during various operations that effect the renaming feature.
Removed ARG_TEXT argument ID and replaced with ARG_EDITABLE_TEXT and
ARG_ADDITIONAL_TEXT.
(nautilus_icon_canvas_item_initialize_class): Function now check for both
ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT. Removed check for ARG_TEXT.
(nautilus_icon_canvas_item_destroy): Both editable_text and
additonal_text are freed.
(nautilus_icon_canvas_item_set_arg): Removed ARG_TEXT and added
additonal_text. editable_text refers to attributes that the user
can change via rename in place. additional_text is any other text
that the user cannot edit via the rename in place feature. Added
a boolean flag, is_renaming, to check against during various
operations that effect the renaming feature. Removed ARG_TEXT
argument ID and replaced with ARG_EDITABLE_TEXT and
ARG_ADDITIONAL_TEXT.
(nautilus_icon_canvas_item_initialize_class): Function now check
for both ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT. Removed check
for ARG_TEXT.
(nautilus_icon_canvas_item_destroy): Both editable_text and
additonal_text are freed.
(nautilus_icon_canvas_item_set_arg): Removed ARG_TEXT and added
handling of ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT.
(nautilus_icon_canvas_item_get_arg): Removed ARG_TEXT and added
(nautilus_icon_canvas_item_get_arg): Removed ARG_TEXT and added
handling of ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT.
(draw_or_measure_label_text): Modified function to not draw the label
icon text if we are renaming in place.
(draw_or_measure_label_text): Function now combines editable and additional
text when performing the measuring operation.
(compute_editable_text_rectangle): Added function to compute bounds of
editable text. This is used to determine size and placement of editable
text item when in renaming mode.
(nautilus_icon_canvas_get_text_bounds): Public API to get bounds of
icon label text.
(nautilus_icon_canvas_get_editable_text_bounds): Public API to get bounds of
editable icon label text.
(draw_or_measure_label_text): Modified function to not draw the
label icon text if we are renaming in place.
(draw_or_measure_label_text): Function now combines editable and
additional text when performing the measuring operation.
(compute_editable_text_rectangle): Added function to compute
bounds of editable text. This is used to determine size and
placement of editable text item when in renaming mode.
(nautilus_icon_canvas_get_text_bounds): Public API to get bounds
of icon label text.
(nautilus_icon_canvas_get_editable_text_bounds): Public API to get
bounds of editable icon label text.
(hit_test_pixbuf): Added check against is_renaming flag.
(nautilus_icon_canvas_get_editable_text): Public API to get editable text string.
(nautilus_icon_canvas_item_set_renaming): Public API to toggle is_renaming flag.
(nautilus_icon_canvas_get_editable_text): Public API to get
editable text string.
(nautilus_icon_canvas_item_set_renaming): Public API to toggle
is_renaming flag.
* libnautilus-extensions/nautilus-icon-canvas-item.h
Added public API prototypes to functions described above.
* libnautilus-extensions/nautilus-icon-container.c
Added GET_ICON_EDITABLE_TEXT and GET_ICON_ADDITONAL_TEXT signals.
Removed GET_ICON_TEXT signal. Added ICON_TEXT_CHANGED signal.
(icon_toggle_selected): Renaming mode is now exited when a selection/deselection occurs.
(key_press_event): GDK_Return ends rename mode and attempts to accept modification. GDK_Escpae
ends rename mode and reverts modification to original.
(nautilus_icon_container_initialize_class): icon_text_changed, get_icon_editable_text and
get_icon_additional_text signals are registered.
(editing_started): New function. Called when an edit begins. Inits class member variables
for edit mode.
(editing_stopped): New function. Called when edit ends. Cleans up edit mode.
Removed GET_ICON_TEXT signal. Added ICON_TEXT_CHANGED signal.
(icon_toggle_selected): Renaming mode is now exited when a
selection/deselection occurs.
(key_press_event): GDK_Return ends rename mode and attempts to
accept modification. GDK_Escape ends rename mode and reverts
modification to original.
(nautilus_icon_container_initialize_class): icon_text_changed,
get_icon_editable_text and get_icon_additional_text signals are
registered.
(editing_started): New function. Called when an edit begins.
Inits class member variables for edit mode.
(editing_stopped): New function. Called when edit ends. Cleans
up edit mode.
(nautilus_icon_container_initialize): rename_widget and original_text private variables
are set to NULL.
(icon_toggle_selected): Added call to end_renaming_mode.
(nautilus_icon_container_update_icon): Added emitting of GET_ICON_EDITABLE_TEXT and
GET_ICON_ADDITIONAL_TEXT signals. Updated gnome_canvas_item_set to use new arguments defined
in nautilus-icon-text-item.
(nautilus_icon_container_show_rename_widget): New function. Creates and displays renaming_widget.
Creates cached copy of original editable text for later compare, connects signals and enters
renaming mode.
(end_renaming_mode): New function. Cleans up and end renaiming mode.
(hide_rename_widget): Called by end_renaming_mode to hide and free renaming_widget.
(icon_toggle_selected): Added call to end_renaming_mode.
(nautilus_icon_container_update_icon): Added emitting of
GET_ICON_EDITABLE_TEXT and GET_ICON_ADDITIONAL_TEXT
signals. Updated gnome_canvas_item_set to use new arguments
defined in nautilus-icon-text-item.
(nautilus_icon_container_show_rename_widget): New
function. Creates and displays renaming_widget. Creates cached
copy of original editable text for later compare, connects signals
and enters renaming mode.
(end_renaming_mode): New function. Cleans up and end renaming
mode.
(hide_rename_widget): Called by end_renaming_mode to hide and free
renaming_widget.
* libnautilus-extensions/nautilus-icon-container.h
Added prototypes for public functions described above.
* libnautilus-extensions/nautilus-icon-private.h
Added boolean for renaming. Added a NautilusIconTextItem variable for the renaiming widget.
Added boolean for renaming. Added a NautilusIconTextItem variable
for the renaiming widget.
* src/file-manager/fm-icon-view.c
Added defines MENU_PATH_RENAME. Added a char * to hold original editable text for a later compare.
Removed get_icon_text_callback and added get_icon_editable_text_callback and
get_icon_additonal_text_callback. These return the editable and additonal text of the icon view.
(rename_icon_callback): Added callback that attempts to rename the NautilusFile the icon view
represents. Action in not taken if there has been no change to the editable text. If the operation
Added defines MENU_PATH_RENAME. Added a char * to hold original
editable text for a later compare. Removed get_icon_text_callback
and added get_icon_editable_text_callback and
get_icon_additonal_text_callback. These return the editable and
additonal text of the icon view.
(rename_icon_callback): Added callback that attempts to rename the
NautilusFile the icon view represents. Action in not taken if
there has been no change to the editable text. If the operation
fails, the user is notified.
(fm_icon_view_append_selection_context_menu_items): Added Rename menu item.
(append_bonobo_menu_item): Added Rename menu item and callback.
(update_bonobo_menu_item): Added senesitivity check for the Rename item. It is
enabled only if a single item is selected.
(fm_icon_view_icon_text_changed_callback): Added function to attempt to change the filename
to the new text. Notify user if operation fails.
(get_icon_editable_text_callback): This callback returns the text items that areeditable by
the user using the "Rename" command. In the case of FMIconView, this
would be the attribute with the name "name".
(get_icon_additional_text_callback): This callback returns the text items that are not
editable by the user using the "Rename" command.
(fm_icon_view_append_selection_context_menu_items): Added Rename
menu item.
(append_bonobo_menu_item): Added Rename menu item and callback.
(update_bonobo_menu_item): Added sensitivity check for the Rename
item. It is enabled only if a single item is selected.
(fm_icon_view_icon_text_changed_callback): Added function to
attempt to change the filename to the new text. Notify user if
operation fails.
(get_icon_editable_text_callback): This callback returns the text
items that are editable by the user using the "Rename" command. In
the case of FMIconView, this would be the attribute with the name
"name".
(get_icon_additional_text_callback): This callback returns the
text items that are not editable by the user using the "Rename"
command.
2000-04-18 John Sullivan <sullivan@eazel.com>
......@@ -250,7 +349,7 @@
* icons/gnome-package: new icon for tar archives
* data/mime/nautilus.keys:
added icon-filename entries to appropriate mime-types
2000-04-14 Darin Adler <darin@eazel.com>
* libnautilus-extensions/nautilus-string.c:
......
......@@ -75,6 +75,34 @@ nautilus_strdup_strftime (const char *format, struct tm *time_pieces)
return result;
}
/**
* nautilus_g_list_exactly_one_item
*
* Like g_list_length (list) == 1, only O(1) instead of O(n).
* @list: List.
*
* Return value: TRUE if the list has exactly one item.
**/
gboolean
nautilus_g_list_exactly_one_item (GList *list)
{
return list != NULL && list->next == NULL;
}
/**
* nautilus_g_list_more_than_one_item
*
* Like g_list_length (list) > 1, only O(1) instead of O(n).
* @list: List.
*
* Return value: TRUE if the list has more than one item.
**/
gboolean
nautilus_g_list_more_than_one_item (GList *list)
{
return list != NULL && list->next != NULL;
}
/**
* nautilus_g_list_equal
*
......
......@@ -34,20 +34,22 @@
#define NAUTILUS_N_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))
/* Date & time functions. */
GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
char * nautilus_strdup_strftime (const char *format,
struct tm *time_pieces);
GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
char * nautilus_strdup_strftime (const char *format,
struct tm *time_pieces);
/* List functions. */
gboolean nautilus_g_list_equal (GList *list_a,
GList *list_b);
void nautilus_g_list_free_deep (GList *list);
void nautilus_g_list_safe_for_each (GList *list,
GFunc function,
gpointer user_data);
gboolean nautilus_g_list_exactly_one_item (GList *list);
gboolean nautilus_g_list_more_than_one_item (GList *list);
gboolean nautilus_g_list_equal (GList *list_a,
GList *list_b);
void nautilus_g_list_free_deep (GList *list);
void nautilus_g_list_safe_for_each (GList *list,
GFunc function,
gpointer user_data);
/* NULL terminated string arrays (strv). */
int nautilus_g_strv_find (char **strv,
const char *find_me);
int nautilus_g_strv_find (char **strv,
const char *find_me);
#endif /* NAUTILUS_GLIB_EXTENSIONS_H */
......@@ -567,10 +567,10 @@ nautilus_icon_canvas_item_update (GnomeCanvasItem *item,
/* routine to underline the text in a gnome_icon_text structure */
static void
gnome_icon_underline_text (GnomeIconTextInfo *text_info, GdkDrawable *drawable, GdkGC *gc, gint x, gint y)
gnome_icon_underline_text (GnomeIconTextInfo *text_info, GdkDrawable *drawable, GdkGC *gc, int x, int y)
{
GList *item;
gint text_width;
int text_width;
GnomeIconTextInfoRow *row;
int xpos;
......@@ -605,19 +605,29 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
char **pieces;
const char *text_piece;
int i;
gchar *combined_text;
char *combined_text;
gboolean have_editable, have_additional;
details = item->details;
if (details->font == NULL || details->editable_text == NULL || details->editable_text[0] == '\0'
|| details->additional_text == NULL) {
have_editable = details->editable_text != NULL
&& details->editable_text[0] != '\0';
have_additional = details->additional_text != NULL
&& details->additional_text[0] != '\0';
/* No font or no text, then do no work. */
if (details->font == NULL || (!have_editable && !have_additional)) {
details->text_height = 0;
details->text_width = 0;
return;
}
/* Combine editable and additonal text for processing */
combined_text = g_strdup_printf("%s%s", details->editable_text, details->additional_text);
/* Combine editable and additional text for processing */
combined_text = g_strconcat
(have_editable ? details->editable_text : "",
(have_editable && have_additional) ? "\n" : "",
have_additional ? details->additional_text : "",
NULL);
width_so_far = 0;
height_so_far = 0;
......@@ -628,9 +638,9 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
}
max_text_width = floor (MAX_TEXT_WIDTH * GNOME_CANVAS_ITEM (item)->canvas->pixels_per_unit);
pieces = g_strsplit (combined_text, "\n", 0);
for (i = 0; (text_piece = pieces[i]) != NULL; i++) {
/* Replace empty string with space for measurement and drawing.
* This makes empty lines appear, instead of being collapsed out.
......@@ -651,10 +661,12 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
/* if it's selected, embolden the text by drawing again offset by one pixel */
if (details->is_highlighted_for_selection || details->is_highlighted_for_drop)
gnome_icon_paint_text (icon_text_info, drawable, gc,
text_left + 1, icon_bottom + height_so_far, GTK_JUSTIFY_CENTER);
text_left + 1, icon_bottom + height_so_far, GTK_JUSTIFY_CENTER);
/* if it's prelit, underline the text */
if (details->is_prelit)
gnome_icon_underline_text (icon_text_info, drawable, gc, text_left + 1, icon_bottom + height_so_far);
if (details->is_prelit) {
gnome_icon_underline_text (icon_text_info, drawable, gc, text_left + 1, icon_bottom + height_so_far);
}
}
width_so_far = MAX (width_so_far, icon_text_info->width);
......@@ -667,7 +679,6 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
height_so_far += 2; /* extra slop for nicer highlighting */
if (drawable != NULL) {
/* Current calculations should match what we measured before drawing.
* This assumes that we will always make a separate call to measure
* before the call to draw. We might later decide to use this function
......@@ -688,15 +699,13 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
}
gdk_gc_unref (gc);
}
else
{
} else {
/* If measuring, remember the width & height. */
details->text_width = width_so_far;
details->text_height = height_so_far;
}
g_free(combined_text);
g_free (combined_text);
}
static void
......@@ -1083,13 +1092,15 @@ compute_text_rectangle (NautilusIconCanvasItem *item, const ArtIRect *icon_rect,
static void
compute_editable_text_rectangle (NautilusIconCanvasItem *item, const ArtIRect *icon_rect, ArtIRect *text_rect)
{
gint text_width, text_height;
int text_width, text_height;
g_assert (item->details->editable_text != NULL);
/* Get editale text dimensions */
text_width = gdk_text_width(item->details->font, item->details->editable_text,
strlen(item->details->editable_text));
text_height = gdk_text_height(item->details->font, item->details->editable_text,
strlen(item->details->editable_text));
/* Get editable text dimensions */
text_width = gdk_text_width (item->details->font, item->details->editable_text,
strlen (item->details->editable_text));
text_height = gdk_text_height (item->details->font, item->details->editable_text,
strlen (item->details->editable_text));
/* Compute text rectangle. */
text_rect->x0 = (icon_rect->x0 + icon_rect->x1) / 2 - text_width / 2;
......@@ -1392,45 +1403,53 @@ nautilus_icon_canvas_item_hit_test_rectangle (NautilusIconCanvasItem *item,
return hit_test (item, &canvas_rect);
}
/* Return coordinates of icon text location */
void
nautilus_icon_canvas_get_text_bounds(NautilusIconCanvasItem *icon_item, ArtIRect *text_rect)
nautilus_icon_canvas_get_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect)
{
ArtIRect icon_rect;
g_assert(icon_item != NULL);
g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (icon_item));
g_return_if_fail (text_rect != NULL);
get_icon_canvas_rectangle (icon_item, &icon_rect);
compute_text_rectangle (icon_item, &icon_rect, text_rect);
}
/* Return coordinates of icon editable_text location */
void
nautilus_icon_canvas_get_editable_text_bounds(NautilusIconCanvasItem *icon_item, ArtIRect *text_rect)
nautilus_icon_canvas_get_editable_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect)
{
ArtIRect icon_rect;
g_assert(icon_item != NULL);
g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (icon_item));
g_return_if_fail (icon_item->details->editable_text != NULL);
g_return_if_fail (text_rect != NULL);
get_icon_canvas_rectangle (icon_item, &icon_rect);
compute_editable_text_rectangle (icon_item, &icon_rect, text_rect);
}
const char *
nautilus_icon_canvas_get_editable_text(NautilusIconCanvasItem *icon_item)
nautilus_icon_canvas_get_editable_text (NautilusIconCanvasItem *icon_item)
{
g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (icon_item), NULL);
return icon_item->details->editable_text;
}
void
nautilus_icon_canvas_item_set_renaming (NautilusIconCanvasItem *item, gboolean state )
nautilus_icon_canvas_item_set_renaming (NautilusIconCanvasItem *item, gboolean state)
{
g_return_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item));
g_return_if_fail (state == FALSE || state == TRUE);
if (item->details->is_renaming == state) {
return;
}
item->details->is_renaming = state;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (item));
}
......@@ -60,35 +60,34 @@ struct NautilusIconCanvasItemClass {
};
/* GtkObject */
GtkType nautilus_icon_canvas_item_get_type (void);
GtkType nautilus_icon_canvas_item_get_type (void);
/* attributes */
void nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
GdkPixbuf *image,
const ArtIRect *embedded_text_rectangle);
GdkPixbuf *nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
ArtIRect *embedded_text_rectangle);
void nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
GList *emblem_pixbufs);
void nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
gboolean show_stretch_handles);
void nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
GdkPixbuf *image,
const ArtIRect *embedded_text_rectangle);
GdkPixbuf * nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
ArtIRect *embedded_text_rectangle);
void nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
GList *emblem_pixbufs);
void nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
gboolean show_stretch_handles);
/* geometry and hit testing */
gboolean nautilus_icon_canvas_item_hit_test_rectangle (NautilusIconCanvasItem *item,
const ArtDRect *world_rectangle);
gboolean nautilus_icon_canvas_item_hit_test_stretch_handles (NautilusIconCanvasItem *item,
const ArtPoint *world_point);
void nautilus_icon_canvas_item_get_icon_rectangle (NautilusIconCanvasItem *item,
ArtDRect *world_rectangle);
void nautilus_icon_canvas_item_update_bounds (NautilusIconCanvasItem *item);
void nautilus_icon_canvas_get_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect);
void nautilus_icon_canvas_get_editable_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect);
const char *nautilus_icon_canvas_get_editable_text (NautilusIconCanvasItem *icon_item);
void nautilus_icon_canvas_item_set_renaming (NautilusIconCanvasItem *icon_item, gboolean state);
gboolean nautilus_icon_canvas_item_hit_test_rectangle (NautilusIconCanvasItem *item,
const ArtDRect *world_rectangle);
gboolean nautilus_icon_canvas_item_hit_test_stretch_handles (NautilusIconCanvasItem *item,
const ArtPoint *world_point);
void nautilus_icon_canvas_item_get_icon_rectangle (NautilusIconCanvasItem *item,
ArtDRect *world_rectangle);
void nautilus_icon_canvas_item_update_bounds (NautilusIconCanvasItem *item);
void nautilus_icon_canvas_get_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect);
void nautilus_icon_canvas_get_editable_text_bounds (NautilusIconCanvasItem *icon_item,
ArtIRect *text_rect);
const char *nautilus_icon_canvas_get_editable_text (NautilusIconCanvasItem *icon_item);
void nautilus_icon_canvas_item_set_renaming (NautilusIconCanvasItem *icon_item,
gboolean state);
END_GNOME_DECLS
......
......@@ -1845,7 +1845,7 @@ nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_STRING);
GTK_TYPE_STRING);
signals[GET_ICON_IMAGES]
= gtk_signal_new ("get_icon_images",
GTK_RUN_LAST,
......@@ -1896,37 +1896,37 @@ nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
GTK_TYPE_STRING);
signals[MOVE_COPY_ITEMS]
= gtk_signal_new ("move_copy_items",
GTK_RUN_LAST,
object_class->type,