[latexila/wip/latexila-next] MainWindow: let TeplApplicationWindow handle the title



commit 8ff7c4ec2e2106e9d0c655d9a693b9319d8b9ca6
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Aug 25 10:00:46 2017 +0200

    MainWindow: let TeplApplicationWindow handle the title

 src/main_window.vala |   41 +----------------------------------------
 1 files changed, 1 insertions(+), 40 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 9d579b9..c7f00be 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -268,7 +268,6 @@ public class MainWindow : ApplicationWindow
             update_file_actions_sensitivity ();
             update_config_project_sensitivity ();
             update_cursor_position_statusbar ();
-            my_set_title ();
 
             if (this.active_tab == null)
             {
@@ -290,6 +289,7 @@ public class MainWindow : ApplicationWindow
         });
 
         tepl_window.set_tab_group (_documents_panel);
+        tepl_window.set_handle_title (true);
 
         /* Other misc stuff */
 
@@ -794,48 +794,9 @@ public class MainWindow : ApplicationWindow
 
     private void sync_name (DocumentTab tab)
     {
-        if (tab == active_tab)
-            my_set_title ();
-
         _main_window_documents.update_document_name (tab);
     }
 
-    private void my_set_title ()
-    {
-        if (active_tab == null)
-        {
-            this.title = "LaTeXila";
-            return;
-        }
-
-        uint max_title_length = 100;
-        string title = null;
-        string dirname = null;
-
-        File loc = active_document.location;
-        if (loc == null)
-            title = active_document.get_short_name_for_display ();
-        else
-        {
-            string basename = loc.get_basename ();
-            if (basename.length > max_title_length)
-                title = Utils.str_middle_truncate (basename, max_title_length);
-            else
-            {
-                title = basename;
-                dirname = Utils.str_middle_truncate (
-                    Utils.get_dirname_for_display (loc),
-                    (uint) long.max (20, max_title_length - basename.length));
-            }
-        }
-
-        this.title = (active_document.get_modified () ? "*" : "") +
-                     title +
-                     (active_document.readonly ? " [" + _("Read-Only") + "]" : "") +
-                     (dirname != null ? " (" + dirname + ")" : "") +
-                     " - LaTeXila";
-    }
-
     // return true if the document has been saved
     public bool save_document (Document doc, bool force_save_as)
     {


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