Commit 3f6ab3e1 authored by Aurimas Černius's avatar Aurimas Černius

Add shortcuts window with main window shortcuts

parent e472fbc8
......@@ -25,7 +25,7 @@ AC_DEFINE_UNQUOTED([LIBGNOTE_VERSION_INFO], ["$LIBGNOTE_VERSION_INFO"], [libgnot
dnl all the library version.
dnl if one is harcoded elsewhere, it is a bug
GTK_VERSION=3.16
GTK_VERSION=3.20
LIBGLIBMM_VERSION=2.32
LIBGTKMM_VERSION=3.18
GTKSPELL_VERSION=3.0.0
......@@ -149,6 +149,7 @@ data/Makefile
data/gnote.desktop.in
data/icons/Makefile
data/appdata/Makefile
data/ui/Makefile
src/Makefile
src/addins/Makefile
src/addins/addins.mk
......
SUBDIRS = appdata icons
SUBDIRS = appdata icons ui
@INTLTOOL_DESKTOP_RULE@
......
uidir = $(datadir)/gnote
ui_DATA = shortcuts-gnote.ui
@INTLTOOL_XML_RULE@
EXTRA_DIST = shortcuts-gnote.ui
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-gnote">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">main-window</property>
<property name="title" translatable="yes">Main Window</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Notes list</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Create new note</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;O</property>
<property name="title" translatable="yes">Open selected note</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;W</property>
<property name="title" translatable="yes">Open selected note in new window</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Delete</property>
<property name="title" translatable="yes">Delete selected note</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
data/appdata/gnote.appdata.xml.in
data/ui/shortcuts-gnote.ui
data/gnote.desktop.in.in
data/org.gnome.gnote.gschema.xml.in
src/actionmanager.cpp
......
......@@ -98,6 +98,7 @@ namespace gnote {
add_app_action("show-preferences");
add_app_action("about");
add_app_action("help-contents");
add_app_action("help-shortcuts");
add_app_action("quit");
}
......@@ -132,6 +133,7 @@ namespace gnote {
add_app_menu_item(APP_ACTION_NEW, 200, _("New _Window"), "app.new-window");
add_app_menu_item(APP_ACTION_MANAGE, 100, _("_Preferences"), "app.show-preferences");
add_app_menu_item(APP_ACTION_LAST, 100, _("_Help"), "app.help-contents");
add_app_menu_item(APP_ACTION_LAST, 100, _("_Shortcuts"), "app.help-shortcuts");
add_app_menu_item(APP_ACTION_LAST, 200, _("_About"), "app.about");
add_app_menu_item(APP_ACTION_LAST, 300, _("_Quit"), "app.quit");
}
......
......@@ -35,6 +35,8 @@
#include <glibmm/optionentry.h>
#include <gtkmm/main.h>
#include <gtkmm/aboutdialog.h>
#include <gtkmm/builder.h>
#include <gtkmm/shortcutswindow.h>
#include "gnote.hpp"
#include "actionmanager.hpp"
......@@ -263,6 +265,19 @@ namespace gnote {
utils::show_help("gnote", "", cscreen, NULL);
}
void Gnote::on_show_help_shortcust_action(const Glib::VariantBase&)
{
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file(DATADIR"/gnote/shortcuts-gnote.ui");
Gtk::ShortcutsWindow *win = nullptr;
builder->get_widget("shortcuts-gnote", win);
if(win == nullptr) {
ERR_OUT(_("Failed to get shortcuts window!"));
return;
}
win->show();
}
void Gnote::on_show_about_action(const Glib::VariantBase&)
{
std::vector<Glib::ustring> authors;
......@@ -399,6 +414,7 @@ namespace gnote {
sigc::mem_fun(*this, &Gnote::on_show_preferences_action));
am.get_app_action("sync-notes")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::open_note_sync_window));
am.get_app_action("help-contents")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_show_help_action));
am.get_app_action("help-shortcuts")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_show_help_shortcust_action));
am.get_app_action("about")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_show_about_action));
am.get_app_action("quit")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_quit_gnote_action));
......
......@@ -154,6 +154,7 @@ private:
void make_app_menu();
void on_new_window_action(const Glib::VariantBase&);
void on_new_note_app_action(const Glib::VariantBase&);
void on_show_help_shortcust_action(const Glib::VariantBase&);
MainWindow *get_active_window();
void register_object();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment