[glom] Menus: Use the win. group/prefix for Cut/Copy/Paste as Print menu items.



commit 4dc5354ed7637836443433203f3ad10f4c5c3670
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 21 10:10:13 2013 +0200

    Menus: Use the win. group/prefix for Cut/Copy/Paste as Print menu items.
    
    Because Why Not. It is what the GTK+ test/example code does, and might
    have some (undocumented, unexplained) advantage.
    
    * glom/modedesign/print_layotus/window_print_layout_edit.[h|cc]:
      Change this to a Gtk::ApplicationWindow so we can use its
      regular add_action() method.
    * glom/appwindow.cc: For the Edit menu's Cut, Copy, Paste, Delete,
      Select and Select All items, and for the File menu's Print Layout
      and Print Preview, just use the regular "win" action group.
    * ui/developer/window_print_layout_edit.glade: Change this to
      a GtkApplicationWindow.
    * ui/operator/window_main.glade: Use the win. prefix for some
      actions.

 glom/appwindow.cc                                  |    8 ++++----
 .../print_layouts/window_print_layout_edit.cc      |   18 +++++++++---------
 .../print_layouts/window_print_layout_edit.h       |    4 ++--
 ui/developer/window_print_layout_edit.glade        |   18 +++++++++---------
 ui/operator/window_main.glade                      |    8 ++++----
 5 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index c77648c..aa2b22d 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -2791,13 +2791,13 @@ void AppWindow::init_menus_edit()
   //Build actions:
   m_refActionGroup_Edit = Gio::SimpleActionGroup::create();
 
-  m_refActionGroup_Edit->add_action("cut",
+  add_action("cut",
     sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_cut_activate));
-  m_refActionGroup_Edit->add_action("copy",
+  add_action("copy",
     sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_copy_activate));
-  m_refActionGroup_Edit->add_action("paste",
+  add_action("paste",
     sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_paste_activate));
-  m_refActionGroup_Edit->add_action("clear");
+  add_action("clear");
     //TODO? sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_clear_activate));
 
   //We remember this action, so that it can be explicitly activated later.
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc 
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index a31177b..fc52228 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -45,7 +45,7 @@ const bool Window_PrintLayout_Edit::glade_developer(true);
 static const char DRAG_TARGET_NAME_RULE[] = "application/x-glom-printoutlayout-rule";
 
 Window_PrintLayout_Edit::Window_PrintLayout_Edit(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& 
builder)
-: Gtk::Window(cobject),
+: Gtk::ApplicationWindow(cobject),
   m_entry_name(0),
   m_entry_title(0),
   m_label_table_name(0),
