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



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

    plugins/markdown-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.

 .../gbp-markdown-preview-workspace-addin.c                |  5 +++--
 src/plugins/markdown-preview/gtk/menus.ui                 | 15 +++++++++------
 src/plugins/markdown-preview/markdown-preview.plugin      |  2 +-
 3 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/markdown-preview/gbp-markdown-preview-workspace-addin.c 
b/src/plugins/markdown-preview/gbp-markdown-preview-workspace-addin.c
index 457865317..779ace827 100644
--- a/src/plugins/markdown-preview/gbp-markdown-preview-workspace-addin.c
+++ b/src/plugins/markdown-preview/gbp-markdown-preview-workspace-addin.c
@@ -44,7 +44,7 @@ static char *markdown_html_prefix;
 static char *markdown_html_suffix;
 
 IDE_DEFINE_ACTION_GROUP (GbpMarkdownPreviewWorkspaceAddin, gbp_markdown_preview_workspace_addin, {
-  { "live-preview", live_preview_action },
+  { "markdown-preview", live_preview_action },
 })
 
 static void
@@ -55,7 +55,7 @@ gbp_markdown_preview_workspace_addin_set_language (GbpMarkdownPreviewWorkspaceAd
 
   IDE_TRACE_MSG ("Switching language-id to %s", language_id ? language_id : "NULL");
   gbp_markdown_preview_workspace_addin_set_action_enabled (self,
-                                                           "live-preview",
+                                                           "markdown-preview",
                                                            ide_str_equal0 ("markdown", language_id));
 }
 
@@ -252,6 +252,7 @@ live_preview_action (GbpMarkdownPreviewWorkspaceAddin *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/markdown-preview/gtk/menus.ui b/src/plugins/markdown-preview/gtk/menus.ui
index 0f8c1690b..c491ba87f 100644
--- a/src/plugins/markdown-preview/gtk/menus.ui
+++ b/src/plugins/markdown-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">markdown-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">markdown-preview-item</attribute>
+        <attribute name="label" translatable="yes">Open Preview…</attribute>
+        <attribute name="action">markdown-preview.markdown-preview</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
   </menu>
 </interface>
diff --git a/src/plugins/markdown-preview/markdown-preview.plugin 
b/src/plugins/markdown-preview/markdown-preview.plugin
index da691b205..ad15b800e 100644
--- a/src/plugins/markdown-preview/markdown-preview.plugin
+++ b/src/plugins/markdown-preview/markdown-preview.plugin
@@ -2,7 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2022 Christian Hergert
-Depends=webkit;
+Depends=editorui;webkit;
 Description=Live preview of Markdown documents
 Embedded=_gbp_markdown_preview_register_types
 Module=markdown-preview


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