[gnome-builder/wip/gtk4-port] plugins/project-tree: incremental fixes on project-tree bugs



commit 760ab77e9fc3de225b91b0d72590030ad510251e
Author: Christian Hergert <chergert redhat com>
Date:   Fri Apr 29 09:48:07 2022 -0700

    plugins/project-tree: incremental fixes on project-tree bugs
    
    We still have some ordering issues to fix (likely with proper dependency
    ordering) and I'd like actions to be installed on the tree rather than
    the pane but that will require work in GTK to allow for alternate action
    muxer parents.

 src/libide/tree/ide-tree-model.c                    |  6 +++---
 src/plugins/buildui/gtk/menus.ui                    |  2 +-
 src/plugins/grep/gbp-grep-tree-addin.c              |  8 +++++++-
 src/plugins/grep/grep.plugin                        |  1 +
 src/plugins/grep/gtk/menus.ui                       |  2 +-
 src/plugins/ls/ls.plugin                            |  1 +
 src/plugins/project-tree/gbp-rename-file-popover.c  |  2 +-
 src/plugins/project-tree/gbp-rename-file-popover.ui | 11 ++++-------
 src/plugins/project-tree/gtk/menus.ui               |  8 ++++++++
 9 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/src/libide/tree/ide-tree-model.c b/src/libide/tree/ide-tree-model.c
