[glom/maemo5] Maemo: Details: Do not show buttons.



commit 4640977a1dc3524bad98fd31374783f07f426d05
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 23 14:09:02 2009 +0200

    Maemo: Details: Do not show buttons.
    
    * glom/mode_data/box_data_details.[h|cc]: ifdef out the buttons for maemo.
    * glom/glom.glade: Hack a HildonStackableWindow into the maemo5 branch
    to avoid a warning with our get_widget_derived() call.

 ChangeLog                               |    8 +++
 glom/bakery/app_withdoc_gtk.h           |    2 +-
 glom/glom.glade                         |    2 +-
 glom/mode_data/box_data_details.cc      |   82 +++++++++++++++++++------------
 glom/mode_data/box_data_details.h       |   43 +++++++++-------
 glom/mode_find/box_data_details_find.cc |    6 +-
 glom/window_boxholder.h                 |    2 +-
 7 files changed, 89 insertions(+), 56 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 374e47c..03d9dba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-09-23  Murray Cumming  <murrayc murrayc com>
 
+	Maemo: Details: Do not show buttons.
+
+	* glom/mode_data/box_data_details.[h|cc]: ifdef out the buttons for maemo.
+	* glom/glom.glade: Hack a HildonStackableWindow into the maemo5 branch 
+	to avoid a warning with our get_widget_derived() call.
+
+2009-09-23  Murray Cumming  <murrayc murrayc com>
+
 	* glom/mode_data/box_data_details.cc: Rename the HBox member variables 
 	to make their purposes clearer.
 
diff --git a/glom/bakery/app_withdoc_gtk.h b/glom/bakery/app_withdoc_gtk.h
index e7c0c2c..316a7a3 100644
--- a/glom/bakery/app_withdoc_gtk.h
+++ b/glom/bakery/app_withdoc_gtk.h
@@ -24,7 +24,7 @@
 #include <glom/bakery/app.h>
 
 #ifdef GLOM_ENABLE_MAEMO
-#include <hildonmm/stackablewindow.h>
+#include <hildonmm/stackable-window.h>
 #endif
 
 #include <gtkmm/menubar.h>
diff --git a/glom/glom.glade b/glom/glom.glade
index 5bf52b1..4d42658 100644
--- a/glom/glom.glade
+++ b/glom/glom.glade
@@ -947,7 +947,7 @@
       </object>
     </child>
   </object>
-  <object class="GtkWindow" id="window_main">
+  <object class="HildonStackableWindow" id="window_main">
     <property name="title" translatable="yes">Glom</property>
     <property name="default_width">900</property>
     <property name="default_height">700</property>
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index dd5478f..9a357fb 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -37,30 +37,24 @@ namespace Glom
 {
 
 Box_Data_Details::Box_Data_Details(bool bWithNavButtons /* = true */)
-: m_hbox_buttons(false, Utils::DEFAULT_SPACING_SMALL),
-  m_hbox_content(false, Utils::DEFAULT_SPACING_SMALL),
+: m_hbox_content(false, Utils::DEFAULT_SPACING_SMALL),
+#ifndef GLOM_ENABLE_MAEMO
+  m_hbox_buttons(false, Utils::DEFAULT_SPACING_SMALL),
   m_Button_New(Gtk::Stock::ADD),
   m_Button_Del(Gtk::Stock::DELETE),
   m_Button_Nav_First(Gtk::Stock::GOTO_FIRST),
   m_Button_Nav_Prev(Gtk::Stock::GO_BACK),
   m_Button_Nav_Next(Gtk::Stock::GO_FORWARD),
   m_Button_Nav_Last(Gtk::Stock::GOTO_LAST),
+#endif //GLOM_ENABLE_MAEMO
   m_bDoNotRefreshRelated(false),
   m_ignore_signals(true)
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  ,m_design_mode(false)
+  , m_design_mode(false)
 #endif
 {
   m_layout_name = "details";
 
-  m_Button_New.set_tooltip_text(_("Create a new record."));
-  m_Button_Del.set_tooltip_text(_("Remove this record."));
-  m_Button_Nav_First.set_tooltip_text(_("View the first record in the list."));
-  m_Button_Nav_Prev.set_tooltip_text(_("View the previous record in the list."));
-  m_Button_Nav_Next.set_tooltip_text(_("View the next record in the list."));
-  m_Button_Nav_Last.set_tooltip_text(_("View the last record in the list."));
-  
-
   add_view(&m_FlowTable); //Allow this to access the document too.
 
   m_FlowTable.set_columns_count(1); //Sub-groups will have multiple columns (by default, there is one sub-group, with 2 columns).
@@ -71,9 +65,14 @@ Box_Data_Details::Box_Data_Details(bool bWithNavButtons /* = true */)
 
   //m_ScrolledWindow.set_border_width(Utils::DEFAULT_SPACING_SMALL);
 #ifdef GLOM_ENABLE_MAEMO
-  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); /* Allow horizontal scrolling in maemo because the screen is rather small and there might be some database UIs that don't fit horizontally. Such a UI may be concidered non-maemo-friendly, but it can still be fully viewed this way. */
+  // Allow horizontal scrolling in maemo because the screen is rather small and 
+  // there might be some database UIs that don't fit horizontally. Such a UI may 
+  // be considered non-maemo-friendly, but it can still be fully viewed this way.
+  // TODO: Prevent the need for horizontal scrolling.
+  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
 #else
-  m_ScrolledWindow.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); /* Allow vertical scrolling, but never scroll horizontally. */
+  // Allow vertical scrolling, but never scroll horizontally:
+  m_ScrolledWindow.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); 
 #endif
   m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_NONE); //SHADOW_IN is Recommended by the GNOME HIG, but looks odd.
 
