File gtk-filesel-dirchanged-fix.patch of Package gtk

diff --exclude=Makefile.in -Nrc -x *~ gtk+-1.2.10.orig/gtk/gtkfilesel.c gtk+-1.2.10/gtk/gtkfilesel.c
*** gtk+-1.2.10.orig/gtk/gtkfilesel.c	Tue Sep 25 13:32:32 2001
--- gtk+-1.2.10/gtk/gtkfilesel.c	Tue Sep 25 13:44:11 2001
***************
*** 2337,2342 ****
--- 2337,2343 ----
                               (GtkSignalFunc) gtk_button_clicked,
                               GTK_OBJECT (filesel->ok_button));
    gtk_box_pack_start (GTK_BOX (entry_vbox), filesel->selection_entry, TRUE, TRUE, 0);
+   gtk_object_set_data (GTK_OBJECT (filesel->selection_entry), "last_entry_was_dir_selection", (gpointer) FALSE);
    gtk_widget_show (filesel->selection_entry);
  
    if (!cmpl_state_okay (filesel->cmpl_state))
***************
*** 2974,2982 ****
    g_return_val_if_fail (widget != NULL, FALSE);
    g_return_val_if_fail (event != NULL, FALSE);
  
    if (event->keyval == GDK_Tab)
      {
-       fs = GTK_FILE_SELECTION (user_data);
        text = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
  
        text = g_strdup (text);
--- 2975,2985 ----
    g_return_val_if_fail (widget != NULL, FALSE);
    g_return_val_if_fail (event != NULL, FALSE);
  
+   fs = GTK_FILE_SELECTION (user_data);
+   gtk_object_set_data (GTK_OBJECT (fs->selection_entry), "last_entry_was_dir_selection", (gpointer) FALSE);
+ 
    if (event->keyval == GDK_Tab)
      {
        text = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
  
        text = g_strdup (text);
***************
*** 3129,3134 ****
--- 3132,3138 ----
        else
  	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
  
+       gtk_object_set_data (GTK_OBJECT (fs->selection_entry), "last_entry_was_dir_selection", (gpointer) FALSE);
        g_free (filename);
      }
  }
***************
*** 3142,3147 ****
--- 3146,3153 ----
  {
    GtkFileSelection *fs = NULL;
    gchar *filename, *temp = NULL;
+   const gchar *entry_text;
+   gboolean last_entry_was_dir_selection;
  
    g_return_if_fail (GTK_IS_CLIST (widget));
  
***************
*** 3152,3157 ****
--- 3158,3167 ----
    gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &temp);
    filename = g_strdup (temp);
  
+   entry_text = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
+   last_entry_was_dir_selection = (gboolean) gtk_object_get_data (GTK_OBJECT (fs->selection_entry),
+ 								 "last_entry_was_dir_selection");
+ 
    if (filename)
      {
        if (bevent)
***************
*** 3162,3175 ****
  	    break;
  	  
  	  default:
! 	    gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
  	    break;
  	  }
!       else
! 	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
  
        g_free (filename);
      }
  }
  
  static void
--- 3172,3195 ----
  	    break;
  	  
  	  default:
! 	    if (!entry_text || !strlen (entry_text) || last_entry_was_dir_selection)
! 	      {
! 		gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
! 		last_entry_was_dir_selection = TRUE;
! 	      }
  	    break;
  	  }
!       else if (!entry_text || !strlen (entry_text) || last_entry_was_dir_selection)
! 	  {
! 	    gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
! 	    last_entry_was_dir_selection = TRUE;
! 	  }
  
        g_free (filename);
      }
+ 
+   gtk_object_set_data (GTK_OBJECT (fs->selection_entry), "last_entry_was_dir_selection",
+ 		       (gpointer) last_entry_was_dir_selection);
  }
  
  static void
***************
*** 3312,3318 ****
      }
    else
      {
!       if (fs->selection_entry)
  	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
      }
  
--- 3332,3343 ----
      }
    else
      {
!       gboolean last_entry_was_dir_selection;
! 
!       last_entry_was_dir_selection = (gboolean) gtk_object_get_data (GTK_OBJECT (fs->selection_entry),
! 								     "last_entry_was_dir_selection");
! 
!       if (fs->selection_entry && last_entry_was_dir_selection)
  	gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
      }
openSUSE Build Service is sponsored by