index 21a7bf974..503526b1c 100644
--- a/src/libide/tree/ide-tree-model.c
+++ b/src/libide/tree/ide-tree-model.c
@@ -56,9 +56,9 @@ static void tree_drag_dest_iface_init   (GtkTreeDragDestIface   *iface);
 static void tree_drag_source_iface_init (GtkTreeDragSourceIface *iface);
 
 G_DEFINE_FINAL_TYPE_WITH_CODE (IdeTreeModel, ide_tree_model, IDE_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, tree_model_iface_init)
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST, tree_drag_dest_iface_init)
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, tree_drag_source_iface_init))
+                               G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, tree_model_iface_init)
+                               G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST, tree_drag_dest_iface_init)
+                               G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, 
tree_drag_source_iface_init))
 
 enum {
   PROP_0,
diff --git a/src/plugins/buildui/gtk/menus.ui b/src/plugins/buildui/gtk/menus.ui
index 799ad1b20..9881a6f49 100644
--- a/src/plugins/buildui/gtk/menus.ui
+++ b/src/plugins/buildui/gtk/menus.ui
@@ -14,7 +14,7 @@
     </section>
   </menu>
   <menu id="project-tree-menu">
-    <section id="project-tree-menu-buildui">
+    <section id="project-tree-menu-foundry-section">
       <item>
         <attribute name="id">project-tree-menu-build</attribute>
         <attribute name="hidden-when">action-disabled</attribute>
diff --git a/src/plugins/grep/gbp-grep-tree-addin.c b/src/plugins/grep/gbp-grep-tree-addin.c
index 60af7bbaf..c9d561251 100644
--- a/src/plugins/grep/gbp-grep-tree-addin.c
+++ b/src/plugins/grep/gbp-grep-tree-addin.c
@@ -22,6 +22,7 @@
 
 #include "config.h"
 
+#include <libide-gui.h>
 #include <libide-projects.h>
 #include <libide-tree.h>
 
@@ -72,11 +73,13 @@ gbp_grep_tree_addin_load (IdeTreeAddin *addin,
                           IdeTree      *tree,
                           IdeTreeModel *model)
 {
-  GbpGrepTreeAddin *self = (GbpGrepTreeAddin *)addin;
   static const GActionEntry actions[] = {
     { "find-in-files", find_in_files_action },
   };
 
+  GbpGrepTreeAddin *self = (GbpGrepTreeAddin *)addin;
+  GtkWidget *pane;
+
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_GREP_TREE_ADDIN (self));
   g_assert (IDE_IS_TREE (tree));
@@ -84,6 +87,9 @@ gbp_grep_tree_addin_load (IdeTreeAddin *addin,
 
   self->tree = tree;
 
+  pane = gtk_widget_get_ancestor (GTK_WIDGET (tree), IDE_TYPE_PANE);
+  g_assert (IDE_IS_PANE (pane));
+
   self->group = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (self->group),
                                    actions,
diff --git a/src/plugins/grep/grep.plugin b/src/plugins/grep/grep.plugin
index 63c5ecc7b..cbd6a3e6c 100644
--- a/src/plugins/grep/grep.plugin
+++ b/src/plugins/grep/grep.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2018 Christian Hergert
+Depends=project-tree;
 Description=Search across project files
 Embedded=_gbp_grep_register_types
 Module=grep
diff --git a/src/plugins/grep/gtk/menus.ui b/src/plugins/grep/gtk/menus.ui
index c035a1acb..cb0993bb3 100644
--- a/src/plugins/grep/gtk/menus.ui
+++ b/src/plugins/grep/gtk/menus.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
   <menu id="project-tree-menu">
-    <section id="project-tree-menu-placeholder2">
+    <section id="project-tree-menu-find-section">
       <item>
         <attribute name="hidden-when">action-disabled</attribute>
         <attribute name="label" translatable="yes">_Find in Files</attribute>
diff --git a/src/plugins/ls/ls.plugin b/src/plugins/ls/ls.plugin
index cdf752201..37db84d12 100644
--- a/src/plugins/ls/ls.plugin
+++ b/src/plugins/ls/ls.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2018 Christian Hergert
+Depends=project-tree;
 Description=List files in a directory as a view
 Embedded=_gbp_ls_register_types
 Hidden=true
diff --git a/src/plugins/project-tree/gbp-rename-file-popover.c 
b/src/plugins/project-tree/gbp-rename-file-popover.c
index 93435635e..3f4805d49 100644
--- a/src/plugins/project-tree/gbp-rename-file-popover.c
+++ b/src/plugins/project-tree/gbp-rename-file-popover.c
@@ -426,7 +426,7 @@ gbp_rename_file_popover_init (GbpRenameFilePopover *self)
                            G_CONNECT_SWAPPED);
 
   controller = gtk_event_controller_focus_new ();
-  g_signal_connect_object (self->entry,
+  g_signal_connect_object (controller,
                            "enter",
                            G_CALLBACK (gbp_rename_file_popover__entry_focus_in_event),
                            self,
diff --git a/src/plugins/project-tree/gbp-rename-file-popover.ui 
b/src/plugins/project-tree/gbp-rename-file-popover.ui
index 9da58ddc6..1d1bbf272 100644
--- a/src/plugins/project-tree/gbp-rename-file-popover.ui
+++ b/src/plugins/project-tree/gbp-rename-file-popover.ui
@@ -4,15 +4,16 @@
   <template class="GbpRenameFilePopover" parent="GtkPopover">
     <child>
       <object class="GtkBox">
-        <property name="border-width">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
-        <property name="visible">true</property>
         <child>
           <object class="GtkLabel" id="label">
             <property name="label" translatable="yes">File Name</property>
             <property name="xalign">0.0</property>
-            <property name="visible">true</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -22,11 +23,9 @@
           <object class="GtkBox">
             <property name="orientation">horizontal</property>
             <property name="spacing">9</property>
-            <property name="visible">true</property>
             <child>
               <object class="GtkEntry" id="entry">
                 <property name="width-chars">20</property>
-                <property name="visible">true</property>
               </object>
             </child>
             <child>
@@ -34,7 +33,6 @@
                 <property name="sensitive">false</property>
                 <property name="label" translatable="yes">_Rename</property>
                 <property name="use-underline">true</property>
-                <property name="visible">true</property>
                 <style>
                   <class name="destructive-action"/>
                 </style>
@@ -45,7 +43,6 @@
         <child>
           <object class="GtkLabel" id="message">
             <property name="xalign">0.0</property>
-            <property name="visible">true</property>
             <style>
               <class name="dim-label"/>
             </style>
diff --git a/src/plugins/project-tree/gtk/menus.ui b/src/plugins/project-tree/gtk/menus.ui
index 41c089e7a..6e9be63c8 100644
--- a/src/plugins/project-tree/gtk/menus.ui
+++ b/src/plugins/project-tree/gtk/menus.ui
@@ -46,6 +46,14 @@
         <attribute name="action">project-tree.open-in-terminal</attribute>
       </item>
     </section>
+    <section id="project-tree-menu-find-section">
+      <attribute name="after">project-tree-menu-open-section</attribute>
+      <attribute name="before">project-tree-menu-foundry-section</attribute>
+    </section>
+    <section id="project-tree-menu-foundry-section">
+      <attribute name="after">project-tree-menu-find-section</attribute>
+      <attribute name="before">project-tree-menu-destructive-section</attribute>
+    </section>
     <section id="project-tree-menu-destructive-section">
       <item>
         <attribute name="id">project-tree-menu-rename</attribute>


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