@@ -87,13 +86,41 @@ Box_Data_Details::Box_Data_Details(bool bWithNavButtons /* = true */)
   // The FlowTable does not support native scrolling, so gtkmm adds it to a
   // viewport first that also has some shadow we do not want.
   Gtk::Viewport* viewport = dynamic_cast<Gtk::Viewport*>(m_FlowTable.get_parent());
-  if(viewport) viewport->set_shadow_type(Gtk::SHADOW_NONE);
+  if(viewport)
+    viewport->set_shadow_type(Gtk::SHADOW_NONE);
+
+
+  pack_start(m_hbox_content);
+
+  m_FlowTable.signal_field_edited().connect( sigc::mem_fun(*this,  &Box_Data_Details::on_flowtable_field_edited) );
+  m_FlowTable.signal_field_open_details_requested().connect( sigc::mem_fun(*this,  &Box_Data_Details::on_flowtable_field_open_details_requested) );
+  show_all();
+
+  m_FlowTable.signal_related_record_changed().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_related_record_changed) );
+
+
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  m_FlowTable.signal_layout_changed().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_layout_changed) );
+#endif // !GLOM_ENABLE_CLIENT_ONLY
+
+  m_FlowTable.signal_requested_related_details().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_requested_related_details) );
+
+  m_FlowTable.signal_script_button_clicked().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_script_button_clicked) );
+
+
+#ifndef GLOM_ENABLE_MAEMO
+  m_Button_New.set_tooltip_text(_("Create a new record."));
+  m_Button_Del.set_tooltip_text(_("Remove this record."));
+  m_Button_Nav_First.set_tooltip_text(_("View the first record in the list."));
+  m_Button_Nav_Prev.set_tooltip_text(_("View the previous record in the list."));
+  m_Button_Nav_Next.set_tooltip_text(_("View the next record in the list."));
+  m_Button_Nav_Last.set_tooltip_text(_("View the last record in the list."));
 
   //Add or delete record:
   m_hbox_buttons.pack_start(m_Button_New, Gtk::PACK_SHRINK);
   m_hbox_buttons.pack_start(m_Button_Del,  Gtk::PACK_SHRINK);
 
-   //Link buttons to handlers:
+  //Link buttons to handlers:
   m_Button_New.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_new));
   m_Button_Del.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_del));
 
@@ -112,23 +139,8 @@ Box_Data_Details::Box_Data_Details(bool bWithNavButtons /* = true */)
   m_Button_Nav_Next.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_nav_next));
   m_Button_Nav_Last.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_nav_last));
 
