[Nemiver-list] base dialog class



Here's the result of trying to abstract out a common class for Dialogs
in nemiver.  Perhaps it's just because I'm not used to working with
the m_priv implementation-hiding idiom, but I couldn't seem to make
that work well with inheritance.  So I basically ripped out all of the
m_priv stuff from the Dialog classes.  (basically I wanted to move the
'glade' and 'dialog' members up to the base Dialog class, and after
that, the compiler wouldn't let me access those data members from
within the Priv classes.  Maybe I just wasn't smart enough to figure
out how to do it).
Other than that, the functionality is pretty much the same as it was
before.  Do you want to try to keep the m_priv stuff?  Or should I
just commit this as is?

--
jonner
Index: src/DBGPerspective/nmv-dialog.cc
===================================================================
--- src/DBGPerspective/nmv-dialog.cc	(revision 0)
+++ src/DBGPerspective/nmv-dialog.cc	(revision 0)
@@ -0,0 +1,70 @@
+//Author: Jonathon Jongsma
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Goupil;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+
+#include <vector>
+#include <libglademm.h>
+#include <gtkmm/dialog.h>
+#include "nmv-exception.h"
+#include "nmv-dialog.h"
+#include "nmv-env.h"
+#include "nmv-ustring.h"
+
+using namespace std ;
+using namespace nemiver::common ;
+
+namespace nemiver {
+
+Dialog::Dialog (const UString &a_resource_root_path,
+                const UString &a_glade_filename,
+                const UString &a_widget_name)
+{
+        vector<string> path_elems ;
+        path_elems.push_back (Glib::locale_from_utf8 (a_resource_root_path)) ;
+        path_elems.push_back ("glade");
+        path_elems.push_back (a_glade_filename);
+        string glade_path = Glib::build_filename (path_elems) ;
+        if (!Glib::file_test (glade_path, Glib::FILE_TEST_IS_REGULAR)) {
+            THROW (UString ("could not find file ") + glade_path) ;
+        }
+        glade = Gnome::Glade::Xml::create (glade_path) ;
+        THROW_IF_FAIL (glade) ;
+        dialog = env::get_widget_from_glade<Gtk::Dialog> (glade,
+                                                          a_widget_name) ;
+        dialog->hide () ;
+}
+
+Dialog::~Dialog ()
+{
+}
+
+int
+Dialog::run ()
+{
+    THROW_IF_FAIL (dialog) ;
+    return dialog->run () ;
+}
+
+}//end namespace nemiver
+
Index: src/DBGPerspective/nmv-dialog.h
===================================================================
--- src/DBGPerspective/nmv-dialog.h	(revision 0)
+++ src/DBGPerspective/nmv-dialog.h	(revision 0)
@@ -0,0 +1,68 @@
+//Author: Jonathon Jongsma
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Goupil;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#ifndef __NEMIVER_DIALOG_H__
+#define __NEMIVER_DIALOG_H__
+
+#include "nmv-object.h"
+#include "nmv-safe-ptr-utils.h"
+
+namespace nemiver {
+
+namespace common {
+class UString ;
+}
+
+using nemiver::common::UString ;
+using nemiver::common::SafePtr ;
+
+class Dialog : public common::Object {
+    //non copyable
+    Dialog (const Dialog&) ;
+    Dialog& operator= (const Dialog&) ;
+
+    //force to create on the stack
+    void* operator new (size_t) ;
+
+    Dialog () ;
+public:
+
+    Dialog (const UString &a_resource_root_path,
+            const UString &a_glade_filename,
+            const UString &a_widget_name) ;
+
+    virtual ~Dialog () ;
+
+    virtual gint run () ;
+
+protected:
+    SafePtr<Gtk::Dialog> dialog ;
+    Glib::RefPtr<Gnome::Glade::Xml> glade ;
+};//end class nemiver
+
+}//end namespace nemiver
+
+#endif //__NEMIVER_DIALOG_H__
+
+
Index: src/DBGPerspective/nmv-load-core-dialog.cc
===================================================================
--- src/DBGPerspective/nmv-load-core-dialog.cc	(revision 97)
+++ src/DBGPerspective/nmv-load-core-dialog.cc	(working copy)
@@ -39,64 +39,21 @@
 
 namespace nemiver {
 
-struct LoadCoreDialog::Priv {
-    UString root_path ;
-    UString program_name ;
-    UString arguments ;
-    UString core_file ;
-    Glib::RefPtr<Gnome::Glade::Xml> glade ;
-    SafePtr<Gtk::Dialog> dialog ;
-
-    void load_glade_file ()
-    {
-        vector<string> path_elems ;
-        path_elems.push_back (Glib::locale_from_utf8 (root_path)) ;
-        path_elems.push_back ("glade");
-        path_elems.push_back ("loadcoredialog.glade");
-        string glade_path = Glib::build_filename (path_elems) ;
-        if (!Glib::file_test (glade_path, Glib::FILE_TEST_IS_REGULAR)) {
-            THROW (UString ("could not find file ") + glade_path) ;
-        }
-        glade = Gnome::Glade::Xml::create (glade_path) ;
-        THROW_IF_FAIL (glade) ;
-        dialog = env::get_widget_from_glade<Gtk::Dialog> (glade,
-                                                          "loadcoredialog") ;
-        dialog->hide () ;
-    }
-
-};//end struct LoadCoreDialog::Priv
-
-LoadCoreDialog::LoadCoreDialog ()
+LoadCoreDialog::LoadCoreDialog (const UString &a_root_path) :
+    Dialog(a_root_path, "loadcoredialog.glade", "loadcoredialog")
 {
-    m_priv = new LoadCoreDialog::Priv ();
-    m_priv->load_glade_file () ;
-}
-
-LoadCoreDialog::LoadCoreDialog (const UString &a_root_path)
-{
-    m_priv = new LoadCoreDialog::Priv ();
-    m_priv->root_path = a_root_path ;
-    m_priv->load_glade_file () ;
     core_file (Glib::get_current_dir ()) ;
 }
 
 LoadCoreDialog::~LoadCoreDialog ()
 {
-    m_priv = NULL ;
 }
 
-int
-LoadCoreDialog::run ()
-{
-    THROW_IF_FAIL (m_priv) ;
-    return m_priv->dialog->run () ;
-}
-
 UString
 LoadCoreDialog::program_name () const
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::FileChooserButton *chooser = env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::FileChooserButton *chooser = env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                                 "filechooserbutton_executable") ;
     return chooser->get_filename () ;
 }
