[glom/maemo5] Maemo: Show the Find UI in a separate window.



commit baa622dde072f35388b8002bbfab1226ca7df3f1
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Sep 28 16:40:04 2009 +0200

    Maemo: Show the Find UI in a separate window.

 ChangeLog          |    4 ++++
 glom/frame_glom.cc |   43 ++++++++++++++++++++++++++++++++-----------
 glom/frame_glom.h  |   24 +++++++++++++-----------
 3 files changed, 49 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8bf9d89..1c286cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-09-28  Murray Cumming  <murrayc murrayc com>
 
+	* glom/frame_glom.[h|cc]: Maemo: Show the Find UI in a separate window.
+
+2009-09-28  Murray Cumming  <murrayc murrayc com>
+
 	Maemo: Find: Use only the details view.
 	
 	* glom/mode_find/notebook_find.[h|cc]: Hide the list view (and tabs) on Maemo.
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index f78ea3c..4e1e769 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -82,9 +82,6 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
   m_box_footer(0),
   m_pLabel_Mode(0),
   m_pLabel_userlevel(0),
-  m_pBox_QuickFind(0),
-  m_pEntry_QuickFind(0),
-  m_pButton_QuickFind(0),
   m_pBox_RecordsCount(0),
   m_pLabel_RecordsCount(0),
   m_pLabel_FoundCount(0),
@@ -94,6 +91,9 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
   m_pBox_Tables(0),
   m_pDialog_Tables(0),
 #endif //GLOM_ENABLE_MAEMO
+  m_pBox_QuickFind(0),
+  m_pEntry_QuickFind(0),
+  m_pButton_QuickFind(0),
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_pDialog_Reports(0),
   m_pDialogLayoutReport(0),
@@ -163,6 +163,12 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
   add_view(&m_Notebook_Find); //Also a composite view.
 
   on_userlevel_changed(AppState::USERLEVEL_OPERATOR); //A default to show before a document is created or loaded.
+  
+  #ifdef GLOM_ENABLE_MAEMO
+  m_maemo_window.set_title(_("Glom: Find"));
+  m_maemo_window_find.add(m_Notebook_Find);
+  m_Notebook_Find.show();
+  #endif
 }
 
 Frame_Glom::~Frame_Glom()
@@ -282,6 +288,12 @@ void Frame_Glom::on_box_tables_selected(const Glib::ustring& strName)
 
 void Frame_Glom::set_mode_widget(Gtk::Widget& widget)
 {
+  #ifdef GLOM_ENABLE_MAEMO
+  //On Maemo, the find UI is always shown in a separate window instead.
+  if(&widget == &m_Notebook_Find)
+    return;
+  #endif
+
   //Remove current contents.
   //I wish that there was a better way to do this:
   //Trying to remove all of them leads to warnings,
@@ -1126,16 +1138,25 @@ void Frame_Glom::on_menu_Mode_Find()
   if(previously_in_data_mode && (list_or_details == Notebook_Data::DATA_VIEW_Details))
     m_Notebook_Data.set_current_view(Notebook_Data::DATA_VIEW_List);
 
-  if(set_mode(MODE_Find))
-  {
-    show_table(m_table_name);
+  if(!set_mode(MODE_Find))
+    return;
+  
+  show_table(m_table_name);
 
-    if(previously_in_data_mode)
-    {
-      //Show the same layout in Find mode as was just being viewed in Data mode:
-      m_Notebook_Find.set_current_view(list_or_details);
-    }
+  if(previously_in_data_mode)
+  {
+    //Show the same layout in Find mode as was just being viewed in Data mode:
+    m_Notebook_Find.set_current_view(list_or_details);
   }
+  
+  #ifdef GLOM_ENABLE_CLIENT_ONLY
+  Gtk::Window* parent = get_app_window();
+  g_assert(parent);
+  if(parent)
+    m_maemo_window_find.set_transient_for(*parent);
+    
+  m_maemo_window_find.show(); //TODO: Switch back to data on hide?
+  #endif
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index fb31fc1..59d8d0a 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -215,11 +215,11 @@ protected:
   void update_table_in_document_from_database();
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  virtual void set_mode_widget(Gtk::Widget& widget); //e.g. show the design mode notebook.
-  virtual bool set_mode(enumModes mode); //bool indicates that there was a change.
+  void set_mode_widget(Gtk::Widget& widget); //e.g. show the design mode notebook.
+  bool set_mode(enumModes mode); //bool indicates that there was a change.
 
-  virtual Gtk::Window* get_app_window();
-  virtual const Gtk::Window* get_app_window() const;
+  Gtk::Window* get_app_window();
+  const Gtk::Window* get_app_window() const;
 
   void update_records_count();
 
@@ -249,8 +249,6 @@ private:
    * @result Whether to try again.
    */
   bool handle_request_password_connection_error(bool asked_for_password, const ExceptionConnection& ex, bool& database_not_found);
-
-protected:
   
   //Member data:
   Glib::ustring m_table_name;
@@ -262,10 +260,6 @@ protected:
   Gtk::Label* m_pLabel_Mode;
   Gtk::Label* m_pLabel_userlevel;
 
-  Gtk::HBox* m_pBox_QuickFind; //Only show this when in Find mode.
-  Gtk::Entry* m_pEntry_QuickFind;
-  Gtk::Button* m_pButton_QuickFind;
-
   Gtk::HBox* m_pBox_RecordsCount; //Only show this when in Data mode.
   Gtk::Label* m_pLabel_RecordsCount;
   Gtk::Label* m_pLabel_FoundCount;
@@ -280,8 +274,16 @@ protected:
 #endif //GLOM_ENABLE_MAEMO
 
   Notebook_Data m_Notebook_Data;
+  
+  Gtk::HBox* m_pBox_QuickFind; //Only show this when in Find mode.
+  Gtk::Entry* m_pEntry_QuickFind;
+  Gtk::Button* m_pButton_QuickFind;
   Notebook_Find m_Notebook_Find;
-
+  
+  #ifdef GLOM_ENABLE_MAEMO
+  Hildon::StackableWindow m_maemo_window_find;
+  #endif
+  
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   //Developer:
   Window_BoxHolder* m_pDialog_Reports;



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