[meld] newdifftab: Refactor tab label handling to avoid calling signal handler



commit 254a1fb2c6b8022880bfecd7e86a81dfa5961930
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Nov 6 07:30:38 2015 +1000

    newdifftab: Refactor tab label handling to avoid calling signal handler

 meld/melddoc.py    |    2 +-
 meld/meldwindow.py |    1 -
 meld/newdifftab.py |    5 ++++-
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index e9ceccb..d3e329d 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -62,7 +62,7 @@ class LabeledObjectMixin(GObject.GObject):
     }
 
     label_text = _("untitled")
-    tooltip_text = _("untitled")
+    tooltip_text = None
 
     def label_changed(self):
         self.emit("label-changed", self.label_text, self.tooltip_text)
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index d3c5ad5..6c7620e 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -570,7 +570,6 @@ class MeldWindow(gnomeglade.Component):
     def append_new_comparison(self):
         doc = newdifftab.NewDiffTab(self)
         self._append_page(doc, "document-new")
-        self.on_notebook_label_changed(doc, _("New comparison"), None)
 
         def diff_created_cb(doc, newdoc):
             doc.on_delete_event()
diff --git a/meld/newdifftab.py b/meld/newdifftab.py
index 1a3f47c..53fecd1 100644
--- a/meld/newdifftab.py
+++ b/meld/newdifftab.py
@@ -20,6 +20,7 @@ from gi.repository import GObject
 from gi.repository import Gtk
 
 from .ui import gnomeglade
+from meld.conf import _
 from meld.melddoc import LabeledObjectMixin
 from meld.recent import recent_comparisons
 
@@ -34,6 +35,8 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component):
                          (object,)),
     }
 
+    label_text = _("New comparison")
+
     def __init__(self, parentapp):
         GObject.GObject.__init__(self)
         gnomeglade.Component.__init__(self, "tab-placeholder.ui",
@@ -129,7 +132,7 @@ class NewDiffTab(LabeledObjectMixin, GObject.GObject, gnomeglade.Component):
         self.emit('diff-created', tab)
 
     def on_container_switch_in_event(self, *args):
-        pass
+        self.label_changed()
 
     def on_container_switch_out_event(self, *args):
         pass


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