Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application: modernize and set up locale #776

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions data/io.elementary.installer.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<file alias="io.elementary.installer.caution.svg" compressed="true" preprocess="xml-stripblanks">caution.svg</file>
<file alias="io.elementary.installer.emblem-downloads.svg" compressed="true" preprocess="xml-stripblanks">emblem-downloads.svg</file>
danirabbit marked this conversation as resolved.
Show resolved Hide resolved
</gresource>
<gresource prefix="/io/elementary/installer/icons">
<file alias="io.elementary.installer.caution.svg" compressed="true" preprocess="xml-stripblanks">caution.svg</file>
<file alias="io.elementary.installer.emblem-downloads.svg" compressed="true" preprocess="xml-stripblanks">emblem-downloads.svg</file>
</gresource>
</gresources>
56 changes: 24 additions & 32 deletions src/Application.vala
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
/*-
* Copyright (c) 2016–2018 elementary LLC. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2016-2024 elementary, Inc. (https://elementary.io)
*
* Authored by: Corentin Noël <[email protected]>
*/
Expand All @@ -26,10 +13,19 @@ public class Installer.App : Gtk.Application {

public static bool test_mode;

public App () {
Object (
application_id: "io.elementary.installer",
flags: ApplicationFlags.FLAGS_NONE
);
}

construct {
application_id = "io.elementary.installer";
flags = ApplicationFlags.FLAGS_NONE;
Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (application_id, Build.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (application_id, "UTF-8");
GLib.Intl.textdomain (application_id);

add_main_option_entries (INSTALLER_OPTIONS);
}

Expand All @@ -44,6 +40,14 @@ public class Installer.App : Gtk.Application {
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

var css_fallback = new Gtk.CssProvider ();
css_fallback.load_from_resource ("io/elementary/installer/disk-bar-fallback.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
css_fallback,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
}

public override void activate () {
Expand All @@ -57,17 +61,6 @@ public class Installer.App : Gtk.Application {
window.show_all ();
add_window (window);

weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default ();
default_theme.add_resource_path ("/io/elementary/installer");

var css_fallback = new Gtk.CssProvider ();
css_fallback.load_from_resource ("io/elementary/installer/disk-bar-fallback.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
css_fallback,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

inhibit (
get_active_window (),
Gtk.ApplicationInhibitFlags.IDLE | Gtk.ApplicationInhibitFlags.SUSPEND,
Expand All @@ -77,6 +70,5 @@ public class Installer.App : Gtk.Application {
}

public static int main (string[] args) {
var application = new Installer.App ();
return application.run (args);
return new Installer.App ().run (args);
}
1 change: 1 addition & 0 deletions src/Config.vala.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Build {
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string LANG_LIST = "@LANG_LIST@";
public const string LOCALEDIR = @LOCALEDIR@;
public const string PREFERRED_LANG_LIST = "@PREFERRED_LANG_LIST@";
public const string XKB_BASE = "@XKB_BASE@";
public const string ISO_CODES_LOCATION = "@ISO_CODES_LOCATION@";
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ vala_files = [
configuration_data = configuration_data()
configuration_data.set('GETTEXT_PACKAGE', meson.project_name())
configuration_data.set('LANG_LIST', get_option('supported_languages'))
configuration_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))

xkbconf = dependency('xkeyboard-config')
xkb_base = xkbconf.get_pkgconfig_variable('xkb_base')
Expand Down
Loading