[nemiver: 3/6] Fix File list so keyboard navigation scrolls list



commit 0cc63ae06702a3e22b00d5c39ffc01422cb1db62
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Sat Mar 7 14:30:35 2009 -0600

    Fix File list so keyboard navigation scrolls list again (Closes: #564294)
    
    	* src/persp/dbgperspective/nmv-file-list.cc: Put a ScrolledWindow around the
    	  TreeView so that it scrolls properly when the user navigates with the
    	  keyboard.  The loading indicator should be outside of the ScrolledWindow
    	* src/persp/dbgperspective/nmv-open-file-dialog.cc: Packing the
    	  FileList widget inside of a ScrolledWindow should not be the responsiblity
    	  of the dialog, leave that to the FileList widget itself.
---
 src/persp/dbgperspective/nmv-file-list.cc        |   30 +++++++++++++++++----
 src/persp/dbgperspective/nmv-open-file-dialog.cc |   11 +------
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-file-list.cc b/src/persp/dbgperspective/nmv-file-list.cc
index 8f75962..92f40a9 100644
--- a/src/persp/dbgperspective/nmv-file-list.cc
+++ b/src/persp/dbgperspective/nmv-file-list.cc
@@ -26,6 +26,7 @@
 #include <glib/gi18n.h>
 #include <gtkmm/treeview.h>
 #include <gtkmm/treestore.h>
+#include <gtkmm/scrolledwindow.h>
 #include "common/nmv-exception.h"
 #include "nmv-file-list.h"
 #include "nmv-ui-utils.h"
@@ -396,7 +397,8 @@ FileListView::find_filename_recursive (const Gtk::TreeModel::iterator &a_iter,
 struct FileList::Priv : public sigc::trackable {
 public:
     SafePtr<Gtk::VBox> vbox;
-    SafePtr<Gtk::Label> loading_label;
+    SafePtr<Gtk::ScrolledWindow> scrolled_window;
+    SafePtr<Gtk::Label> loading_indicator;
     SafePtr<FileListView> tree_view;
 
     Glib::RefPtr<Gtk::ActionGroup> file_list_action_group;
@@ -405,13 +407,19 @@ public:
 
     Priv (IDebuggerSafePtr &a_debugger, const UString &a_starting_path) :
         vbox (new Gtk::VBox()),
-        loading_label (new Gtk::Label(_("Loading Files from target executable..."))),
+        scrolled_window (new Gtk::ScrolledWindow ()),
+        loading_indicator (new Gtk::Label (_("Loading Files from target executable..."))),
         debugger (a_debugger),
         start_path (a_starting_path)
     {
         build_tree_view ();
-        vbox->pack_start (*loading_label, Gtk::PACK_SHRINK, 3 /*padding*/);
-        vbox->pack_start (*tree_view);
+        vbox->pack_start (*loading_indicator, Gtk::PACK_SHRINK, 3 /*padding*/);
+        vbox->pack_start (*scrolled_window);
+        scrolled_window->set_policy (Gtk::POLICY_AUTOMATIC,
+                                     Gtk::POLICY_AUTOMATIC);
+        scrolled_window->set_shadow_type (Gtk::SHADOW_IN);
+        scrolled_window->add (*tree_view);
+        scrolled_window->show ();
         vbox->show ();
         debugger->files_listed_signal ().connect(
             sigc::mem_fun(*this, &FileList::Priv::on_files_listed_signal));
@@ -424,6 +432,16 @@ public:
         tree_view->show ();
     }
 
+    void show_loading_indicator ()
+    {
+        loading_indicator->show ();
+    }
+
+    void stop_loading_indicator ()
+    {
+        loading_indicator->hide ();
+    }
+
     void on_files_listed_signal (const vector<UString> &a_files,
                                  const UString &a_cookie)
     {
@@ -433,7 +451,7 @@ public:
 
         THROW_IF_FAIL (tree_view);
 
-        loading_label->hide ();
+        stop_loading_indicator ();
         tree_view->set_files (a_files);
         // this signal should only be called once per dialog
         // -- the first time
@@ -472,7 +490,7 @@ FileList::update_content ()
     THROW_IF_FAIL (m_priv);
     THROW_IF_FAIL (m_priv->debugger);
     // set some placeholder text to indicate that we're loading files
-    m_priv->loading_label->show ();
+    m_priv->show_loading_indicator ();
     m_priv->debugger->list_files ();
 }
 
diff --git a/src/persp/dbgperspective/nmv-open-file-dialog.cc b/src/persp/dbgperspective/nmv-open-file-dialog.cc
index 13f0c53..495752d 100644
--- a/src/persp/dbgperspective/nmv-open-file-dialog.cc
+++ b/src/persp/dbgperspective/nmv-open-file-dialog.cc
@@ -25,7 +25,6 @@
 
 #include <glib/gi18n.h>
 #include <libglademm.h>
-#include <gtkmm/scrolledwindow.h>
 #include <gtkmm/filechooserwidget.h>
 #include <gtkmm/radiobutton.h>
 #include <gtkmm/button.h>
@@ -43,7 +42,6 @@ namespace nemiver {
 class OpenFileDialog::Priv {
     public:
     Gtk::VBox* vbox_file_list;
-    Gtk::ScrolledWindow scrolled_window;
     Gtk::RadioButton *radio_button_file_list, *radio_button_chooser;
     Gtk::FileChooserWidget file_chooser;
     FileList file_list;
@@ -96,11 +94,6 @@ public:
             (sigc::mem_fun (*this,
                             &Priv::on_chooser_selection_changed_signal));
 
-        scrolled_window.set_policy (Gtk::POLICY_AUTOMATIC,
-                                    Gtk::POLICY_AUTOMATIC);
-        scrolled_window.set_shadow_type (Gtk::SHADOW_IN);
-        scrolled_window.add(file_list.widget ());
-
         update_from_debugger_state ();
     }
 
@@ -116,8 +109,8 @@ public:
             LOG_DD("Target file list is active");
             // remove existing children of vbox_file_list
             vbox_file_list->children ().clear();
-            vbox_file_list->pack_start (scrolled_window);
-            scrolled_window.show ();
+            vbox_file_list->pack_start (file_list.widget ());
+            file_list.widget ().show ();
         } else if (radio_button_chooser->get_active ()) {
             LOG_DD("file chooser is active");
             // remove existing children of vbox_file_list



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