Skip to content

Commit

Permalink
Merge pull request #152 from technosf/development
Browse files Browse the repository at this point in the history
Changes to get gschema compiling
  • Loading branch information
technosf authored Oct 26, 2024
2 parents c357a70 + 8d72482 commit eab6157
Show file tree
Hide file tree
Showing 23 changed files with 770 additions and 244 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build-aux
.vscode
.buildconfig
.flatpak-builder
.flatpak
code.sh
favicon.ico
tuner.code-workspace
1 change: 0 additions & 1 deletion com.github.louis77.tuner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ finish-args:
- "--share=ipc"
- "--socket=fallback-x11"
- "--socket=wayland"
- "--talk-name=org.gtk.vfs"
- "--talk-name=org.gtk.vfs.*"
- "--share=network"
- "--metadata=X-DConf=migrate-path=/com/github/louis77/tuner/"
Expand Down
54 changes: 47 additions & 7 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,41 +1,81 @@
#
# Data meson build file
#
# Icons, desktop file, appdata and schema
#

#
# Install icons
#
message('Installing Icons...')

icon_sizes = ['16', '24', '32', '48', '64', '128']

foreach i : icon_sizes
install_data (
join_paths ('icons', i, meson.project_name () + '.svg'),
install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps')
install_dir: join_paths (get_option ('datadir'), 'icons','hicolor', i + 'x' + i, 'apps'),
install_tag: 'icons'
)
install_data (
join_paths ('icons', i, meson.project_name () + '.svg'),
install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps')
install_dir: join_paths (get_option ('datadir'), 'icons','hicolor', i + 'x' + i + '@2', 'apps'),
install_tag: 'icons'
)
endforeach


message('Installed icons\n')


#
# Install desktop file
#
message('Installing desktop file...')
# Translate and install our .desktop file so the Applications Menu will see it
i18n.merge_file (
input: meson.project_name () + '.desktop.in',
output: meson.project_name () + '.desktop',
po_dir: join_paths (meson.project_source_root(), 'po', 'extra'),
type: 'desktop',
install: true,
install_dir: join_paths (get_option ('datadir'), 'applications')
install_dir: join_paths (get_option ('datadir'), 'applications'),
install_tag: 'applications'
)

message('Installed desktop file\n')


#
# Install appdata
#
message('Installing appdata...')

# Translate and install our .appdata.xml file so AppCenter will see it
i18n.merge_file (
input: meson.project_name () + '.appdata.xml.in',
output: meson.project_name () + '.appdata.xml',
po_dir: join_paths (meson.project_source_root(), 'po', 'extra'),
install: true,
install_dir: join_paths (get_option ('datadir'), 'metainfo')
install_dir: join_paths (get_option ('datadir'), 'metainfo'),
install_tag: 'metainfo'
)

message('Installed appdata\n')


#
# Install schema
# This doesn't work on older versions of meson:
# schemas_dir = get_option('prefix') / get_option('datadir') / 'glib-2.0' / 'schemas'
#
message('Installing schema...')