-  pack_start(m_hbox_content);
   pack_start(m_hbox_buttons, Gtk::PACK_SHRINK);
-
-  m_FlowTable.signal_field_edited().connect( sigc::mem_fun(*this,  &Box_Data_Details::on_flowtable_field_edited) );
-  m_FlowTable.signal_field_open_details_requested().connect( sigc::mem_fun(*this,  &Box_Data_Details::on_flowtable_field_open_details_requested) );
-  show_all();
-
-  m_FlowTable.signal_related_record_changed().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_related_record_changed) );
-
-
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  m_FlowTable.signal_layout_changed().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_layout_changed) );
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
-  m_FlowTable.signal_requested_related_details().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_requested_related_details) );
-
-  m_FlowTable.signal_script_button_clicked().connect( sigc::mem_fun(*this, &Box_Data_Details::on_flowtable_script_button_clicked) );
+#endif //GLOM_ENABLE_MAEMO
 
   m_ignore_signals = false;
 }
@@ -285,8 +297,10 @@ bool Box_Data_Details::fill_from_database()
       Privileges table_privs = Privs::get_current_privs(m_table_name);
 
       //Enable/Disable record creation and deletion:
+      #ifndef GLOM_ENABLE_MAEMO
       m_Button_New.set_sensitive(table_privs.m_create);
       m_Button_Del.set_sensitive(table_privs.m_delete);
+      #endif //GLOM_ENABLE_MAEMO
 
       if(table_privs.m_view)
       {
@@ -408,6 +422,7 @@ bool Box_Data_Details::fill_from_database()
   return bResult;
 }
 
+#ifndef GLOM_ENABLE_MAEMO
 void Box_Data_Details::on_button_new()
 {
   if(!confirm_discard_unstored_data())
@@ -494,6 +509,7 @@ void Box_Data_Details::on_button_nav_last()
   if(confirm_discard_unstored_data())
     signal_nav_last().emit();
 }
