Reworked track settings.
[demorecorder] / src / TrackTransport.vala
index 2e4b69d..1f28706 100644 (file)
@@ -19,7 +19,10 @@ namespace IdWorks {
 
 public class TrackTransport : Gtk.HBox {
   
-  public TrackBin track_bin;
+  public TrackBin track_bin {
+    get { return this.track.bin; }
+    set { this.track.bin = value; }
+  }
   public Track track;
   public Gtk.Window window;
 
@@ -40,10 +43,10 @@ public class TrackTransport : Gtk.HBox {
   Gtk.Button btn_delete;
   
   Gtk.Label lbl_title;
-  string _title;
+  //string _title;
   public string title {
-    get { return _title; /*lbl_title.get_text();*/ } 
-    set { _title = value; lbl_title.set_markup("<b>" + _title + "</b>"); }
+    get { return this.track.label; /*lbl_title.get_text();*/ } 
+    set { this.track.label = value; lbl_title.set_markup("<b>" + value + "</b>"); }
   }
   
   Gtk.ToggleButton btn_active;
@@ -195,8 +198,14 @@ public class TrackTransport : Gtk.HBox {
     lbl_title = new Gtk.Label("<b>New Track</b>");
     lbl_title.use_markup = true;
     lbl_title.set_alignment(0.1f, 0.4f);
-    lbl_title.set_ellipsize(Pango.EllipsizeMode.START);
-    this.pack_start(lbl_title, true, true, 2);
+    lbl_title.set_ellipsize(Pango.EllipsizeMode.END);
+    lbl_title.set_line_wrap(true);
+    Gtk.EventBox click_title = new Gtk.EventBox();
+    click_title.set_above_child(true);
+    click_title.set_visible_window(true);
+    click_title.add(lbl_title);
+    click_title.button_release_event.connect((e) => {edit_title(lbl_title.get_text());});
+    this.pack_start(click_title, true, true, 2);
     Gtk.HButtonBox buttons = new Gtk.HButtonBox();
     btn_active = new Gtk.ToggleButton(); //.with_label("Active");
     btn_mute.set_image(new Gtk.Image.from_icon_name("general_presence_online", Gtk.IconSize.SMALL_TOOLBAR));
@@ -221,7 +230,19 @@ public class TrackTransport : Gtk.HBox {
     btn_delete.clicked.connect((b) => { delete_clicked(); });
     buttons.add(btn_delete);
     this.pack_start(buttons, false, false, 0);
-  }  
+  }
+  
+  private bool edit_title(string text) {
+    TrackDetailsDialog dlg = new TrackDetailsDialog.with_values(window, "Track details", text);
+    dlg.set_transient_for(this.window);
+    int ret = dlg.run();
+    if (Gtk.ResponseType.OK == ret) {
+      this.title = dlg.get_name();
+    }
+    dlg.destroy();
+    dlg = null;
+    return false;
+  }
   
   /* Overrides */
   private override void add(Gtk.Widget w) {