[gnome-builder/wip/gtk4-port] libide/gui: add action to open by uri
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/gui: add action to open by uri
- Date: Mon, 6 Jun 2022 22:54:50 +0000 (UTC)
commit d145cda62c1d73e3a857e4b4d6b781feab865159
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 6 15:52:48 2022 -0700
libide/gui: add action to open by uri
This is helpful for debugging, if nothing else.
src/libide/gui/ide-workbench.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 0caf62835..3b54fc061 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -118,6 +118,8 @@ static void ide_workbench_action_close (IdeWorkbench *self,
GVariant *param);
static void ide_workbench_action_open (IdeWorkbench *self,
GVariant *param);
+static void ide_workbench_action_open_uri (IdeWorkbench *self,
+ GVariant *param);
static void ide_workbench_action_dump_tasks (IdeWorkbench *self,
GVariant *param);
static void ide_workbench_action_object_tree (IdeWorkbench *self,
@@ -134,6 +136,7 @@ static void ide_workbench_action_configure (IdeWorkbench *self,
IDE_DEFINE_ACTION_GROUP (IdeWorkbench, ide_workbench, {
{ "close", ide_workbench_action_close },
{ "open", ide_workbench_action_open },
+ { "open-uri", ide_workbench_action_open_uri, "s" },
{ "reload-files", ide_workbench_action_reload_all },
{ "global-search", ide_workbench_action_global_search },
{ "configure", ide_workbench_action_configure },
@@ -1451,6 +1454,23 @@ ide_workbench_action_open (IdeWorkbench *self,
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
}
+static void
+ide_workbench_action_open_uri (IdeWorkbench *self,
+ GVariant *param)
+{
+ g_autoptr(GFile) file = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_WORKBENCH (self));
+ g_assert (g_variant_is_of_type (param, G_VARIANT_TYPE_STRING));
+
+ file = g_file_new_for_uri (g_variant_get_string (param, NULL));
+ ide_workbench_open_async (self, file, NULL, 0, NULL, NULL, NULL, NULL);
+
+ IDE_EXIT;
+}
+
static void
ide_workbench_action_global_search (IdeWorkbench *self,
GVariant *param)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]