schemas_dir = join_paths (get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas')
settings_schemas = [ meson.project_name () + '.gschema.xml' ]

settings_schemas = [ meson.project_name() + '.gschema.xml' ]

install_data(settings_schemas, install_dir: schemas_dir)

meson.add_install_script('glib-compile-schemas', schemas_dir, install_tag: 'schemas')


message('Installed schema\n')
10 changes: 8 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
project (
'com.github.louis77.tuner',
'vala', 'c',
version: '1.5.4'
version: '1.5.5',
meson_version: '>= 0.60.0',
)

message('Starting build for project: ' + meson.project_name())
message('Build type: ' + get_option('buildtype'))


# if meson.get_compiler ('vala').get_id() == 'valac'
# extra_args = ['-g', '--save_temps']
# endif
Expand Down Expand Up @@ -65,6 +70,7 @@ executable (
)

subdir ('data')

subdir ('po')

meson.add_install_script ('meson/post_install.py')
message('Build for project: ' + meson.project_name() + ' finished.\n')
8 changes: 8 additions & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# PO meson build file
#

message('Installing translations...' )

# Install main translations
i18n.gettext (meson.project_name (),
args: [
Expand All @@ -9,3 +15,5 @@ i18n.gettext (meson.project_name (),
)

subdir ('extra')

message('Installed translations\n')
104 changes: 87 additions & 17 deletions src/Application.vala
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
/*
/**
* @file Application.vala
* @brief Contains the main Application class for the Tuner application
*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2020-2022 Louis Brauer <louis@brauer.family>
*/

/**
Application
Entry point for Tuner
*/
/**
* @brief Entry point for Tuner application
* @class Tuner.Application
* @brief Main application class for Tuner
* @extends Gtk.Application
*
* This class serves as the entry point for the Tuner application.
* It handles application initialization, window management, and theme settings.
*/
public class Tuner.Application : Gtk.Application {

/** @brief Application version */
public const string APP_VERSION = VERSION;

/** @brief Application ID */
public const string APP_ID = "com.github.louis77.tuner";

/** @brief Unicode character for starred items */
public const string STAR_CHAR = "";

/** @brief Unicode character for unstarred items */
public const string UNSTAR_CHAR = "";

// /**
// * @enum Theme
// * @brief Enumeration of available themes
// */
// public enum Theme {
// SYSTEM,
// LIGHT,
// DARK
// }

/** @brief Application settings */
public GLib.Settings settings { get; construct; }

/** @brief Player controller */
public PlayerController player { get; construct; }

/** @brief Cache directory path */
public string? cache_dir { get; construct; }

/** @brief Data directory path */
public string? data_dir { get; construct; }

/** @brief Main application window */
public Window window;

public const string APP_VERSION = VERSION;
public const string APP_ID = "com.github.louis77.tuner";
public const string STAR_CHAR = "";
public const string UNSTAR_CHAR = "";

/** @brief Action entries for the application */
private const ActionEntry[] ACTION_ENTRIES = {
{ "resume-window", on_resume_window }
};
Expand All @@ -49,6 +78,8 @@ public class Tuner.Application : Gtk.Application {
GLib.Intl.textdomain (GETTEXT_PACKAGE);

settings = new GLib.Settings (this.application_id);
warning(@"Settings path: $(settings.path)");

player = new PlayerController ();

cache_dir = Path.build_filename (Environment.get_user_cache_dir (), application_id);
Expand All @@ -60,9 +91,7 @@ public class Tuner.Application : Gtk.Application {
add_action_entries(ACTION_ENTRIES, this);
}

/**
* @brief Singleton instance of the Application
*/
/** @brief Singleton instance of the Application */
public static Application _instance = null;

/**
Expand All @@ -78,8 +107,32 @@ public class Tuner.Application : Gtk.Application {
}
}

// /**
// * @brief Current theme of the application
// */
// public bool prefer_dark_theme {
// get {
// return settings.get_boolean("prefer-dark-theme");
// }
// set {
// var gtk_settings = Gtk.Settings.get_default();
// if (gtk_settings == null) {
// warning("Failed to get GTK settings");
// }
// else {
// gtk_settings.gtk_application_prefer_dark_theme = value;
// }
// settings.set_boolean("prefer-dark-theme", value);
// }
// }



/**
* @brief Activates the application
*
* This method is called when the application is activated. It creates
* or presents the main window and initializes the DBus connection.
*/
protected override void activate() {
if (window == null) {
Expand All @@ -89,11 +142,12 @@ public class Tuner.Application : Gtk.Application {
} else {
window.present ();
}

}

/**
* @brief Resumes the window
*
* This method is called to bring the main window to the foreground.
*/
private void on_resume_window() {
window.present();
Expand All @@ -102,6 +156,8 @@ public class Tuner.Application : Gtk.Application {
/**
* @brief Ensures a directory exists
* @param path The directory path to ensure
*
* This method creates the specified directory if it doesn't exist.
*/
private void ensure_dir (string path) {
var dir = File.new_for_path (path);
Expand All @@ -119,5 +175,19 @@ public class Tuner.Application : Gtk.Application {
}
}

}
// /**
// * @brief Converts a string to a Theme enum value
// * @param theme The theme string to convert
// * @return The corresponding Theme enum value
// */
// public static Theme theme_from_string(string theme_string) {

// warning(@"Theme requested: $(theme_string)");
// switch (theme_string) {
// case "TUNER_APPLICATION_THEME_LIGHT": return Theme.LIGHT;
// case "TUNER_APPLICATION_THEME_DARK": return Theme.DARK;
// default: return Theme.SYSTEM;
// }
// }

}
Loading

0 comments on commit eab6157

Please sign in to comment.