[glom/gmenu] gmenu: move Relationships Overview menu to .glade file.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/gmenu] gmenu: move Relationships Overview menu to .glade file.
- Date: Mon, 23 Sep 2013 20:23:47 +0000 (UTC)
commit e0c929e5fc5a9cd3d33e6afff647611c4275478d
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Sep 23 22:16:01 2013 +0200
gmenu: move Relationships Overview menu to .glade file.
.../dialog_relationships_overview.cc | 42 +-------------------
.../dialog_relationships_overview.h | 1 +
ui/developer/dialog_relationships_overview.glade | 26 ++++++++++++
3 files changed, 29 insertions(+), 40 deletions(-)
---
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index 2a398e0..4827ab3 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -43,6 +43,7 @@ const bool Dialog_RelationshipsOverview::glade_developer(true);
Dialog_RelationshipsOverview::Dialog_RelationshipsOverview(BaseObjectType* cobject, const
Glib::RefPtr<Gtk::Builder>& builder)
: Gtk::Dialog(cobject),
+ m_builder(builder),
m_menu(0),
m_modified(false),
m_scrolledwindow_canvas(0)
@@ -69,48 +70,9 @@ Dialog_RelationshipsOverview::Dialog_RelationshipsOverview(BaseObjectType* cobje
insert_action_group("relationshipsoverview", action_group);
- Glib::RefPtr<Gtk::Builder> refUIBuilder = Gtk::Builder::create();
-
- try
- {
- static const Glib::ustring ui_description =
- "<interface>"
- " <menu id='Overview_MainMenu'>"
- " <submenu>"
- " <attribute name='label' translatable='yes'>_File</attribute>"
- " <section>"
- " <item>"
- " <attribute name='label' translatable='yes'>Page _Setup</attribute>"
- " <attribute name='action'>relationshipsoverview.pagesetup</attribute>"
- " </item>"
- " <item>"
- " <attribute name='label' translatable='yes'>_Print</attribute>"
- " <attribute name='action'>relationshipsoverview.print</attribute>"
- " </item>"
- " </section>"
- " </submenu>"
- " <submenu>"
- " <attribute name='label' translatable='yes'>_View</attribute>"
- " <section>"
- " <item>"
- " <attribute name='label' translatable='yes'>Show _Grid</attribute>"
- " <attribute name='action'>relationshipsoverview.showgrid</attribute>"
- " </item>"
- " </section>"
- " </submenu>"
- " </menu>"
- "</interface>";
-
- refUIBuilder->add_from_string(ui_description);
- }
- catch(const Glib::Error& ex)
- {
- std::cerr << G_STRFUNC << ": building menus failed: " << ex.what();
- }
-
//Get the menu:
Glib::RefPtr<Glib::Object> object =
- refUIBuilder->get_object("Overview_MainMenu");
+ builder->get_object("Overview_MainMenu");
Glib::RefPtr<Gio::Menu> gmenu =
Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
if(!gmenu)
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.h
b/glom/mode_design/relationships_overview/dialog_relationships_overview.h
index 62cebd7..df4d266 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.h
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.h
@@ -78,6 +78,7 @@ private:
Glib::RefPtr<CanvasGroupDbTable> get_table_group(const Glib::ustring& table_name);
+ Glib::RefPtr<Gtk::Builder> m_builder;
Glib::RefPtr<Gio::SimpleAction> m_action_showgrid;
Gtk::MenuBar* m_menu;
diff --git a/ui/developer/dialog_relationships_overview.glade
b/ui/developer/dialog_relationships_overview.glade
index 1c0df6c..67a617e 100644
--- a/ui/developer/dialog_relationships_overview.glade
+++ b/ui/developer/dialog_relationships_overview.glade
@@ -1,6 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
+
+ <menu id='Overview_MainMenu'>
+ <submenu>
+ <attribute name='label' translatable='yes'>_File</attribute>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>Page _Setup</attribute>
+ <attribute name='action'>relationshipsoverview.pagesetup</attribute>
+ </item>
+ <item>
+ <attribute name='label' translatable='yes'>_Print</attribute>
+ <attribute name='action'>relationshipsoverview.print</attribute>
+ </item>
+ </section>
+ </submenu>
+ <submenu>
+ <attribute name='label' translatable='yes'>_View</attribute>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>Show _Grid</attribute>
+ <attribute name='action'>relationshipsoverview.showgrid</attribute>
+ </item>
+ </section>
+ </submenu>
+ </menu>
+
<object class="GtkDialog" id="dialog_relationships_overview">
<property name="can_focus">False</property>
<property name="border_width">6</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]