[glom] Application: Manually specify accelerators.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Application: Manually specify accelerators.
- Date: Thu, 17 Oct 2013 19:21:04 +0000 (UTC)
commit 070e9f1a1b98f840dd1fa9b6162d1d4287912d32
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Oct 17 21:18:34 2013 +0200
Application: Manually specify accelerators.
* glom/applicaiton.[h|cc]: Use add_accelerator() to make the
accelerators (already specified in the window_main.glade file)
actually work.
* glom/appwindow.cc: Add a comment about it.
See GTK+ bug 708905
glom/application.cc | 19 +++++++++++++++++++
glom/application.h | 1 +
glom/appwindow.cc | 3 +++
3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/glom/application.cc b/glom/application.cc
index 4f091f1..da14eef 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -87,6 +87,25 @@ void Application::on_activate()
create_window();
}
+void Application::on_startup()
+{
+ //Call the base class:
+ Gtk::Application::on_startup();
+
+ //TODO: Remove this if there is ever an easier way to make 'accel's from the .glade file just work.
+ //See https://bugzilla.gnome.org/show_bug.cgi?id=708905
+
+ //From window_main.glade:
+ add_accelerator("<Primary>n", "file.new");
+ add_accelerator("<Primary>o", "file.open");
+ add_accelerator("<Primary>w", "win.close");
+ add_accelerator("<Primary>c", "edit.copy");
+ add_accelerator("<Primary>v", "edit.paste");
+ add_accelerator("<Primary>f", "edit.find");
+
+ std::cout << "debug" << std::endl;
+}
+
void Application::on_open(const Gio::Application::type_vec_files& files,
const Glib::ustring& hint)
{
diff --git a/glom/application.h b/glom/application.h
index 4c5a4e6..3da9536 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -38,6 +38,7 @@ public:
protected:
//Overrides of default signal handlers:
virtual void on_activate();
+ virtual void on_startup();
virtual void on_open(const Gio::Application::type_vec_files& files,
const Glib::ustring& hint);
virtual int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>& command_line);
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index fc985fa..0bd65de 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -116,6 +116,9 @@ AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
m_menubar->show();
m_pBoxTop->pack_start(*m_menubar, Gtk::PACK_SHRINK);
+ //TODO: Remove our use of add_accelerator() in application.cc,
+ //if there is ever an easier way to make the 'accel's from the .glade file just work.
+ //See https://bugzilla.gnome.org/show_bug.cgi?id=708905
add_mime_type("application/x-glom"); //TODO: make this actually work - we need to register it properly.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]