From c6c37d096f3d236e86c3073a58f7836298b05faa Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 11 Mar 2022 12:23:38 +0000 Subject: Remove the --enable-hidpi option completely Based on a patch by Fabian Vogt , many thanks. --- client/as-builder.c | 4 ++-- libappstream-builder/asb-app.c | 17 ----------------- libappstream-builder/asb-app.h | 2 -- libappstream-builder/asb-context.c | 18 ++++++++---------- libappstream-builder/asb-context.h | 2 +- libappstream-builder/asb-self-test.c | 1 - libappstream-builder/plugins/asb-plugin-appdata.c | 2 -- libappstream-builder/plugins/asb-plugin-icon.c | 4 ---- 8 files changed, 11 insertions(+), 39 deletions(-) diff --git a/client/as-builder.c b/client/as-builder.c index 60464bb..0ae5308 100644 --- a/client/as-builder.c +++ b/client/as-builder.c @@ -80,7 +80,7 @@ main (int argc, char **argv) { "include-failed", '\0', 0, G_OPTION_ARG_NONE, &include_failed, /* TRANSLATORS: command line option */ _("Include failed results in the output"), NULL }, - { "enable-hidpi", '\0', 0, G_OPTION_ARG_NONE, &hidpi_enabled, + { "enable-hidpi", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &hidpi_enabled, /* TRANSLATORS: command line option */ _("Add HiDPI icons to the tarball"), NULL }, { "enable-embed", '\0', 0, G_OPTION_ARG_NONE, &embedded_icons, @@ -229,7 +229,7 @@ main (int argc, char **argv) /* set build flags */ if (hidpi_enabled) - flags |= ASB_CONTEXT_FLAG_HIDPI_ICONS; + g_printerr ("--enable-hidpi now does nothing and will be removed in future versions\n"); if (add_cache_id) g_print ("--add-cache-id now does nothing and will be removed in future versions\n"); if (embedded_icons) diff --git a/libappstream-builder/asb-app.c b/libappstream-builder/asb-app.c index fdbc100..31c3ff0 100644 --- a/libappstream-builder/asb-app.c +++ b/libappstream-builder/asb-app.c @@ -26,7 +26,6 @@ typedef struct GPtrArray *requires_appdata; AsbPackage *pkg; gboolean ignore_requires_appdata; - gboolean hidpi_enabled; } AsbAppPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsbApp, asb_app, AS_TYPE_APP) @@ -103,22 +102,6 @@ asb_app_set_package (AsbApp *app, AsbPackage *pkg) as_app_add_pkgname (AS_APP (app), asb_package_get_name (pkg)); } -/** - * asb_app_set_hidpi_enabled: - * @app: A #AsbApp - * @hidpi_enabled: if HiDPI mode should be enabled - * - * Sets the HiDPI mode for the application. - * - * Since: 0.3.1 - **/ -void -asb_app_set_hidpi_enabled (AsbApp *app, gboolean hidpi_enabled) -{ - AsbAppPrivate *priv = GET_PRIVATE (app); - priv->hidpi_enabled = hidpi_enabled; -} - /** * asb_app_save_resources: * @app: A #AsbApp diff --git a/libappstream-builder/asb-app.h b/libappstream-builder/asb-app.h index 39d423f..4de30d0 100644 --- a/libappstream-builder/asb-app.h +++ b/libappstream-builder/asb-app.h @@ -51,8 +51,6 @@ typedef enum { AsbApp *asb_app_new (AsbPackage *pkg, const gchar *id); -void asb_app_set_hidpi_enabled (AsbApp *app, - gboolean hidpi_enabled); void asb_app_set_package (AsbApp *app, AsbPackage *pkg); AsbPackage *asb_app_get_package (AsbApp *app); diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c index 0bf6e32..a879471 100644 --- a/libappstream-builder/asb-context.c +++ b/libappstream-builder/asb-context.c @@ -508,6 +508,8 @@ asb_context_setup (AsbContext *ctx, GError **error) { AsbContextPrivate *priv = GET_PRIVATE (ctx); g_autofree gchar *icons_dir = NULL; + g_autofree gchar *icons_dir_hidpi = NULL; + g_autofree gchar *icons_dir_lodpi = NULL; g_autofree gchar *screenshot_dir1 = NULL; g_autofree gchar *screenshot_dir2 = NULL; @@ -565,16 +567,12 @@ asb_context_setup (AsbContext *ctx, GError **error) /* icons is nuked; we can re-decompress from the -icons.tar.gz */ if (!asb_utils_ensure_exists (priv->icons_dir, error)) return FALSE; - if (priv->flags & ASB_CONTEXT_FLAG_HIDPI_ICONS) { - g_autofree gchar *icons_dir_hidpi = NULL; - g_autofree gchar *icons_dir_lodpi = NULL; - icons_dir_lodpi = g_build_filename (priv->icons_dir, "64x64", NULL); - if (!asb_utils_ensure_exists (icons_dir_lodpi, error)) - return FALSE; - icons_dir_hidpi = g_build_filename (priv->icons_dir, "128x128", NULL); - if (!asb_utils_ensure_exists (icons_dir_hidpi, error)) - return FALSE; - } + icons_dir_lodpi = g_build_filename (priv->icons_dir, "64x64", NULL); + if (!asb_utils_ensure_exists (icons_dir_lodpi, error)) + return FALSE; + icons_dir_hidpi = g_build_filename (priv->icons_dir, "128x128", NULL); + if (!asb_utils_ensure_exists (icons_dir_hidpi, error)) + return FALSE; /* load plugins */ if (!asb_plugin_loader_setup (priv->plugin_loader, error)) diff --git a/libappstream-builder/asb-context.h b/libappstream-builder/asb-context.h index 1796f74..522f5f0 100644 --- a/libappstream-builder/asb-context.h +++ b/libappstream-builder/asb-context.h @@ -37,7 +37,7 @@ struct _AsbContextClass * @ASB_CONTEXT_FLAG_IGNORE_MISSING_INFO: Ignore missing information * @ASB_CONTEXT_FLAG_IGNORE_MISSING_PARENTS: Ignore missing parents * @ASB_CONTEXT_FLAG_ADD_CACHE_ID: Unused - * @ASB_CONTEXT_FLAG_HIDPI_ICONS: Include HiDPI icons + * @ASB_CONTEXT_FLAG_HIDPI_ICONS: Unused * @ASB_CONTEXT_FLAG_EMBEDDED_ICONS: Embed the icons in the XML * @ASB_CONTEXT_FLAG_NO_NETWORK: Do not download files * @ASB_CONTEXT_FLAG_INCLUDE_FAILED: Write the origin-ignore.xml file diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c index dbc21b9..8f6ed1b 100644 --- a/libappstream-builder/asb-self-test.c +++ b/libappstream-builder/asb-self-test.c @@ -345,7 +345,6 @@ asb_test_context_func (void) asb_context_set_api_version (ctx, 0.9); asb_context_set_flags (ctx, ASB_CONTEXT_FLAG_NO_NETWORK | ASB_CONTEXT_FLAG_INCLUDE_FAILED | - ASB_CONTEXT_FLAG_HIDPI_ICONS | ASB_CONTEXT_FLAG_ADD_DEFAULT_ICONS); asb_context_set_basename (ctx, "appstream"); asb_context_set_origin (ctx, "asb-self-test"); diff --git a/libappstream-builder/plugins/asb-plugin-appdata.c b/libappstream-builder/plugins/asb-plugin-appdata.c index 8fcecbc..4bb910a 100644 --- a/libappstream-builder/plugins/asb-plugin-appdata.c +++ b/libappstream-builder/plugins/asb-plugin-appdata.c @@ -171,8 +171,6 @@ asb_plugin_process_filename (AsbPlugin *plugin, } /* success */ - asb_app_set_hidpi_enabled (app, asb_context_get_flag (plugin->ctx, - ASB_CONTEXT_FLAG_HIDPI_ICONS)); asb_plugin_add_app (apps, AS_APP (app)); return TRUE; } diff --git a/libappstream-builder/plugins/asb-plugin-icon.c b/libappstream-builder/plugins/asb-plugin-icon.c index 7e5bd37..187feaa 100644 --- a/libappstream-builder/plugins/asb-plugin-icon.c +++ b/libappstream-builder/plugins/asb-plugin-icon.c @@ -110,10 +110,6 @@ asb_plugin_icon_convert_cached (AsbPlugin *plugin, as_icon_set_prefix (icon, as_app_get_icon_path (AS_APP (app))); as_app_add_icon (AS_APP (app), icon); - /* is HiDPI disabled */ - if (!asb_context_get_flag (plugin->ctx, ASB_CONTEXT_FLAG_HIDPI_ICONS)) - return TRUE; - /* try to get a HiDPI icon */ fn_hidpi = as_utils_find_icon_filename_full (tmpdir, key, AS_UTILS_FIND_ICON_HI_DPI, -- cgit v1.2.1