[glom] Main Window: Combine the top two rows of widgets.



commit ca3a8e77085e63bb098da77d434a8834d811069d
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Jun 22 23:43:33 2011 +0200

    Main Window: Combine the top two rows of widgets.
    
    * glom/utility_widgets/notebook_noframe.[h|cc]: Add
    set_action_widget(), as in the GtkNotebook API.
    * glom/glom.glade:
    * glom/frame_glom.[h|cc]: Remove the top HBox, instead
    putting the table name label in the notebook widget,
    at the left of the tabs.

 ChangeLog                                |   11 +++++++++++
 glom/frame_glom.cc                       |    9 ++++-----
 glom/frame_glom.h                        |    1 -
 glom/glom.glade                          |   25 -------------------------
 glom/utility_widgets/notebook_noframe.cc |   22 ++++++++++++++++++++--
 glom/utility_widgets/notebook_noframe.h  |    5 ++++-
 6 files changed, 39 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index abe6c1a..9b3624a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-06-22  Murray Cumming  <murrayc murrayc com>
 
+	Main Window: Combine the top two rows of widgets.
+
+	* glom/utility_widgets/notebook_noframe.[h|cc]: Add 
+	set_action_widget(), as in the GtkNotebook API.
+	* glom/glom.glade:
+	* glom/frame_glom.[h|cc]: Remove the top HBox, instead 
+	putting the table name label in the notebook widget, 
+	at the left of the tabs.
+
+2011-06-22  Murray Cumming  <murrayc murrayc com>
+
 	Remove the User Level menu and the User Level label.
 
 	* glom/glom.glade: Main window: Remove the User Level label.
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 8d26ff7..60b64b1 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -79,7 +79,6 @@ namespace Glom
 Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
 : PlaceHolder(cobject, builder),
   m_pLabel_Table(0),
-  m_box_header(0),
   m_box_footer(0),
   m_pBox_RecordsCount(0),
   m_pLabel_RecordsCount(0),
@@ -111,19 +110,19 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
   m_pDialogConnection(0)
 {
   //Load widgets from glade file:
-  builder->get_widget("label_table_name_main", m_pLabel_Table);
-
-  builder->get_widget("hbox_header", m_box_header);
   builder->get_widget("hbox_footer", m_box_footer);
 
   //Hide unnecessary widgets on maemo that take too much space,
   //and reduce the border width:
   #ifdef GLOM_ENABLE_MAEMO
-  m_box_header->hide();
   m_box_footer->hide();
   set_border_width(Glom::Utils::DEFAULT_SPACING_LARGE);
   #endif
 
+  m_pLabel_Table = Gtk::manage(new Gtk::Label(_("No Table Selected")));
+  m_pLabel_Table->show();
+  m_Notebook_Data.set_action_widget(m_pLabel_Table, Gtk::PACK_START);
+
   //QuickFind widgets:
   //We don't use Glade for these, so it easier to modify them for the Maemo port.
   m_pBox_QuickFind = Gtk::manage(new Gtk::HBox(false, Utils::DEFAULT_SPACING_SMALL));
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index e38a7eb..5df625d 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -254,7 +254,6 @@ private:
 
   //Child widgets:
   Gtk::Label* m_pLabel_Table;
-  Gtk::HBox* m_box_header;
   Gtk::HBox* m_box_footer;
 
   Gtk::HBox* m_pBox_RecordsCount; //Only show this when in Data mode.
diff --git a/glom/glom.glade b/glom/glom.glade
index 58fca56..3e7524c 100644
--- a/glom/glom.glade
+++ b/glom/glom.glade
@@ -1603,31 +1603,6 @@ The data in the field was not recognized. Please try to correct the data or reve
             <property name="border_width">12</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkHBox" id="hbox_header">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label_table_name_main">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">&lt;b&gt;No Table Selected&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkVBox" id="vbox_quickfind">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
diff --git a/glom/utility_widgets/notebook_noframe.cc b/glom/utility_widgets/notebook_noframe.cc
index 4ab81a8..f7b5557 100644
--- a/glom/utility_widgets/notebook_noframe.cc
+++ b/glom/utility_widgets/notebook_noframe.cc
@@ -35,10 +35,13 @@ NotebookNoFrame::NotebookNoFrame()
   set_spacing(Utils::DEFAULT_SPACING_SMALL);
 
   m_box_tabs.set_spacing(Utils::DEFAULT_SPACING_SMALL);
-  m_box_tabs.set_layout(Gtk::BUTTONBOX_START);
+  m_box_tabs.pack_start(m_box_action_left, Gtk::PACK_SHRINK);
+  m_box_tabs.pack_end(m_box_action_right, Gtk::PACK_SHRINK);
+
   pack_start(m_box_tabs, Gtk::PACK_SHRINK);
   m_box_tabs.show();
 
+
   pack_start(m_box_pages);
   m_box_pages.show();
 }
@@ -129,7 +132,7 @@ int NotebookNoFrame::append_page(Gtk::Widget& child, Gtk::Widget& tab_label)
   toggle->set_active(false);
   toggle->add(tab_label);
   toggle->show();
-  m_box_tabs.pack_start(*toggle);
+  m_box_tabs.pack_start(*toggle, Gtk::PACK_SHRINK);
   m_vec_tab_widgets.push_back(toggle);
 
   //We put the child into a box so we can show or hide it regardless of
@@ -198,4 +201,19 @@ void NotebookNoFrame::on_tab_toggled(int index)
   m_signal_switch_page.emit(child, new_current_page);
 }
 
+void NotebookNoFrame::set_action_widget(Gtk::Widget* widget, Gtk::PackType pack_type)
+{
+  if(pack_type == Gtk::PACK_START)
+  {
+    m_box_action_left.pack_start(*widget, Gtk::PACK_SHRINK);
+    m_box_action_left.show();
+  }
+  else
+  {
+    m_box_action_right.pack_end(*widget, Gtk::PACK_SHRINK);
+    m_box_action_right.show();
+  }
+}
+
+
 } //namespace Glom
diff --git a/glom/utility_widgets/notebook_noframe.h b/glom/utility_widgets/notebook_noframe.h
index 08e63e1..ce52e89 100644
--- a/glom/utility_widgets/notebook_noframe.h
+++ b/glom/utility_widgets/notebook_noframe.h
@@ -50,6 +50,8 @@ public:
   int get_current_page() const;
   void set_current_page(int page_num);
 
+  void set_action_widget(Gtk::Widget* widget, Gtk::PackType pack_type);
+
   typedef sigc::signal<void, Gtk::Widget*, guint> type_signal_switch_page;
 
   type_signal_switch_page signal_switch_page();
@@ -57,8 +59,9 @@ public:
 protected:
   void on_tab_toggled(int index);
 
-  Gtk::ButtonBox m_box_tabs;
+  Gtk::Box m_box_tabs;
   Gtk::Box m_box_pages;
+  Gtk::Box m_box_action_left, m_box_action_right;
 
   type_signal_switch_page m_signal_switch_page;
 



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