Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gok/ChangeLog,v
retrieving revision 1.335
diff -u -r1.335 ChangeLog
--- ChangeLog	5 Dec 2003 20:23:54 -0000	1.335
+++ ChangeLog	6 Dec 2003 19:07:04 -0000
@@ -1,3 +1,10 @@
+2003-12-06  Jan Arne Petersen  <jpetersen@uni-bonn.de>
+
+	* gok/gok-editor.c: (gok_editor_open_file),
+	(gok_editor_save_current_keyboard_as):
+	* gok/gok-page-feedbacks.c: (gok_page_feedbacks_get_sound_file):
+	Replace GtkFileSelection with GtkFileChooser.
+
 2003-12-05  Bill Haneman <billh@gnome.org>
 
 	* gok/gok-keyboard.c:
Index: gok/gok-editor.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-editor.c,v
retrieving revision 1.11
diff -u -r1.11 gok-editor.c
--- gok/gok-editor.c	4 Nov 2003 13:40:12 -0000	1.11
+++ gok/gok-editor.c	6 Dec 2003 19:07:06 -0000
@@ -243,12 +243,13 @@
 */
 void gok_editor_open_file()
 {
-	GtkFileSelection* pDialogFilename;
+	GtkWidget* pDialogFilename;
 	GtkWidget* pDialog;
 	gint response;
-	const gchar* filename;
+	gchar* filename;
 	GtkWidget* pEntry;
 	GokKey* pKey;
+	GtkFileFilter *filter;
 	
 	if (m_bFileModified == TRUE)
 	{
@@ -269,34 +270,44 @@
 	}
 
 	/* create the file selector dialog */
-	pDialogFilename = (GtkFileSelection*)gtk_file_selection_new (_("Select keyboard file for editing"));
+	pDialogFilename = gtk_file_chooser_dialog_new (_("Select keyboard file for editing"),
+						       GTK_WINDOW(m_pWindowEditor),
+						       GTK_FILE_CHOOSER_ACTION_OPEN,
+						       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						       GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+						       NULL);
 
 	/* display only .kbd files */
 	/* TODO - this is not working! Why?? */
-	gtk_file_selection_complete (pDialogFilename, "*.kbd");
+	filter = gtk_file_filter_new ();
+	gtk_file_filter_set_name (filter, _(".kbd files"));
+	gtk_file_filter_add_pattern (filter, "*.kbd");
+	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(pDialogFilename), filter);
 	
-   /* display that file selector dialog */
+	/* display that file selector dialog */
+	gtk_window_set_default_size (GTK_WINDOW(pDialogFilename), 600, 400);
 	response = gtk_dialog_run (GTK_DIALOG(pDialogFilename));
 
-	if (response == GTK_RESPONSE_CANCEL)
+	if (response != GTK_RESPONSE_OK)
 	{
 		/* destroy the file selector dialog */
-		gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+		gtk_widget_destroy (pDialogFilename);
 
 		return;
 	}
 	
 	/* get the file name */
-	filename = gtk_file_selection_get_filename (pDialogFilename);
+	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(pDialogFilename));
 	
 	/* is this a GOK keyboard file? */
 	if ((strlen(filename) < 4) ||
 		(strcmp(filename + (strlen(filename)-4), ".kbd") != 0))
 	{
 		/* no, destroy the file selector dialog */
-		gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+		gtk_widget_destroy (pDialogFilename);
 
-		gok_editor_message_filename_bad ((gchar*)filename);		
+		gok_editor_message_filename_bad (filename);
+		g_free (filename);
 		return;
 	}
 	
@@ -305,11 +316,10 @@
 	{
 		g_free (m_pFilename);
 	}
-	m_pFilename = (gchar*)g_malloc (strlen (filename) + 1);
-	strcpy (m_pFilename, filename);
+	m_pFilename = filename;
 	
 	/* destroy the file selector dialog */
-	gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+	gtk_widget_destroy (pDialogFilename);
 
 	/* delete the previous keyboard */
 	if (m_pKeyboard != NULL)