@@ -104,8 +61,8 @@
 void
 LoadCoreDialog::program_name (const UString &a_name)
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::FileChooserButton *chooser = env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::FileChooserButton *chooser = env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                                 "filechooserbutton_executable") ;
     chooser->set_filename (a_name) ;
 }
@@ -113,9 +70,9 @@
 UString
 LoadCoreDialog::core_file () const
 {
-    THROW_IF_FAIL (m_priv) ;
+    THROW_IF_FAIL (glade) ;
     Gtk::FileChooserButton *chooser =
-        env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+        env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                 "filechooserbutton_corefile");
     return chooser->get_filename () ;
 }
@@ -123,9 +80,9 @@
 void
 LoadCoreDialog::core_file (const UString &a_dir)
 {
-    THROW_IF_FAIL (m_priv) ;
+    THROW_IF_FAIL (glade) ;
     Gtk::FileChooserButton *chooser =
-        env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+        env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                 "filechooserbutton_corefile");
     chooser->set_filename (a_dir) ;
 }
Index: src/DBGPerspective/nmv-run-program-dialog.cc
===================================================================
--- src/DBGPerspective/nmv-run-program-dialog.cc	(revision 97)
+++ src/DBGPerspective/nmv-run-program-dialog.cc	(working copy)
@@ -40,64 +40,21 @@
 
 namespace nemiver {
 
-struct RunProgramDialog::Priv {
-    UString root_path ;
-    UString program_name ;
-    UString arguments ;
-    UString working_directory ;
-    Glib::RefPtr<Gnome::Glade::Xml> glade ;
-    SafePtr<Gtk::Dialog> dialog ;
-
-    void load_glade_file ()
-    {
-        vector<string> path_elems ;
-        path_elems.push_back (Glib::locale_from_utf8 (root_path)) ;
-        path_elems.push_back ("glade");
-        path_elems.push_back ("runprogramdialog.glade");
-        string glade_path = Glib::build_filename (path_elems) ;
-        if (!Glib::file_test (glade_path, Glib::FILE_TEST_IS_REGULAR)) {
-            THROW (UString ("could not find file ") + glade_path) ;
-        }
-        glade = Gnome::Glade::Xml::create (glade_path) ;
-        THROW_IF_FAIL (glade) ;
-        dialog = env::get_widget_from_glade<Gtk::Dialog> (glade,
-                                                          "runprogramdialog") ;
-        dialog->hide () ;
-    }
-
-};//end struct RunProgramDialog::Priv
-
-RunProgramDialog::RunProgramDialog ()
+RunProgramDialog::RunProgramDialog (const UString &a_root_path) :
+    Dialog(a_root_path, "runprogramdialog.glade", "runprogramdialog")
 {
-    m_priv = new RunProgramDialog::Priv ();
-    m_priv->load_glade_file () ;
-}
-
-RunProgramDialog::RunProgramDialog (const UString &a_root_path)
-{
-    m_priv = new RunProgramDialog::Priv ();
-    m_priv->root_path = a_root_path ;
-    m_priv->load_glade_file () ;
     working_directory (Glib::get_current_dir ()) ;
 }
 
 RunProgramDialog::~RunProgramDialog ()
 {
-    m_priv = NULL ;
 }
 
-int
-RunProgramDialog::run ()
-{
-    THROW_IF_FAIL (m_priv) ;
-    return m_priv->dialog->run () ;
-}
-
 UString
 RunProgramDialog::program_name () const
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::FileChooserButton *fcb = env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::FileChooserButton *fcb = env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                                 "filechooserbutton_program") ;
     return fcb->get_filename () ;
 }