@@ -196,27 +196,27 @@ void Window_PrintLayout_Edit::init_menu()
 {
   Glib::RefPtr<Gio::SimpleActionGroup> action_group = Gio::SimpleActionGroup::create();
 
-  action_group->add_action("page-setup",
+  add_action("page-setup",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_file_page_setup));
-  action_group->add_action("print-preview",
+  add_action("print-preview",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_file_print_preview) );
 
-  m_action_edit_cut = action_group->add_action("cut",
+  m_action_edit_cut = add_action("cut",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_cut) );
 
-  m_action_edit_copy = action_group->add_action("copy",
+  m_action_edit_copy = add_action("copy",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_copy) );
   
-  m_action_edit_paste = action_group->add_action("paste", 
+  m_action_edit_paste = add_action("paste", 
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_paste) );
   m_action_edit_paste->set_enabled(false); //This is enabled when something is copied or cut.
 
-  m_action_edit_delete = action_group->add_action("delete",
+  m_action_edit_delete = add_action("delete",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_delete) );
 
-  action_group->add_action("select-all",
+  add_action("select-all",
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_selectall) ); //TODO: 
Gtk::AccelKey("<control>A"), //TODO: Suggest this as part of the stock item in GTK+?
-  action_group->add_action("unselect-all", //TODO: Propose a new stock item for GTK+.
+  add_action("unselect-all", //TODO: Propose a new stock item for GTK+.
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_unselectall) );
 
   action_group->add_action("insert-field",
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.h 
b/glom/mode_design/print_layouts/window_print_layout_edit.h
index 97363fd..bdfe934 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.h
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.h
@@ -27,7 +27,7 @@
 #include <glom/mode_design/print_layouts/print_layout_toolbar.h>
 #include <glom/mode_design/print_layouts/print_layout_toolbar_button.h>
 #include <libglom/document/document.h>
-#include <gtkmm/window.h>
+#include <gtkmm/applicationwindow.h>
 #include <gtkmm/entry.h>
 #include <gtkmm/label.h>
 #include <glom/utility_widgets/gimpruler/gimpruler.h>
@@ -40,7 +40,7 @@ namespace Glom
 {
 
 class Window_PrintLayout_Edit
-: public Gtk::Window,
+: public Gtk::ApplicationWindow,
   public View_Composite_Glom
 {
 public:
diff --git a/ui/developer/window_print_layout_edit.glade b/ui/developer/window_print_layout_edit.glade
index f434a74..992d295 100644
--- a/ui/developer/window_print_layout_edit.glade
+++ b/ui/developer/window_print_layout_edit.glade
@@ -9,11 +9,11 @@
       <section>
         <item>
           <attribute name='label' translatable='yes'>Page Set_up</attribute>
-          <attribute name='action'>printlayout.pagesetup</attribute>
+          <attribute name='action'>win.pagesetup</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>Print Pre_view</attribute>
-          <attribute name='action'>printlayout.printpreview</attribute>
+          <attribute name='action'>win.printpreview</attribute>
         </item>
       </section>
     </submenu>
@@ -22,29 +22,29 @@
       <section>
         <item>
           <attribute name='label' translatable='yes'>Cu_t</attribute>
-          <attribute name='action'>printlayout.cut</attribute>
+          <attribute name='action'>win.cut</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Copy</attribute>
-          <attribute name='action'>printlayout.copy</attribute>
+          <attribute name='action'>win.copy</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Paste</attribute>
-          <attribute name='action'>printlayout.paste</attribute>
+          <attribute name='action'>win.paste</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Delete</attribute>
-          <attribute name='action'>printlayout.delete</attribute>
+          <attribute name='action'>win.delete</attribute>
         </item>
       </section>
       <section>
         <item>
           <attribute name='label' translatable='yes'>Select _All</attribute>
-          <attribute name='action'>printlayout.selectall</attribute>
+          <attribute name='action'>win.selectall</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Unselect All</attribute>
-          <attribute name='action'>printlayout.unselectall</attribute>
+          <attribute name='action'>win.unselectall</attribute>
         </item>
       </section>
     </submenu>
@@ -173,7 +173,7 @@
     </section>
   </menu>
 
-  <object class="GtkWindow" id="window_print_layout_edit">
+  <object class="GtkApplicationWindow" id="window_print_layout_edit">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Print Layout Editor</property>
     <child>
diff --git a/ui/operator/window_main.glade b/ui/operator/window_main.glade
index 78d9357..1a7f550 100644
--- a/ui/operator/window_main.glade
+++ b/ui/operator/window_main.glade
@@ -207,21 +207,21 @@
       <section>
         <item>
           <attribute name='label' translatable='yes'>Cu_t</attribute>
-          <attribute name='action'>edit.cut</attribute>
+          <attribute name='action'>win.cut</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Copy</attribute>
-          <attribute name='action'>edit.copy</attribute>
+          <attribute name='action'>win.copy</attribute>
           <attribute name='accel'>&lt;Primary&gt;c</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Paste</attribute>
-          <attribute name='action'>edit.paste</attribute>
+          <attribute name='action'>win.paste</attribute>
           <attribute name='accel'>&lt;Primary&gt;v</attribute>
         </item>
         <item>
           <attribute name='label' translatable='yes'>_Clear</attribute>
-          <attribute name='action'>edit.clear</attribute>
+          <attribute name='action'>win.clear</attribute>
         </item>
       </section>
       <section>


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