Skip to content

Commit

Permalink
Use consts if possible (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano authored Apr 9, 2022
1 parent ba117dd commit 7c277ac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ add_project_arguments(

config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_data.set_quoted('PROJECT_NAME', meson.project_name())
config_file = configure_file(
input: 'src' / 'Config.vala.in',
output: '@BASENAME@',
Expand Down
10 changes: 5 additions & 5 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ public class Application : Gtk.Application {

public Application () {
Object (
application_id: "com.github.ryonakano.pinit",
application_id: Constants.PROJECT_NAME,
flags: ApplicationFlags.FLAGS_NONE
);
}

construct {
Intl.setlocale (LocaleCategory.ALL, "");
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Intl.textdomain (GETTEXT_PACKAGE);
Intl.bindtextdomain (Constants.PROJECT_NAME, Constants.LOCALEDIR);
Intl.bind_textdomain_codeset (Constants.PROJECT_NAME, "UTF-8");
Intl.textdomain (Constants.PROJECT_NAME);
}

static construct {
settings = new Settings ("com.github.ryonakano.pinit");
settings = new Settings (Constants.PROJECT_NAME);
}

protected override void activate () {
Expand Down
7 changes: 5 additions & 2 deletions src/Config.vala.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string LOCALEDIR = @LOCALEDIR@;
public class Constants {
public const string APP_NAME = "Pin It!";
public const string LOCALEDIR = @LOCALEDIR@;
public const string PROJECT_NAME = @PROJECT_NAME@;
}
4 changes: 2 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MainWindow : Hdy.Window {

public MainWindow () {
Object (
title: "Pin It!"
title: Constants.APP_NAME
);
}

Expand Down Expand Up @@ -143,7 +143,7 @@ public class MainWindow : Hdy.Window {
}

public void show_welcome_view () {
header_bar.title = "Pin It!";
header_bar.title = Constants.APP_NAME;
home_button.sensitive = false;
deck.visible_child = welcome_view;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Views/WelcomeView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class WelcomeView : Granite.Widgets.Welcome {
public WelcomeView () {
Object (
title: "Pin It!",
title: Constants.APP_NAME,
subtitle: _("Pin any apps into the launcher")
);
}
Expand Down

0 comments on commit 7c277ac

Please sign in to comment.