[gnome-builder/wip/gtk4-port] plugins/html-preview: be more specific in some API usage



commit a7518bd25060a9dbf381de8d6ac3adfc6cee7ac6
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 6 14:55:14 2022 -0700

    plugins/html-preview: be more specific in some API usage
    
    This helps prevent chances that things could collide by action-name.
    Additionally, raise the page when showing.

 .../html-preview/gbp-html-preview-workspace-addin.c       |  5 +++--
 src/plugins/html-preview/gtk/menus.ui                     | 15 +++++++++------
 src/plugins/html-preview/html-preview.plugin              |  2 +-
 3 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/html-preview/gbp-html-preview-workspace-addin.c 
b/src/plugins/html-preview/gbp-html-preview-workspace-addin.c
index c31e4d614..5a0482fa5 100644
--- a/src/plugins/html-preview/gbp-html-preview-workspace-addin.c
+++ b/src/plugins/html-preview/gbp-html-preview-workspace-addin.c
@@ -43,7 +43,7 @@ static void live_preview_action (GbpHtmlPreviewWorkspaceAddin *self,
                                  GVariant                     *params);
 
 IDE_DEFINE_ACTION_GROUP (GbpHtmlPreviewWorkspaceAddin, gbp_html_preview_workspace_addin, {
-  { "live-preview", live_preview_action },
+  { "html-preview", live_preview_action },
 })
 
 static void
@@ -59,7 +59,7 @@ gbp_html_preview_workspace_addin_set_language (GbpHtmlPreviewWorkspaceAddin *sel
   enabled = language_id != NULL &&
             g_hash_table_contains (known_languages, language_id);
 
-  gbp_html_preview_workspace_addin_set_action_enabled (self, "live-preview", enabled);
+  gbp_html_preview_workspace_addin_set_action_enabled (self, "html-preview", enabled);
 }
 
 static void
@@ -236,6 +236,7 @@ live_preview_action (GbpHtmlPreviewWorkspaceAddin *self,
   ide_panel_position_set_depth (position, 0);
 
   ide_workspace_add_page (self->workspace, IDE_PAGE (page), position);
+  panel_widget_raise (PANEL_WIDGET (page));
 
   IDE_EXIT;
 }
diff --git a/src/plugins/html-preview/gtk/menus.ui b/src/plugins/html-preview/gtk/menus.ui
index 8b34fb69b..2c2e89e1a 100644
--- a/src/plugins/html-preview/gtk/menus.ui
+++ b/src/plugins/html-preview/gtk/menus.ui
@@ -1,10 +1,13 @@
 <?xml version="1.0"?>
 <interface>
-  <menu id="ide-editor-page-preview-section">
-    <item>
-      <attribute name="label" translatable="yes">Open Preview…</attribute>
-      <attribute name="action">html-preview.live-preview</attribute>
-      <attribute name="hidden-when">action-disabled</attribute>
-    </item>
+  <menu id="ide-editor-page-menu">
+    <section id="ide-editor-page-preview-section">
+      <item>
+        <attribute name="id">html-preview-item</attribute>
+        <attribute name="label" translatable="yes">Open Preview…</attribute>
+        <attribute name="action">html-preview.html-preview</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
   </menu>
 </interface>
diff --git a/src/plugins/html-preview/html-preview.plugin b/src/plugins/html-preview/html-preview.plugin
index 1c57072c3..0a26c739a 100644
--- a/src/plugins/html-preview/html-preview.plugin
+++ b/src/plugins/html-preview/html-preview.plugin
@@ -2,7 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2015-2022 Christian Hergert
-Depends=webkit;
+Depends=editorui;webkit;
 Description=Live preview of HTML documents
 Embedded=_gbp_html_preview_register_types
 Module=html-preview


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