gtranslator r3701 - in trunk: . plugins/alternate-language plugins/source-code-view plugins/subversion src src/dialogs



Author: icq
Date: Mon Sep 22 09:43:49 2008
New Revision: 3701
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3701&view=rev

Log:
Squashed commit of the following:

commit 99b5573f9226da76ea06bb303b84248e8d7d2c8d
Author: Ignacio Casal Quinteiro <nacho resa gmail com>
Date:   Wed Aug 20 20:54:57 2008 +0200

    2008-08-20  Ignacio Casal Quinteiro  <nacho resa gmail com>

    	* plugins/alternate-language/alternate-language-panel.c
    	(open_file), (open_button_clicked_cb):
    	* plugins/source-code-view/source-code-view-plugin.c
    	(follow_if_link):
    	* plugins/subversion/commit-dialog.c (send_status_command):
    	* plugins/subversion/diff-dialog.c
    (gtranslator_show_diff_dialog):
    	* plugins/subversion/subversion-plugin.c (on_add_activated):
    	* plugins/subversion/update-dialog.c (setup_dir):
    	Ported plugins to new location (GFile) API.

commit a90ca5788a5d3ba6b7dfbe095ceee962c94721f7
Author: Ignacio Casal Quinteiro <nacho resa gmail com>
Date:   Wed Aug 20 20:27:53 2008 +0200

    2008-08-20  Ignacio Casal Quinteiro  <nacho resa gmail com>

    	* actions-file.c (gtranslator_open),
    	(gtranslator_po_parse_files_from_dialog),
    	(save_dialog_response_cb), (gtranslator_save_file_as_dialog),
    	(is_duplicated_location), (load_file_list),
    	(gtranslator_actions_load_locations):
    	* actions.h:
    	* dialogs/assistant.c (add_to_database), (destroy_idle_data):
    	* dialogs/close-confirmation-dialog.c (build_single_doc_dialog),
    	(populate_model):
    	* dialogs/preferences-dialog.c (add_to_database),
    	(destroy_idle_data), (on_add_database_button_pulsed):
    	* main.c (get_command_line_data), (main):
    	* notebook.c (sync_name):
    	* po.c (gtranslator_po_init), (gtranslator_po_finalize),
    	(gtranslator_po_parse), (gtranslator_po_save_header_in_msg),
    	(gtranslator_po_save_file), (gtranslator_po_get_location),
    	(gtranslator_po_set_location):
    	* po.h:
    	* utils.c (gtranslator_utils_drop_get_locations),
    	(gtranslator_utils_scan_dir):
    	* utils.h:
    	* window.c (drag_data_received_cb), (gtranslator_recent_add),
    	(gtranslator_recent_chooser_item_activated_cb),
    	(gtranslator_window_create_tab),
    	(gtranslator_window_get_tab_from_location):
    	* window.h:
    	Switched from const gchar *uri/path to GFile.

Modified:
   trunk/ChangeLog
   trunk/plugins/alternate-language/alternate-language-panel.c
   trunk/plugins/source-code-view/source-code-view-plugin.c
   trunk/plugins/subversion/commit-dialog.c
   trunk/plugins/subversion/diff-dialog.c
   trunk/plugins/subversion/subversion-plugin.c
   trunk/plugins/subversion/update-dialog.c
   trunk/src/ChangeLog
   trunk/src/actions-file.c
   trunk/src/actions.h
   trunk/src/dialogs/assistant.c
   trunk/src/dialogs/close-confirmation-dialog.c
   trunk/src/dialogs/preferences-dialog.c
   trunk/src/main.c
   trunk/src/notebook.c
   trunk/src/po.c
   trunk/src/po.h
   trunk/src/utils.c
   trunk/src/utils.h
   trunk/src/window.c
   trunk/src/window.h

Modified: trunk/plugins/alternate-language/alternate-language-panel.c
==============================================================================
--- trunk/plugins/alternate-language/alternate-language-panel.c	(original)
+++ trunk/plugins/alternate-language/alternate-language-panel.c	Mon Sep 22 09:43:49 2008
@@ -142,11 +142,16 @@
 	   GtranslatorAlternateLangPanel *panel)
 {
 	GError *error = NULL;
-	gchar *po_file = g_strdup (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)));
-		  
+	GFile *file;
+	gchar *po_file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+	
+	file = g_file_new_for_path (po_file);
+	g_free (po_file);
 		  
 	panel->priv->po = gtranslator_po_new ();
-	gtranslator_po_parse (panel->priv->po, po_file, &error);
+	gtranslator_po_parse (panel->priv->po, file, &error);
+	
+	g_object_unref (file);
 	
 	if (error != NULL)
 	{
@@ -200,9 +205,9 @@
 			GtranslatorAlternateLangPanel *panel)
 {
 	GtkWidget *dialog = NULL;
-	const gchar *filename;
 	gchar *dir;
 	GtranslatorPo *tab_po;
+	GFile *location, *parent;
 			       
 	if(dialog != NULL) {
 		gtk_window_present(GTK_WINDOW(dialog));
@@ -218,8 +223,12 @@
 					       NULL);
 	
 	tab_po = gtranslator_tab_get_po (panel->priv->tab);
-	filename = gtranslator_po_get_filename (tab_po);
-	dir = g_path_get_dirname (filename);
+	location = gtranslator_po_get_location (tab_po);
+	parent = g_file_get_parent (location);
+	g_object_unref (location);
+	
+	dir = g_file_get_path (parent);
+	g_object_unref (parent);
 	
 	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dir);
 	g_free (dir);

Modified: trunk/plugins/source-code-view/source-code-view-plugin.c
==============================================================================
--- trunk/plugins/source-code-view/source-code-view-plugin.c	(original)
+++ trunk/plugins/source-code-view/source-code-view-plugin.c	Mon Sep 22 09:43:49 2008
@@ -173,9 +173,9 @@
 	GSList *tags = NULL, *tagp = NULL;
 	GtranslatorTab *tab;
 	GtranslatorPo *po;
-	const gchar *po_path;
 	gchar *fullpath;
 	gchar *dirname;
+	GFile *location, *parent;
 	
 	tab = gtranslator_window_get_active_tab (plugin->priv->window);
 
@@ -183,8 +183,12 @@
 		return;
 	po = gtranslator_tab_get_po (tab);
 
-	po_path = gtranslator_po_get_filename (po);
-	dirname = g_path_get_dirname (po_path);
+	location = gtranslator_po_get_location (po);
+	parent = g_file_get_parent (location);
+	g_object_unref (location);
+	
+	dirname = g_file_get_path (parent);
+	g_object_unref (parent);
 	
 	tags = gtk_text_iter_get_tags (iter);
 	for (tagp = tags;  tagp != NULL;  tagp = tagp->next)

Modified: trunk/plugins/subversion/commit-dialog.c
==============================================================================
--- trunk/plugins/subversion/commit-dialog.c	(original)
+++ trunk/plugins/subversion/commit-dialog.c	Mon Sep 22 09:43:49 2008
@@ -481,13 +481,20 @@
 	SvnStatusCommand *status_command;
 	GtranslatorTab *tab;
 	GtranslatorPo *po;
+	GFile *location, *parent;
 	
 	/* Setting up */
 	dlg->priv->window = window;
 	tab = gtranslator_window_get_active_tab (window);
 	po = gtranslator_tab_get_po (tab);
 	g_free (dlg->priv->dirname);
-	dlg->priv->dirname = g_path_get_dirname (gtranslator_po_get_filename (po));
+	
+	location = gtranslator_po_get_location (po);
+	parent = g_file_get_parent (location);
+	g_object_unref (location);
+	
+	dlg->priv->dirname = g_file_get_path (parent);
+	g_object_unref (parent);
 	
 	status_command = svn_status_command_new (dlg->priv->dirname,
 						 TRUE, TRUE);

Modified: trunk/plugins/subversion/diff-dialog.c
==============================================================================
--- trunk/plugins/subversion/diff-dialog.c	(original)
+++ trunk/plugins/subversion/diff-dialog.c	Mon Sep 22 09:43:49 2008
@@ -567,15 +567,15 @@
 gtranslator_show_diff_dialog (GtranslatorWindow *window)
 {
 	static GtranslatorDiffDialog *dlg = NULL;
-	const gchar *filename;
 	GtranslatorTab *tab;
 	GtranslatorPo *po;
+	GFile *location;
 	
 	g_return_if_fail (GTR_IS_WINDOW (window));
 	
 	tab = gtranslator_window_get_active_tab (window);
 	po = gtranslator_tab_get_po (tab);
-	filename = gtranslator_po_get_filename (po);
+	location = gtranslator_po_get_location (po);
 	
 	if(dlg == NULL)
 	{
@@ -596,7 +596,7 @@
 	
 	//As we are not destroying the dialog we have to free the filename
 	g_free (dlg->priv->filename);
-	dlg->priv->filename = g_strdup (filename);
+	dlg->priv->filename = g_file_get_path (location);
 	setup_diff_filename_entry (dlg);
 	
 	if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (dlg)))

Modified: trunk/plugins/subversion/subversion-plugin.c
==============================================================================
--- trunk/plugins/subversion/subversion-plugin.c	(original)
+++ trunk/plugins/subversion/subversion-plugin.c	Mon Sep 22 09:43:49 2008
@@ -96,13 +96,21 @@
 	GtranslatorTab *tab;
 	GtranslatorPo *po;
 	SvnAddCommand *add_command;
+	GFile *location;
+	gchar *path;
 	
 	tab = gtranslator_window_get_active_tab (window);
 	po = gtranslator_tab_get_po (tab);
