[gnome-builder] terminal: fix context menu for terminals



commit 2852c6aa3f641757461be331450ff9562d6be088
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 17 12:12:13 2019 -0800

    terminal: fix context menu for terminals
    
    Fixes #761

 src/libide/gui/ide-application.c   |  1 +
 src/libide/terminal/gtk/menus.ui   | 40 ++++++++++++++++++++++++++++++++++++++
 src/libide/terminal/ide-terminal.c |  2 +-
 3 files changed, 42 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/gui/ide-application.c b/src/libide/gui/ide-application.c
index 782518fdd..75112c5af 100644
--- a/src/libide/gui/ide-application.c
+++ b/src/libide/gui/ide-application.c
@@ -385,6 +385,7 @@ ide_application_init (IdeApplication *self)
   /* Ensure our core data is loaded early. */
   dzl_application_add_resources (DZL_APPLICATION (self), "resource:///org/gnome/libide-sourceview/");
   dzl_application_add_resources (DZL_APPLICATION (self), "resource:///org/gnome/libide-gui/");
+  dzl_application_add_resources (DZL_APPLICATION (self), "resource:///org/gnome/libide-terminal/");
 
   /* Make sure our GAction are available */
   _ide_application_init_actions (self);
diff --git a/src/libide/terminal/gtk/menus.ui b/src/libide/terminal/gtk/menus.ui
index b70d3ad94..604559627 100644
--- a/src/libide/terminal/gtk/menus.ui
+++ b/src/libide/terminal/gtk/menus.ui
@@ -9,4 +9,44 @@
       </item>
     </section>
   </menu>
+  <menu id="ide-terminal-page-popup-menu">
+    <section id="ide-terminal-page-popup-menu-link-section">
+      <item>
+        <attribute name="label" translatable="yes">_Open Link</attribute>
+        <attribute name="action">terminal.open-link</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Copy Link Address</attribute>
+        <attribute name="action">terminal.copy-link-address</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section id="ide-terminal-page-popup-menu-clipboard-section">
+      <item>
+        <attribute name="id">copy</attribute>
+        <attribute name="label" translatable="yes">_Copy</attribute>
+        <attribute name="action">terminal.copy-clipboard</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Paste</attribute>
+        <attribute name="action">terminal.paste-clipboard</attribute>
+      </item>
+    </section>
+    <section id="ide-terminal-page-popup-menu-selection-section">
+      <submenu id="ide-terminal-page-popup-menu-selection-submenu">
+        <attribute name="label" translatable="yes">Selection</attribute>
+        <item>
+          <attribute name="label" translatable="yes">Select _All</attribute>
+          <attribute name="action">terminal.select-all</attribute>
+          <attribute name="target" type="(b)">(true,)</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Select _None</attribute>
+          <attribute name="action">terminal.select-all</attribute>
+          <attribute name="target" type="(b)">(false,)</attribute>
+        </item>
+      </submenu>
+    </section>
+  </menu>
 </interface>
diff --git a/src/libide/terminal/ide-terminal.c b/src/libide/terminal/ide-terminal.c
index 3410a2c4b..185fc2007 100644
--- a/src/libide/terminal/ide-terminal.c
+++ b/src/libide/terminal/ide-terminal.c
@@ -156,7 +156,7 @@ popup_targets_received (GtkClipboard     *clipboard,
 
       priv->url = vte_terminal_match_check_event (VTE_TERMINAL (self), event, NULL);
 
-      menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "ide-terminal-view-popup-menu");
+      menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "ide-terminal-page-popup-menu");
       priv->popup_menu = gtk_menu_new_from_model (G_MENU_MODEL (menu));
 
       group = DZL_WIDGET_ACTION_GROUP (gtk_widget_get_action_group (GTK_WIDGET (self), "terminal"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]