[glom] Relationships Overview Window: Make this into an ApplicationWindow.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Relationships Overview Window: Make this into an ApplicationWindow.
- Date: Wed, 23 Oct 2013 10:32:06 +0000 (UTC)
commit 9230f91a68db3aa516d65fa2aa99588697902242
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Oct 23 12:29:25 2013 +0200
Relationships Overview Window: Make this into an ApplicationWindow.
* data/ui/developer/window_relationships_overview.glade:
Change this from GtkWindow to GtkApplicationWindow.
* mode_design/relationships_overview/window_relationships_overview.cc:
Change the print and page-setup actions to be in the standard
win. group.
* glom/frame_glom.cc: Add the window to the GtkApplication.
* glom/application.cc: on_startup() : Add a Ctrl P acelerator.
.../developer/window_relationships_overview.glade | 6 ++--
glom/application.cc | 1 +
glom/frame_glom.cc | 33 +++++++++++++++-----
glom/frame_glom.h | 3 ++
.../window_relationships_overview.cc | 6 ++--
.../window_relationships_overview.h | 4 +-
6 files changed, 37 insertions(+), 16 deletions(-)
---
diff --git a/data/ui/developer/window_relationships_overview.glade
b/data/ui/developer/window_relationships_overview.glade
index a1d6764..37fde7a 100644
--- a/data/ui/developer/window_relationships_overview.glade
+++ b/data/ui/developer/window_relationships_overview.glade
@@ -8,11 +8,11 @@
<section>
<item>
<attribute name='label' translatable='yes'>Page _Setup</attribute>
- <attribute name='action'>relationshipsoverview.pagesetup</attribute>
+ <attribute name='action'>win.pagesetup</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Print</attribute>
- <attribute name='action'>relationshipsoverview.print</attribute>
+ <attribute name='action'>win.print</attribute>
<attribute name='accel'><Primary>p</attribute>
</item>
</section>
@@ -42,7 +42,7 @@
</menu>
<!-- interface-requires gtk+ 3.6 -->
- <object class="GtkWindow" id="window_relationships_overview">
+ <object class="GtkApplicationWindow" id="window_relationships_overview">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Relationships Overview</property>
<property name="default_width">400</property>
diff --git a/glom/application.cc b/glom/application.cc
index 2961f6f..dda83ca 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -99,6 +99,7 @@ void Application::on_startup()
add_accelerator("<Primary>n", "file.new");
add_accelerator("<Primary>o", "file.open");
add_accelerator("<Primary>w", "win.close");
+ add_accelerator("<Primary>p", "win.print"); //Not in the main window, but in the Relationships Overview
window, and maybe other.
add_accelerator("<Primary>c", "edit.copy");
add_accelerator("<Primary>v", "edit.paste");
add_accelerator("<Primary>f", "edit.find");
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 1ba842c..2ac0737 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1619,6 +1619,7 @@ void Frame_Glom::on_menu_developer_relationships_overview()
add_view(m_window_relationships_overview);
m_window_relationships_overview->signal_hide().connect( sigc::mem_fun(*this,
&Frame_Glom::on_developer_dialog_hide));
+ add_window_to_app(m_window_relationships_overview);
}
if(m_window_relationships_overview)
@@ -1798,7 +1799,30 @@ void Frame_Glom::on_box_reports_selected(const Glib::ustring& report_name)
}
}
+void Frame_Glom::add_window_to_app(Gtk::ApplicationWindow* window)
+{
+ if(!window)
+ {
+ std::cerr << G_STRFUNC << ": window is null." << std::endl;
+ return;
+ }
+ Gtk::Window* app_window = get_app_window();
+ if(!app_window)
+ {
+ std::cerr << G_STRFUNC << ": app_window is null" << std::endl;
+ return;
+ }
+
+ //This probably lets the GtkApplication know about the window's actions, which might be useful.
+ Glib::RefPtr<Gtk::Application> app = app_window->get_application();
+ if(app)
+ app->add_window(*window);
+ else
+ {
+ std::cerr << G_STRFUNC << ": app is null." << std::endl;
+ }
+}
void Frame_Glom::on_box_print_layouts_selected(const Glib::ustring& print_layout_name)
{
@@ -1822,14 +1846,7 @@ void Frame_Glom::on_box_print_layouts_selected(const Glib::ustring& print_layout
add_view(m_pDialogLayoutPrint);
m_pDialogLayoutPrint->signal_hide().connect( sigc::mem_fun(*this,
&Frame_Glom::on_dialog_layout_print_hide) );
- //This probably lets the GtkApplication know about the window's actions, which might be useful.
- Glib::RefPtr<Gtk::Application> app = app_window->get_application();
- if(app)
- app->add_window(*m_pDialogLayoutPrint);
- else
- {
- std::cerr << G_STRFUNC << ": app is null." << std::endl;
- }
+ add_window_to_app(m_pDialogLayoutPrint);
}
m_pDialog_PrintLayouts->hide();
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index 0abbb36..e02513a 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -42,6 +42,7 @@
#endif // !GLOM_ENABLE_CLIENT_ONLY
#include "dialog_connection.h"
+#include <gtkmm/applicationwindow.h>
#include <libglom/utils.h>
#include "mode_data/box_data_list_related.h" //only for m_HackToFixLinkerError.
@@ -216,6 +217,8 @@ private:
Gtk::Window* get_app_window();
const Gtk::Window* get_app_window() const;
+ void add_window_to_app(Gtk::ApplicationWindow* window);
+
/** Show the number of records in the table, and the number found, in the UI.
* @result The number of records found, for convenience for the caller.
*/
diff --git a/glom/mode_design/relationships_overview/window_relationships_overview.cc
b/glom/mode_design/relationships_overview/window_relationships_overview.cc
index 1b3e7fa..18a2e9b 100644
--- a/glom/mode_design/relationships_overview/window_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/window_relationships_overview.cc
@@ -42,7 +42,7 @@ const char* Window_RelationshipsOverview::glade_id("window_relationships_overvie
const bool Window_RelationshipsOverview::glade_developer(true);
Window_RelationshipsOverview::Window_RelationshipsOverview(BaseObjectType* cobject, const
Glib::RefPtr<Gtk::Builder>& builder)
- : Gtk::Window(cobject),
+ : Gtk::ApplicationWindow(cobject),
m_builder(builder),
m_menu(0),
m_modified(false),
@@ -62,9 +62,9 @@ Window_RelationshipsOverview::Window_RelationshipsOverview(BaseObjectType* cobje
Glib::RefPtr<Gio::SimpleActionGroup> action_group = Gio::SimpleActionGroup::create();
- action_group->add_action("pagesetup",
+ add_action("pagesetup",
sigc::mem_fun(*this, &Window_RelationshipsOverview::on_menu_file_page_setup) );
- action_group->add_action("print",
+ add_action("print",
sigc::mem_fun(*this, &Window_RelationshipsOverview::on_menu_file_print) );
m_action_showgrid = Gio::SimpleAction::create_bool("showgrid", false);
diff --git a/glom/mode_design/relationships_overview/window_relationships_overview.h
b/glom/mode_design/relationships_overview/window_relationships_overview.h
index e8664d9..19b3bfa 100644
--- a/glom/mode_design/relationships_overview/window_relationships_overview.h
+++ b/glom/mode_design/relationships_overview/window_relationships_overview.h
@@ -25,7 +25,7 @@
#include "glom/utility_widgets/canvas/canvas_editable.h"
#include "canvas_group_dbtable.h"
#include <gtkmm/dialog.h>
-#include <gtkmm/widget.h>
+#include <gtkmm/applicationwindow.h>
#include <gtkmm/menubar.h>
#include <gtkmm/printoperation.h>
#include <gtkmm/scrolledwindow.h>
@@ -41,7 +41,7 @@ namespace Glom
{
class Window_RelationshipsOverview
- : public Gtk::Window,
+ : public Gtk::ApplicationWindow,
public View_Composite_Glom
{
public:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]