Commit 18c32d0a authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Cosimo Cecchi

Unbreak typeahead find for 33% zoom level (#341708).

2009-03-18  Cosimo Cecchi  <cosimoc@gnome.org>

	* libnautilus-private/nautilus-icon-container.c:
	(nautilus_icon_container_get_icon_text),
	(nautilus_icon_container_search_iter),
	(nautilus_icon_container_update_icon):
	* libnautilus-private/nautilus-icon-container.h:
	* src/file-manager/fm-icon-container.c:
	(fm_icon_container_get_icon_text):
	Unbreak typeahead find for 33% zoom level (#341708).

svn path=/trunk/; revision=15136
parent bae20f54
2009-03-18 Cosimo Cecchi <cosimoc@gnome.org>
* libnautilus-private/nautilus-icon-container.c:
(nautilus_icon_container_get_icon_text),
(nautilus_icon_container_search_iter),
(nautilus_icon_container_update_icon):
* libnautilus-private/nautilus-icon-container.h:
* src/file-manager/fm-icon-container.c:
(fm_icon_container_get_icon_text):
Unbreak typeahead find for 33% zoom level (#341708).
2009-03-18 Cosimo Cecchi <cosimoc@gnome.org> 2009-03-18 Cosimo Cecchi <cosimoc@gnome.org>
* src/nautilus-application.c: (open_window), (open_windows), * src/nautilus-application.c: (open_window), (open_windows),
......
...@@ -4907,13 +4907,28 @@ nautilus_icon_container_search_button_press_event (GtkWidget *widget, ...@@ -4907,13 +4907,28 @@ nautilus_icon_container_search_button_press_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
static void
nautilus_icon_container_get_icon_text (NautilusIconContainer *container,
NautilusIconData *data,
char **editable_text,
char **additional_text,
gboolean include_invisible)
{
NautilusIconContainerClass *klass;
klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
g_assert (klass->get_icon_text != NULL);
klass->get_icon_text (container, data, editable_text, additional_text, include_invisible);
}
static gboolean static gboolean
nautilus_icon_container_search_iter (NautilusIconContainer *container, nautilus_icon_container_search_iter (NautilusIconContainer *container,
const char *key, gint n) const char *key, gint n)
{ {
GList *p; GList *p;
NautilusIcon *icon; NautilusIcon *icon;
const char *name; char *name;
int count; int count;
char *normalized_key, *case_normalized_key; char *normalized_key, *case_normalized_key;
char *normalized_name, *case_normalized_name; char *normalized_name, *case_normalized_name;
...@@ -4932,10 +4947,12 @@ nautilus_icon_container_search_iter (NautilusIconContainer *container, ...@@ -4932,10 +4947,12 @@ nautilus_icon_container_search_iter (NautilusIconContainer *container,
} }
icon = NULL; icon = NULL;
name = NULL;
count = 0; count = 0;
for (p = container->details->icons; p != NULL && count != n; p = p->next) { for (p = container->details->icons; p != NULL && count != n; p = p->next) {
icon = p->data; icon = p->data;
name = nautilus_icon_canvas_item_get_editable_text (icon->item); nautilus_icon_container_get_icon_text (container, icon->data, &name,
NULL, TRUE);
/* This can happen if a key event is handled really early while /* This can happen if a key event is handled really early while
* loading the icon container, before the items have all been * loading the icon container, before the items have all been
...@@ -4961,6 +4978,8 @@ nautilus_icon_container_search_iter (NautilusIconContainer *container, ...@@ -4961,6 +4978,8 @@ nautilus_icon_container_search_iter (NautilusIconContainer *container,
} }
g_free (case_normalized_name); g_free (case_normalized_name);
g_free (name);
name = NULL;
} }
g_free (case_normalized_key); g_free (case_normalized_key);
...@@ -6765,21 +6784,6 @@ nautilus_icon_container_get_icon_images (NautilusIconContainer *container, ...@@ -6765,21 +6784,6 @@ nautilus_icon_container_get_icon_images (NautilusIconContainer *container,
return klass->get_icon_images (container, data, size, emblem_pixbufs, embedded_text, for_drag_accept, need_large_embeddded_text, embedded_text_needs_loading, has_open_window); return klass->get_icon_images (container, data, size, emblem_pixbufs, embedded_text, for_drag_accept, need_large_embeddded_text, embedded_text_needs_loading, has_open_window);
} }
static void
nautilus_icon_container_get_icon_text (NautilusIconContainer *container,
NautilusIconData *data,
char **editable_text,
char **additional_text)
{
NautilusIconContainerClass *klass;
klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
g_assert (klass->get_icon_text != NULL);
klass->get_icon_text (container, data, editable_text, additional_text);
}
static void static void
nautilus_icon_container_freeze_updates (NautilusIconContainer *container) nautilus_icon_container_freeze_updates (NautilusIconContainer *container)
{ {
...@@ -6991,7 +6995,8 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, ...@@ -6991,7 +6995,8 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
nautilus_icon_container_get_icon_text (container, nautilus_icon_container_get_icon_text (container,
icon->data, icon->data,
&editable_text, &editable_text,
&additional_text); &additional_text,
FALSE);
/* If name of icon being renamed was changed from elsewhere, end renaming mode. /* If name of icon being renamed was changed from elsewhere, end renaming mode.
* Alternatively, we could replace the characters in the editable text widget * Alternatively, we could replace the characters in the editable text widget
......
...@@ -142,7 +142,8 @@ typedef struct { ...@@ -142,7 +142,8 @@ typedef struct {
void (* get_icon_text) (NautilusIconContainer *container, void (* get_icon_text) (NautilusIconContainer *container,
NautilusIconData *data, NautilusIconData *data,
char **editable_text, char **editable_text,
char **additional_text); char **additional_text,
gboolean include_invisible);
char * (* get_icon_description) (NautilusIconContainer *container, char * (* get_icon_description) (NautilusIconContainer *container,
NautilusIconData *data); NautilusIconData *data);
int (* compare_icons) (NautilusIconContainer *container, int (* compare_icons) (NautilusIconContainer *container,
......
...@@ -283,7 +283,8 @@ static void ...@@ -283,7 +283,8 @@ static void
fm_icon_container_get_icon_text (NautilusIconContainer *container, fm_icon_container_get_icon_text (NautilusIconContainer *container,
NautilusIconData *data, NautilusIconData *data,
char **editable_text, char **editable_text,
char **additional_text) char **additional_text,
gboolean include_invisible)
{ {
char *actual_uri; char *actual_uri;
gchar *description; gchar *description;
...@@ -292,23 +293,30 @@ fm_icon_container_get_icon_text (NautilusIconContainer *container, ...@@ -292,23 +293,30 @@ fm_icon_container_get_icon_text (NautilusIconContainer *container,
int i, j, num_attributes; int i, j, num_attributes;
FMIconView *icon_view; FMIconView *icon_view;
NautilusFile *file; NautilusFile *file;
gboolean use_additional;
file = NAUTILUS_FILE (data); file = NAUTILUS_FILE (data);
g_assert (NAUTILUS_IS_FILE (file)); g_assert (NAUTILUS_IS_FILE (file));
g_assert (editable_text != NULL); g_assert (editable_text != NULL);
g_assert (additional_text != NULL);
icon_view = get_icon_view (container); icon_view = get_icon_view (container);
g_return_if_fail (icon_view != NULL); g_return_if_fail (icon_view != NULL);
use_additional = (additional_text != NULL);
/* In the smallest zoom mode, no text is drawn. */ /* In the smallest zoom mode, no text is drawn. */
if (nautilus_icon_container_get_zoom_level (container) == NAUTILUS_ZOOM_LEVEL_SMALLEST) { if (nautilus_icon_container_get_zoom_level (container) == NAUTILUS_ZOOM_LEVEL_SMALLEST &&
!include_invisible) {
*editable_text = NULL; *editable_text = NULL;
} else { } else {
/* Strip the suffix for nautilus object xml files. */ /* Strip the suffix for nautilus object xml files. */
*editable_text = nautilus_file_get_display_name (file); *editable_text = nautilus_file_get_display_name (file);
} }
if (!use_additional) {
return;
}
if (fm_icon_view_is_compact (icon_view)) { if (fm_icon_view_is_compact (icon_view)) {
*additional_text = NULL; *additional_text = NULL;
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment