gtranslator r3672 - trunk/src



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

Log:
2008-08-07  Ignacio Casal Quinteiro  <nacho resa gmail com>

	* actions-file.c (gtranslator_open), (gtranslator_close_tab),
	(gtranslator_file_close), (gtranslator_file_quit):
	* actions.h:
	* window.c (notebook_tab_close_request):
	Now it closes the right tab when you click on close button.
	And sets the opened tab as active.

Modified:
   trunk/src/ChangeLog
   trunk/src/actions-file.c
   trunk/src/actions.h
   trunk/src/window.c

Modified: trunk/src/actions-file.c
==============================================================================
--- trunk/src/actions-file.c	(original)
+++ trunk/src/actions-file.c	Mon Sep 22 09:42:11 2008
@@ -39,6 +39,7 @@
 #include "profile.h"
 #include "statusbar.h"
 #include "tab.h"
+#include "utils.h"
 #include "window.h"
 
 #define GTR_TAB_SAVE_AS "gtranslator-tab-save-as"
@@ -86,6 +87,7 @@
 	 * 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.
@@ -637,14 +639,10 @@
 	gtk_widget_destroy (GTK_WIDGET (dlg));
 }
 
-void 
-gtranslator_file_close (GtkAction * widget,
-			GtranslatorWindow *window)
+void
+gtranslator_close_tab (GtranslatorTab *tab,
+		       GtranslatorWindow *window)
 {
-	GtranslatorTab *tab;
-	
-	tab = gtranslator_window_get_active_tab (window);
-	
 	g_object_set_data (G_OBJECT (window),
 			   GTR_IS_CLOSING_ALL,
 			   GINT_TO_POINTER (0));
@@ -668,6 +666,17 @@
 		_gtranslator_window_close_tab (window, tab);
 }
 
+void 
+gtranslator_file_close (GtkAction * widget,
+			GtranslatorWindow *window)
+{
+	GtranslatorTab *tab;
+	
+	tab = gtranslator_window_get_active_tab (window);
+	
+	gtranslator_close_tab (tab, window);
+}
+
 void
 gtranslator_file_quit (GtkAction *action,
 		       GtranslatorWindow *window)
@@ -692,6 +701,9 @@
 	  g_file_delete (file, NULL, NULL);
 	  gtranslator_profile_save_profiles_in_xml (filename);
 	}
+	
+	g_free (config_folder);
+	g_object_unref (file);
 
 	nb = gtranslator_window_get_notebook (window);
 	pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK(nb));

Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h	(original)
+++ trunk/src/actions.h	Mon Sep 22 09:42:11 2008
@@ -38,6 +38,9 @@
 						 GtranslatorWindow *window,
 						 GError **error);
 
+void       gtranslator_close_tab                (GtranslatorTab *tab,
+						 GtranslatorWindow *window);
+
 void       gtranslator_file_close               (GtkAction * widget,
 						 GtranslatorWindow *window);
 

Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c	(original)
+++ trunk/src/window.c	Mon Sep 22 09:42:11 2008
@@ -847,7 +847,7 @@
 {
 	/* Note: we are destroying the tab before the default handler
 	 * seems to be ok, but we need to keep an eye on this. */
-	gtranslator_file_close (NULL, window);
+	gtranslator_close_tab (tab, window);
 	
 	gtranslator_plugins_engine_update_plugins_ui (gtranslator_plugins_engine_get_default (),
 						      window, FALSE);



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