try using top-menu-bar buttons and not notebook tabs to control window visibility
[ardour.git] / gtk2_ardour / ardour_ui2.cc
1 /*
2     Copyright (C) 1999 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifdef WAF_BUILD
21 #include "gtk2ardour-config.h"
22 #endif
23
24 #include <fcntl.h>
25 #include <signal.h>
26 #include <unistd.h>
27 #include <cerrno>
28 #include <iostream>
29 #include <cmath>
30
31 #include <sigc++/bind.h>
32 #include "pbd/error.h"
33 #include "pbd/basename.h"
34 #include "pbd/fastlog.h"
35
36 #include "gtkmm2ext/cairocell.h"
37 #include "gtkmm2ext/utils.h"
38 #include "gtkmm2ext/click_box.h"
39 #include "gtkmm2ext/window_title.h"
40
41 #include "ardour/profile.h"
42 #include "ardour/session.h"
43 #include "ardour/types.h"
44
45 #include "ardour_ui.h"
46 #include "keyboard.h"
47 #include "public_editor.h"
48 #include "audio_clock.h"
49 #include "actions.h"
50 #include "main_clock.h"
51 #include "utils.h"
52 #include "theme_manager.h"
53 #include "midi_tracer.h"
54 #include "shuttle_control.h"
55 #include "global_port_matrix.h"
56 #include "location_ui.h"
57 #include "rc_option_editor.h"
58 #include "time_info_box.h"
59
60 #include "i18n.h"
61
62 using namespace std;
63 using namespace ARDOUR;
64 using namespace PBD;
65 using namespace Gtkmm2ext;
66 using namespace Gtk;
67 using namespace Glib;
68 using namespace ARDOUR_UI_UTILS;
69
70
71 bool
72 ARDOUR_UI::tabs_button_event (GdkEventButton* ev)
73 {
74         std::vector<Widget*> children = _tabs.get_children();
75
76         for (std::vector<Widget*>::iterator w = children.begin(); w != children.end(); ++w) {
77
78                 Gtk::Widget* close_button = reinterpret_cast<Gtk::Widget*> ((*w)->get_data ("close-button"));
79
80                 if (close_button) {
81
82                         Gtk::Allocation alloc (close_button->get_allocation());
83                         int dx, dy;
84
85                         /* Allocation origin uses toplevel window coordinates;
86                          * event origin uses _tabs-centric coordinate space, so
87                          * translate before computing if event is inside the
88                          * close button.
89                          */
90
91                         close_button->get_toplevel()->translate_coordinates (_tabs, alloc.get_x(), alloc.get_y(), dx, dy);
92
93                         if (ev->x >= dx &&
94                             ev->y >= dy &&
95                             ev->x < dx + alloc.get_width() &&
96                             ev->y < dy + alloc.get_height()) {
97                                 if (close_button->event ((GdkEvent*) ev)) {
98                                         return true;
99                                 }
100                         }
101                 }
102         }
103
104         return false;
105 }
106
107 void
108 ARDOUR_UI::setup_tooltips ()
109 {
110         set_tip (roll_button, _("Play from playhead"));
111         set_tip (stop_button, _("Stop playback"));
112         set_tip (rec_button, _("Toggle record"));
113         set_tip (play_selection_button, _("Play range/selection"));
114         set_tip (goto_start_button, _("Go to start of session"));
115         set_tip (goto_end_button, _("Go to end of session"));
116         set_tip (auto_loop_button, _("Play loop range"));
117         set_tip (midi_panic_button, _("MIDI Panic\nSend note off and reset controller messages on all MIDI channels"));
118         set_tip (auto_return_button, _("Return to last playback start when stopped"));
119         set_tip (follow_edits_button, _("Playhead follows range selections and edits"));
120         set_tip (auto_input_button, _("Be sensible about input monitoring"));
121         set_tip (click_button, _("Enable/Disable audio click"));
122         set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
123         set_tip (auditioning_alert_button, _("When active, auditioning is taking place.\nClick to stop the audition"));
124         set_tip (feedback_alert_button, _("When active, there is a feedback loop."));
125         set_tip (primary_clock, _("<b>Primary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
126         set_tip (secondary_clock, _("<b>Secondary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
127         set_tip (editor_meter_peak_display, _("Reset All Peak Indicators"));
128         set_tip (error_alert_button, _("Show Error Log and acknowledge warnings"));
129
130         synchronize_sync_source_and_video_pullup ();
131
132         editor->setup_tooltips ();
133 }
134
135 bool
136 ARDOUR_UI::status_bar_button_press (GdkEventButton* ev)
137 {
138         bool handled = false;
139
140         switch (ev->button) {
141         case 1:
142                 status_bar_label.set_text ("");
143                 handled = true;
144                 break;
145         default:
146                 break;
147         }
148
149         return handled;
150 }
151
152 void
153 ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
154 {
155         string text;
156
157         UI::display_message (prefix, prefix_len, ptag, mtag, msg);
158
159         ArdourLogLevel ll = LogLevelNone;
160
161         if (strcmp (prefix, _("[ERROR]: ")) == 0) {
162                 text = "<span color=\"red\" weight=\"bold\">";
163                 ll = LogLevelError;
164         } else if (strcmp (prefix, _("[WARNING]: ")) == 0) {
165                 text = "<span color=\"yellow\" weight=\"bold\">";
166                 ll = LogLevelWarning;
167         } else if (strcmp (prefix, _("[INFO]: ")) == 0) {
168                 text = "<span color=\"green\" weight=\"bold\">";
169                 ll = LogLevelInfo;
170         } else {
171                 text = "<span color=\"white\" weight=\"bold\">???";
172         }
173
174         _log_not_acknowledged = std::max(_log_not_acknowledged, ll);
175
176 #ifdef TOP_MENUBAR
177         text += prefix;
178         text += "</span>";
179         text += msg;
180
181         status_bar_label.set_markup (text);
182 #endif
183 }
184
185 XMLNode*
186 ARDOUR_UI::tearoff_settings (const char* name) const
187 {
188         XMLNode* ui_node = Config->extra_xml(X_("UI"));
189
190         if (ui_node) {
191                 XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
192                 if (tearoff_node) {
193                         XMLNode* mnode = tearoff_node->child (name);
194                         return mnode;
195                 }
196         }
197
198         return 0;
199 }
200
201 #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
202
203 void
204 ARDOUR_UI::setup_transport ()
205 {
206         RefPtr<Action> act;
207
208         transport_hbox.set_border_width (PX_SCALE(3));
209         transport_hbox.set_spacing (PX_SCALE(3));
210
211         transport_base.set_name ("TransportBase");
212         transport_base.add (transport_hbox);
213
214         transport_frame.set_shadow_type (SHADOW_OUT);
215         transport_frame.set_name ("BaseFrame");
216         transport_frame.add (transport_base);
217
218         auto_return_button.set_text(_("Auto Return"));
219
220         follow_edits_button.set_text(_("Follow Edits"));
221
222 //      auto_input_button.set_text (_("Auto Input"));
223
224         click_button.set_icon (ArdourIcon::TransportMetronom);
225
226         act = ActionManager::get_action ("Transport", "ToggleClick");
227         click_button.set_related_action (act);
228         click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
229
230         auto_return_button.set_name ("transport option button");
231         follow_edits_button.set_name ("transport option button");
232         auto_input_button.set_name ("transport option button");
233
234         /* these have to provide a clear indication of active state */
235
236         click_button.set_name ("transport button");
237         sync_button.set_name ("transport active option button");
238
239         stop_button.set_active (true);
240
241         goto_start_button.set_icon (ArdourIcon::TransportStart);
242         goto_end_button.set_icon (ArdourIcon::TransportEnd);
243         roll_button.set_icon (ArdourIcon::TransportPlay);
244         stop_button.set_icon (ArdourIcon::TransportStop);
245         play_selection_button.set_icon (ArdourIcon::TransportRange);
246         auto_loop_button.set_icon (ArdourIcon::TransportLoop);
247         rec_button.set_icon (ArdourIcon::RecButton);
248         midi_panic_button.set_icon (ArdourIcon::TransportPanic);
249
250         act = ActionManager::get_action (X_("Transport"), X_("Stop"));
251         stop_button.set_related_action (act);
252         act = ActionManager::get_action (X_("Transport"), X_("Roll"));
253         roll_button.set_related_action (act);
254         act = ActionManager::get_action (X_("Transport"), X_("Record"));
255         rec_button.set_related_action (act);
256         act = ActionManager::get_action (X_("Transport"), X_("GotoStart"));
257         goto_start_button.set_related_action (act);
258         act = ActionManager::get_action (X_("Transport"), X_("GotoEnd"));
259         goto_end_button.set_related_action (act);
260         act = ActionManager::get_action (X_("Transport"), X_("Loop"));
261         auto_loop_button.set_related_action (act);
262         act = ActionManager::get_action (X_("Transport"), X_("PlaySelection"));
263         play_selection_button.set_related_action (act);
264         act = ActionManager::get_action (X_("MIDI"), X_("panic"));
265         midi_panic_button.set_related_action (act);
266         act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
267         sync_button.set_related_action (act);
268
269         /* clocks, etc. */
270
271         ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
272         ARDOUR_UI::Clock.connect (sigc::mem_fun (secondary_clock, &AudioClock::set));
273
274         primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
275         secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
276         big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed));
277
278         act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
279         auto_return_button.set_related_action (act);
280         act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
281         follow_edits_button.set_related_action (act);
282         act = ActionManager::get_action ("Transport", "ToggleAutoInput");
283         auto_input_button.set_related_action (act);
284
285         /* alerts */
286
287         /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
288
289         solo_alert_button.set_name ("rude solo");
290         act = ActionManager::get_action (X_("Main"), X_("cancel-solo"));
291         solo_alert_button.set_related_action (act);
292         auditioning_alert_button.set_name ("rude audition");
293         auditioning_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_press), false);
294         feedback_alert_button.set_name ("feedback alert");
295         feedback_alert_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::feedback_alert_press), false);
296         error_alert_button.set_name ("error alert");
297         error_alert_button.signal_button_release_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::error_alert_press), false);
298         act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
299         error_alert_button.set_related_action(act);
300         error_alert_button.set_fallthrough_to_parent(true);
301
302         alert_box.set_homogeneous (true);
303         alert_box.set_spacing (PX_SCALE(2));
304         alert_box.pack_start (solo_alert_button, true, true);
305         alert_box.pack_start (auditioning_alert_button, true, true);
306         alert_box.pack_start (feedback_alert_button, true, true);
307
308         /* all transport buttons should be the same size vertically and
309          * horizontally
310          */
311
312         Glib::RefPtr<SizeGroup> transport_button_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
313         transport_button_size_group->add_widget (goto_start_button);
314         transport_button_size_group->add_widget (goto_end_button);
315         transport_button_size_group->add_widget (auto_loop_button);
316         transport_button_size_group->add_widget (rec_button);
317         transport_button_size_group->add_widget (play_selection_button);
318         transport_button_size_group->add_widget (roll_button);
319         transport_button_size_group->add_widget (stop_button);
320
321         /* the icon for this has an odd aspect ratio, so fatten up the button */
322         midi_panic_button.set_size_request (PX_SCALE(25), -1);
323         goto_start_button.set_size_request (PX_SCALE(28), PX_SCALE(44));
324         click_button.set_size_request (PX_SCALE(32), PX_SCALE(44));
325
326
327         HBox* tbox1 = manage (new HBox);
328         HBox* tbox2 = manage (new HBox);
329         HBox* tbox = manage (new HBox);
330
331         VBox* vbox1 = manage (new VBox);
332         VBox* vbox2 = manage (new VBox);
333
334         Alignment* a1 = manage (new Alignment);
335         Alignment* a2 = manage (new Alignment);
336
337         tbox1->set_spacing (PX_SCALE(2));
338         tbox2->set_spacing (PX_SCALE(2));
339         tbox->set_spacing (PX_SCALE(2));
340
341         if (!Profile->get_trx()) {
342                 tbox1->pack_start (midi_panic_button, true, true, 5);
343                 tbox1->pack_start (click_button, true, true, 5);
344         }
345
346         tbox1->pack_start (goto_start_button, true, true);
347         tbox1->pack_start (goto_end_button, true, true);
348         tbox1->pack_start (auto_loop_button, true, true);
349
350         if (!Profile->get_trx()) {
351                 tbox2->pack_start (play_selection_button, true, true);
352         }
353         tbox2->pack_start (roll_button, true, true);
354         tbox2->pack_start (stop_button, true, true);
355         tbox2->pack_start (rec_button, true, true, 5);
356
357         vbox1->pack_start (*tbox1, true, true);
358         vbox2->pack_start (*tbox2, true, true);
359
360         a1->add (*vbox1);
361         a1->set (0.5, 0.5, 0.0, 1.0);
362         a2->add (*vbox2);
363         a2->set (0.5, 0.5, 0.0, 1.0);
364
365         tbox->pack_start (*a1, false, false);
366         tbox->pack_start (*a2, false, false);
367
368         HBox* clock_box = manage (new HBox);
369
370         clock_box->pack_start (*primary_clock, false, false);
371         if (!ARDOUR::Profile->get_small_screen() && !ARDOUR::Profile->get_trx()) {
372                 clock_box->pack_start (*secondary_clock, false, false);
373         }
374         clock_box->set_spacing (PX_SCALE(3));
375
376         shuttle_box = manage (new ShuttleControl);
377         shuttle_box->show ();
378
379         VBox* transport_vbox = manage (new VBox);
380         transport_vbox->set_name ("TransportBase");
381         transport_vbox->set_border_width (0);
382         transport_vbox->set_spacing (PX_SCALE(3));
383         transport_vbox->pack_start (*tbox, true, true, 0);
384
385         if (!Profile->get_trx()) {
386                 transport_vbox->pack_start (*shuttle_box, false, false, 0);
387         }
388
389         time_info_box = manage (new TimeInfoBox);
390
391         transport_hbox.pack_start (*transport_vbox, false, true);
392
393         /* transport related toggle controls */
394
395         VBox* auto_box = manage (new VBox);
396         auto_box->set_homogeneous (true);
397         auto_box->set_spacing (PX_SCALE(2));
398         auto_box->pack_start (sync_button, true, true);
399         if (!ARDOUR::Profile->get_trx()) {
400                 auto_box->pack_start (follow_edits_button, true, true);
401                 auto_box->pack_start (auto_return_button, true, true);
402         }
403
404         if (!ARDOUR::Profile->get_trx()) {
405                 transport_hbox.pack_start (*auto_box, false, false);
406         }
407         transport_hbox.pack_start (*clock_box, true, true);
408
409         if (ARDOUR::Profile->get_trx()) {
410                 transport_hbox.pack_start (*auto_box, false, false);
411         }
412
413         if (!ARDOUR::Profile->get_trx()) {
414                 transport_hbox.pack_start (*time_info_box, false, false);
415         }
416
417         if (!ARDOUR::Profile->get_trx()) {
418                 transport_hbox.pack_start (alert_box, false, false);
419                 transport_hbox.pack_start (meter_box, false, false);
420                 transport_hbox.pack_start (editor_meter_peak_display, false, false);
421         }
422
423         /* desensitize */
424
425         set_transport_sensitivity (false);
426 }
427 #undef PX_SCALE
428
429 void
430 ARDOUR_UI::soloing_changed (bool onoff)
431 {
432         if (solo_alert_button.get_active() != onoff) {
433                 solo_alert_button.set_active (onoff);
434         }
435 }
436
437 void
438 ARDOUR_UI::_auditioning_changed (bool onoff)
439 {
440         auditioning_alert_button.set_active (onoff);
441         set_transport_sensitivity (!onoff);
442 }
443
444 void
445 ARDOUR_UI::auditioning_changed (bool onoff)
446 {
447         UI::instance()->call_slot (MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::_auditioning_changed, this, onoff));
448 }
449
450 bool
451 ARDOUR_UI::audition_alert_press (GdkEventButton*)
452 {
453         if (_session) {
454                 _session->cancel_audition();
455         }
456         return true;
457 }
458
459 bool
460 ARDOUR_UI::feedback_alert_press (GdkEventButton *)
461 {
462         return true;
463 }
464
465 bool
466 ARDOUR_UI::error_alert_press (GdkEventButton* ev)
467 {
468         bool do_toggle = true;
469         if (ev->button == 1) {
470                 if (_log_not_acknowledged == LogLevelError) {
471                         // just acknowledge the error, don't hide the log if it's already visible
472                         RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
473                         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
474                         if (tact && tact->get_active()) {
475                                 do_toggle = false;
476                         }
477                 }
478                 _log_not_acknowledged = LogLevelNone;
479                 error_blink (false); // immediate acknowledge
480         }
481         // maybe fall through to to button toggle
482         return !do_toggle;
483 }
484
485 void
486 ARDOUR_UI::solo_blink (bool onoff)
487 {
488         if (_session == 0) {
489                 return;
490         }
491
492         if (_session->soloing() || _session->listening()) {
493                 if (onoff) {
494                         solo_alert_button.set_active (true);
495                 } else {
496                         solo_alert_button.set_active (false);
497                 }
498         } else {
499                 solo_alert_button.set_active (false);
500         }
501 }
502
503 void
504 ARDOUR_UI::sync_blink (bool onoff)
505 {
506         if (_session == 0 || !_session->config.get_external_sync()) {
507                 /* internal sync */
508                 sync_button.set_active (false);
509                 return;
510         }
511
512         if (!_session->transport_locked()) {
513                 /* not locked, so blink on and off according to the onoff argument */
514
515                 if (onoff) {
516                         sync_button.set_active (true);
517                 } else {
518                         sync_button.set_active (false);
519                 }
520         } else {
521                 /* locked */
522                 sync_button.set_active (true);
523         }
524 }
525
526 void
527 ARDOUR_UI::audition_blink (bool onoff)
528 {
529         if (_session == 0) {
530                 return;
531         }
532
533         if (_session->is_auditioning()) {
534                 if (onoff) {
535                         auditioning_alert_button.set_active (true);
536                 } else {
537                         auditioning_alert_button.set_active (false);
538                 }
539         } else {
540                 auditioning_alert_button.set_active (false);
541         }
542 }
543
544 void
545 ARDOUR_UI::feedback_blink (bool onoff)
546 {
547         if (_feedback_exists) {
548                 if (onoff) {
549                         feedback_alert_button.set_active (true);
550                 } else {
551                         feedback_alert_button.set_active (false);
552                 }
553         } else {
554                 feedback_alert_button.set_active (false);
555         }
556 }
557
558 void
559 ARDOUR_UI::error_blink (bool onoff)
560 {
561         switch (_log_not_acknowledged) {
562                 case LogLevelError:
563                         // blink
564                         if (onoff) {
565                                 error_alert_button.set_custom_led_color(0xff0000ff); // bright red
566                         } else {
567                                 error_alert_button.set_custom_led_color(0x880000ff); // dark red
568                         }
569                         break;
570                 case LogLevelWarning:
571                         error_alert_button.set_custom_led_color(0xccaa00ff); // yellow
572                         break;
573                 case LogLevelInfo:
574                         error_alert_button.set_custom_led_color(0x88cc00ff); // lime green
575                         break;
576                 default:
577                         error_alert_button.set_custom_led_color(0x333333ff); // gray
578                         break;
579         }
580 }
581
582
583
584 void
585 ARDOUR_UI::set_transport_sensitivity (bool yn)
586 {
587         ActionManager::set_sensitive (ActionManager::transport_sensitive_actions, yn);
588         shuttle_box->set_sensitive (yn);
589 }
590
591 void
592 ARDOUR_UI::editor_realized ()
593 {
594         boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
595         Config->map_parameters (pc);
596
597         UIConfiguration::instance().reset_dpi ();
598 }
599
600 void
601 ARDOUR_UI::maximise_editing_space ()
602 {
603         if (editor) {
604                 editor->maximise_editing_space ();
605         }
606 }
607
608 void
609 ARDOUR_UI::restore_editing_space ()
610 {
611         if (editor) {
612                 editor->restore_editing_space ();
613         }
614 }
615
616 void
617 ARDOUR_UI::show_ui_prefs ()
618 {
619         if (rc_option_editor) {
620                 show_tabbable (rc_option_editor);
621                 rc_option_editor->set_current_page (_("GUI"));
622         }
623 }
624
625 bool
626 ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
627 {
628         if (ev->button != 3) {
629                 /* this handler is just for button-3 clicks */
630                 return false;
631         }
632
633         show_tabbable (rc_option_editor);
634         rc_option_editor->set_current_page (_("Misc"));
635         return true;
636 }
637
638 void
639 ARDOUR_UI::toggle_follow_edits ()
640 {
641         RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
642         assert (act);
643
644         RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
645         assert (tact);
646
647         UIConfiguration::instance().set_follow_edits (tact->get_active ());
648 }
649
650 void
651 ARDOUR_UI::update_title ()
652 {
653         if (_session) {
654                 bool dirty = _session->dirty();
655
656                 string session_name;
657
658                 if (_session->snap_name() != _session->name()) {
659                         session_name = _session->snap_name();
660                 } else {
661                         session_name = _session->name();
662                 }
663
664                 if (dirty) {
665                         session_name = "*" + session_name;
666                 }
667
668                 WindowTitle title (session_name);
669                 title += Glib::get_application_name();
670                 _main_window.set_title (title.get_string());
671         } else {
672                 WindowTitle title (Glib::get_application_name());
673                 _main_window.set_title (title.get_string());
674         }
675
676 }
677