[latexila] Use tepl_buffer_get_short_title()



commit 38e1f9e1ef07a97f90add7d56226ba6c4066f576
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Aug 6 17:27:44 2017 +0200

    Use tepl_buffer_get_short_title()

 src/document_tab.vala          |    5 -----
 src/main_window.vala           |    5 +++++
 src/main_window_documents.vala |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/document_tab.vala b/src/document_tab.vala
index 7994b27..4d9c454 100644
--- a/src/document_tab.vala
+++ b/src/document_tab.vala
@@ -224,11 +224,6 @@ public class DocumentTab : Tepl.Tab
         return Utils.get_relative_path (origin, target, common_dir);
     }
 
-    public string get_name ()
-    {
-        return _label_mark.label + _label_text.label;
-    }
-
     public string get_menu_tip ()
     {
         return _("Activate '%s'").printf (document.get_uri_for_display ());
diff --git a/src/main_window.vala b/src/main_window.vala
index 93de1d0..c7b8055 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -732,6 +732,11 @@ public class MainWindow : ApplicationWindow
             _main_window_build_tools.update_sensitivity ();
         });
 
+        doc.notify["tepl-short-title"].connect (() =>
+        {
+            sync_name (tab);
+        });
+
         doc.notify["project-id"].connect (() =>
         {
             _main_window_build_tools.update_sensitivity ();
diff --git a/src/main_window_documents.vala b/src/main_window_documents.vala
index 5decf0a..462e063 100644
--- a/src/main_window_documents.vala
+++ b/src/main_window_documents.vala
@@ -133,7 +133,7 @@ public class MainWindowDocuments
         {
             DocumentTab tab = _documents_panel.get_nth_page (doc_num) as DocumentTab;
             string action_name = get_list_action_name (doc_num);
-            string name = tab.get_name ().replace ("_", "__");
+            string name = tab.get_buffer ().get_short_title ().replace ("_", "__");
             string tip = tab.get_menu_tip ();
 
             string accel = null;
@@ -184,7 +184,7 @@ public class MainWindowDocuments
         Gtk.Action? action = _list_action_group.get_action (action_name);
         return_if_fail (action != null);
 
-        action.label = tab.get_name ().replace ("_", "__");
+        action.label = tab.get_buffer ().get_short_title ().replace ("_", "__");
         action.tooltip = tab.get_menu_tip ();
     }
 


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