gimp r28094 - in trunk: . app/core app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r28094 - in trunk: . app/core app/widgets
- Date: Mon, 2 Mar 2009 21:48:50 +0000 (UTC)
Author: mitch
Date: Mon Mar 2 21:48:50 2009
New Revision: 28094
URL: http://svn.gnome.org/viewvc/gimp?rev=28094&view=rev
Log:
2009-03-02 Michael Natterer <mitch gimp org>
* app/core/gimptagged.[ch]: add gimp_tagged_set_tags() which
takes a GList of tags.
* app/widgets/gimptagentry.c (gimp_tag_entry_assign_tags): use it.
(gimp_tag_entry_item_set_tags): remove.
Modified:
trunk/ChangeLog
trunk/app/core/gimptagged.c
trunk/app/core/gimptagged.h
trunk/app/widgets/gimptagentry.c
Modified: trunk/app/core/gimptagged.c
==============================================================================
--- trunk/app/core/gimptagged.c (original)
+++ trunk/app/core/gimptagged.c Mon Mar 2 21:48:50 2009
@@ -36,6 +36,7 @@
LAST_SIGNAL
};
+
static void gimp_tagged_base_init (gpointer klass);
static guint gimp_tagged_signals[LAST_SIGNAL] = { 0, };
@@ -80,6 +81,7 @@
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_TAG);
+
gimp_tagged_signals[TAG_REMOVED] =
g_signal_new ("tag-removed",
GIMP_TYPE_TAGGED,
@@ -104,8 +106,8 @@
* object.
**/
void
-gimp_tagged_add_tag (GimpTagged *tagged,
- GimpTag *tag)
+gimp_tagged_add_tag (GimpTagged *tagged,
+ GimpTag *tag)
{
g_return_if_fail (GIMP_IS_TAGGED (tagged));
@@ -137,6 +139,40 @@
}
/**
+ * gimp_tagged_set_tags:
+ * @tagged: an object that implements the %GimpTagged interface
+ * @tags: a list of tags
+ *
+ * Sets the list of tags assigned to this object. The passed list of
+ * tags is copied and should be freed by the caller.
+ **/
+void
+gimp_tagged_set_tags (GimpTagged *tagged,
+ GList *tags)
+{
+ GList *old_tags;
+ GList *list;
+
+ g_return_if_fail (GIMP_IS_TAGGED (tagged));
+
+ old_tags = g_list_copy (gimp_tagged_get_tags (tagged));
+
+ for (list = old_tags; list; list = g_list_next (list))
+ {
+ gimp_tagged_remove_tag (tagged, list->data);
+ }
+
+ g_list_free (old_tags);
+
+ for (list = tags; list; list = g_list_next (list))
+ {
+ g_return_if_fail (GIMP_IS_TAG (list->data));
+
+ gimp_tagged_add_tag (tagged, list->data);
+ }
+}
+
+/**
* gimp_tagged_get_tags:
* @tagged: an object that implements the %GimpTagged interface
*
Modified: trunk/app/core/gimptagged.h
==============================================================================
--- trunk/app/core/gimptagged.h (original)
+++ trunk/app/core/gimptagged.h Mon Mar 2 21:48:50 2009
@@ -57,7 +57,11 @@
GimpTag *tag);
void gimp_tagged_remove_tag (GimpTagged *tagged,
GimpTag *tag);
+
+void gimp_tagged_set_tags (GimpTagged *tagged,
+ GList *tags);
GList * gimp_tagged_get_tags (GimpTagged *tagged);
+
gchar * gimp_tagged_get_identifier (GimpTagged *tagged);
gchar * gimp_tagged_get_checksum (GimpTagged *tagged);
Modified: trunk/app/widgets/gimptagentry.c
==============================================================================
--- trunk/app/widgets/gimptagentry.c (original)
+++ trunk/app/widgets/gimptagentry.c Mon Mar 2 21:48:50 2009
@@ -93,8 +93,6 @@
static gboolean gimp_tag_entry_query_tag (GimpTagEntry *entry);
static void gimp_tag_entry_assign_tags (GimpTagEntry *entry);
-static void gimp_tag_entry_item_set_tags (GimpTagged *entry,
- GList *tags);
static void gimp_tag_entry_load_selection (GimpTagEntry *entry,
gboolean sort);
@@ -720,15 +718,15 @@
static void
gimp_tag_entry_assign_tags (GimpTagEntry *tag_entry)
{
- GList *selected_iterator = NULL;
- GimpTagged *selected_item;
- gchar **parsed_tags;
- gint count;
- gint i;
- GimpTag *tag;
- GList *tag_list = NULL;
+ GList *selected_iterator = NULL;
+ gchar **parsed_tags;
+ gint count;
+ gint i;
+ GimpTag *tag;
+ GList *tag_list = NULL;
parsed_tags = gimp_tag_entry_parse_tags (tag_entry);
+
count = g_strv_length (parsed_tags);
for (i = 0; i < count; i++)
{
@@ -744,34 +742,10 @@
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);
- }
- g_list_free (tag_list);
-}
-
-static void
-gimp_tag_entry_item_set_tags (GimpTagged *tagged,
- GList *tags)
-{
- GList *old_tags;
- GList *tags_iterator;
-
- old_tags = g_list_copy (gimp_tagged_get_tags (tagged));
- for (tags_iterator = old_tags;
- tags_iterator;
- tags_iterator = g_list_next (tags_iterator))
- {
- gimp_tagged_remove_tag (tagged, tags_iterator->data);
+ gimp_tagged_set_tags (selected_iterator->data, tag_list);
}
- g_list_free (old_tags);
- for (tags_iterator = tags;
- tags_iterator;
- tags_iterator = g_list_next (tags_iterator))
- {
- gimp_tagged_add_tag (tagged, tags_iterator->data);
- }
+ g_list_free (tag_list);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]