@@ -943,9 +953,10 @@
 */
 gboolean gok_editor_save_current_keyboard_as ()
 {
-	GtkFileSelection* pDialogFilename;
+	GtkWidget* pDialogFilename;
 	gint response;
-	const gchar* filename;
+	gchar* filename;
+	GtkFileFilter *filter;
 	
 	if (m_pKeyboard != NULL)
 	{
@@ -953,33 +964,43 @@
 		{
 			/* get name of keyboard filename */
 			/* create the file selector dialog */
-			pDialogFilename = (GtkFileSelection*)gtk_file_selection_new ("Save keyboard file as");
-		
+			pDialogFilename = gtk_file_chooser_dialog_new (_("Save keyboard file as"),
+								       GTK_WINDOW(m_pWindowEditor),
+								       GTK_FILE_CHOOSER_ACTION_SAVE,
+								       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+								       GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+								       NULL);
+
 			/* display only .kbd files */
 			/* TODO - this is not working! Why?? */
-			gtk_file_selection_complete (pDialogFilename, "*.kbd");
-			
-		   /* display that file selector dialog */
+			filter = gtk_file_filter_new ();
+			gtk_file_filter_set_name (filter, _(".kbd files"));
+			gtk_file_filter_add_pattern (filter, "*.kbd");
+			gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(pDialogFilename), filter);
+	
+			/* display that file selector dialog */
+			gtk_window_set_default_size (GTK_WINDOW(pDialogFilename), 600, 400);
 			response = gtk_dialog_run (GTK_DIALOG(pDialogFilename));
 		
-			if (response == GTK_RESPONSE_CANCEL)
+			if (response != GTK_RESPONSE_OK)
 			{
 				/* destroy the file selector dialog */
-				gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+				gtk_widget_destroy (pDialogFilename);
 				return FALSE;
 			}
 			
 			/* get the file name */
-			filename = gtk_file_selection_get_filename (pDialogFilename);
+			filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pDialogFilename));
 			
 			/* is this a GOK keyboard file? */
 			if ((strlen(filename) < 4) ||
 				(strcmp(filename + (strlen(filename)-4), ".kbd") != 0))
 			{
 				/* no, destroy the file selector dialog */
-				gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+				gtk_widget_destroy (pDialogFilename);
 				
-				gok_editor_message_filename_bad ((gchar*)filename);		
+				gok_editor_message_filename_bad (filename);
+				g_free (filename);
 				return FALSE;
 			}
 			
@@ -988,14 +1009,13 @@
 			{
 				g_free (m_pFilename);
 			}
-			m_pFilename = (gchar*)g_malloc (strlen (filename) + 1);
-			strcpy (m_pFilename, filename);
+			m_pFilename = filename;
 			
 			/* destroy the file selector dialog */
-			gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+			gtk_widget_destroy (pDialogFilename);
 
 			/* save the keyboard under this filename */
-			gok_editor_save_keyboard (m_pKeyboard, (gchar*)filename);
+			gok_editor_save_keyboard (m_pKeyboard, filename);
 		}
 	}
 	
Index: gok/gok-page-feedbacks.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-page-feedbacks.c,v
retrieving revision 1.14
diff -u -r1.14 gok-page-feedbacks.c
--- gok/gok-page-feedbacks.c	16 Oct 2002 18:03:25 -0000	1.14
+++ gok/gok-page-feedbacks.c	6 Dec 2003 19:07:07 -0000
@@ -839,9 +839,9 @@
 **/
 void gok_page_feedbacks_get_sound_file ()
 {
-	GtkFileSelection* pDialogFilename;
+	GtkWidget* pDialogFilename;
 	gint response;
-	const gchar* filename;
+	gchar* filename;
 	GtkWidget* pEntry;
 
 	/* make sure the current feedback is not NULL */
@@ -851,21 +851,27 @@
 	}
 	
 	/* create the file selector dialog */
-	pDialogFilename = (GtkFileSelection*)gtk_file_selection_new (_("Select sound file"));
+	pDialogFilename = gtk_file_chooser_dialog_new (_("Select sound file"),
+						       NULL,
+						       GTK_FILE_CHOOSER_ACTION_OPEN,
+						       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						       GTK_STOCK_OK, GTK_RESPONSE_OK,
+						       NULL);
+
+	/* display that file selector dialog */
+	gtk_window_set_default_size (GTK_WINDOW (pDialogFilename), 600, 400);
+	response = gtk_dialog_run (GTK_DIALOG (pDialogFilename));
 
-   /* display that file selector dialog */
-	response = gtk_dialog_run (GTK_DIALOG(pDialogFilename));
-
-	if (response == GTK_RESPONSE_CANCEL)
+	if (response != GTK_RESPONSE_OK)
 	{
 		/* destroy the file selector dialog */
-		gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+		gtk_widget_destroy (pDialogFilename);
 
 		return;
 	}
 
 	/* get the file name */
-	filename = gtk_file_selection_get_filename (pDialogFilename);
+	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pDialogFilename));
 
 	/* add it to the feedback */
 	if (m_pFeedbackCurrent->pNameSound != NULL)
@@ -873,7 +879,7 @@
 		g_free (m_pFeedbackCurrent->pNameSound);
 	}
         
-	m_pFeedbackCurrent->pNameSound = g_strdup (filename);
+	m_pFeedbackCurrent->pNameSound = filename;
 
 	/* update the combo box list */
 	gok_feedbacks_update_sound_combo();
@@ -886,7 +892,7 @@
 	m_bIgnoreSoundNameChange = FALSE;
 
 	/* destroy the file selector dialog */
-	gtk_widget_destroy (GTK_WIDGET(pDialogFilename));
+	gtk_widget_destroy (pDialogFilename);
 }
 
 /**
