[gnome-builder/wip/gtk4-port] plugins/flatpak: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/flatpak: port to GTK 4
- Date: Tue, 19 Apr 2022 03:46:02 +0000 (UTC)
commit b7e7bca9d2bd044613844fac414259fd894c4882
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 18 20:45:02 2022 -0700
plugins/flatpak: port to GTK 4
We can actually drop the clone widget in here because it hasn't even been
used in a number of releases. Although, it would be nice to someday restore
functionality to clone from .Sources runtimes.
src/plugins/flatpak/flatpak.gresource.xml | 1 -
.../flatpak/gbp-flatpak-build-system-discovery.c | 4 +-
src/plugins/flatpak/gbp-flatpak-clone-widget.c | 742 ---------------------
src/plugins/flatpak/gbp-flatpak-clone-widget.h | 39 --
src/plugins/flatpak/gbp-flatpak-clone-widget.ui | 44 --
src/plugins/flatpak/gbp-flatpak-config-provider.c | 2 +-
src/plugins/flatpak/gbp-flatpak-download-stage.c | 2 +-
src/plugins/flatpak/gbp-flatpak-install-dialog.c | 4 +-
src/plugins/flatpak/gbp-flatpak-install-dialog.ui | 33 +-
src/plugins/flatpak/gbp-flatpak-manifest.c | 6 +-
src/plugins/flatpak/gbp-flatpak-pipeline-addin.c | 26 +-
src/plugins/flatpak/gbp-flatpak-runtime.c | 8 +-
src/plugins/flatpak/ipc-flatpak-transfer-impl.c | 2 +-
src/plugins/flatpak/meson.build | 1 -
src/plugins/meson.build | 2 +-
15 files changed, 30 insertions(+), 886 deletions(-)
---
diff --git a/src/plugins/flatpak/flatpak.gresource.xml b/src/plugins/flatpak/flatpak.gresource.xml
index 494fd672a..9b03d6f6e 100644
--- a/src/plugins/flatpak/flatpak.gresource.xml
+++ b/src/plugins/flatpak/flatpak.gresource.xml
@@ -2,7 +2,6 @@
<gresources>
<gresource prefix="/plugins/flatpak">
<file>flatpak.plugin</file>
- <file preprocess="xml-stripblanks">gbp-flatpak-clone-widget.ui</file>
<file preprocess="xml-stripblanks">gbp-flatpak-install-dialog.ui</file>
</gresource>
</gresources>
diff --git a/src/plugins/flatpak/gbp-flatpak-build-system-discovery.c
b/src/plugins/flatpak/gbp-flatpak-build-system-discovery.c
index 4308f9aaf..8eb9920d1 100644
--- a/src/plugins/flatpak/gbp-flatpak-build-system-discovery.c
+++ b/src/plugins/flatpak/gbp-flatpak-build-system-discovery.c
@@ -202,9 +202,9 @@ gbp_flatpak_build_system_discovery_discover (IdeBuildSystemDiscovery *discovery
{
gchar *ret;
- if (dzl_str_equal0 (buildsystem, "cmake-ninja"))
+ if (ide_str_equal0 (buildsystem, "cmake-ninja"))
buildsystem = "cmake";
- else if (dzl_str_equal0 (buildsystem, "simple"))
+ else if (ide_str_equal0 (buildsystem, "simple"))
{
JsonNode *sdk_extensions;
JsonArray *sdk_extensions_array;
diff --git a/src/plugins/flatpak/gbp-flatpak-config-provider.c
b/src/plugins/flatpak/gbp-flatpak-config-provider.c
index 1721fe2f6..852ecc031 100644
--- a/src/plugins/flatpak/gbp-flatpak-config-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-config-provider.c
@@ -535,7 +535,7 @@ guess_best_config (GPtrArray *ar)
/* If appid.json is the same as the filename, that is the
* best match (after unstable) we can have. Use it.
*/
- if (dzl_str_equal0 (app_id_json, base))
+ if (ide_str_equal0 (app_id_json, base))
return IDE_CONFIG (config);
}
diff --git a/src/plugins/flatpak/gbp-flatpak-download-stage.c
b/src/plugins/flatpak/gbp-flatpak-download-stage.c
index 4ee3d58d0..553c8c61e 100644
--- a/src/plugins/flatpak/gbp-flatpak-download-stage.c
+++ b/src/plugins/flatpak/gbp-flatpak-download-stage.c
@@ -121,7 +121,7 @@ gbp_flatpak_download_stage_query (IdePipelineStage *stage,
ide_subprocess_launcher_push_argv (launcher, "--ccache");
ide_subprocess_launcher_push_argv (launcher, "--force-clean");
- if (!dzl_str_empty0 (self->state_dir))
+ if (!ide_str_empty0 (self->state_dir))
{
ide_subprocess_launcher_push_argv (launcher, "--state-dir");
ide_subprocess_launcher_push_argv (launcher, self->state_dir);
diff --git a/src/plugins/flatpak/gbp-flatpak-install-dialog.c
b/src/plugins/flatpak/gbp-flatpak-install-dialog.c
index 8098dc515..bcb322340 100644
--- a/src/plugins/flatpak/gbp-flatpak-install-dialog.c
+++ b/src/plugins/flatpak/gbp-flatpak-install-dialog.c
@@ -73,7 +73,7 @@ gbp_flatpak_install_dialog_response (GtkDialog *dialog,
if (GTK_DIALOG_CLASS (gbp_flatpak_install_dialog_parent_class)->response)
GTK_DIALOG_CLASS (gbp_flatpak_install_dialog_parent_class)->response (dialog, response_id);
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@@ -120,7 +120,7 @@ gbp_flatpak_install_dialog_init (GbpFlatpakInstallDialog *self)
gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
- dzl_gtk_widget_add_style_class (button, "suggested-action");
+ gtk_widget_add_css_class (button, "suggested-action");
}
void
diff --git a/src/plugins/flatpak/gbp-flatpak-install-dialog.ui
b/src/plugins/flatpak/gbp-flatpak-install-dialog.ui
index c994b84e1..f505f00b9 100644
--- a/src/plugins/flatpak/gbp-flatpak-install-dialog.ui
+++ b/src/plugins/flatpak/gbp-flatpak-install-dialog.ui
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk+" version="3.24"/>
+ <requires lib="gtk" version="4.0"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name name -->
@@ -13,27 +12,18 @@
</columns>
</object>
<template class="GbpFlatpakInstallDialog" parent="GtkDialog">
- <property name="can_focus">False</property>
<property name="modal">True</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkBox">
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
- <property name="can_focus">False</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkBox" id="content">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">12</property>
@@ -44,23 +34,16 @@
<child>
<object class="GtkLabel" id="subtitle">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="label" translatable="yes">Builder needs to install the following software
development kits to build your project.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="xalign">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="margin_top">12</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
@@ -69,7 +52,6 @@
<child>
<object class="GtkTreeView" id="runtimes">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="model">liststore1</property>
<child internal-child="selection">
<object class="GtkTreeSelection">
@@ -113,23 +95,10 @@
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</template>
</interface>
diff --git a/src/plugins/flatpak/gbp-flatpak-manifest.c b/src/plugins/flatpak/gbp-flatpak-manifest.c
index 8a12b420e..c0e595a0e 100644
--- a/src/plugins/flatpak/gbp-flatpak-manifest.c
+++ b/src/plugins/flatpak/gbp-flatpak-manifest.c
@@ -296,7 +296,7 @@ discover_primary_module (GbpFlatpakManifest *self,
!(name = json_object_get_string_member (obj, "name")))
continue;
- if (dzl_str_equal0 (name, dir_name))
+ if (ide_str_equal0 (name, dir_name))
{
self->primary_module = g_strdup (name);
return obj;
@@ -932,9 +932,9 @@ apply_changes_to_tree (GbpFlatpakManifest *self)
key = ide_environment_variable_get_key (var);
value = ide_environment_variable_get_value (var);
- if (dzl_str_equal0 (key, "CFLAGS"))
+ if (ide_str_equal0 (key, "CFLAGS"))
json_object_set_string_member (build_options, "cflags", value);
- else if (dzl_str_equal0 (key, "CXXFLAGS"))
+ else if (ide_str_equal0 (key, "CXXFLAGS"))
json_object_set_string_member (build_options, "cxxflags", value);
else
json_object_set_string_member (env_obj, key, value);
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index 33834962e..0ce7a74f4 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -22,6 +22,8 @@
#include <glib/gi18n.h>
+#include <libide-gtk.h>
+
#include "gbp-flatpak-manifest.h"
#include "gbp-flatpak-download-stage.h"
#include "gbp-flatpak-pipeline-addin.h"
@@ -196,17 +198,17 @@ reap_staging_dir_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- DzlDirectoryReaper *reaper = (DzlDirectoryReaper *)object;
+ IdeDirectoryReaper *reaper = (IdeDirectoryReaper *)object;
g_autoptr(IdePipelineStage) stage = user_data;
g_autoptr(GError) error = NULL;
IDE_ENTRY;
- g_assert (DZL_IS_DIRECTORY_REAPER (reaper));
+ g_assert (IDE_IS_DIRECTORY_REAPER (reaper));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_PIPELINE_STAGE (stage));
- if (!dzl_directory_reaper_execute_finish (reaper, result, &error))
+ if (!ide_directory_reaper_execute_finish (reaper, result, &error))
ide_object_warning (stage,
"Failed to reap staging directory: %s",
error->message);
@@ -258,14 +260,14 @@ check_for_build_init_files (IdePipelineStage *stage,
if (!completed && parent_exists)
{
- g_autoptr(DzlDirectoryReaper) reaper = NULL;
+ g_autoptr(IdeDirectoryReaper) reaper = NULL;
g_autoptr(GFile) staging = g_file_new_for_path (staging_dir);
ide_pipeline_stage_pause (stage);
- reaper = dzl_directory_reaper_new ();
- dzl_directory_reaper_add_directory (reaper, staging, 0);
- dzl_directory_reaper_execute_async (reaper,
+ reaper = ide_directory_reaper_new ();
+ ide_directory_reaper_add_directory (reaper, staging, 0);
+ ide_directory_reaper_execute_async (reaper,
cancellable,
reap_staging_dir_cb,
g_object_ref (stage));
@@ -274,17 +276,17 @@ check_for_build_init_files (IdePipelineStage *stage,
static void
reap_staging_dir (IdePipelineStage *stage,
- DzlDirectoryReaper *reaper,
+ IdeDirectoryReaper *reaper,
const gchar *staging_dir)
{
g_autoptr(GFile) dir = NULL;
g_assert (IDE_IS_PIPELINE_STAGE (stage));
- g_assert (DZL_IS_DIRECTORY_REAPER (reaper));
+ g_assert (IDE_IS_DIRECTORY_REAPER (reaper));
g_assert (staging_dir != NULL);
dir = g_file_new_for_path (staging_dir);
- dzl_directory_reaper_add_directory (reaper, dir, 0);
+ ide_directory_reaper_add_directory (reaper, dir, 0);
}
static gboolean
@@ -338,7 +340,7 @@ register_build_init_stage (GbpFlatpakPipelineAddin *self,
* If we got here by using a non-flatpak configuration, then there is a
* chance we don't have a valid app-id.
*/
- if (dzl_str_empty0 (app_id))
+ if (ide_str_empty0 (app_id))
app_id = "com.example.App";
if (platform == NULL && sdk == NULL)
@@ -634,7 +636,7 @@ build_bundle_notify_completed (IdePipelineStage *stage,
if (ide_pipeline_stage_get_completed (stage))
{
g_autoptr(GFile) file = g_file_new_for_path (dest_path);
- dzl_file_manager_show (file, NULL);
+ ide_file_manager_show (file, NULL);
}
}
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index 154a18d54..f7be43c1d 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -416,7 +416,7 @@ gbp_flatpak_runtime_translate_file (IdeRuntime *runtime,
translated = g_build_filename (runtime_dir,
"source",
- path + DZL_LITERAL_LENGTH ("/run/build-runtime/"),
+ path + strlen ("/run/build-runtime/"),
NULL);
return g_file_new_for_path (translated);
}
@@ -432,7 +432,7 @@ gbp_flatpak_runtime_translate_file (IdeRuntime *runtime,
g_autofree gchar *translated = NULL;
translated = g_build_filename (debug_dir,
- path + DZL_LITERAL_LENGTH ("/usr/lib/debug/"),
+ path + strlen ("/usr/lib/debug/"),
NULL);
return g_file_new_for_path (translated);
}
@@ -442,7 +442,7 @@ gbp_flatpak_runtime_translate_file (IdeRuntime *runtime,
return g_object_ref (self->deploy_dir_files);
if (g_str_has_prefix (path, "/usr/"))
- return g_file_get_child (self->deploy_dir_files, path + DZL_LITERAL_LENGTH ("/usr/"));
+ return g_file_get_child (self->deploy_dir_files, path + strlen ("/usr/"));
build_dir = get_staging_directory (self);
app_files_path = g_build_filename (build_dir, "files", NULL);
@@ -455,7 +455,7 @@ gbp_flatpak_runtime_translate_file (IdeRuntime *runtime,
g_autofree gchar *translated = NULL;
translated = g_build_filename (app_files_path,
- path + DZL_LITERAL_LENGTH ("/app/"),
+ path + strlen ("/app/"),
NULL);
return g_file_new_for_path (translated);
}
diff --git a/src/plugins/flatpak/ipc-flatpak-transfer-impl.c b/src/plugins/flatpak/ipc-flatpak-transfer-impl.c
index 7cc0d2892..deed8d5ca 100644
--- a/src/plugins/flatpak/ipc-flatpak-transfer-impl.c
+++ b/src/plugins/flatpak/ipc-flatpak-transfer-impl.c
@@ -98,7 +98,7 @@ ipc_flatpak_transfer_impl_handle_confirm (IpcFlatpakTransfer *transfer,
if (gbp_flatpak_install_dialog_is_empty (dialog))
{
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
ipc_flatpak_transfer_complete_confirm (transfer, g_steal_pointer (&invocation));
return TRUE;
}
diff --git a/src/plugins/flatpak/meson.build b/src/plugins/flatpak/meson.build
index d6455ab0b..c800da78b 100644
--- a/src/plugins/flatpak/meson.build
+++ b/src/plugins/flatpak/meson.build
@@ -20,7 +20,6 @@ plugins_sources += files([
'gbp-flatpak-build-target-provider.c',
'gbp-flatpak-build-target.c',
'gbp-flatpak-client.c',
- 'gbp-flatpak-clone-widget.c',
'gbp-flatpak-config-provider.c',
'gbp-flatpak-dependency-updater.c',
'gbp-flatpak-download-stage.c',
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 1dbadcec9..7144edd1f 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -69,7 +69,7 @@ subdir('editorui')
subdir('editorconfig')
#subdir('emacs')
subdir('eslint')
-#subdir('flatpak')
+subdir('flatpak')
#subdir('file-search')
#subdir('find-other-file')
subdir('gcc')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]