[glom] Dialog_Glom: Make this a little less stupid, so we can ifdef for Maemo.



commit b3cba91ec4c8a79e6bb81fa6336e11ff9d72bc53
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 22 19:30:00 2009 +0200

    Dialog_Glom: Make this a little less stupid, so we can ifdef for Maemo.
    
    * glom/dialog_glom.[h|cc]: Derive from Window, not Dialog.
    Constructor: Add the provided box instead of requiring us to add it
    explicitly (to the Dialog's vbox).
    * glom/frame_glom.cc:
    * glom/mode_data/notebook_data.cc: Adapt.

 ChangeLog                       |   10 ++++++++++
 glom/dialog_glom.cc             |   14 +++++---------
 glom/dialog_glom.h              |   12 +++++-------
 glom/frame_glom.cc              |    3 ---
 glom/mode_data/notebook_data.cc |    6 +++---
 5 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f2c62bd..aa511f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-09-22  Murray Cumming  <murrayc murrayc com>
 
+	Dialog_Glom: Make this a little less stupid, so we can ifdef for Maemo.
+
+	* glom/dialog_glom.[h|cc]: Derive from Window, not Dialog.
+	Constructor: Add the provided box instead of requiring us to add it 
+	explicitly (to the Dialog's vbox).
+	* glom/frame_glom.cc:
+	* glom/mode_data/notebook_data.cc: Adapt.
+
+2009-09-22  Murray Cumming  <murrayc murrayc com>
+
 	On Maemo, show the details in a separate window.
 	
 	* glom/mode_data/notebook_data.[h|cc]: On maemo, hide the tabs, and don't 
diff --git a/glom/dialog_glom.cc b/glom/dialog_glom.cc
index 038b23c..69f9f8a 100644
--- a/glom/dialog_glom.cc
+++ b/glom/dialog_glom.cc
@@ -32,21 +32,17 @@ Dialog_Glom::Dialog_Glom(Box_WithButtons* pBox, const Glib::ustring& title)
   set_border_width(Utils::DEFAULT_SPACING_SMALL);
 
   m_pBox = pBox;
+  g_assert(m_pBox);
 
-  if(m_pBox)
-  {
-    m_pBox->signal_cancelled.connect(sigc::mem_fun(*this, &Dialog_Glom::on_box_cancelled));
-    m_pBox->show();
-  }
-  else
-    std::cerr << "Dialog_Glom::Dialog_Glom(): pBox was NULL." << std::endl;
+  m_pBox->signal_cancelled.connect(sigc::mem_fun(*this, &Dialog_Glom::on_box_cancelled));
+
+  add(*m_pBox);
+  m_pBox->show();
 
   //Set the default button, if there is one:
   Gtk::Widget* default_button = m_pBox->get_default_button();
   if(default_button)
     set_default(*default_button);
-
-  set_has_separator(false);
 }
 
 Dialog_Glom::~Dialog_Glom()
diff --git a/glom/dialog_glom.h b/glom/dialog_glom.h
index 81d0dac..94f5c4e 100644
--- a/glom/dialog_glom.h
+++ b/glom/dialog_glom.h
@@ -22,27 +22,25 @@
 #define DIALOG_GLOM_H
 
 #include <glom/box_withbuttons.h>
-#include <gtkmm/dialog.h>
+#include <gtkmm/window.h>
 #include <gtkmm/button.h>
 
 namespace Glom
 {
 
-//TODO: Use a Window instead of a Dialog?
 /** A window that can hold a Box_WithButtons.
  */
 class Dialog_Glom :
-  public Gtk::Dialog
+  public Gtk::Window
 {
 public: 
   Dialog_Glom(Box_WithButtons* pBox, const Glib::ustring& title = Glib::ustring());
   virtual ~Dialog_Glom();
 
-//TODO: Make this private and non-virtual?
-  //Signal handlers:
-  virtual void on_box_cancelled();
+private:
 
-protected:
+  //Signal handlers:
+  void on_box_cancelled();
 
   //Member widgets:
   Box_WithButtons* m_pBox;
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index f33bcfd..95f2160 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1317,7 +1317,6 @@ void Frame_Glom::do_menu_Navigate_Table(bool open_default)
     if(pWindow)
       m_pDialog_Tables->set_transient_for(*pWindow);
 
-    m_pDialog_Tables->get_vbox()->pack_start(*m_pBox_Tables);
     m_pDialog_Tables->set_default_size(300, 400);
     m_pBox_Tables->show_all();
     add_view(m_pBox_Tables);
@@ -1810,7 +1809,6 @@ void Frame_Glom::on_menu_developer_reports()
     m_pDialogLayoutReport->set_transient_for(*(get_app_window()));
     m_pDialogLayoutReport->signal_hide().connect( sigc::mem_fun(*this, &Frame_Glom::on_dialog_layout_report_hide) );
 
-    m_pDialog_Reports->get_vbox()->pack_start(*m_pBox_Reports);
     m_pDialog_Reports->set_default_size(300, 400);
     m_pBox_Reports->show_all();
 
@@ -1837,7 +1835,6 @@ void Frame_Glom::on_menu_developer_print_layouts()
     Utils::get_glade_developer_widget_derived_with_warning("box_print_layouts", m_pBox_PrintLayouts);
     m_pDialog_PrintLayouts = new Dialog_Glom(m_pBox_PrintLayouts);
 
-    m_pDialog_PrintLayouts->get_vbox()->pack_start(*m_pBox_PrintLayouts);
     m_pDialog_PrintLayouts->set_default_size(300, 400);
     m_pBox_PrintLayouts->show_all();
     add_view(m_pBox_PrintLayouts);
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 4edd3e9..283344e 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -27,7 +27,7 @@ namespace Glom
 
 Notebook_Data::Notebook_Data()
 : m_iPage_Details(0), m_iPage_List(0)
-  #ifndef GLOM_ENABLE_MAEMO
+  #ifdef GLOM_ENABLE_MAEMO
   , m_window_maemo_details(0)
   #endif
 {
@@ -46,8 +46,6 @@ Notebook_Data::Notebook_Data()
   if(pWindow)
     m_window_maemo_details->set_transient_for(*pWindow);
 
-  //TODO: Avoid having to add this to the Dialog_Glom _again_:
-  m_window_maemo_details->get_vbox()->pack_start(m_Box_Details);
   m_Box_Details.show_all();
   #endif //GLOM_ENABLE_MAEMO
 
@@ -98,8 +96,10 @@ Notebook_Data::~Notebook_Data()
   remove_view(&m_Box_List);
   remove_view(&m_Box_Details);
 
+#ifdef GLOM_ENABLE_MAEMO
   if(m_window_maemo_details)
     delete m_window_maemo_details;
+#endif //GLOM_ENABLE_MAEMO
 }
 
 bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value_for_details)



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