apply same always-check-display to recent sessions scroller in new session dialog
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 21 Sep 2013 17:14:33 +0000 (13:14 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 21 Sep 2013 17:14:33 +0000 (13:14 -0400)
It turns out that we always create a new ArdourStartup right now, so this and the previous commit
are not actually necessary, but they do pave the way for keeping the dialog around instead

gtk2_ardour/startup.cc
gtk2_ardour/startup.h

index 6c68f69fadaad324e1d852901e6e64619e82ff9e..ed6d3b020efebbd414a6c6db2d8988b42f22f0a9 100644 (file)
@@ -546,45 +546,32 @@ ArdourStartup::setup_initial_choice_page ()
                info_box->pack_start (*updates_button, false, false);
        }
 
-       ARDOUR::RecentSessions rs;
-       ARDOUR::read_recent_sessions (rs);
-       
-       if (!rs.empty()) {
-
-               /* recent session scroller */
-
-               Label* load_label = manage (new Label);
-               load_label->set_markup (string_compose ("<span weight=\"bold\" size=\"large\">%1</span>", _("Load a recent session")));
-               load_label->set_alignment (0, 0.5);
+       /* recent session scroller */
 
-               centering_vbox->pack_start (*load_label, false, false, 12);
-
-               recent_session_model = TreeStore::create (recent_session_columns);
-               redisplay_recent_sessions ();
-
-               recent_session_display.set_model (recent_session_model);
-               recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
-               recent_session_display.set_headers_visible (false);
-               recent_session_display.get_selection()->set_mode (SELECTION_SINGLE);
+       recent_label.set_no_show_all (true);
+       recent_scroller.set_no_show_all (true);
        
-               recent_session_display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &ArdourStartup::recent_session_row_selected));
+       recent_label.set_markup (string_compose ("<span weight=\"bold\" size=\"large\">%1</span>", _("Load a recent session")));
+       recent_label.set_alignment (0, 0.5);
        
-               recent_scroller.add (recent_session_display);
-               recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
-               recent_scroller.set_shadow_type (Gtk::SHADOW_IN);
+       recent_session_model = TreeStore::create (recent_session_columns);
        
-               recent_session_display.show();
+       recent_session_display.set_model (recent_session_model);
+       recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
+       recent_session_display.set_headers_visible (false);
+       recent_session_display.get_selection()->set_mode (SELECTION_SINGLE);
        
-               recent_scroller.show();
-               recent_session_display.signal_row_activated().connect (sigc::mem_fun (*this, &ArdourStartup::recent_row_activated));
+       recent_session_display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &ArdourStartup::recent_session_row_selected));
        
-               int cnt = redisplay_recent_sessions ();
-               if (cnt > 4) {
-                       recent_scroller.set_size_request (-1, 300);
-               }
+       recent_scroller.add (recent_session_display);
+       recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+       recent_scroller.set_shadow_type (Gtk::SHADOW_IN);
        
-               centering_vbox->pack_start (recent_scroller, false, true);
-       }
+       recent_session_display.show();
+       recent_session_display.signal_row_activated().connect (sigc::mem_fun (*this, &ArdourStartup::recent_row_activated));
+       
+       centering_vbox->pack_start (recent_label, false, false, 12);
+       centering_vbox->pack_start (recent_scroller, false, true);
 
        /* Browse button */
        
@@ -1373,7 +1360,6 @@ ArdourStartup::on_map ()
 {
        Gtk::Assistant::on_map ();
 
-       redisplay_recent_sessions ();
        populate_session_templates ();
 
        if (!template_model->children().empty()) {
@@ -1383,5 +1369,20 @@ ArdourStartup::on_map ()
                use_template_button.hide();
                template_chooser.hide ();
        }
+
+       if (recent_session_model) {
+               int cnt = redisplay_recent_sessions ();
+               if (cnt > 0) {
+                       recent_scroller.show();
+                       recent_label.show ();
+                       
+                       if (cnt > 4) {
+                               recent_scroller.set_size_request (-1, 300);
+                       }
+               } else {
+                       recent_scroller.hide();
+                       recent_label.hide ();
+               }
+       }
 }
                
index fce2bdb2db8dcc00e65e4e532e41456c3b3647f7..45d11190f9602d6c2e601126cca5ee184a298b22 100644 (file)
@@ -160,6 +160,7 @@ class ArdourStartup : public Gtk::Assistant {
        Gtk::TreeView                recent_session_display;
        Glib::RefPtr<Gtk::TreeStore> recent_session_model;
        Gtk::ScrolledWindow          recent_scroller;
+        Gtk::Label                   recent_label;
        Gtk::FileChooserButton       existing_session_chooser;
        int redisplay_recent_sessions ();
        void recent_session_row_selected ();