+#endif //GLOM_ENABLE_MAEMO
 
 Gnome::Gda::Value Box_Data_Details::get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const
 {
@@ -580,6 +596,7 @@ void Box_Data_Details::on_related_record_added(Gnome::Gda::Value /* strKeyValue
   m_bDoNotRefreshRelated = bDoNotRefreshRelated;
 }
 
+#ifndef GLOM_ENABLE_MAEMO
 Box_Data_Details::type_signal_void Box_Data_Details::signal_nav_first()
 {
   return m_signal_nav_first;
@@ -604,6 +621,7 @@ Box_Data_Details::type_signal_record_deleted Box_Data_Details::signal_record_del
 {
   return m_signal_record_deleted; 
 }
+#endif //GLOM_ENABLE_MAEMO
 
 Box_Data_Details::type_signal_requested_related_details Box_Data_Details::signal_requested_related_details()
 {
@@ -691,8 +709,10 @@ void Box_Data_Details::on_flowtable_script_button_clicked(const sharedptr<const
     }
     else
     {
+      #ifndef GLOM_ENABLE_MAEMO
       //Tell the parent to do something appropriate, such as show another record:
       signal_record_deleted().emit(primary_key_value);
+      #endif
     }
   }
 }
diff --git a/glom/mode_data/box_data_details.h b/glom/mode_data/box_data_details.h
index 42cc516..e5843f7 100644
--- a/glom/mode_data/box_data_details.h
+++ b/glom/mode_data/box_data_details.h
@@ -48,6 +48,7 @@ public:
 
  
   //Signals:
+#ifndef GLOM_ENABLE_MAEMO
   typedef sigc::signal<void> type_signal_void;
   type_signal_void signal_nav_first();
   type_signal_void signal_nav_prev();
@@ -56,6 +57,7 @@ public:
 
   typedef sigc::signal<void, const Gnome::Gda::Value&> type_signal_record_deleted; //arg is PrimaryKey.
   type_signal_record_deleted signal_record_deleted();
+#endif
 
    /** For instance,
     * void on_requested_related_details(const Glib::ustring& table_name, Gnome::Gda::Value primary_key_value);
@@ -89,14 +91,19 @@ protected:
 
   void print_layout_group(xmlpp::Element* node_parent, const sharedptr<const LayoutGroup>& group);
 
+private:
   //Signal handlers:
-  virtual void on_button_new();
-  virtual void on_button_del();
+#ifndef GLOM_ENABLE_MAEMO
+  void on_button_new();
+  void on_button_del();
+
+  void on_button_nav_first();
+  void on_button_nav_prev();
+  void on_button_nav_next();
+  void on_button_nav_last();
+#endif //GLOM_ENABLE_MAEMO
 
-  virtual void on_button_nav_first();
-  virtual void on_button_nav_prev();
-  virtual void on_button_nav_next();
-  virtual void on_button_nav_last();
+protected:
 
   virtual void on_userlevel_changed(AppState::userlevels user_level); //override
 
@@ -129,37 +136,35 @@ protected:
 
   //Member widgets:
   Gtk::ScrolledWindow m_ScrolledWindow;
-  Gtk::HBox m_HBox;
-  Gtk::HBox m_HBox_Sidebar;
-  Gtk::Button m_Button_New;
-  Gtk::Button m_Button_Del;
+  Gtk::HBox m_hbox_content;
+  FlowTableWithFields m_FlowTable;
+
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   LayoutToolbar m_Dragbar;
 #endif
 
-  /*
-  Gtk::Frame m_Frame_Related;
-  Gtk::Alignment m_Alignment_Related;
-  Gtk::Label m_Label_Related;
-  Gtk::Notebook m_Notebook_Related;
-  */
-
+#ifndef GLOM_ENABLE_MAEMO
+  Gtk::HBox m_hbox_buttons;
+  Gtk::Button m_Button_New;
+  Gtk::Button m_Button_Del;
   Gtk::Button m_Button_Nav_First;
   Gtk::Button m_Button_Nav_Prev;
   Gtk::Button m_Button_Nav_Next;
   Gtk::Button m_Button_Nav_Last;
-  FlowTableWithFields m_FlowTable;
-
+#endif
   guint m_ColumnName, m_ColumnValue;
   bool m_bDoNotRefreshRelated; //Stops us from refreshing related records in response to an addition of a related record.
   bool m_ignore_signals;
 
+#ifndef GLOM_ENABLE_MAEMO
   type_signal_void m_signal_nav_first;
   type_signal_void m_signal_nav_prev;
   type_signal_void m_signal_nav_next;
   type_signal_void m_signal_nav_last;
 
   type_signal_record_deleted m_signal_record_deleted;
+
+#endif //GLOM_ENABLE_MAEMO
   type_signal_requested_related_details m_signal_requested_related_details;
   
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_find/box_data_details_find.cc b/glom/mode_find/box_data_details_find.cc
index d241412..65a7e8c 100644
--- a/glom/mode_find/box_data_details_find.cc
+++ b/glom/mode_find/box_data_details_find.cc
@@ -29,10 +29,10 @@ namespace Glom
 Box_Data_Details_Find::Box_Data_Details_Find()
 : Box_Data_Details(false)
 {
-   //m_strHint = _("Enter the search criteria and click [Find]\n Glom will then change to Data mode to display the results.");
-
   //Instead of nav buttons:
-  m_HBox.pack_end(m_Button_Find, Gtk::PACK_SHRINK);
+  #ifndef GLOM_ENABLE_MAEMO //TODO_Maemo: Really have this buttons somewhere?
+  m_hbox_buttons.pack_end(m_Button_Find, Gtk::PACK_SHRINK);
+  #endif
 
   g_object_set(m_Button_Find.gobj(), "can-default", TRUE, (gpointer)NULL); //TODO: Make this a real method in gtkmm?
 
diff --git a/glom/window_boxholder.h b/glom/window_boxholder.h
index 66d51b3..ca2faee 100644
--- a/glom/window_boxholder.h
+++ b/glom/window_boxholder.h
@@ -26,7 +26,7 @@
 #include <gtkmm/button.h>
 
 #ifdef GLOM_ENABLE_MAEMO
-#include <hildonmm/stackablewindow.h>
+#include <hildonmm/stackable-window.h>
 #endif
 
 namespace Glom



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