@@ -105,8 +62,8 @@
 void
 RunProgramDialog::program_name (const UString &a_name)
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::FileChooserButton *fcb = env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::FileChooserButton *fcb = env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                                 "filechooserbutton_program") ;
     fcb->set_filename (a_name) ;
 }
@@ -114,8 +71,8 @@
 UString
 RunProgramDialog::arguments () const
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::Entry *entry = env::get_widget_from_glade<Gtk::Entry> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::Entry *entry = env::get_widget_from_glade<Gtk::Entry> (glade,
                                                                 "argumentsentry");
     return entry->get_text () ;
 }
@@ -123,8 +80,8 @@
 void
 RunProgramDialog::arguments (const UString &a_args)
 {
-    THROW_IF_FAIL (m_priv) ;
-    Gtk::Entry *entry = env::get_widget_from_glade<Gtk::Entry> (m_priv->glade,
+    THROW_IF_FAIL (glade) ;
+    Gtk::Entry *entry = env::get_widget_from_glade<Gtk::Entry> (glade,
                                                                 "argumentsentry");
     entry->set_text (a_args) ;
 }
@@ -132,9 +89,9 @@
 UString
 RunProgramDialog::working_directory () const
 {
-    THROW_IF_FAIL (m_priv) ;
+    THROW_IF_FAIL (glade) ;
     Gtk::FileChooserButton *fcb =
-        env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+        env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                 "filechooserbutton_workingdir");
     return fcb->get_filename () ;
 }
