[gnome-builder/wip/gtk4-port: 1550/1774] libide/commands: remove command providers




commit 5d96fd6c180fe42e587b1e56cc1efdea8246f2e8
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 15 22:33:43 2022 -0700

    libide/commands: remove command providers
    
    We don't need this anymore as we have other ways to do this, along with
    search being the primary replacement for the command bar. Vim uses a
    custom command-bar in the statusbar and we can't query actions like we
    used to in GTK 4.

 src/libide/commands/ide-command-manager.c          | 541 ---------------------
 src/libide/commands/ide-command-manager.h          |  69 ---
 src/libide/commands/ide-command-provider.c         | 148 ------
 src/libide/commands/ide-command-provider.h         |  84 ----
 src/libide/commands/ide-command.c                  | 194 --------
 src/libide/commands/ide-command.h                  |  73 ---
 src/libide/commands/libide-commands.h              |  29 --
 src/libide/commands/meson.build                    |  78 ---
 src/libide/gui/ide-workbench.c                     |  14 -
 src/libide/gui/ide-workspace-actions.c             |  35 --
 src/libide/gui/meson.build                         |   1 -
 src/libide/meson.build                             |   1 -
 src/plugins/command-bar/command-bar-plugin.c       |  40 --
 src/plugins/command-bar/command-bar.gresource.xml  |   8 -
 src/plugins/command-bar/command-bar.plugin         |  10 -
 .../command-bar/gbp-command-bar-command-provider.c | 185 -------
 .../command-bar/gbp-command-bar-command-provider.h |  31 --
 src/plugins/command-bar/gbp-command-bar-private.h  |  29 --
 .../command-bar/gbp-command-bar-shortcuts.c        |  64 ---
 .../command-bar/gbp-command-bar-suggestion.c       | 171 -------
 .../command-bar/gbp-command-bar-suggestion.h       |  35 --
 .../command-bar/gbp-command-bar-workspace-addin.c  | 165 -------
 .../command-bar/gbp-command-bar-workspace-addin.h  |  31 --
 src/plugins/command-bar/gbp-command-bar.c          | 386 ---------------
 src/plugins/command-bar/gbp-command-bar.h          |  35 --
 src/plugins/command-bar/gbp-command-bar.ui         |  42 --
 src/plugins/command-bar/gbp-gaction-command.c      | 174 -------
 src/plugins/command-bar/gbp-gaction-command.h      |  38 --
 src/plugins/command-bar/meson.build                |  17 -
 src/plugins/command-bar/themes/shared.css          |  17 -
 src/plugins/meson.build                            |   1 -
 31 files changed, 2746 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 7123d2d47..0369761b9 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -25,7 +25,6 @@
 #include <glib/gi18n.h>
 #include <libpeas/peas.h>
 
-#include <libide-commands.h>
 #include <libide-debugger.h>
 #include <libide-gtk.h>
 #include <libide-threading.h>
@@ -386,9 +385,6 @@ ide_workbench_constructed (GObject *object)
   peas_extension_set_foreach (self->addins,
                               ide_workbench_addin_added_cb,
                               self);
-
-  /* Load command providers (which may register shortcuts) */
-  (void)ide_command_manager_from_context (self->context);
 }
 
 static void
