[gnome-software: 1/3] build: Add -Dprofile option to allow changing application ID




commit ec67612b017785dbe83b6d344bfded00fb4c8a83
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Apr 19 13:23:06 2021 +0100

    build: Add -Dprofile option to allow changing application ID
    
    This is intended to only be used for development preview snapshots,
    definitely not by packagers.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 meson.build          | 10 ++++++++++
 meson_options.txt    |  1 +
 src/gs-application.c | 14 ++++++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index a4983ad98..2c9f475e9 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,16 @@ conf.set_quoted('PACKAGE_NAME', meson.project_name())
 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
 conf.set_quoted('BUILD_TYPE', get_option('buildtype'))
 
+build_profile = get_option('profile')
+if get_option('buildtype') == 'release'
+  build_profile = ''
+endif
+
+conf.set_quoted('BUILD_PROFILE', build_profile)
+
+application_id = 'org.gnome.Software' + build_profile
+conf.set_quoted('APPLICATION_ID', application_id)
+
 # this refers to the gnome-software plugin API version
 # this is not in any way related to a package or soname version
 gs_plugin_api_version = '16'
diff --git a/meson_options.txt b/meson_options.txt
index 57c55fc56..f8ffcdb69 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,3 +21,4 @@ option('hardcoded_popular', type : 'boolean', value : true, description : 'enabl
 option('default_featured_apps', type : 'boolean', value : true, description : 'enable installation of 
default featured apps list')
 option('mogwai', type : 'boolean', value : false, description : 'enable metered data support using Mogwai')
 option('sysprof', type : 'feature', value : 'auto', description : 'enable sysprof-capture support for 
profiling')
+option('profile', type : 'string', value : '', description : 'Build with specified application ID')
diff --git a/src/gs-application.c b/src/gs-application.c
index a3a1745ac..32dc8506c 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -348,6 +348,8 @@ about_activated (GSimpleAction *action,
        };
        const gchar *copyright = "Copyright \xc2\xa9 2016-2019 Richard Hughes, Matthias Clasen, Kalev Lember";
        GtkAboutDialog *dialog;
+       g_autofree gchar *program_name_alloc = NULL;
+       const gchar *program_name;
 
        dialog = GTK_ABOUT_DIALOG (gtk_about_dialog_new ());
        gtk_about_dialog_set_authors (dialog, authors);
@@ -356,7 +358,15 @@ about_activated (GSimpleAction *action,
        gtk_about_dialog_set_logo_icon_name (dialog, "org.gnome.Software");
        gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
        gtk_about_dialog_set_version (dialog, get_version());
-       gtk_about_dialog_set_program_name (dialog, g_get_application_name ());
+
+       if (g_strcmp0 (BUILD_PROFILE, "Devel") == 0) {
+               /* This isn’t translated as it’s never released */
+               program_name = program_name_alloc = g_strdup_printf ("%s (Development Snapshot)",
+                                                                    g_get_application_name ());
+       } else {
+               program_name = g_get_application_name ();
+       }
+       gtk_about_dialog_set_program_name (dialog, program_name);
 
        /* TRANSLATORS: this is the title of the about window */
        gtk_window_set_title (GTK_WINDOW (dialog), _("About Software"));
@@ -1321,7 +1331,7 @@ GsApplication *
 gs_application_new (GsDebug *debug)
 {
        return g_object_new (GS_APPLICATION_TYPE,
-                            "application-id", "org.gnome.Software",
+                            "application-id", APPLICATION_ID,
                             "flags", G_APPLICATION_HANDLES_OPEN,
                             "inactivity-timeout", 12000,
                             "debug", debug,


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