@@ -142,9 +99,9 @@
 void
 RunProgramDialog::working_directory (const UString &a_dir)
 {
-    THROW_IF_FAIL (m_priv) ;
+    THROW_IF_FAIL (glade) ;
     Gtk::FileChooserButton *fcb =
-        env::get_widget_from_glade<Gtk::FileChooserButton> (m_priv->glade,
+        env::get_widget_from_glade<Gtk::FileChooserButton> (glade,
                                                 "filechooserbutton_workingdir");
     fcb->set_filename (a_dir) ;
 }
Index: src/DBGPerspective/nmv-load-core-dialog.h
===================================================================
--- src/DBGPerspective/nmv-load-core-dialog.h	(revision 97)
+++ src/DBGPerspective/nmv-load-core-dialog.h	(working copy)
@@ -25,7 +25,7 @@
 #ifndef __NEMIVER_LOAD_CORE_DIALOG_H__
 #define __NEMIVER_LOAD_CORE_DIALOG_H__
 
-#include "nmv-object.h"
+#include "nmv-dialog.h"
 #include "nmv-safe-ptr-utils.h"
 
 namespace nemiver {
@@ -37,26 +37,12 @@
 using nemiver::common::UString ;
 using nemiver::common::SafePtr ;
 
-class LoadCoreDialog : public common::Object {
-    struct Priv ;
-    SafePtr<Priv> m_priv ;
+class LoadCoreDialog : public Dialog {
 
-    //non copyable
-    LoadCoreDialog (const LoadCoreDialog&) ;
-    LoadCoreDialog& operator= (const LoadCoreDialog&) ;
-
-    //force to create on the stack
-    void* operator new (size_t) ;
-
-    LoadCoreDialog () ;
 public:
-
     LoadCoreDialog (const UString &a_resource_root_path) ;
-
     virtual ~LoadCoreDialog () ;
 
-    gint run () ;
-
     UString program_name () const ;
     void program_name (const UString &a_name) ;
 
Index: src/DBGPerspective/nmv-run-program-dialog.h
===================================================================
--- src/DBGPerspective/nmv-run-program-dialog.h	(revision 97)
+++ src/DBGPerspective/nmv-run-program-dialog.h	(working copy)
@@ -25,7 +25,7 @@
 #ifndef __NEMIVER_RUN_PROGRAM_DIALOG_H__
 #define __NEMIVER_RUN_PROGRAM_DIALOG_H__
 
-#include "nmv-object.h"
+#include "nmv-dialog.h"
 #include "nmv-safe-ptr-utils.h"
 
 namespace nemiver {
@@ -37,26 +37,14 @@
 using nemiver::common::UString ;
 using nemiver::common::SafePtr ;
 
-class RunProgramDialog : public common::Object {
-    struct Priv ;
-    SafePtr<Priv> m_priv ;
+class RunProgramDialog : public Dialog {
 
-    //non copyable
-    RunProgramDialog (const RunProgramDialog&) ;
-    RunProgramDialog& operator= (const RunProgramDialog&) ;
-
-    //force to create on the stack
-    void* operator new (size_t) ;
-
-    RunProgramDialog () ;
 public:
 
     RunProgramDialog (const UString &a_resource_root_path) ;
 
     virtual ~RunProgramDialog () ;
 
-    gint run () ;
-
     UString program_name () const ;
     void program_name (const UString &a_name) ;
 
Index: src/DBGPerspective/nmv-proc-list-dialog.cc
===================================================================
--- src/DBGPerspective/nmv-proc-list-dialog.cc	(revision 97)
+++ src/DBGPerspective/nmv-proc-list-dialog.cc	(working copy)
@@ -29,7 +29,6 @@
 #include <gtkmm.h>
 #include <glib/gi18n.h>
 #include "nmv-proc-list-dialog.h"
-#include "nmv-proc-mgr.h"
 #include "nmv-env.h"
 
 using namespace std ;
@@ -59,163 +58,118 @@
     }
 };//end class Gtk::TreeModel
 
-static ProcListCols&
+    static ProcListCols&
 columns ()
 {
     static ProcListCols s_columns ;
     return s_columns ;
 }
 
-struct ProcListDialog::Priv {
-    IProcMgr &proc_mgr ;
-    UString root_path ;
-    Glib::RefPtr<Gnome::Glade::Xml> glade ;
-    SafePtr<Gtk::Dialog> dialog ;
-    Gtk::TreeView *proclist_view ;
-    Glib::RefPtr<Gtk::ListStore> proclist_store ;
-    IProcMgr::Process selected_process ;
-    bool process_selected ;
+void ProcListDialog::on_selection_changed_signal ()
+{
+    vector<Gtk::TreeModel::Path> paths =
+        proclist_view->get_selection ()->get_selected_rows () ;
 
-    Priv (const UString &a_root_path,
-          IProcMgr &a_proc_mgr) :
-        proc_mgr (a_proc_mgr),
-        root_path (a_root_path),
-        process_selected (false)
-    {
-        init () ;
-    }
+    if (paths.empty ()) {return;}
 
-    void init ()
-    {
-        load_glade_file () ;
-    }
+    Gtk::TreeModel::iterator row_it = proclist_store->get_iter (paths[0]) ;
+    if (row_it == proclist_store->children ().end ()) {return;}
+    selected_process = (*row_it)[columns ().process] ;
+    process_selected = true ;
+}
 
-    void load_glade_file ()
-    {
-        vector<string> path_elems ;
-        path_elems.push_back (Glib::locale_from_utf8 (root_path)) ;
-        path_elems.push_back ("glade");
-        path_elems.push_back ("proclistdialog.glade");
-        string glade_path = Glib::build_filename (path_elems) ;
-        if (!Glib::file_test (glade_path, Glib::FILE_TEST_IS_REGULAR)) {
-            THROW (UString ("could not find file ") + glade_path) ;
+void ProcListDialog::load_process_list ()
+{
+    process_selected = false ;
+    Gtk::TreeModel::iterator store_it ;
+    list<IProcMgr::Process> process_list = proc_mgr.get_all_process_list ();
+    list<IProcMgr::Process>::iterator process_iter;
+    list<UString> args ;
+    list<UString>::iterator str_iter ;
+    UString args_str ;
+    proclist_store->clear () ;
+    for (process_iter = process_list.begin () ;
+            process_iter != process_list.end ();
+            ++process_iter) {
+        args = process_iter->args () ;
+        if (args.empty ()) {continue;}
+        store_it = proclist_store->append () ;
+        (*store_it)[columns ().pid] = process_iter->pid () ;
+        (*store_it)[columns ().user_name] = process_iter->user_name () ;
+        args_str = "" ;
+        for (str_iter = args.begin () ;
+                str_iter != args.end () ;
+                ++str_iter) {
+            args_str += *str_iter + " " ;
         }
-        glade = Gnome::Glade::Xml::create (glade_path) ;
-        THROW_IF_FAIL (glade) ;
-        dialog = env::get_widget_from_glade<Gtk::Dialog> (glade,
-                                                          "proclistdialog") ;
-        init_widget () ;
+        (*store_it)[columns ().proc_args] = args_str ;
+        (*store_it)[columns ().process] = *process_iter;
     }
+}
 
-    void on_selection_changed_signal ()
-    {
-        vector<Gtk::TreeModel::Path> paths =
-           proclist_view->get_selection ()->get_selected_rows () ;
 
-        if (paths.empty ()) {return;}
+ProcListDialog::ProcListDialog (const UString &a_root_path,
+                                IProcMgr &a_proc_mgr) :
+    Dialog(a_root_path, "proclistdialog.glade", "proclistdialog"),
+    proc_mgr (a_proc_mgr),
+    process_selected (false)
+{
+    dialog->hide () ;
+    proclist_view = env::get_widget_from_glade<Gtk::TreeView>
+        (glade, "proclisttreeview") ;
+    proclist_store = Gtk::ListStore::create (columns ()) ;
+    proclist_view->set_model (proclist_store) ;
 
-        Gtk::TreeModel::iterator row_it = proclist_store->get_iter (paths[0]) ;
-        if (row_it == proclist_store->children ().end ()) {return;}
-        selected_process = (*row_it)[columns ().process] ;
-        process_selected = true ;
-    }
+    proclist_view->append_column ("PID", columns ().pid) ;
+    Gtk::TreeViewColumn *col = proclist_view->get_column (0) ;
+    THROW_IF_FAIL (col) ;
+    col->set_clickable (true) ;
+    col->set_resizable (true) ;
+    col->set_sort_column_id (columns ().pid) ;
 
-    void init_widget ()
-    {
-        dialog->hide () ;
-        proclist_view = env::get_widget_from_glade<Gtk::TreeView>
-                                                    (glade, "proclisttreeview") ;
-        proclist_store = Gtk::ListStore::create (columns ()) ;
-        proclist_view->set_model (proclist_store) ;
+    proclist_view->append_column (_("User Name"), columns ().user_name) ;
+    col = proclist_view->get_column (1) ;
+    THROW_IF_FAIL (col) ;
+    col->set_clickable (true) ;
+    col->set_resizable (true) ;
+    col->set_sort_column_id (columns ().user_name) ;
 
-        proclist_view->append_column ("PID", columns ().pid) ;
-        Gtk::TreeViewColumn *col = proclist_view->get_column (0) ;
-        THROW_IF_FAIL (col) ;
-        col->set_clickable (true) ;
-        col->set_resizable (true) ;
-        col->set_sort_column_id (columns ().pid) ;
+    proclist_view->append_column (_("Proc Args"), columns ().proc_args) ;
+    col = proclist_view->get_column (2) ;
+    THROW_IF_FAIL (col) ;
+    col->set_clickable (true) ;
+    col->set_resizable (true) ;
+    col->set_sort_column_id (columns ().proc_args) ;
 
-        proclist_view->append_column (_("User Name"), columns ().user_name) ;
-        col = proclist_view->get_column (1) ;
-        THROW_IF_FAIL (col) ;
-        col->set_clickable (true) ;
-        col->set_resizable (true) ;
-        col->set_sort_column_id (columns ().user_name) ;
+    proclist_view->get_selection ()->set_mode (Gtk::SELECTION_SINGLE) ;
+    col = proclist_view->get_column (ProcListCols::PID) ;
 
-        proclist_view->append_column (_("Proc Args"), columns ().proc_args) ;
-        col = proclist_view->get_column (2) ;
-        THROW_IF_FAIL (col) ;
-        col->set_clickable (true) ;
-        col->set_resizable (true) ;
-        col->set_sort_column_id (columns ().proc_args) ;
+    proclist_view->get_selection ()->signal_changed ().connect
+        (sigc::mem_fun (*this,
+                        &ProcListDialog::on_selection_changed_signal)) ;
+}
 
-        proclist_view->get_selection ()->set_mode (Gtk::SELECTION_SINGLE) ;
-        col = proclist_view->get_column (ProcListCols::PID) ;
-
-        proclist_view->get_selection ()->signal_changed ().connect
-                                                        (sigc::mem_fun (*this,
-                                                         &Priv::on_selection_changed_signal)) ;
-    }
-
-    void load_process_list ()
-    {
-        process_selected = false ;
-        Gtk::TreeModel::iterator store_it ;
-        list<IProcMgr::Process> process_list = proc_mgr.get_all_process_list ();
-        list<IProcMgr::Process>::iterator process_iter;
-        list<UString> args ;
-        list<UString>::iterator str_iter ;
-        UString args_str ;
-        proclist_store->clear () ;
-        for (process_iter = process_list.begin () ;
-             process_iter != process_list.end ();
-             ++process_iter) {
-            args = process_iter->args () ;
-            if (args.empty ()) {continue;}
-            store_it = proclist_store->append () ;
-            (*store_it)[columns ().pid] = process_iter->pid () ;
-            (*store_it)[columns ().user_name] = process_iter->user_name () ;
-            args_str = "" ;
-            for (str_iter = args.begin () ;
-                 str_iter != args.end () ;
-                 ++str_iter) {
-                args_str += *str_iter + " " ;
-            }
-            (*store_it)[columns ().proc_args] = args_str ;
-            (*store_it)[columns ().process] = *process_iter;
-        }
-    }
-};//end ProcListDialog
-
-
-ProcListDialog::ProcListDialog (const UString &a_root_path,
-                                IProcMgr &a_proc_mgr)
+gint ProcListDialog::run ()
 {
-    m_priv = new Priv (a_root_path, a_proc_mgr);
+    load_process_list();
+    Dialog::run();
 }
 
 ProcListDialog::~ProcListDialog ()
 {
 }
 
-gint
-ProcListDialog::run ()
-{
-    m_priv->load_process_list () ;
-    return m_priv->dialog->run () ;
-}
-
 bool
 ProcListDialog::has_selected_process ()
 {
-    return m_priv->process_selected;
+    return process_selected;
 }
 
 bool
 ProcListDialog::get_selected_process (IProcMgr::Process &a_proc)
 {
-    if (!m_priv->process_selected) {return false;}
-    a_proc = m_priv->selected_process ;
+    if (!process_selected) {return false;}
+    a_proc = selected_process ;
     return true;
 }
 
Index: src/DBGPerspective/nmv-proc-list-dialog.h
===================================================================
--- src/DBGPerspective/nmv-proc-list-dialog.h	(revision 97)
+++ src/DBGPerspective/nmv-proc-list-dialog.h	(working copy)
@@ -25,7 +25,7 @@
 #ifndef __NMV_PROC_LIST_DIALOG_H__
 #define __NMV_PROC_LIST_DIALOG_H__
 
-#include "nmv-object.h"
+#include "nmv-dialog.h"
 #include "nmv-safe-ptr-utils.h"
 #include "nmv-proc-mgr.h"
 
@@ -34,25 +34,27 @@
 }
 
 namespace nemiver {
-class ProcListDialog : public Object {
-    struct Priv ;
-    //non copyable
-    ProcListDialog (const ProcListDialog &) ;
-    ProcListDialog& operator= (const ProcListDialog &) ;
+class ProcListDialog : public Dialog {
 
-    ProcListDialog () ;
-
-    SafePtr<Priv> m_priv ;
-
 public:
 
     ProcListDialog (const UString &a_root_path,
                     IProcMgr &a_proc_mgr) ;
     virtual ~ProcListDialog () ;
+    virtual gint run () ;
 
-    gint run () ;
     bool has_selected_process () ;
     bool get_selected_process (IProcMgr::Process &a_proc/*out param*/) ;
+
+private:
+    void on_selection_changed_signal ();
+    void load_process_list ();
+
+    IProcMgr &proc_mgr ;
+    Gtk::TreeView *proclist_view ;
+    Glib::RefPtr<Gtk::ListStore> proclist_store ;
+    IProcMgr::Process selected_process ;
+    bool process_selected ;
 };//end class ProcListDialog
 }//end namespace nemiver
 
Index: src/DBGPerspective/Makefile.am
===================================================================
--- src/DBGPerspective/Makefile.am	(revision 97)
+++ src/DBGPerspective/Makefile.am	(working copy)
@@ -18,6 +18,8 @@
 nmv-dbg-perspective.h \
 nmv-source-editor.cc \
 nmv-source-editor.h \
+nmv-dialog.cc \
+nmv-dialog.h \
 nmv-run-program-dialog.cc \
 nmv-run-program-dialog.h \
 nmv-load-core-dialog.cc \


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