-
-	add_command = svn_add_command_new ((gchar *)gtranslator_po_get_filename (po),
+	
+	location = gtranslator_po_get_location (po);
+	path = g_file_get_path (location);
+	g_object_unref (location);
+	
+	add_command = svn_add_command_new (path,
 					   FALSE,
 					   FALSE);
+	
+	g_free (path);
 
 	g_signal_connect (G_OBJECT (add_command), "command-finished",
 			  G_CALLBACK (on_add_command_finished),

Modified: trunk/plugins/subversion/update-dialog.c
==============================================================================
--- trunk/plugins/subversion/update-dialog.c	(original)
+++ trunk/plugins/subversion/update-dialog.c	Mon Sep 22 09:43:49 2008
@@ -190,19 +190,20 @@
 {
 	GtranslatorTab *tab;
 	GtranslatorPo *po;
-	gchar *dirname;
 	gchar *dir;
-	GFile *file;
+	GFile *location, *parent, *file;
 	
 	tab = gtranslator_window_get_active_tab (dlg->priv->window);
 	po = gtranslator_tab_get_po (tab);
-	dirname = g_path_get_dirname (gtranslator_po_get_filename (po));
+	location = gtranslator_po_get_location (po);
 	
-	dir = g_build_filename (dirname, "../", NULL);
-	g_free (dirname);
+	/* Get the directory of the po file */
+	parent = g_file_get_parent (location);
+	g_object_unref (location);
 	
-	file = g_file_new_for_path (dir);
-	g_free (dir);
+	/* Get the parent directory */
+	file = g_file_get_parent (parent);
+
 	dir = g_file_get_uri (file);
 	
 	gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dlg->priv->dir_button),

Modified: trunk/src/actions-file.c
==============================================================================
--- trunk/src/actions-file.c	(original)
+++ trunk/src/actions-file.c	Mon Sep 22 09:43:49 2008
@@ -54,9 +54,9 @@
  * and if not, opens it in a new tab.
  */
 gboolean 
-gtranslator_open(const gchar *filename,
-		 GtranslatorWindow *window,
-		 GError **error)
+gtranslator_open (GFile *location,
+		  GtranslatorWindow *window,
+		  GError **error)
 {
 	GtranslatorHeader *header;
 	GtranslatorPo	*po;
@@ -70,8 +70,8 @@
 	 * to handle.
 	 */
 	po = gtranslator_po_new();
-	gtranslator_po_parse(po, filename, error);
-	
+	gtranslator_po_parse (po, location, error);
+
 	if((*error != NULL) && (((GError *)*error)->code != GTR_PO_ERROR_RECOVERY))
 		return FALSE;
 
@@ -81,30 +81,30 @@
 	/*
 	 * If not a crash/temporary file, add to the history.
 	 */
-	gtranslator_recent_add(window, filename, project_id);
+	gtranslator_recent_add (window, location, project_id);
 
 	/*
 	 * Create a page to add to our list of open files
 	 */
 	tab = gtranslator_window_create_tab(window, po);
 	gtranslator_window_set_active_tab (window, GTK_WIDGET (tab));
-	
+
 	/*
 	 * Show the current message.
 	 */
 	current = gtranslator_po_get_current_message(po);
 	gtranslator_tab_message_go_to (tab, current, FALSE, GTR_TAB_MOVE_NONE);
-	
+
 	/*
 	 * Grab the focus
 	 */
 	active_view = gtranslator_tab_get_active_view(tab);
 	gtk_widget_grab_focus(GTK_WIDGET(active_view));
-	
+
 	gtranslator_statusbar_update_progress_bar (GTR_STATUSBAR (gtranslator_window_get_statusbar (window)),
 						   (gdouble)gtranslator_po_get_translated_count (po),
 						   (gdouble)gtranslator_po_get_messages_count (po));
-	
+
 	return TRUE;
 }
 
@@ -112,16 +112,27 @@
 gtranslator_po_parse_files_from_dialog (GtkWidget * dialog,
 					GtranslatorWindow *window)
 {
-	GSList *po_files;
+	GSList *po_files, *l;
+	GSList *locations;
 	GFile *file, *parent;
 	gchar *uri;
 	
 	po_files = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog));
+	for (l = po_files; l != NULL; l = g_slist_next (l))
+	{
+		GFile *file;
+		
+		file = g_file_new_for_uri (l->data);
+		locations = g_slist_prepend (locations, file);
+	}
 
 	/*
 	 * We store latest directory
 	 */
 	file = g_file_new_for_uri (po_files->data);
+	g_slist_foreach (po_files, (GFunc)g_free, NULL);
+	g_slist_free (po_files);
+	
 	parent = g_file_get_parent (file);
 	g_object_unref (file);
 
@@ -135,9 +146,9 @@
 	/*
 	 * Open the file via our centralized opening function.
 	 */
-	load_file_list (window, (const GSList *)po_files);
-
-	g_slist_free (po_files);
+	load_file_list (window, (const GSList *)locations);
+	g_slist_foreach (locations, (GFunc)g_object_unref, NULL);
+	g_slist_free (locations);
 	
 	/*
 	 * Destroy the dialog 
@@ -211,6 +222,7 @@
 	GtranslatorPo *po;
 	GtranslatorTab *tab;
 	gchar *filename;
+	GFile *location;
 	
 	tab = GTR_TAB (g_object_get_data (G_OBJECT (dialog),
 					  GTR_TAB_SAVE_AS));
@@ -228,11 +240,16 @@
 	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 	g_return_if_fail (filename != NULL);
 	
+	location = g_file_new_for_path (filename);
+	g_free (filename);
+	
 	gtk_widget_destroy (GTK_WIDGET (dialog));
 	
 	if (po != NULL)
 	{
-		gtranslator_po_set_filename (po, filename);
+		gtranslator_po_set_location (po, location);
+		
+		g_object_unref (location);
 		
 		gtranslator_po_save_file (po, &error);
 	
@@ -247,15 +264,13 @@
 			gtk_dialog_run(GTK_DIALOG(dialog));
 			gtk_widget_destroy(dialog);
 			g_clear_error(&error);
-			g_free (filename);
 			return;
 		}
 	
 		/* We have to change the state of the tab */
-		gtranslator_po_set_state(po, GTR_PO_STATE_SAVED);	
-			
-		g_free (filename);
+		gtranslator_po_set_state(po, GTR_PO_STATE_SAVED);
 	}
+	g_object_unref (location);
 }
 
 static GtkFileChooserConfirmation
@@ -289,7 +304,7 @@
 	GtkWidget *dialog = NULL;
 	GtranslatorTab *current_page;
 	GtranslatorPo *po;
-	const gchar *filename;
+	GFile *location;
 	gchar *uri = NULL;
 	gboolean uri_set = FALSE;
 	
@@ -316,9 +331,11 @@
 	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 	
 	/*Set the suggested file */
-	filename = gtranslator_po_get_filename (po);
+	location = gtranslator_po_get_location (po);
 	
-	uri = g_filename_to_uri (filename, NULL, NULL);
+	uri = g_file_get_uri (location);
+	
+	g_object_unref (location);
 	
 	if (uri)
 		uri_set = gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog),
@@ -377,80 +394,71 @@
 }
 
 static gboolean
-is_duplicated_uri (const GSList *uris, 
-		   const gchar  *u)
+is_duplicated_location (const GSList *locations, 
+			GFile  *u)
 {
-	while (uris != NULL)
+	while (locations != NULL)
 	{
-		if (strcmp (u, (const gchar*)uris->data) == 0)
+		if (g_file_equal (u, locations->data))
 			return TRUE;
 			
-		uris = g_slist_next (uris);
+		locations = g_slist_next (locations);
 	}
 	
 	return FALSE;
 }
 
 static void
