[gnome-builder/wip/gtk4-port: 473/1774] plugins/open-with-external: port to GTK 4




commit 2fa7279f2e3c40a9b56ca85db48172b281ce1f5a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 6 22:55:51 2022 -0700

    plugins/open-with-external: port to GTK 4

 src/plugins/meson.build                            |  2 +-
 .../open-with-external/gbp-owe-workbench-addin.c   | 26 ++++++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 15b7541fe..da5c593e0 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -104,7 +104,7 @@ subdir('newcomers')
 subdir('notification')
 subdir('npm')
 #subdir('omni-gutter')
-#subdir('open-with-external')
+subdir('open-with-external')
 subdir('phpize')
 #subdir('podman')
 subdir('project-tree')
diff --git a/src/plugins/open-with-external/gbp-owe-workbench-addin.c 
b/src/plugins/open-with-external/gbp-owe-workbench-addin.c
index 816fe643f..2fa787ccb 100644
--- a/src/plugins/open-with-external/gbp-owe-workbench-addin.c
+++ b/src/plugins/open-with-external/gbp-owe-workbench-addin.c
@@ -20,15 +20,16 @@
 
 #define G_LOG_DOMAIN "gbp-owe-workbench-addin"
 
+#include "config.h"
+
 #include "gbp-owe-workbench-addin.h"
 
 #include <libportal/portal.h>
-#include <libportal-gtk3/portal-gtk3.h>
+#include <libportal-gtk4/portal-gtk4.h>
 
 struct _GbpOweWorkbenchAddin
 {
-  IdeObject         parent_instance;
-
+  IdeObject parent_instance;
   XdpPortal *portal;
   IdeWorkbench *workbench;
 };
@@ -36,9 +37,9 @@ struct _GbpOweWorkbenchAddin
 static void addin_iface_init (IdeWorkbenchAddinInterface *iface);
 
 G_DEFINE_FINAL_TYPE_WITH_CODE (GbpOweWorkbenchAddin,
-                         gbp_owe_workbench_addin,
-                         IDE_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, addin_iface_init))
+                               gbp_owe_workbench_addin,
+                               IDE_TYPE_OBJECT,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, addin_iface_init))
 
 static gboolean
 gbp_owe_workbench_addin_can_open (IdeWorkbenchAddin     *addin,
@@ -60,8 +61,9 @@ gbp_owe_workbench_addin_can_open (IdeWorkbenchAddin     *addin,
    */
   *priority = G_MAXINT / 2;
 
-  // xdp_portal_open_uri() doesn't accept opening directories, and anyway there's
-  // the Open Containing Folder entry for that purpose.
+  /* xdp_portal_open_uri() doesn't accept opening directories, and anyway there's
+   * the Open Containing Folder entry for that purpose.
+   */
   return filetype != G_FILE_TYPE_DIRECTORY;
 }
 
@@ -79,10 +81,8 @@ on_file_opened_cb (GObject      *source_object,
 
   if (!xdp_portal_open_uri_finish (portal, res, &error) &&
       !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-    {
-      ide_task_return_new_error (task, error->domain, error->code,
-                                 "Couldn't open file with external program using libportal: %s", 
error->message);
-    }
+    ide_task_return_new_error (task, error->domain, error->code,
+                               "Couldn't open file with external program using libportal: %s", 
error->message);
   else
     ide_task_return_boolean (task, TRUE);
 }
@@ -91,6 +91,8 @@ static void
 gbp_owe_workbench_addin_open_async (IdeWorkbenchAddin     *addin,
                                     GFile                 *file,
                                     const gchar           *content_type,
+                                    int                    line,
+                                    int                    line_offset,
                                     IdeBufferOpenFlags     flags,
                                     GCancellable          *cancellable,
                                     GAsyncReadyCallback    callback,


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