gimp r27246 - in branches/soc-2008-tagging: . app/core app/widgets
- From: aurisj svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27246 - in branches/soc-2008-tagging: . app/core app/widgets
- Date: Sun, 12 Oct 2008 18:27:04 +0000 (UTC)
Author: aurisj
Date: Sun Oct 12 18:27:03 2008
New Revision: 27246
URL: http://svn.gnome.org/viewvc/gimp?rev=27246&view=rev
Log:
2008-10-12 Aurimas JuÅka <aurisj svn gnome org>
* app/core/gimpfilteredcontainer.c
* app/core/gimppalette.c
* app/core/gimptagcache.c
* app/widgets/gimptagentry.c
* app/widgets/gimptagpopup.c: rewrote GList iterations using
for instead of while.
Modified:
branches/soc-2008-tagging/ChangeLog
branches/soc-2008-tagging/app/core/gimpfilteredcontainer.c
branches/soc-2008-tagging/app/core/gimppalette.c
branches/soc-2008-tagging/app/core/gimptagcache.c
branches/soc-2008-tagging/app/widgets/gimptagentry.c
branches/soc-2008-tagging/app/widgets/gimptagpopup.c
Modified: branches/soc-2008-tagging/app/core/gimpfilteredcontainer.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimpfilteredcontainer.c (original)
+++ branches/soc-2008-tagging/app/core/gimpfilteredcontainer.c Sun Oct 12 18:27:03 2008
@@ -343,13 +343,12 @@
{
GList *tag_iterator;
- tag_iterator = gimp_tagged_get_tags (tagged);
- while (tag_iterator)
+ for (tag_iterator = gimp_tagged_get_tags (tagged); tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
gimp_filtered_container_tag_added (tagged,
GIMP_TAG (tag_iterator->data),
filtered_container);
- tag_iterator = g_list_next (tag_iterator);
}
g_signal_connect (tagged, "tag-added",
@@ -373,13 +372,12 @@
G_CALLBACK (gimp_filtered_container_tag_removed),
filtered_container);
- tag_iterator = gimp_tagged_get_tags (tagged);
- while (tag_iterator)
+ for (tag_iterator = gimp_tagged_get_tags (tagged); tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
gimp_filtered_container_tag_removed (tagged,
GIMP_TAG (tag_iterator->data),
filtered_container);
- tag_iterator = g_list_next (tag_iterator);
}
}
Modified: branches/soc-2008-tagging/app/core/gimppalette.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimppalette.c (original)
+++ branches/soc-2008-tagging/app/core/gimppalette.c Sun Oct 12 18:27:03 2008
@@ -345,13 +345,12 @@
checksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (checksum, (const guchar *) &palette->n_colors,
sizeof (palette->n_colors));
- color_iterator = palette->colors;
- while (color_iterator)
+ for (color_iterator = palette->colors; color_iterator;
+ color_iterator = g_list_next (color_iterator))
{
entry = (GimpPaletteEntry *) color_iterator->data;
g_checksum_update (checksum, (const guchar *) &entry->color,
sizeof (entry->color));
- color_iterator = g_list_next (color_iterator);
}
checksum_string = g_strdup (g_checksum_get_string (checksum));
g_checksum_free (checksum);
Modified: branches/soc-2008-tagging/app/core/gimptagcache.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimptagcache.c (original)
+++ branches/soc-2008-tagging/app/core/gimptagcache.c Sun Oct 12 18:27:03 2008
@@ -228,12 +228,10 @@
if (rec->identifier == identifier_quark)
{
- tag_iterator = rec->tags;
- while (tag_iterator)
+ for (tag_iterator = rec->tags; tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
gimp_tagged_add_tag (tagged, GIMP_TAG (tag_iterator->data));
-
- tag_iterator = g_list_next (tag_iterator);
}
rec->referenced = TRUE;
return;
@@ -259,12 +257,10 @@
g_quark_to_string (identifier_quark));
rec->identifier = identifier_quark;
- tag_iterator = rec->tags;
- while (tag_iterator)
+ for (tag_iterator = rec->tags; tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
gimp_tagged_add_tag (tagged, GIMP_TAG (tag_iterator->data));
-
- tag_iterator = g_list_next (tag_iterator);
}
rec->referenced = TRUE;
return;
@@ -338,19 +334,18 @@
}
}
- iterator = cache->containers;
- while (iterator)
+ for (iterator = cache->containers; iterator;
+ iterator = g_list_next (iterator))
{
gimp_container_foreach (GIMP_CONTAINER (iterator->data),
(GFunc) tagged_to_cache_record_foreach, &saved_records);
- iterator = g_list_next (iterator);
}
buf = g_string_new ("");
g_string_append (buf, "<?xml version='1.0' encoding='UTF-8'?>\n");
g_string_append (buf, "<tag_cache>\n");
- iterator = saved_records;
- while (iterator)
+ for (iterator = saved_records; iterator;
+ iterator = g_list_next (iterator))
{
GimpTagCacheRecord *cache_rec = (GimpTagCacheRecord*) iterator->data;
GList *tag_iterator;
@@ -363,18 +358,14 @@
g_quark_to_string (cache_rec->checksum));
g_free (identifier_string);
- tag_iterator = cache_rec->tags;
- while (tag_iterator)
+ for (tag_iterator = cache_rec->tags; tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
tag_string = g_markup_escape_text (gimp_tag_get_name (GIMP_TAG (tag_iterator->data)), -1);
g_string_append_printf (buf, "\t\t<tag>%s</tag>\n", tag_string);
g_free (tag_string);
- tag_iterator = g_list_next (tag_iterator);
}
g_string_append (buf, "\t</resource>\n");
-
-
- iterator = g_list_next (iterator);
}
g_string_append (buf, "</tag_cache>\n");
@@ -389,13 +380,12 @@
g_free (filename);
g_string_free (buf, TRUE);
- iterator = saved_records;
- while (iterator)
+ for (iterator = saved_records; iterator;
+ iterator = g_list_next (iterator))
{
GimpTagCacheRecord *cache_rec = (GimpTagCacheRecord*) iterator->data;
g_list_free (cache_rec->tags);
g_free (cache_rec);
- iterator = g_list_next (iterator);
}
g_list_free (saved_records);
}
Modified: branches/soc-2008-tagging/app/widgets/gimptagentry.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagentry.c (original)
+++ branches/soc-2008-tagging/app/widgets/gimptagentry.c Sun Oct 12 18:27:03 2008
@@ -385,16 +385,14 @@
selection_end, selection_end);
}
- iterator = tag_entry->selected_items;
- while (iterator)
+ for (iterator = tag_entry->selected_items; iterator;
+ iterator = g_list_next (iterator))
{
if (gimp_container_have (GIMP_CONTAINER (tag_entry->filtered_container),
GIMP_OBJECT(iterator->data)))
{
break;
}
-
- iterator = g_list_next (iterator);
}
if (tag_entry->mode == GIMP_TAG_ENTRY_MODE_ASSIGN
@@ -747,12 +745,11 @@
}
g_strfreev (parsed_tags);
- selected_iterator = tag_entry->selected_items;
- while (selected_iterator)
+ for (selected_iterator = tag_entry->selected_items; selected_iterator;
+ selected_iterator = g_list_next (selected_iterator))
{
selected_item = GIMP_TAGGED (selected_iterator->data);
gimp_tag_entry_item_set_tags (selected_item, tag_list);
- selected_iterator = g_list_next (selected_iterator);
}
g_list_free (tag_list);
}
@@ -765,20 +762,17 @@
GList *tags_iterator;
old_tags = g_list_copy (gimp_tagged_get_tags (tagged));
- tags_iterator = old_tags;
- while (tags_iterator)
+ for (tags_iterator = old_tags; tags_iterator;
+ tags_iterator = g_list_next (tags_iterator))
{
gimp_tagged_remove_tag (tagged, GIMP_TAG (tags_iterator->data));
- tags_iterator = g_list_next (tags_iterator);
}
g_list_free (old_tags);
- tags_iterator = tags;
- while (tags_iterator)
+ for (tags_iterator = tags; tags_iterator;
+ tags_iterator = g_list_next (tags_iterator))
{
- printf ("tagged: %s\n", gimp_tag_get_name (GIMP_TAG (tags_iterator->data)));
gimp_tagged_add_tag (tagged, GIMP_TAG (tags_iterator->data));
- tags_iterator = g_list_next (tags_iterator);
}
}
@@ -872,8 +866,8 @@
tag_entry->selected_items = g_list_copy (items);
- iterator = tag_entry->selected_items;
- while (iterator)
+ for (iterator = tag_entry->selected_items; iterator;
+ iterator = g_list_next (iterator))
{
if (gimp_tagged_get_tags (GIMP_TAGGED (iterator->data))
&& gimp_container_have (GIMP_CONTAINER (tag_entry->filtered_container),
@@ -881,8 +875,6 @@
{
break;
}
-
- iterator = g_list_next (iterator);
}
if (tag_entry->mode == GIMP_TAG_ENTRY_MODE_ASSIGN)
@@ -930,8 +922,8 @@
{
tag_list = g_list_sort (tag_list, gimp_tag_compare_func);
}
- tag_iterator = tag_list;
- while (tag_iterator)
+ for (tag_iterator = tag_list; tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
tag = GIMP_TAG (tag_iterator->data);
text = g_strdup_printf ("%s%s ", gimp_tag_get_name (tag), gimp_tag_entry_get_separator ());
@@ -940,8 +932,6 @@
&insert_pos);
tag_entry->internal_operation--;
g_free (text);
-
- tag_iterator = g_list_next (tag_iterator);
}
g_list_free (tag_list);
@@ -1013,9 +1003,9 @@
}
all_tags = g_hash_table_get_keys (tag_entry->filtered_container->tag_ref_counts);
- tag_iterator = all_tags;
length = g_strv_length (used_tags);
- while (tag_iterator)
+ for (tag_iterator = all_tags; tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
tag = GIMP_TAG (tag_iterator->data);
tag_name = gimp_tag_get_name (tag);
@@ -1035,7 +1025,6 @@
candidates = g_list_append (candidates, tag_iterator->data);
}
}
- tag_iterator = g_list_next (tag_iterator);
}
g_list_free (all_tags);
g_free (prefix);
@@ -1156,7 +1145,8 @@
{
GList *selected_iterator = tag_entry->selected_items;
- while (selected_iterator)
+ for (selected_iterator = tag_entry->selected_items; selected_iterator;
+ selected_iterator = g_list_next (selected_iterator))
{
if (gimp_tagged_get_tags (GIMP_TAGGED (selected_iterator->data))
&& gimp_container_have (GIMP_CONTAINER (tag_entry->filtered_container),
@@ -1164,7 +1154,6 @@
{
break;
}
- selected_iterator = g_list_next (selected_iterator);
}
if (! selected_iterator)
{
@@ -1634,8 +1623,8 @@
g_free (last_item);
}
- tags_iterator = tag_entry->recent_list;
- while (tags_iterator)
+ for (tags_iterator = tag_entry->recent_list; tags_iterator;
+ tags_iterator = g_list_next (tags_iterator))
{
if (! strcmp (tags_string, tags_iterator->data))
{
@@ -1644,7 +1633,6 @@
recent_item);
break;
}
- tags_iterator = g_list_next (tags_iterator);
}
if (! recent_item)
Modified: branches/soc-2008-tagging/app/widgets/gimptagpopup.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagpopup.c (original)
+++ branches/soc-2008-tagging/app/widgets/gimptagpopup.c Sun Oct 12 18:27:03 2008
@@ -435,12 +435,11 @@
tag_data->bounds.x = width - tag_data->bounds.x - tag_data->bounds.width;
}
- iterator = tag_popup->close_rectangles;
- while (iterator)
+ for (iterator = tag_popup->close_rectangles; iterator;
+ iterator = g_list_next (iterator))
{
GdkRectangle *rect = (GdkRectangle *) iterator->data;
rect->x = width - rect->x - rect->width;
- iterator = g_list_next (iterator);
}
}
height = y + line_height + GIMP_TAG_POPUP_MARGIN;
@@ -745,9 +744,10 @@
if (i == tag_popup->tag_count)
{
- GList *iterator = tag_popup->close_rectangles;
+ GList *iterator;
- while (iterator)
+ for (iterator = tag_popup->close_rectangles; iterator;
+ iterator = g_list_next (iterator))
{
bounds = (GdkRectangle *) iterator->data;
if (x >= bounds->x
@@ -758,8 +758,6 @@
gtk_widget_destroy (GTK_WIDGET (tag_popup));
break;
}
-
- iterator = g_list_next (iterator);
}
}
}
@@ -926,8 +924,8 @@
PopupTagData search_key;
PopupTagData *search_result;
- tag_iterator = gimp_tagged_get_tags (tagged);
- while (tag_iterator)
+ for (tag_iterator = gimp_tagged_get_tags (tagged); tag_iterator;
+ tag_iterator = g_list_next (tag_iterator))
{
search_key.tag = GIMP_TAG (tag_iterator->data);
search_result =
@@ -940,8 +938,6 @@
search_result->state = GTK_STATE_NORMAL;
}
}
-
- tag_iterator = g_list_next (tag_iterator);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]