-load_file_list(GtranslatorWindow *window,
-	       const GSList *uris)
+load_file_list (GtranslatorWindow *window,
+	        const GSList *locations)
 {
-	GSList        *uris_to_load = NULL;
+	GSList *locations_to_load = NULL;
 	const GSList  *l;
 	GError *error = NULL;
-	gchar *path;
 	GtkWidget *tab;
-	
-	g_return_if_fail ((uris != NULL) && (uris->data != NULL));
+
+	g_return_if_fail ((locations != NULL) && (locations->data != NULL));
 
 	/* Remove the uris corresponding to documents already open
 	 * in "window" and remove duplicates from "uris" list */
-	l = uris;
-	while (uris != NULL)
+	l = locations;
+	while (locations != NULL)
 	{
-		if (!is_duplicated_uri (uris_to_load, uris->data))
+		if (!is_duplicated_location (locations_to_load, locations->data))
 		{
 			/*We need to now if is already loaded in any tab*/
-			tab = gtranslator_window_get_tab_from_uri (window,
-								   (const gchar *)uris->data);
+			tab = gtranslator_window_get_tab_from_location (window,
+									(GFile *)locations->data);
 
 			if (tab != NULL)
 			{
-				if (uris == l)
-				{
+				if (locations == l)
 					gtranslator_window_set_active_tab (window,
 									   tab);
-				}
-
 			}
 			else
-			{
-				uris_to_load = g_slist_prepend (uris_to_load, 
-								uris->data);
-			}
+				locations_to_load = g_slist_prepend (locations_to_load, 
+								     locations->data);
 
 		}
 
-		uris = g_slist_next (uris);
+		locations = g_slist_next (locations);
 	}
 
-	if (uris_to_load == NULL)
+	if (locations_to_load == NULL)
 		return;
+
+	locations_to_load = g_slist_reverse (locations_to_load);
+	l = locations_to_load;
 	
-	uris_to_load = g_slist_reverse (uris_to_load);
-	l = uris_to_load;
-	
-	while (uris_to_load != NULL)
+	while (locations_to_load != NULL)
 	{
-		g_return_if_fail (uris_to_load->data != NULL);
+		g_return_if_fail (locations_to_load->data != NULL);
 
-		path = g_filename_from_uri((const gchar *)uris_to_load->data,
-					   NULL, NULL);
-		if(!gtranslator_open(path, window, &error))
+		if (!gtranslator_open (locations_to_load->data, window, &error))
 			break;
-		
-		g_free(path);
-		uris_to_load = g_slist_next (uris_to_load);
+
+		locations_to_load = g_slist_next (locations_to_load);
 	}
 	
 	/*
@@ -458,9 +466,7 @@
 	 * and free the path
 	 */
 	if(error != NULL)
-	{
-		g_free(path);
-		
+	{	
 		GtkWidget *dialog;
 		/*
 		 * We have to show the error in a dialog
@@ -486,13 +492,13 @@
  * Ignore non-existing URIs 
  */
 void
-gtranslator_actions_load_uris (GtranslatorWindow *window,
-			       const GSList        *uris)
+gtranslator_actions_load_locations (GtranslatorWindow *window,
+				    const GSList      *locations)
 {	
 	g_return_if_fail (GTR_IS_WINDOW (window));
-	g_return_if_fail ((uris != NULL) && (uris->data != NULL));
+	g_return_if_fail ((locations != NULL) && (locations->data != NULL));
 	
-	load_file_list (window, uris);
+	load_file_list (window, locations);
 }
 
 static void

Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h	(original)
+++ trunk/src/actions.h	Mon Sep 22 09:43:49 2008
@@ -20,6 +20,7 @@
 #define __ACTIONS_H__
 
 #include <gtk/gtkaction.h>
+#include <gio/gio.h>
 #include "window.h"
 
 G_BEGIN_DECLS
@@ -34,7 +35,7 @@
 void       gtranslator_save_file_as_dialog      (GtkAction * action,
 						 GtranslatorWindow *window);
 
-gboolean   gtranslator_open                     (const gchar *filename,
+gboolean   gtranslator_open                     (GFile *location,
 						 GtranslatorWindow *window,
 						 GError **error);
 
@@ -47,8 +48,8 @@
 void       gtranslator_file_quit                (GtkAction *action,
 						 GtranslatorWindow *window);
 
-void       gtranslator_actions_load_uris        (GtranslatorWindow *window,
-						 const GSList        *uris);
+void       gtranslator_actions_load_locations   (GtranslatorWindow *window,
+						 const GSList      *locations);
 
 /*Edit*/
 void       gtranslator_actions_edit_undo        (GtkAction   *action,

Modified: trunk/src/dialogs/assistant.c
==============================================================================
--- trunk/src/dialogs/assistant.c	(original)
+++ trunk/src/dialogs/assistant.c	Mon Sep 22 09:43:49 2008
@@ -71,7 +71,7 @@
 
 typedef struct _IdleData
 {
-	GList *list;
+	GSList *list;
 	GtkProgressBar *progress;
 	GtranslatorTranslationMemory *tm;
 	GtkWindow *parent;
@@ -81,26 +81,26 @@
 add_to_database (gpointer data_pointer)
 {
 	IdleData *data = (IdleData *)data_pointer;
-	static GList *l = NULL;
+	static GSList *l = NULL;
 	gdouble percentage;
 	
 	if (l == NULL)
 		l = data->list;
 	else
-		l = g_list_next (l);
+		l = g_slist_next (l);
 
 	if (l)
 	{
 		GList *msg_list = NULL;
 		GList *l2 = NULL;
-		const gchar *file_uri;
+		GFile *location;
 		GError *error = NULL;
 		GtranslatorPo *po;
 		
 		po = gtranslator_po_new ();
-		file_uri = (const gchar*)l->data;
+		location = (GFile *)l->data;
 		
-		gtranslator_po_parse (po, file_uri, &error);
+		gtranslator_po_parse (po, location, &error);
 		if (error)
 			return TRUE;
 		
@@ -141,7 +141,7 @@
 		return FALSE;
 	}
 	
-	percentage = (gdouble)g_list_position (data->list, l) / (gdouble) g_list_length (data->list);
+	percentage = (gdouble)g_slist_position (data->list, l) / (gdouble) g_slist_length (data->list);
 
 	/*
 	 * Set the progress only if the values are reasonable.
@@ -165,8 +165,8 @@
 	
 	gtk_widget_hide (GTK_WIDGET (d->progress));
 	
-	g_list_foreach (d->list, (GFunc)g_free, NULL);
-	g_list_free (d->list);
+	g_slist_foreach (d->list, (GFunc)g_object_unref, NULL);
+	g_slist_free (d->list);
 	
 	gtk_widget_destroy (GTK_WIDGET (d->parent));
 	

Modified: trunk/src/dialogs/close-confirmation-dialog.c
==============================================================================
--- trunk/src/dialogs/close-confirmation-dialog.c	(original)
+++ trunk/src/dialogs/close-confirmation-dialog.c	Mon Sep 22 09:43:49 2008
@@ -356,7 +356,8 @@
 	GtkWidget     *primary_label;
 	GtkWidget     *image;
 	GtranslatorPo *doc;
-	const gchar   *doc_name;
+	GFile         *location;
+	gchar         *doc_name;
 	gchar         *str;
 	gchar         *markup_str;
 
@@ -375,10 +376,13 @@
 	gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
 	gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
 
-	doc_name = gtranslator_po_get_filename (doc);
+	location = gtranslator_po_get_location (doc);
+	doc_name = g_file_get_path (location);
+	g_object_unref (location);
 
 	str = g_markup_printf_escaped (_("Save the changes to document \"%s\" before closing?"),
 				       doc_name);
+	g_free (doc_name);
 
 	markup_str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", str, "</span>", NULL);
 	g_free (str);
@@ -415,11 +419,14 @@
 	while (docs != NULL)
 	{
 		GtranslatorPo *po;
-		const gchar *name;
+		GFile *location;
+		gchar *name;
 
 		po = GTR_PO (docs->data);
 
-		name = gtranslator_po_get_filename (po);
+		location = gtranslator_po_get_location (po);
+		name = g_file_get_path (location);
+		g_object_unref (location);
 
 		gtk_list_store_append (GTK_LIST_STORE (store), &iter);
 		gtk_list_store_set (GTK_LIST_STORE (store), &iter,
@@ -428,6 +435,7 @@
 				    DOC_COLUMN, po,
 			            -1);
 
+		g_free (name);
 		docs = g_list_next (docs);
 	}
 }

Modified: trunk/src/dialogs/preferences-dialog.c
==============================================================================
--- trunk/src/dialogs/preferences-dialog.c	(original)
+++ trunk/src/dialogs/preferences-dialog.c	Mon Sep 22 09:43:49 2008
@@ -635,7 +635,7 @@
 
 typedef struct _IdleData
 {
-	GList *list;
+	GSList *list;
 	GtkProgressBar *progress;
 	GtranslatorTranslationMemory *tm;
 	GtkWindow *parent;
@@ -645,26 +645,26 @@
 add_to_database (gpointer data_pointer)
 {
 	IdleData *data = (IdleData *)data_pointer;
-	static GList *l = NULL;
+	static GSList *l = NULL;
 	gdouble percentage;
 	
 	if (l == NULL)
 		l = data->list;
 	else
-		l = g_list_next (l);
+		l = g_slist_next (l);
 
 	if (l)
 	{
 		GList *msg_list = NULL;
 		GList *l2 = NULL;
-		const gchar *file_uri;
+		GFile *location;
 		GError *error = NULL;
 		GtranslatorPo *po;
 		
 		po = gtranslator_po_new ();
-		file_uri = (const gchar*)l->data;
+		location = (GFile *)l->data;
 		
-		gtranslator_po_parse (po, file_uri, &error);
+		gtranslator_po_parse (po, location, &error);
 		if (error)
 			return TRUE;
 		
@@ -703,7 +703,7 @@
 		return FALSE;
 	}
 	
-	percentage = (gdouble)g_list_position (data->list, l) / (gdouble) g_list_length (data->list);
+	percentage = (gdouble)g_slist_position (data->list, l) / (gdouble) g_slist_length (data->list);
 
 	/*
 	 * Set the progress only if the values are reasonable.
@@ -726,8 +726,8 @@
 	IdleData *d = (IdleData *)data;
 	
 	gtk_widget_hide (GTK_WIDGET (d->progress));
-	g_list_foreach (d->list, (GFunc)g_free, NULL);
-	g_list_free (d->list);
+	g_slist_foreach (d->list, (GFunc)g_object_unref, NULL);
+	g_slist_free (d->list);
 	
 	g_free (d);
 }
@@ -747,11 +747,11 @@
 
   dir = g_file_new_for_path (dir_name);
 
-  if (gtranslator_prefs_manager_get_use_lang_profile ()) {
+  if (gtranslator_prefs_manager_get_use_lang_profile ())
     gtranslator_utils_scan_dir (dir, &data->list, gtranslator_prefs_manager_get_tm_lang_entry());
-  } else {
+  else
     gtranslator_utils_scan_dir (dir, &data->list, NULL);
-  }
+  
   data->tm = GTR_TRANSLATION_MEMORY (gtranslator_application_get_translation_memory (GTR_APP));
   data->progress = GTK_PROGRESS_BAR (dlg->priv->add_database_progressbar);
   data->parent = GTK_WINDOW (dlg);

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Mon Sep 22 09:43:49 2008
@@ -60,16 +60,12 @@
 		for (i = 0; file_arguments[i]; i++) 
 		{			
 			GFile  *file;
-			gchar *uri;
 
 			file = g_file_new_for_commandline_arg (file_arguments[i]);
-			uri = g_file_get_uri (file);
-			g_object_unref (file);
-
 			
-			if (uri != NULL){
+			if (file != NULL){
 				file_list = g_slist_prepend (file_list, 
-							     uri);
+							     file);
 				
 			}
 			else
@@ -87,8 +83,8 @@
  * The ubiquitous main function...
  */
 gint
-main(gint argc,
-     gchar *argv[])
+main (gint argc,
+      gchar *argv[])
 {
 	GError *error = NULL;
 	GtranslatorPluginsEngine *engine;
@@ -190,8 +186,8 @@
 	file_list = get_command_line_data ();
 	if (file_list)
 	{
-		gtranslator_actions_load_uris (window, (const GSList *)file_list);
-		g_slist_foreach (file_list, (GFunc) g_free, NULL);
+		gtranslator_actions_load_locations (window, (const GSList *)file_list);
+		g_slist_foreach (file_list, (GFunc) g_object_unref, NULL);
 		g_slist_free (file_list);
 	}
 	

Modified: trunk/src/notebook.c
==============================================================================
--- trunk/src/notebook.c	(original)
+++ trunk/src/notebook.c	Mon Sep 22 09:43:49 2008
@@ -75,6 +75,8 @@
 	GtkWidget *ebox;
 	gchar *tooltip;
 	GtranslatorTab *tab;
+	GFile *location;
+	gchar *path;
 	
 	label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
 	ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label-ebox"));
@@ -84,11 +86,17 @@
 	g_return_if_fail (str != NULL);
 	
 	gtk_label_set_text (GTK_LABEL (label), str);
-	
+
+	location = gtranslator_po_get_location (po);
+	path = g_file_get_path (location);
+	g_object_unref (location);
+
 	tooltip = g_strdup_printf (_("<b>Path:</b> %s"),
-				   gtranslator_po_get_filename (po));
+				   path);
+	
 	gtk_widget_set_tooltip_markup (ebox, tooltip);
 	
+	g_free (path);
 	g_free (tooltip);
 	g_free (str);
 }
@@ -258,7 +266,7 @@
 	g_return_if_fail (GTR_IS_TAB (tab));
 	
 	po = gtranslator_tab_get_po (tab);
-	
+
 	label = build_tab_label (notebook, tab);
 
 	sync_name (po, NULL, label);

Modified: trunk/src/po.c
==============================================================================
--- trunk/src/po.c	(original)
+++ trunk/src/po.c	Mon Sep 22 09:43:49 2008
@@ -41,6 +41,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gettext-po.h>
+#include <gio/gio.h>
 
 #define GTR_PO_GET_PRIVATE(object)	(G_TYPE_INSTANCE_GET_PRIVATE ( \
 					 (object),	\
@@ -52,10 +53,7 @@
 
 struct _GtranslatorPoPrivate
 {
-	/*
-	 * Absolute file name
-	 */
-	gchar *filename;
+	GFile *location;
 	
 	/*
 	 * Gettext's file handle
@@ -179,6 +177,8 @@
 gtranslator_po_init (GtranslatorPo *po)
 {
 	po->priv = GTR_PO_GET_PRIVATE (po);
+	
+	po->priv->location = NULL;
 }
 
 static void
@@ -196,7 +196,8 @@
 		g_list_free (po->priv->domains);
 	}
 
-	g_free (po->priv->filename);
+	if (po->priv->location)
+		g_object_unref (po->priv->location);
 	g_free (po->priv->obsolete);
 
 	if (po->priv->gettext_po_file)
@@ -298,18 +299,19 @@
 /**
  * gtranslator_po_parse:
  * @po: a #GtranslatorPo
- * @filename: the filename path to open
+ * @location: the file to open
  * @error: a variable to store the errors
  *
  * Parses all things related to the #GtranslatorPo and initilizes all neccessary
  * variables.
  **/
 void
-gtranslator_po_parse(GtranslatorPo *po,
-		     const gchar *filename,
-		     GError **error)
+gtranslator_po_parse (GtranslatorPo *po,
+		      GFile *location,
+		      GError **error)
 {
 	GtranslatorPoPrivate *priv = po->priv;
+	gchar *filename;
 	GtranslatorMsg *msg;
 	struct po_xerror_handler handler;
 	po_message_t message;
@@ -320,12 +322,8 @@
 	gint i = 0;
 	gint pos = 1;
 	
-	g_return_if_fail(filename!=NULL);
-	g_return_if_fail(GTR_IS_PO(po));
-
-	base=g_path_get_basename(filename);
-	g_return_if_fail(base[0]!='\0');
-	g_free(base);
+	g_return_if_fail (GTR_IS_PO (po));
+	g_return_if_fail (location != NULL);
 	
 	/*
 	 * Initialice the handler error.
@@ -340,25 +338,25 @@
 	}
 
 	/*
-	 * Get absolute filename.
+	 * Get filename path.
 	 */
-	if (!g_path_is_absolute(filename)) 
-		priv->filename = g_build_filename (filename, NULL);
-	else
-		priv->filename = g_strdup(filename);
-	
-	priv->gettext_po_file = po_file_read(priv->filename,
-					     &handler);
-	if(priv->gettext_po_file == NULL)
+	po->priv->location = g_file_dup (location);
+	filename = g_file_get_path (location);
+	
+	priv->gettext_po_file = po_file_read (filename,
+					      &handler);
+	if (priv->gettext_po_file == NULL)
 	{
 		g_set_error (error,
 			     GTR_PO_ERROR,
 			     GTR_PO_ERROR_FILENAME,
 			     _("Failed opening file '%s': %s"),
-			     priv->filename, g_strerror(errno));
+			     filename, g_strerror (errno));
 		g_object_unref(po);
+		g_free (filename);
 		return;
 	}
+	g_free (filename);
 	
 	/*
 	 * No need to return; this can be corrected by the user
@@ -581,7 +579,7 @@
 	gchar *new_date;
 	gchar *aux;
 	gchar *aux2;
-	gchar *comments;
+	const gchar *comments;
 	gchar **comments_lines;
 	gchar **comments_translator_values;
 
@@ -760,6 +758,7 @@
 {
 	struct po_xerror_handler handler;
 	gchar *msg_error;
+	gchar *filename;
 	
 	/*
 	 * Initialice the handler error.
@@ -767,7 +766,9 @@
 	handler.xerror = &on_gettext_po_xerror;
 	handler.xerror2 = &on_gettext_po_xerror2;
 	
-	if (g_str_has_suffix(po->priv->filename, ".pot"))
+	filename = g_file_get_path (po->priv->location);
+	
+	if (g_str_has_suffix (filename, ".pot"))
 	{
 		g_set_error (error,
 			     GTR_PO_ERROR,
@@ -775,7 +776,8 @@
 			     _("You are saving a file with a .pot extension.\n"
 			     "Pot files are generated by the compilation process.\n"
 			     "Your file should likely be named '%s.po'."), 
-			     po->priv->filename);
+			     filename);
+		g_free (filename);
 		return;
 	}
 	
@@ -800,7 +802,7 @@
 	gtranslator_po_save_header_in_msg (po);	
 	
 	if (!po_file_write (gtranslator_po_get_po_file (po),
-			    po->priv->filename, &handler))
+			    filename, &handler))
 	{
 		g_set_error (error,
 			     GTR_PO_ERROR,
@@ -808,8 +810,10 @@
 			     _("There was an error writing the PO file: %s"),
 			     message_error);
 		g_free (message_error);
+		g_free (filename);
 		return;
 	}
+	g_free (filename);
 	
 	/* If we are here everything is ok and we can set the state as saved */
 	gtranslator_po_set_state (po, GTR_PO_STATE_SAVED);
@@ -833,33 +837,36 @@
  * gtranslator_po_get_filename:
  * @po: a #GtranslatorPo
  * 
- * Gets the path of the po file.
+ * Gets the GFile of the po file.
  * 
- * Returns: the file name string
+ * Returns: the GFile associated with the @po. The returned location must be freed
+ * with g_object_unref.
  **/
-const gchar *
-gtranslator_po_get_filename(GtranslatorPo *po)
+GFile *
+gtranslator_po_get_location (GtranslatorPo *po)
 {
-	return po->priv->filename;
+	g_return_val_if_fail (GTR_IS_PO (po), NULL);
+	
+	return g_file_dup (po->priv->location);
 }
 
 /**
- * gtranslator_po_set_filename:
+ * gtranslator_po_set_location:
  * @po: a #GtranslatorPo
- * @data: The file name text you want to set
+ * @location: The GFile to set to the #GtranslatorPo
  *
- * Sets the text path within the #GtranslatorPo object. It overwrites any text
- * that was there before.
+ * Sets the GFile location within the #GtranslatorPo object.
  **/
 void
-gtranslator_po_set_filename(GtranslatorPo *po,
-			    gchar *data)
+gtranslator_po_set_location (GtranslatorPo *po,
+			     GFile *location)
 {
 	g_return_if_fail(GTR_IS_PO(po));
 	
-	if(po->priv->filename)
-		g_free(po->priv->filename);
-	po->priv->filename = g_strdup(data);
+	if (po->priv->location)
+		g_object_unref (po->priv->location);
+	
+	po->priv->location = g_file_dup (location);
 }
 
 /**

Modified: trunk/src/po.h
==============================================================================
--- trunk/src/po.h	(original)
+++ trunk/src/po.h	Mon Sep 22 09:43:49 2008
@@ -23,6 +23,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include <gettext-po.h>
+#include <gio/gio.h>
 
 #include "header.h"
 
@@ -93,8 +94,8 @@
 GtranslatorPo	*gtranslator_po_new			(void);
 
 void		gtranslator_po_parse			(GtranslatorPo *po,
-							const gchar *filename,
-							GError **error);
+							 GFile *filename,
+							 GError **error);
 
 void		gtranslator_po_save_header_in_msg	(GtranslatorPo *po);
 
@@ -106,10 +107,10 @@
 void            gtranslator_po_set_state                (GtranslatorPo *po,
 							 GtranslatorPoState state);
 
-const gchar    *gtranslator_po_get_filename		(GtranslatorPo *po);
+GFile          *gtranslator_po_get_location             (GtranslatorPo *po);
 
-void            gtranslator_po_set_filename		(GtranslatorPo *po,
-							gchar *data);
+void            gtranslator_po_set_location		(GtranslatorPo *po,
+							 GFile *location);
 
 gboolean         gtranslator_po_get_write_perms		(GtranslatorPo *po);
 

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c	(original)
+++ trunk/src/utils.c	Mon Sep 22 09:43:49 2008
@@ -466,31 +466,27 @@
  *		 were no valid uris. g_strfreev should be used when the 
  *		 string array is no longer used
  */
-gchar **
-gtranslator_utils_drop_get_uris (GtkSelectionData *selection_data)
+GSList *
+gtranslator_utils_drop_get_locations (GtkSelectionData *selection_data)
 {
 	gchar **uris;
 	gint i;
-	gint p = 0;
-	gchar **uri_list;
+	GSList *locations = NULL;
 
 	uris = g_uri_list_extract_uris ((gchar *) selection_data->data);
-	uri_list = g_new0(gchar *, g_strv_length (uris) + 1);
 
 	for (i = 0; uris[i] != NULL; i++)
 	{
+		GFile *file;
 		/* Silently ignore malformed URI/filename */
 		if (gtranslator_utils_is_valid_uri (uris[i]))
-			uri_list[p++] = g_strdup (uris[i]);
-	}
-
-	if (*uri_list == NULL)
-	{
-		g_free(uri_list);
-		return NULL;
+		{
+			file = g_file_new_for_uri (uris[i]);
+			locations = g_slist_prepend (locations, file);
+		}
 	}
 
-	return uri_list;
+	return locations;
 }
 
 gchar *
@@ -863,15 +859,16 @@
 /**
  * gtranslator_utils_scan_dir:
  * @dir: the dir to parse
- * @list: the list where to store the filenames
+ * @list: the list where to store the GFiles
  * @po_name: the name of the specific po file to search or NULL.
  *
  * Scans the directory and subdirectories of @dir looking for filenames remained
- * wiht .po or files that matches @po_name.
+ * with .po or files that matches @po_name. The contents of @list must be freed with
+ * g_slist_foreach (list, (GFunc)g_object_unref, NULL).
  */
 void
 gtranslator_utils_scan_dir (GFile *dir,
-			    GList **list,
+			    GSList **list,
 			    const gchar *po_name)
 {
 	GFileInfo *info;
@@ -908,11 +905,10 @@
 				filename = g_strdup (".po");
 			
 			if (g_str_has_suffix (name, filename))
-				*list = g_list_prepend (*list, g_file_get_path (file));
+				*list = g_slist_prepend (*list, file);
 			g_free (filename);
 
 			gtranslator_utils_scan_dir (file, list, po_name);
-			g_object_unref (file);
 			g_object_unref (info);
 		}
 		g_file_enumerator_close (enumerator, NULL, NULL);

Modified: trunk/src/utils.h
==============================================================================
--- trunk/src/utils.h	(original)
+++ trunk/src/utils.h	Mon Sep 22 09:43:49 2008
@@ -54,7 +54,7 @@
 						       const gchar *widget_name,
 						       ...)G_GNUC_NULL_TERMINATED;
 
-gchar        **gtranslator_utils_drop_get_uris        (GtkSelectionData *selection_data);
+GSList        *gtranslator_utils_drop_get_locations   (GtkSelectionData *selection_data);
 
 gchar         *gtranslator_utils_escape_search_text   (const gchar* text);
 
@@ -86,7 +86,7 @@
 gchar         *gtranslator_utils_get_current_year (void);
 
 void           gtranslator_utils_scan_dir              (GFile *dir,
-							GList **list,
+							GSList **list,
 							const gchar *po_name);
 
 #endif

Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c	(original)
+++ trunk/src/window.c	Mon Sep 22 09:43:49 2008
@@ -748,28 +748,6 @@
 	return GTR_WINDOW (target_window);
 }
 
-static void
-load_uris_from_drop (GtranslatorWindow  *window,
-		     gchar       **uri_list)
-{
-	GSList *uris = NULL;
-	gint i;
-	
-	if (uri_list == NULL)
-		return;
-	
-	for (i = 0; uri_list[i] != NULL; ++i)
-	{
-		uris = g_slist_prepend (uris, uri_list[i]);
-	}
-
-	uris = g_slist_reverse (uris);
-	gtranslator_actions_load_uris (window,
-				      uris);
-
-	g_slist_free (uris);
-}
-
 /* Handle drops on the GtranslatorWindow */
 static void
 drag_data_received_cb (GtkWidget        *widget,
@@ -782,7 +760,7 @@
 		       gpointer          data)
 {
 	GtranslatorWindow *window;
-	gchar **uri_list;
+	GSList *locations;
 
 	window = get_drop_window (widget);
 	
@@ -791,9 +769,11 @@
 
 	if (info == TARGET_URI_LIST)
 	{
-		uri_list = gtranslator_utils_drop_get_uris(selection_data);
-		load_uris_from_drop (window, uri_list);
-		g_strfreev (uri_list);
+		locations = gtranslator_utils_drop_get_locations (selection_data);
+		gtranslator_actions_load_locations (window, locations);
+		
+		g_slist_foreach (locations, (GFunc)g_object_unref, NULL);
+		g_slist_free (locations);
 	}
 }
 
@@ -983,21 +963,14 @@
 
 void
 gtranslator_recent_add (GtranslatorWindow *window,
-			const gchar *path,
+			GFile *location,
 			gchar *project_id)
 {
 	GtkRecentData *recent_data;
 	gchar *uri;
 	GError *error = NULL;
 
-	uri = g_filename_to_uri (path, NULL, &error);
-	if (error)
-	{	
-		g_warning ("Could not convert uri \"%s\" to a local path: %s",
-			   uri, error->message);
-		g_error_free (error);
-		return;
-	}
+	uri = g_file_get_uri (location);
 
 	recent_data = g_slice_new (GtkRecentData);
 
@@ -1019,7 +992,6 @@
 	g_free (uri);
 	g_free (recent_data->app_exec);
 	g_slice_free (GtkRecentData, recent_data);
-
 }
 
 void
@@ -1053,45 +1025,21 @@
 gtranslator_recent_chooser_item_activated_cb (GtkRecentChooser *chooser,
 					      GtranslatorWindow *window)
 {
-	gchar *uri, *path;
+	gchar *uri;
 	GError *error = NULL;
 	GtkWidget *dialog;
+	GSList *list = NULL;
+	GFile *location;
 
 	uri = gtk_recent_chooser_get_current_uri (chooser);
-
-	path = g_filename_from_uri (uri, NULL, NULL);
-	if (error)
-	{
-		g_warning ("Could not convert uri \"%s\" to a local path: %s",
-			   uri, error->message);
-		g_error_free (error);
-		return;
-	}
-	
-	/*
-	 * FIXME: We have to detect if the file is already opened
-	 * If it is we should display a warning dialog.
-	 */
-	gtranslator_open (path, window, &error);
-	if(error)
-	{
-		/*
-		 * We have to show the error in a dialog
-		 */
-		dialog = gtk_message_dialog_new(GTK_WINDOW(window),          
-						GTK_DIALOG_DESTROY_WITH_PARENT,
-						GTK_MESSAGE_ERROR,
-						GTK_BUTTONS_CLOSE,
-						error->message);
-		gtk_dialog_run (GTK_DIALOG (dialog));
-		gtk_widget_destroy (dialog);
-
-		if(error->code == GTR_PO_ERROR_FILENAME)
-			gtranslator_recent_remove (window, path);
-	}
-
+	location = g_file_new_for_uri (uri);
 	g_free (uri);
-	g_free (path);
+	
+	list = g_slist_prepend (list, location);
+	
+	gtranslator_actions_load_locations (window, list);
+	g_slist_foreach (list, (GFunc)g_object_unref, NULL);
+	g_slist_free (list);
 }
 
 static GtkWidget *
@@ -1613,12 +1561,13 @@
 			      GtranslatorPo *po)
 {
 	GtranslatorTab *tab;
-	
+
 	tab = gtranslator_tab_new(po);
 	gtk_widget_show(GTK_WIDGET(tab));
-	
+
 	gtranslator_notebook_add_page(GTR_NOTEBOOK(window->priv->notebook),
 				      tab);
+
 	return tab;
 }
 
@@ -1854,43 +1803,40 @@
 /**
  * gtranslator_window_get_tab_from_uri:
  * @window: a #GtranslatorWindow
- * @uri: the path/uri of the po file of the #GtranslatorTab
+ * @location: the GFile of the po file of the #GtranslatorTab
  *
  * Gets the #GtranslatorTab of the #GtranslatorWindows that matches with the
- * @uri.
+ * @location.
  *
- * Returns: the #GtranslatorTab which @uri matches with its po file.
+ * Returns: the #GtranslatorTab which @location matches with its po file.
  */
 GtkWidget *
-gtranslator_window_get_tab_from_uri (GtranslatorWindow *window,
-				     const gchar *uri)
+gtranslator_window_get_tab_from_location (GtranslatorWindow *window,
+					  GFile *location)
 {
-	GList *tabs;
+	GList *tabs, *l;
 	GtranslatorPo *po;
-	const gchar *po_uri;
+	GFile *po_location;
 	
 	g_return_if_fail (GTR_IS_WINDOW (window));
-	
-	gchar *good_uri = g_filename_from_uri (uri, NULL, NULL);
 
 	tabs = gtranslator_window_get_all_tabs (window);
 	
-	while (tabs != NULL)
+	for (l = tabs; l != NULL; l = g_list_next (l))
 	{
-		po = gtranslator_tab_get_po (GTR_TAB (tabs->data));
+		po = gtranslator_tab_get_po (GTR_TAB (l->data));
 		
-		po_uri = gtranslator_po_get_filename (po);
-	
-		if (g_utf8_collate (good_uri, po_uri) == 0)
+		po_location = gtranslator_po_get_location (po);
+
+		if (g_file_equal (location, po_location) == TRUE)
 		{
-			g_free (good_uri);
-			return tabs->data;
+			g_object_unref (po_location);
+			
+			return l->data;
 		}
-		
-		tabs = tabs->next;
+		g_object_unref (po_location);
 	}
 	
-	g_free (good_uri);
 	return NULL;
 }
 

Modified: trunk/src/window.h
==============================================================================
--- trunk/src/window.h	(original)
+++ trunk/src/window.h	Mon Sep 22 09:43:49 2008
@@ -122,8 +122,9 @@
 GObject *        _gtranslator_window_get_layout_manager
 						      (GtranslatorWindow *window);
 
-GtkWidget        *gtranslator_window_get_tab_from_uri (GtranslatorWindow *window,
-						       const gchar *uri);
+GtkWidget        *gtranslator_window_get_tab_from_location
+						      (GtranslatorWindow *window,
+						       GFile *location);
 
 void              gtranslator_window_set_active_tab   (GtranslatorWindow *window,
 						       GtkWidget *tab);



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