[glom/gmenu] gmenu: Fix the Active Platform menu.



commit 644c4fb137a7b9288da235b8a031cfab1840fceb
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 17 12:15:03 2013 +0200

    gmenu: Fix the Active Platform menu.

 glom/appwindow.cc                       |   18 ++++++++++--------
 glom/appwindow.h                        |    3 ++-
 glom/libglom/document/document.h        |    2 ++
 glom/print_layout/canvas_print_layout.h |    1 +
 4 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index f1ea8b5..8f2c4f9 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -398,10 +398,10 @@ void AppWindow::init_menus()
   m_listDeveloperActions.push_back(action);
 
   //"Active Platform" menu:
-  action = m_refActionGroup_Developer->add_action_radio_integer("active-platform",
+  m_action_menu_developer_active_platform = 
m_refActionGroup_Developer->add_action_radio_string("active-platform",
     sigc::mem_fun(*this, &AppWindow::on_menu_developer_active_platform),
-    0); //TODO: No magic number
-  m_listDeveloperActions.push_back(action);
+    "");
+  m_listDeveloperActions.push_back(m_action_menu_developer_active_platform);
 
   action = m_refActionGroup_Developer->add_action("export-backup",
     sigc::mem_fun(*this, &AppWindow::on_menu_developer_export_backup));
@@ -612,12 +612,12 @@ void AppWindow::init_menus()
     "        <item>"
     "         <attribute name='label' translatable='yes'>_Normal</attribute>" //TODO: _("The layout to use 
for normal desktop environments."));
     "          <attribute name='action'>developer.active-platform</attribute>"
-    "          <attribute name='target' type='i'>0</attribute>"
+    "          <attribute name='target'></attribute>"
     "        </item>"
     "        <item>"
     "          <attribute name='label' translatable='yes'>_Maemo</attribute>" //TODO: This is obsolete 
//TODO: _("The layout to use for Maemo devices."));
     "          <attribute name='action'>developer.active-platform</attribute>"
-    "          <attribute name='target' type='i'>1</attribute>"
+    "          <attribute name='target'>maemo</attribute>"
     "        </item>"
     "      </submenu>"
     "      <item>"
@@ -2631,12 +2631,14 @@ void AppWindow::on_menu_developer_translations()
   }
 }
 
-void AppWindow::on_menu_developer_active_platform(int parameter)
+void AppWindow::on_menu_developer_active_platform(const Glib::ustring& parameter)
 {
-  //TODO:
+  //The state is not changed automatically:
+  m_action_menu_developer_active_platform->change_state(parameter);
+
   Document* document = dynamic_cast<Document*>(get_document());
   if(document)
-   document->set_active_layout_platform("");
+   document->set_active_layout_platform(parameter);
 
   m_pFrame->show_table_refresh();
 }
diff --git a/glom/appwindow.h b/glom/appwindow.h
index be2b171..4b7b428 100644
--- a/glom/appwindow.h
+++ b/glom/appwindow.h
@@ -239,7 +239,7 @@ private:
   void on_menu_file_save_as_example();
   void on_menu_developer_changelanguage();
   void on_menu_developer_translations();
-  void on_menu_developer_active_platform(int state);
+  void on_menu_developer_active_platform(const Glib::ustring& parameter);
   void on_menu_developer_export_backup();
   void on_menu_developer_restore_backup();
   void on_menu_developer_enable_layout_drag_and_drop();
@@ -295,6 +295,7 @@ private:
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   Glib::RefPtr<Gio::SimpleAction> m_action_developer_users;
   Glib::RefPtr<Gio::SimpleAction> m_action_menu_developer_usermode;
+  Glib::RefPtr<Gio::SimpleAction> m_action_menu_developer_active_platform;
   Glib::RefPtr<Gio::SimpleAction> m_action_enable_layout_drag_and_drop ;
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index cde3d1f..b9c0734 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -439,10 +439,12 @@ public:
 #endif //SWIG
 
   /** This is transitory information, not saved to disk.
+   * @result the active platform name - see get_data_layout_groups().
    */
   Glib::ustring get_active_layout_platform() const;
 
   /** This is transitory information, not saved to disk.
+   * @layout_platform the active platform name - see get_data_layout_groups().
    */
   void set_active_layout_platform(const Glib::ustring& layout_platform = Glib::ustring());
 
diff --git a/glom/print_layout/canvas_print_layout.h b/glom/print_layout/canvas_print_layout.h
index bb1971d..2d097f5 100644
--- a/glom/print_layout/canvas_print_layout.h
+++ b/glom/print_layout/canvas_print_layout.h
@@ -28,6 +28,7 @@
 #include <libglom/data_structure/layout/layoutitem_line.h>
 #include <giomm/simpleactiongroup.h>
 #include <gtkmm/pagesetup.h>
+#include <gtkmm/menu.h>
 
 namespace Glom
 {


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