[gnome-builder/wip/chergert/perspective] libide: add shortcuts window to libide
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/perspective] libide: add shortcuts window to libide
- Date: Fri, 27 Nov 2015 23:59:50 +0000 (UTC)
commit ef50d23850f3ec4f739a33065717930aec661520
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 27 15:59:17 2015 -0800
libide: add shortcuts window to libide
data/ui/gb-shortcuts-window.ui | 291 ---------------------
data/ui/ide-shortcuts-window.ui | 443 +++++++++++++++++++++++++++++++++
libide/Makefile.am | 2 +
libide/ide-application-actions.c | 32 ++-
libide/ide-shortcuts-window.c | 42 +++
libide/ide-shortcuts-window.h | 32 +++
libide/resources/libide.gresource.xml | 1 +
7 files changed, 547 insertions(+), 296 deletions(-)
---
diff --git a/data/ui/ide-shortcuts-window.ui b/data/ui/ide-shortcuts-window.ui
new file mode 100644
index 0000000..d234105
--- /dev/null
+++ b/data/ui/ide-shortcuts-window.ui
@@ -0,0 +1,443 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.19 -->
+ <template class="IdeShortcutsWindow">
+ <property name="modal">1</property>
+ <child>
+ <object class="GtkShortcutsSection">
+ <property name="visible">1</property>
+ <property name="section-name">editor</property>
+ <property name="title" translatable="yes">Editor Shortcuts</property>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">General</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Global Search</property>
+ <property name="accelerator"><ctrl>period</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="accelerator"><ctrl>comma</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Command Bar</property>
+ <property name="accelerator"><ctrl>Return</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Terminal</property>
+ <property name="accelerator"><ctrl><shift>t</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Keyboard Shortcuts</property>
+ <property name="accelerator"><ctrl><shift>question</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Panels</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Toggle left panel</property>
+ <property name="accelerator">F9</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Toggle right panel</property>
+ <property name="accelerator"><shift>F9</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Toggle bottom panel</property>
+ <property name="accelerator"><ctrl>F9</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Touchpad gestures</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="shortcut-type">gesture-two-finger-swipe-right</property>
+ <property name="title" translatable="yes">Switch to the next document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="shortcut-type">gesture-two-finger-swipe-left</property>
+ <property name="title" translatable="yes">Switch to the previous document</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Files</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>n</property>
+ <property name="title" translatable="yes">Create new document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>o</property>
+ <property name="title" translatable="yes">Open a document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>s</property>
+ <property name="title" translatable="yes">Save the document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>w</property>
+ <property name="title" translatable="yes">Close the document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><alt>Page_Down</property>
+ <property name="title" translatable="yes">Switch to the next document</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><alt>Page_Up</property>
+ <property name="title" translatable="yes">Switch to the previous document</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Find and replace</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>f</property>
+ <property name="title" translatable="yes">Find</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>g</property>
+ <property name="title" translatable="yes">Find the next match</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>g</property>
+ <property name="title" translatable="yes">Find the previous match</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>k</property>
+ <property name="title" translatable="yes">Clear highlight</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Copy and Paste</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>c</property>
+ <property name="title" translatable="yes">Copy selected text to clipboard</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>x</property>
+ <property name="title" translatable="yes">Cut selected text to clipboard</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>v</property>
+ <property name="title" translatable="yes">Paste text from clipboard</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Undo and Redo</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>z</property>
+ <property name="title" translatable="yes">Undo previous command</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>z</property>
+ <property name="title" translatable="yes">Redo previous command</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Editing</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>a</property>
+ <property name="title" translatable="yes">Increment number at cursor</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>x</property>
+ <property name="title" translatable="yes">Decrement number at cursor</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>j</property>
+ <property name="title" translatable="yes">Join selected lines</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>space</property>
+ <property name="title" translatable="yes">Show completion window</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator">Insert</property>
+ <property name="title" translatable="yes">Toggle overwrite</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><alt>i</property>
+ <property name="title" translatable="yes">Reindent line</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Navigation</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt>n</property>
+ <property name="title" translatable="yes">Move to next error in file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt>p</property>
+ <property name="title" translatable="yes">Move to previous error in file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><shift><alt>Left</property>
+ <property name="title" translatable="yes">Move to previous edit location</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><shift><alt>Right</property>
+ <property name="title" translatable="yes">Move to next edit location</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt>period</property>
+ <property name="title" translatable="yes">Jump to definition of symbol</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt><shift>Up</property>
+ <property name="title" translatable="yes">Move sectionport up within the file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt><shift>Down</property>
+ <property name="title" translatable="yes">Move sectionport down within the file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt><shift>End</property>
+ <property name="title" translatable="yes">Move sectionport to end of file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt><shift>Home</property>
+ <property name="title" translatable="yes">Move sectionport to beginning of file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>percent</property>
+ <property name="title" translatable="yes">Move to matching bracket</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Selections</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>a</property>
+ <property name="title" translatable="yes">Select all</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>backslash</property>
+ <property name="title" translatable="yes">Unselect all</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsSection">
+ <property name="visible">1</property>
+ <property name="section-name">terminal</property>
+ <property name="title" translatable="yes">Terminal Shortcuts</property>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">General</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Global Search</property>
+ <property name="accelerator"><ctrl>period</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="accelerator"><ctrl>comma</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Command Bar</property>
+ <property name="accelerator"><ctrl>Return</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Terminal</property>
+ <property name="accelerator"><ctrl><shift>t</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Keyboard Shortcuts</property>
+ <property name="accelerator"><ctrl><shift>question</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Copy and Paste</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>c</property>
+ <property name="title" translatable="yes">Copy selected text to clipboard</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><shift>v</property>
+ <property name="title" translatable="yes">Paste text from clipboard</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 53e4592..d5b2ddb 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -300,6 +300,8 @@ libide_1_0_la_SOURCES = \
ide-ref-ptr.h \
ide-search-reducer.c \
ide-search-reducer.h \
+ ide-shortcuts-window.c \
+ ide-shortcuts-window.h \
ide-source-iter.c \
ide-source-iter.h \
ide-source-snippet-completion-item.c \
diff --git a/libide/ide-application-actions.c b/libide/ide-application-actions.c
index f5a2972..1e08653 100644
--- a/libide/ide-application-actions.c
+++ b/libide/ide-application-actions.c
@@ -27,6 +27,7 @@
#include "ide-application-credits.h"
#include "ide-application-private.h"
#include "ide-debug.h"
+#include "ide-shortcuts-window.h"
#include "ide-workbench.h"
static void
@@ -290,23 +291,44 @@ ide_application_actions_new_project (GSimpleAction *action,
cleanup:
g_list_free (windows);
}
+#endif
static void
ide_application_actions_shortcuts (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- IdeShortcutsWindow *window;
+ IdeApplication *self = user_data;
+ GtkWindow *window;
+ GtkWindow *parent = NULL;
+ GList *list;
+
+ g_assert (IDE_IS_APPLICATION (self));
+
+ list = gtk_application_get_windows (GTK_APPLICATION (self));
+
+ for (; list; list = list->next)
+ {
+ window = list->data;
+
+ if (IDE_IS_SHORTCUTS_WINDOW (window))
+ {
+ gtk_window_present (window);
+ return;
+ }
+
+ if (IDE_IS_WORKBENCH (window))
+ parent = window;
+ }
window = g_object_new (IDE_TYPE_SHORTCUTS_WINDOW,
+ "application", self,
"window-position", GTK_WIN_POS_CENTER,
- "default-width", 800,
- "default-height", 600,
+ "transient-for", parent,
NULL);
gtk_window_present (GTK_WINDOW (window));
}
-#endif
static const GActionEntry IdeApplicationActions[] = {
{ "about", ide_application_actions_about },
@@ -314,7 +336,7 @@ static const GActionEntry IdeApplicationActions[] = {
//{ "new-project", ide_application_actions_new_project },
{ "preferences", ide_application_actions_preferences },
{ "quit", ide_application_actions_quit },
- //{ "shortcuts", ide_application_actions_shortcuts },
+ { "shortcuts", ide_application_actions_shortcuts },
//{ "support", ide_application_actions_support },
};
diff --git a/libide/ide-shortcuts-window.c b/libide/ide-shortcuts-window.c
new file mode 100644
index 0000000..dd78e74
--- /dev/null
+++ b/libide/ide-shortcuts-window.c
@@ -0,0 +1,42 @@
+/* ide-shortcuts-window.c
+ *
+ * Copyright (C) 2015 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n.h>
+
+#include "ide-shortcuts-window.h"
+
+struct _IdeShortcutsWindow
+{
+ GtkShortcutsWindow parent_instance;
+};
+
+G_DEFINE_TYPE (IdeShortcutsWindow, ide_shortcuts_window, GTK_TYPE_SHORTCUTS_WINDOW)
+
+static void
+ide_shortcuts_window_class_init (IdeShortcutsWindowClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/ui/ide-shortcuts-window.ui");
+}
+
+static void
+ide_shortcuts_window_init (IdeShortcutsWindow *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/libide/ide-shortcuts-window.h b/libide/ide-shortcuts-window.h
new file mode 100644
index 0000000..5fb8d35
--- /dev/null
+++ b/libide/ide-shortcuts-window.h
@@ -0,0 +1,32 @@
+/* ide-shortcuts-window.h
+ *
+ * Copyright (C) 2015 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_SHORTCUTS_WINDOW_H
+#define IDE_SHORTCUTS_WINDOW_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_SHORTCUTS_WINDOW (ide_shortcuts_window_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeShortcutsWindow, ide_shortcuts_window, IDE, SHORTCUTS_WINDOW, GtkShortcutsWindow)
+
+G_END_DECLS
+
+#endif /* IDE_SHORTCUTS_WINDOW_H */
diff --git a/libide/resources/libide.gresource.xml b/libide/resources/libide.gresource.xml
index a3b84c8..9e8814c 100644
--- a/libide/resources/libide.gresource.xml
+++ b/libide/resources/libide.gresource.xml
@@ -60,6 +60,7 @@
<file alias="ide-preferences-perspective.ui">../../data/ui/ide-preferences-perspective.ui</file>
<file alias="ide-preferences-spin-button.ui">../../data/ui/ide-preferences-spin-button.ui</file>
<file alias="ide-preferences-switch.ui">../../data/ui/ide-preferences-switch.ui</file>
+ <file alias="ide-shortcuts-window.ui">../../data/ui/ide-shortcuts-window.ui</file>
<file alias="ide-workbench-header-bar.ui">../../data/ui/ide-workbench-header-bar.ui</file>
<file alias="ide-workbench.ui">../../data/ui/ide-workbench.ui</file>
</gresource>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]