[glom/maemo5] Maemo: List: Click to view details.



commit 37d637c716eb062f1d743249236c7208932b21a8
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 6 18:09:00 2009 +0200

    Maemo: List: Click to view details.
    
    * glom/utility_widgets/db_adddel/db_adddel.[h|cc]: Connect to
    TouchSelector::signal_changed to respond to clicks on the list. Note that
    a drag to pan (scroll) does not cause that signal to be emitted.
    * glom/utility_widgets/db_adddel/db_adddel_withbuttons.[h|cc]: On Mameo,
    remove the Delete and Edit buttons because deleting can be done via the
    details window (viewable on Maemo). The Add button is still there and is ugly.

 ChangeLog                                          |   11 ++++++
 glom/utility_widgets/db_adddel/db_adddel.cc        |   12 ++++++-
 glom/utility_widgets/db_adddel/db_adddel.h         |    1 +
 .../db_adddel/db_adddel_withbuttons.cc             |   37 +++++++++----------
 .../db_adddel/db_adddel_withbuttons.h              |   13 +++++--
 5 files changed, 51 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 45f9aac..363cfa0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-10-06  Murray Cumming  <murrayc murrayc com>
 
+	Maemo: List: Click to view details.
+	
+	* glom/utility_widgets/db_adddel/db_adddel.[h|cc]: Connect to 
+	TouchSelector::signal_changed to respond to clicks on the list. Note that 
+	a drag to pan (scroll) does not cause that signal to be emitted.
+	* glom/utility_widgets/db_adddel/db_adddel_withbuttons.[h|cc]: On Mameo, 
+	remove the Delete and Edit buttons because deleting can be done via the 
+	details window (viewable on Maemo). The Add button is still there and is ugly. 
+
+2009-10-06  Murray Cumming  <murrayc murrayc com>
+
 	DbAddDel: Expand an appropriate column.
 	
 	* glom/libglom/data_structure/layout/layoutitem.[h|cc]: get_display_width(): 
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 6eb83ef..9459709 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -115,12 +115,14 @@ DbAddDel::DbAddDel()
   pack_start(m_ScrolledWindow);
   #else
   //Do not let the treeview emit activated as soon as a row is pressed.
-  //TODO: Allow this default mamoe behaviour?
+  //TODO: Allow this default maemo behaviour?
   g_object_set(m_TreeView.gobj(), "hildon-ui-mode", HILDON_UI_MODE_NORMAL, (void*)0);
   
   //Allow get_selected() and get_active() to work:
   m_TreeView.set_column_selection_mode(Hildon::TOUCH_SELECTOR_SELECTION_MODE_SINGLE);
   pack_start(m_TreeView);
+  
+  m_TreeView.signal_changed().connect(sigc::mem_fun(*this, &DbAddDel::on_maemo_touchselector_changed));
   #endif //GLOM_ENABLE_MAEMO
 
   m_TreeView.show();
@@ -233,6 +235,14 @@ void DbAddDel::on_MenuPopup_activate_layout()
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
 #ifdef GLOM_ENABLE_MAEMO
+void DbAddDel::on_maemo_touchselector_changed(int /* column */)
+{
+  if(!m_bIgnoreTreeViewSignals)
+    do_user_requested_edit();
+}
+#endif //GLOM_ENABLE_MAEMO
+
+#ifdef GLOM_ENABLE_MAEMO
 void DbAddDel::setup_menu()
 {
 }
diff --git a/glom/utility_widgets/db_adddel/db_adddel.h b/glom/utility_widgets/db_adddel/db_adddel.h
index 416e209..b7ef658 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.h
+++ b/glom/utility_widgets/db_adddel/db_adddel.h
@@ -302,6 +302,7 @@ private:
   //Signal handlers:
   #ifdef GLOM_ENABLE_MAEMO
   void treeviewcolumn_on_cell_data(const Gtk::TreeModel::iterator& iter, int model_column_index, int data_model_column_index);
+  void on_maemo_touchselector_changed(int column);
   #else
   void treeviewcolumn_on_cell_data(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter, int model_column_index, int data_model_column_index);
   #endif //GLOM_ENABLE_MAEMO
diff --git a/glom/utility_widgets/db_adddel/db_adddel_withbuttons.cc b/glom/utility_widgets/db_adddel/db_adddel_withbuttons.cc
index 627a186..6e195bf 100644
--- a/glom/utility_widgets/db_adddel/db_adddel_withbuttons.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel_withbuttons.cc
@@ -31,9 +31,7 @@ DbAddDel_WithButtons::DbAddDel_WithButtons()
   m_Button_Del(Gtk::Stock::DELETE),
   m_Button_Edit(Gtk::Stock::OPEN)
 #else
-  m_Button_Add(Gtk::Hildon::SIZE_FINGER_HEIGHT, Hildon::BUTTON_ARRANGEMENT_HORIZONTAL),
-  m_Button_Del(Gtk::Hildon::SIZE_FINGER_HEIGHT, Hildon::BUTTON_ARRANGEMENT_HORIZONTAL),
-  m_Button_Edit(Gtk::Hildon::SIZE_FINGER_HEIGHT, Hildon::BUTTON_ARRANGEMENT_HORIZONTAL)
+  m_Button_Add(Gtk::Hildon::SIZE_FINGER_HEIGHT, Hildon::BUTTON_ARRANGEMENT_HORIZONTAL)
 #endif
 {
   m_HBox.set_spacing(Utils::DEFAULT_SPACING_SMALL);
@@ -43,14 +41,17 @@ DbAddDel_WithButtons::DbAddDel_WithButtons()
 
   //Link buttons to handlers:
   m_Button_Add.signal_clicked().connect(sigc::mem_fun(*this, &DbAddDel_WithButtons::on_button_add));
+  m_HBox.pack_end(m_Button_Add, Gtk::PACK_SHRINK);
+    
+  #ifndef GLOM_ENABLE_MAEMO
   m_Button_Del.signal_clicked().connect(sigc::mem_fun(*this, &DbAddDel_WithButtons::on_button_del));
   m_Button_Edit.signal_clicked().connect(sigc::mem_fun(*this, &DbAddDel_WithButtons::on_button_edit));
 
   m_HBox.pack_end(m_Button_Edit, Gtk::PACK_SHRINK);
   m_HBox.pack_end(m_Button_Del, Gtk::PACK_SHRINK);
-  m_HBox.pack_end(m_Button_Add, Gtk::PACK_SHRINK);
+  #endif //GLOM_ENABLE_MAEMO
 
-#ifdef GLOM_ENABLE_MAEMO
+  #ifdef GLOM_ENABLE_MAEMO
   //Use smaller icon-only buttons for these infrequently-clicked buttons,
   //to save screen space.
   
@@ -58,13 +59,7 @@ DbAddDel_WithButtons::DbAddDel_WithButtons()
   //but it seems impossible to have Hildon::Buttons smaller than Gtk::Hildon::SIZE_FINGER_HEIGHT.
   Gtk::Image* image = Gtk::manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
   m_Button_Add.set_image(*image);
-  
-  image = Gtk::manage(new Gtk::Image(Gtk::Stock::DELETE, Gtk::ICON_SIZE_SMALL_TOOLBAR));
-  m_Button_Del.set_image(*image);
-  
-  image = Gtk::manage(new Gtk::Image(Gtk::Stock::OPEN, Gtk::ICON_SIZE_SMALL_TOOLBAR));
-  m_Button_Edit.set_image(*image);
-#endif //GLOM_ENABLE_MAEMO
+  #endif //GLOM_ENABLE_MAEMO
 
   setup_buttons();
 }
@@ -80,17 +75,17 @@ void DbAddDel_WithButtons::on_button_add()
 #endif
 }
 
+#ifndef GLOM_ENABLE_MAEMO
 void DbAddDel_WithButtons::on_button_del()
 {
-#ifndef GLOM_ENABLE_MAEMO
   on_MenuPopup_activate_Delete();
-#endif
 }
 
 void DbAddDel_WithButtons::on_button_edit()
 {
   do_user_requested_edit();
 }
+#endif //GLOM_ENABLE_MAEMO
 
 void DbAddDel_WithButtons::set_allow_add(bool val)
 {
@@ -122,16 +117,20 @@ void DbAddDel_WithButtons::setup_buttons()
   const bool allow_del = get_allow_user_actions() && m_allow_delete;
   const bool allow_add = get_allow_user_actions() && m_allow_add;
  
-  m_Button_Edit.show();
-  m_Button_Del.show();
   m_Button_Add.show();
-  
-  m_Button_Edit.set_property("visible", allow_edit);
-  m_Button_Del.set_property("visible", allow_del);
   m_Button_Add.set_property("visible", allow_add);
+ 
+   
+  #ifndef GLOM_ENABLE_MAEMO
+  m_Button_Edit.show();
+  m_Button_Edit.set_property("visible", allow_edit);
   
   if(!m_open_button_title.empty())
     m_Button_Edit.set_label(m_open_button_title);
+ 
+  m_Button_Del.show();
+  m_Button_Del.set_property("visible", allow_del);
+  #endif //GLOM_ENABLE_MAEMO
   
   m_HBox.show();
 }
diff --git a/glom/utility_widgets/db_adddel/db_adddel_withbuttons.h b/glom/utility_widgets/db_adddel/db_adddel_withbuttons.h
index 6d89260..46e44a9 100644
--- a/glom/utility_widgets/db_adddel/db_adddel_withbuttons.h
+++ b/glom/utility_widgets/db_adddel/db_adddel_withbuttons.h
@@ -47,8 +47,11 @@ private:
   void setup_buttons();
 
   void on_button_add();
+  
+  #ifndef GLOM_ENABLE_MAEMO
   void on_button_del();
   void on_button_edit();
+  #endif //GLOM_ENABLE_MAEMO
 
   virtual void show_all_vfunc();
 
@@ -58,12 +61,16 @@ private:
 #ifndef GLOM_ENABLE_MAEMO
   typedef Gtk::Button type_button; 
 #else
-  typedef Hildon::Button type_button; 
-#endif
+  typedef Hildon::Button type_button;
 
-  type_button m_Button_Add;
+  //We don't need these buttons on Maemo because the user can 
+  //- click to got to details.
+  //- go to the details and then del.
   type_button m_Button_Del;
   type_button m_Button_Edit;
+#endif
+
+  type_button m_Button_Add;
 };
 
 } //namespace Glom



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