@@ -774,7 +770,6 @@ ide_workbench_add_workspace (IdeWorkbench *self,
 {
   g_autoptr(GPtrArray) addins = NULL;
   IdeShortcutManager *shortcuts;
-  IdeCommandManager *command_manager;
   GList *mru_link;
 
   g_return_if_fail (IDE_IS_MAIN_THREAD ());
@@ -852,10 +847,6 @@ ide_workbench_add_workspace (IdeWorkbench *self,
       formatted = g_strdup_printf (_("Builder — %s"), title);
       gtk_window_set_title (GTK_WINDOW (workspace), formatted);
     }
-
-  /* Load shortcuts for commands */
-  command_manager = ide_command_manager_from_context (self->context);
-  ide_command_manager_load_shortcuts (command_manager, GTK_NATIVE (workspace));
 }
 
 /**
@@ -870,7 +861,6 @@ ide_workbench_remove_workspace (IdeWorkbench *self,
                                 IdeWorkspace *workspace)
 {
   g_autoptr(GPtrArray) addins = NULL;
-  IdeCommandManager *command_manager;
   GList *list;
   GList *mru_link;
   guint count = 0;
@@ -886,10 +876,6 @@ ide_workbench_remove_workspace (IdeWorkbench *self,
                                         G_CALLBACK (ide_workbench_workspace_is_active_cb),
                                         self);
 
-  /* Remove any shortcuts that were registered by command providers */
-  command_manager = ide_command_manager_from_context (self->context);
-  ide_command_manager_unload_shortcuts (command_manager, GTK_NATIVE (workspace));
-
   /* Notify all the addins about losing the workspace. */
   if ((addins = ide_workbench_collect_addins (self)))
     {
diff --git a/src/libide/gui/ide-workspace-actions.c b/src/libide/gui/ide-workspace-actions.c
index f7773c8a7..106e39a36 100644
--- a/src/libide/gui/ide-workspace-actions.c
+++ b/src/libide/gui/ide-workspace-actions.c
@@ -22,8 +22,6 @@
 
 #include "config.h"
 
-#include <libide-commands.h>
-
 #include "ide-gui-global.h"
 #include "ide-workspace-private.h"
 
@@ -40,41 +38,8 @@ ide_workspace_actions_close (GSimpleAction *action,
   gtk_window_close (GTK_WINDOW (self));
 }
 
-static void
-ide_workspace_actions_command (GSimpleAction *action,
-                               GVariant      *param,
-                               gpointer       user_data)
-{
-  IdeCommandManager *command_manager;
-  IdeWorkspace *self = user_data;
-  IdeContext *context;
-  g_autoptr(GVariant) str = NULL;
-  g_autoptr(GVariant) maybe = NULL;
-  g_autoptr(GVariant) params = NULL;
-
-  g_assert (G_IS_SIMPLE_ACTION (action));
-  g_assert (param != NULL);
-  g_assert (g_variant_is_of_type (param, G_VARIANT_TYPE ("(smv)")));
-  g_assert (IDE_IS_WORKSPACE (self));
-
-  context = ide_widget_get_context (GTK_WIDGET (self));
-  command_manager = ide_command_manager_from_context (context);
-
-  str = g_variant_get_child_value (param, 0);
-  maybe = g_variant_get_child_value (param, 1);
-
-  if (maybe != NULL && g_variant_n_children (maybe) == 1)
-    params = g_variant_get_child_value (maybe, 0);
-
-  ide_command_manager_execute (command_manager,
-                               GTK_WIDGET (self),
-                               g_variant_get_string (str, NULL),
-                               params);
-}
-
 static const GActionEntry actions[] = {
   { "close", ide_workspace_actions_close },
-  { "command", ide_workspace_actions_command, "s" },
 };
 
 void
diff --git a/src/libide/gui/meson.build b/src/libide/gui/meson.build
index 40dc85479..c0f821ebc 100644
--- a/src/libide/gui/meson.build
+++ b/src/libide/gui/meson.build
@@ -168,7 +168,6 @@ libide_gui_deps = [
 
   libide_core_dep,
   libide_io_dep,
-  libide_commands_dep,
   libide_foundry_dep,
   libide_gtk_dep,
   libide_debugger_dep,
diff --git a/src/libide/meson.build b/src/libide/meson.build
index 0b5d296ea..6f2eed369 100644
--- a/src/libide/meson.build
+++ b/src/libide/meson.build
@@ -7,7 +7,6 @@ subdir('plugins')
 subdir('threading')
 subdir('io')
 subdir('gtk')
-subdir('commands')
 subdir('code')
 subdir('vcs')
 subdir('tree')
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 31ba8a9f3..48aa8aeca 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -53,7 +53,6 @@ subdir('codespell')
 subdir('code-index')
 subdir('codeui')
 #subdir('color-picker')
-#subdir('command-bar')
 subdir('comment-code')
 subdir('copyright')
 subdir('c-pack')


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