gimp r26224 - in branches/soc-2008-tagging: . app/core app/widgets
- From: aurisj svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26224 - in branches/soc-2008-tagging: . app/core app/widgets
- Date: Thu, 17 Jul 2008 18:31:14 +0000 (UTC)
Author: aurisj
Date: Thu Jul 17 18:31:13 2008
New Revision: 26224
URL: http://svn.gnome.org/viewvc/gimp?rev=26224&view=rev
Log:
2008-07-17 Aurimas JuÅka <aurisj svn gnome org>
* app/widgets/gimptagentry.c (gimp_tag_entry_load_selection): display
sorted assigned tag list, so that user could find needed tags faster.
* app/core/Makefile.am
* app/core/gimptag.[ch]: move common tag functions to a single place.
* app/widgets/gimpcombotagentry.c: use the common functions.
Added:
branches/soc-2008-tagging/app/core/gimptag.c
branches/soc-2008-tagging/app/core/gimptag.h
Modified:
branches/soc-2008-tagging/ChangeLog
branches/soc-2008-tagging/app/core/Makefile.am
branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
branches/soc-2008-tagging/app/widgets/gimptagentry.c
Modified: branches/soc-2008-tagging/app/core/Makefile.am
==============================================================================
--- branches/soc-2008-tagging/app/core/Makefile.am (original)
+++ branches/soc-2008-tagging/app/core/Makefile.am Thu Jul 17 18:31:13 2008
@@ -312,6 +312,8 @@
gimpstrokeoptions.h \
gimpsubprogress.c \
gimpsubprogress.h \
+ gimptag.c \
+ gimptag.h \
gimptagcache.c \
gimptagcache.h \
gimptagged.c \
Added: branches/soc-2008-tagging/app/core/gimptag.c
==============================================================================
--- (empty file)
+++ branches/soc-2008-tagging/app/core/gimptag.c Thu Jul 17 18:31:13 2008
@@ -0,0 +1,28 @@
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "core-types.h"
+
+#include "gimptag.h"
+
+GimpTag
+gimp_tag_from_string (const gchar *string)
+{
+ if (g_utf8_strchr (string, -1, ','))
+ {
+ return 0;
+ }
+
+ return g_quark_from_string (string);
+}
+
+int
+gimp_tag_compare_func (const void *p1,
+ const void *p2)
+{
+ return strcmp (g_quark_to_string (GPOINTER_TO_UINT (p1)),
+ g_quark_to_string (GPOINTER_TO_UINT (p2)));
+}
+
Added: branches/soc-2008-tagging/app/core/gimptag.h
==============================================================================
--- (empty file)
+++ branches/soc-2008-tagging/app/core/gimptag.h Thu Jul 17 18:31:13 2008
@@ -0,0 +1,12 @@
+
+#ifndef __GIMP_TAG_H__
+#define __GIMP_TAG_H__
+
+GimpTag gimp_tag_from_string (const gchar *string);
+#define gimp_tag_to_string g_quark_to_string
+
+int gimp_tag_compare_func (const void *p1,
+ const void *p2);
+
+#endif // __GIMP_TAG_H__
+
Modified: branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c (original)
+++ branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c Thu Jul 17 18:31:13 2008
@@ -31,6 +31,7 @@
#include "core/gimpfilteredcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpviewable.h"
+#include "core/gimptag.h"
#include "core/gimptagged.h"
#include "gimptagentry.h"
@@ -296,14 +297,6 @@
return FALSE;
}
-static int
-tag_list_sort_proc (const void *p1,
- const void *p2)
-{
- return strcmp (g_quark_to_string (GPOINTER_TO_UINT (p1)),
- g_quark_to_string (GPOINTER_TO_UINT (p2)));
-}
-
static void
gimp_combo_tag_entry_popup_list (GimpComboTagEntry *combo_entry)
{
@@ -352,7 +345,7 @@
tag_hash = GIMP_TAG_ENTRY (combo_entry->tag_entry)->tagged_container->tag_ref_counts;
tag_list = g_hash_table_get_keys (tag_hash);
- tag_list = g_list_sort (tag_list, tag_list_sort_proc);
+ tag_list = g_list_sort (tag_list, gimp_tag_compare_func);
popup_data->tag_count = g_list_length (tag_list);
popup_data->tag_data = g_malloc (sizeof (PopupTagData) * popup_data->tag_count);
tag_iterator = tag_list;
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 Thu Jul 17 18:31:13 2008
@@ -31,6 +31,7 @@
#include "core/gimpfilteredcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpviewable.h"
+#include "core/gimptag.h"
#include "core/gimptagged.h"
#include "gimptagentry.h"
@@ -341,6 +342,7 @@
gimp_tag_entry_load_selection (GimpTagEntry *tag_entry)
{
GimpTagged *selected_item;
+ GList *tag_list;
GList *tag_iterator;
gint insert_pos;
GimpTag tag;
@@ -356,7 +358,9 @@
selected_item = GIMP_TAGGED (tag_entry->selected_items->data);
insert_pos = 0;
- tag_iterator = gimp_tagged_get_tags (selected_item);
+ tag_list = g_list_copy (gimp_tagged_get_tags (selected_item));
+ tag_list = g_list_sort (tag_list, gimp_tag_compare_func);
+ tag_iterator = tag_list;
while (tag_iterator)
{
tag = GPOINTER_TO_UINT (tag_iterator->data);
@@ -367,6 +371,7 @@
tag_iterator = g_list_next (tag_iterator);
}
+ g_list_free (tag_list);
}
static gchar*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]