gimp r26464 - in branches/soc-2008-tagging: . app/widgets



Author: aurisj
Date: Sat Aug  9 14:22:51 2008
New Revision: 26464
URL: http://svn.gnome.org/viewvc/gimp?rev=26464&view=rev

Log:
2008-08-09  Aurimas JuÅka  <aurisj svn gnome org>

	* app/widgets/gimpcombotagentry.c
	* app/widgets/gimptagentry.c
	* app/widgets/gimptagentry.h: do not popup tag list when there are no
	possible selections.



Modified:
   branches/soc-2008-tagging/ChangeLog
   branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
   branches/soc-2008-tagging/app/widgets/gimptagentry.c
   branches/soc-2008-tagging/app/widgets/gimptagentry.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	Sat Aug  9 14:22:51 2008
@@ -189,6 +189,7 @@
   gint                  tag_count;
   gint                  window_width;
   gint                  window_height;
+  GtkStateType          arrow_state;
 
   if (widget->window == event->window)
     {
@@ -210,8 +211,18 @@
                           TRUE, window_width - 14, 0, 14, window_height);
     }
 
+  if (tag_count > 0
+      && ! GIMP_TAG_ENTRY (combo_entry)->has_invalid_tags)
+    {
+      arrow_state = GTK_STATE_NORMAL;
+    }
+  else
+    {
+      arrow_state = GTK_STATE_INSENSITIVE;
+    }
+
   gtk_paint_arrow (widget->style,
-                   event->window, tag_count > 0 ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
+                   event->window, arrow_state,
                    GTK_SHADOW_NONE, NULL, NULL, NULL,
                    GTK_ARROW_DOWN, TRUE,
                    arrow_rect.x + arrow_rect.width / 2 - 4,
@@ -266,7 +277,8 @@
   gint          tag_count;
 
   tag_count = gimp_filtered_container_get_tag_count (combo_entry->filtered_container);
-  if (tag_count > 0)
+  if (tag_count > 0
+      && ! GIMP_TAG_ENTRY (combo_entry)->has_invalid_tags)
     {
       combo_entry->popup = gimp_tag_popup_new (combo_entry);
       g_signal_connect (combo_entry->popup, "destroy",

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	Sat Aug  9 14:22:51 2008
@@ -215,6 +215,7 @@
   entry->selected_items        = NULL;
   entry->mode                  = GIMP_TAG_ENTRY_MODE_QUERY;
   entry->description_shown     = FALSE;
+  entry->has_invalid_tags      = FALSE;
   entry->mask                  = g_string_new ("");
 
   g_signal_connect (entry, "activate",
@@ -556,6 +557,9 @@
   gint                          i;
   GimpTag                      *tag;
   GList                        *query_list = NULL;
+  gboolean                      has_invalid_tags;
+
+  has_invalid_tags = FALSE;
 
   parsed_tags = gimp_tag_entry_parse_tags (entry);
   count = g_strv_length (parsed_tags);
@@ -564,6 +568,10 @@
       if (strlen (parsed_tags[i]) > 0)
         {
           tag = gimp_tag_try_new (parsed_tags[i]);
+          if (! tag)
+            {
+              has_invalid_tags = TRUE;
+            }
           query_list = g_list_append (query_list, tag);
         }
     }
@@ -571,6 +579,12 @@
 
   gimp_filtered_container_set_filter (GIMP_FILTERED_CONTAINER (entry->filtered_container),
                                       query_list);
+
+  if (has_invalid_tags != entry->has_invalid_tags)
+    {
+      entry->has_invalid_tags = has_invalid_tags;
+      gtk_widget_queue_draw (GTK_WIDGET (entry));
+    }
 }
 
 static gboolean

Modified: branches/soc-2008-tagging/app/widgets/gimptagentry.h
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagentry.h	(original)
+++ branches/soc-2008-tagging/app/widgets/gimptagentry.h	Sat Aug  9 14:22:51 2008
@@ -54,6 +54,7 @@
   gint                          internal_operation;
   gint                          suppress_mask_update;
   gboolean                      description_shown;
+  gboolean                      has_invalid_tags;
 };
 
 struct _GimpTagEntryClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]