[glom/maemo5] Added a Tables PickerButton that seems to work.



commit 370471b51c2de7391e6136684a5ac5183867113d
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Sep 7 21:58:47 2009 +0200

    Added a Tables PickerButton that seems to work.

 glom/application.cc          |   28 ++++++++++++++++++++++------
 glom/application.h           |    6 ++++--
 glom/frame_glom.cc           |    4 ++--
 glom/frame_glom.h            |    6 ++++--
 glom/navigation/box_tables.h |    4 ++--
 po/POTFILES.in               |    1 +
 6 files changed, 35 insertions(+), 14 deletions(-)
---
diff --git a/glom/application.cc b/glom/application.cc
index acf84b2..16788cf 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -112,7 +112,7 @@ App_Glom::App_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& bu
 
 App_Glom::~App_Glom()
 {
-#ifndef GLOM_ENABLE_CLIENT_ONLY
+  #ifndef GLOM_ENABLE_CLIENT_ONLY
   if(m_window_translations)
   {
     m_pFrame->remove_view(m_window_translations);
@@ -124,7 +124,11 @@ App_Glom::~App_Glom()
     delete m_avahi_progress_dialog;
     m_avahi_progress_dialog = 0;
   }
-#endif // !GLOM_ENABLE_CLIENT_ONLY
+  #endif // !GLOM_ENABLE_CLIENT_ONLY
+
+  #ifdef GLOM_ENABLE_MAEMO
+  m_pFrame->remove_view(&m_appmenu_button_table);
+  #endif
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -341,12 +345,24 @@ void App_Glom::init_menus_file()
 #endif //GLOM_ENABLE_MAEMO
 
 #ifdef GLOM_ENABLE_MAEMO
+void App_Glom::on_appmenu_button_table_value_changed()
+{
+  const Glib::ustring table_name = m_appmenu_button_table.get_table_name();
+  if(m_pFrame)
+    m_pFrame->on_box_tables_selected(table_name);
+}
+
+#endif //GLOM_ENABLE_MAEMO
+
+#ifdef GLOM_ENABLE_MAEMO
 void App_Glom::init_menus()
 {
   //There is no real menu on Maemo. We use HildonAppMenu instead.
 
+  m_pFrame->add_view(&m_appmenu_button_table);
   m_appmenu_button_table.show();
-  m_appmenu_button_table.set_title(_("Table"));
+  m_appmenu_button_table.signal_value_changed().connect(
+    sigc::mem_fun(*this, &App_Glom::on_appmenu_button_table_value_changed) );
   m_maemo_appmenu.append(m_appmenu_button_table);
 
   //set_app_menu(*appmenu); //TODO: Use this instead?
@@ -1691,7 +1707,7 @@ void App_Glom::remove_developer_action(const Glib::RefPtr<Gtk::Action>& refActio
 #ifdef GLOM_ENABLE_MAEMO
 void App_Glom::fill_menu_tables()
 {
-  //TODO: Change the Hildon::AppMenu.
+  m_appmenu_button_table.fill_from_database();
 }
 #else
 void App_Glom::fill_menu_tables()
@@ -2060,7 +2076,7 @@ void App_Glom::on_menu_file_save_as_example()
 
       document->set_allow_autosave(true);
 
-      bool bTest  = document->save();
+      bool bTest = document->save();
 
       if(!bTest)
       {
@@ -2434,7 +2450,7 @@ Document* App_Glom::on_connection_pool_get_document()
 }
 #endif //GLOM_ENABLE_CLIENT_ONLY
 
-//overriden to show the current table name in the window's title:
+//overridden to show the current table name in the window's title:
 void App_Glom::update_window_title()
 {
   //Set application's main window title:
diff --git a/glom/application.h b/glom/application.h
index 89cc0b0..4539c5e 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -32,7 +32,7 @@
 #include <gtkmm/enums.h>
 
 #include <hildonmm/app-menu.h>
-#include <hildonmm/button.h>
+#include <glom/navigation/maemo/pickerbutton_table.h>
 #endif //GLOM_ENABLE_MAEMO
 
 #include <glom/bakery/app_withdoc_gtk.h>
@@ -197,7 +197,9 @@ private:
 
 #ifdef GLOM_ENABLE_MAEMO
   Hildon::AppMenu m_maemo_appmenu;
-  Hildon::Button m_appmenu_button_table;
+  PickerButton_Table m_appmenu_button_table;
+
+  void on_appmenu_button_table_value_changed();
 #endif //GLOM_ENABLE_MAEMO
 
   Glib::RefPtr<Gtk::ToggleAction> m_toggleaction_network_shared;
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 5687374..3eec32c 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -271,15 +271,15 @@ void Frame_Glom::set_databases_selected(const Glib::ustring& strName)
   do_menu_Navigate_Table(true /* open default */);
 }
 
-#ifndef GLOM_ENABLE_MAEMO
 void Frame_Glom::on_box_tables_selected(const Glib::ustring& strName)
 {
+#ifndef GLOM_ENABLE_MAEMO
   if(m_pDialog_Tables)
     m_pDialog_Tables->hide();
+#endif //GLOM_ENABLE_MAEMO
 
   show_table(strName);
 }
-#endif //GLOM_ENABLE_MAEMO
 
 void Frame_Glom::set_mode_widget(Gtk::Widget& widget)
 {
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index a324fda..2fbe2dd 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -29,7 +29,11 @@
 #include <libglom/document/document.h>
 
 #include "dialog_glom.h"
+
+#ifndef GLOM_ENABLE_MAEMO
 #include "navigation/box_tables.h"
+#endif
+
 #include "mode_data/notebook_data.h"
 #include "mode_find/notebook_find.h"
 
@@ -68,9 +72,7 @@ public:
 
   void set_databases_selected(const Glib::ustring& strName);
 
-#ifndef GLOM_ENABLE_MAEMO
   void on_box_tables_selected(const Glib::ustring& strName);
-#endif
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   void on_box_reports_selected(const Glib::ustring& strName);
diff --git a/glom/navigation/box_tables.h b/glom/navigation/box_tables.h
index 1035546..7d7b116 100644
--- a/glom/navigation/box_tables.h
+++ b/glom/navigation/box_tables.h
@@ -42,9 +42,9 @@ public:
   virtual ~Box_Tables();
 
 private:
-  virtual bool fill_from_database(); //override
+  bool fill_from_database(); //override
 
-  virtual void fill_table_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const TableInfo>& table_info);
+  void fill_table_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const TableInfo>& table_info);
 
   //Signal handlers:
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4ff5ac3..1dd7b6d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -105,6 +105,7 @@ glom/mode_find/box_data_details_find.cc
 glom/mode_find/box_data_list_find.cc
 glom/mode_find/notebook_find.cc
 glom/navigation/box_tables.cc
+glom/navigation/maemo/pickerbutton_table.cc
 glom/print_layout/canvas_layout_item.cc
 glom/print_layout/canvas_print_layout.cc
 glom/python_embed/glom_python.cc



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