[gtranslator] Add debug and save the layout also when disposing the tab.



commit 35ec0b89a9b26a2c32e79c90e5c47226863d3c37
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed May 4 13:58:35 2011 +0200

    Add debug and save the layout also when disposing the tab.

 src/gtr-notebook.c |    3 +++
 src/gtr-tab.c      |   22 ++++++++++++++++++++--
 src/gtr-view.c     |    3 +++
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/gtr-notebook.c b/src/gtr-notebook.c
index 452c419..704ed07 100644
--- a/src/gtr-notebook.c
+++ b/src/gtr-notebook.c
@@ -23,6 +23,7 @@
 #include "gtr-notebook.h"
 #include "gtr-tab.h"
 #include "gtr-tab-label.h"
+#include "gtr-debug.h"
 
 #include <glib.h>
 #include <glib-object.h>
@@ -103,6 +104,8 @@ gtr_notebook_init (GtrNotebook * notebook)
 static void
 gtr_notebook_finalize (GObject * object)
 {
+  DEBUG_PRINT ("Finalize notebook");
+
   G_OBJECT_CLASS (gtr_notebook_parent_class)->finalize (object);
 }
 
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 0af4890..f095c0a 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -46,6 +46,7 @@
 #include "gtr-translation-memory-ui.h"
 #include "gtr-dirs.h"
 #include "gtr-plugins-engine.h"
+#include "gtr-debug.h"
 
 #include <glib.h>
 #include <glib-object.h>
@@ -119,6 +120,7 @@ struct _GtrTabPrivate
   guint blocking : 1;
 
   guint tab_realized : 1;
+  guint dispose_has_run : 1;
 };
 
 enum
@@ -666,8 +668,7 @@ on_state_notify (GtrPo      *po,
 }
 
 static void
-on_layout_changed (GdlDockMaster *master,
-                   GtrTab        *tab)
+save_layout (GtrTab *tab)
 {
   gchar *filename;
 
@@ -679,6 +680,13 @@ on_layout_changed (GdlDockMaster *master,
 }
 
 static void
+on_layout_changed (GdlDockMaster *master,
+                   GtrTab        *tab)
+{
+  save_layout (tab);
+}
+
+static void
 gtr_tab_draw (GtrTab *tab)
 {
   GtkWidget *hbox;
@@ -891,6 +899,8 @@ gtr_tab_finalize (GObject * object)
 {
   GtrTab *tab = GTR_TAB (object);
 
+  DEBUG_PRINT ("Finalize tab");
+
   if (tab->priv->timer != NULL)
     g_timer_destroy (tab->priv->timer);
 
@@ -905,6 +915,14 @@ gtr_tab_dispose (GObject * object)
 {
   GtrTabPrivate *priv = GTR_TAB (object)->priv;
 
+  DEBUG_PRINT ("Dispose tab");
+
+  if (!priv->dispose_has_run)
+    {
+      save_layout (GTR_TAB (object));
+      priv->dispose_has_run = TRUE;
+    }
+
   if (priv->extensions != NULL)
     {
       g_object_unref (priv->extensions);
diff --git a/src/gtr-view.c b/src/gtr-view.c
index a0c0550..2369110 100644
--- a/src/gtr-view.c
+++ b/src/gtr-view.c
@@ -32,6 +32,7 @@
 #include "gtr-utils.h"
 #include "gtr-view.h"
 #include "gtr-application.h"
+#include "gtr-debug.h"
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -168,6 +169,8 @@ gtr_view_dispose (GObject * object)
 {
   GtrView *view = GTR_VIEW (object);
 
+  DEBUG_PRINT ("Dispose view");
+
   if (view->priv->editor_settings)
     {
       g_object_unref (view->priv->editor_settings);



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