Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The upcoming features and releases can be checked out in the [milestones](https:
| [GtkSource-5][GtkSourceNuget] | Extends a Gtk.TextView to be like a source code editor |
| [Secret-1][SecretNuget] | Access to the system keyring via libsecret |
| [Rsvg-2.0][RsvgNuget] | SVG rendering library |
| [Geoclue-2.0][GeoclueNuget] | Location services library |


## Get Involved
Expand Down Expand Up @@ -113,6 +114,7 @@ The code in the library folder is not complete because most of the code is gener
[GtkSourceNuget]: https://www.nuget.org/packages/GirCore.GtkSource-5/
[SecretNuget]: https://www.nuget.org/packages/GirCore.Secret-1/
[RsvgNuget]: https://www.nuget.org/packages/GirCore.Rsvg-2.0/
[GeoclueNuget]: https://www.nuget.org/packages/GirCore.Geoclue-2.0/

## Licensing terms
Gir.Core is licensed under the terms of the MIT-License. Please see the [license file](license.txt) for further information.
Expand Down
1 change: 1 addition & 0 deletions scripts/GenerateLibs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let girFiles =
"GdkPixbuf-2.0.gir"
"GdkWayland-4.0.gir"
"GdkWin32-4.0.gir"
"Geoclue-2.0.gir"
"Gio-2.0.gir"
"GLib-2.0.gir"
"GObject-2.0.gir"
Expand Down
1 change: 1 addition & 0 deletions src/GirCore.Libs.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"Libs\\Gdk-4.0\\Gdk-4.0.csproj",
"Libs\\GdkWayland-4.0\\GdkWayland-4.0.csproj",
"Libs\\GdkPixbuf-2.0\\GdkPixbuf-2.0.csproj",
"Libs\\Geoclue-2.0\\Geoclue-2.0.csproj",
"Libs\\Gio-2.0\\Gio-2.0.csproj",
"Libs\\GLib-2.0\\GLib-2.0.csproj",
"Libs\\GObject-2.0\\GObject-2.0.csproj",
Expand Down
1 change: 1 addition & 0 deletions src/GirCore.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<Project Path="Libs/GdkPixbuf-2.0/GdkPixbuf-2.0.csproj" />
<Project Path="Libs/GdkWayland-4.0/GdkWayland-4.0.csproj" />
<Project Path="Libs/GdkWin32-4.0/GdkWin32-4.0.csproj" />
<Project Path="Libs/Geoclue-2.0/Geoclue-2.0.csproj" />
<Project Path="Libs/Gio-2.0/Gio-2.0.csproj" />
<Project Path="Libs/GirTest-0.1/GirTest-0.1.csproj" />
<Project Path="Libs/GLib-2.0/GLib-2.0.csproj" />
Expand Down
12 changes: 12 additions & 0 deletions src/Libs/Geoclue-2.0/Geoclue-2.0.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GirCore.Geoclue-2.0</PackageId>
<RootNamespace>Geoclue</RootNamespace>
<Description>C# bindings for libgeoclue.</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Gio-2.0\Gio-2.0.csproj" />
<ProjectReference Include="..\GObject-2.0\GObject-2.0.csproj" />
</ItemGroup>
</Project>
64 changes: 64 additions & 0 deletions src/Libs/Geoclue-2.0/Public/Module.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;

namespace Geoclue;

public static class Module
{
private static bool IsInitialized;
private static DllImportResolver? CustomDllImportResolver;

/// <summary>
/// Initialize the <c>Geoclue</c> module.
/// </summary>
/// <remarks>
/// <para>
/// Calling this method is necessary to correctly initialize the bindings
/// and should be done before using anything else in the <see cref="Geoclue" />
/// namespace.
/// </para>
/// <para>
/// Calling this method will also initialize the modules this module
/// depends on:
/// </para>
/// <list type="table">
/// <item><description><see cref="GObject.Module" /></description></item>
/// <item><description><see cref="Gio.Module" /></description></item>
/// </list>
/// </remarks>
public static void Initialize()
{
if (IsInitialized)
return;

GObject.Module.Initialize();
Gio.Module.Initialize();

NativeLibrary.SetDllImportResolver(typeof(Module).Assembly, CustomDllImportResolver ?? Internal.ImportResolver.Resolve);

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 38 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context
Internal.TypeRegistration.RegisterTypes();

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Windows)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (Linux)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

Check failure on line 39 in src/Libs/Geoclue-2.0/Public/Module.cs

View workflow job for this annotation

GitHub Actions / Build (MacOS)

The name 'Internal' does not exist in the current context

IsInitialized = true;
}

/// <summary>
/// Set a custom DllImportResolver. This disables the automatic loading of native binaries for
/// Geoclue. If the given DllImportResolver receives the library name "Geoclue" it has to return a pointer
/// to the desired native Geoclue binary.
/// </summary>
/// <remarks>
/// Please be aware that using this API means you are out of the officially supported area
/// as you are able to combine GirCore with some binary the package was not build for. Please consider
/// to generate a custom GirCore package which exactly matches your binary.
/// </remarks>
/// <param name="customDllImportResolver">Custom DllImportResolver to use.</param>
/// <exception cref="Exception">Throws an exception if the method is called after module initialization.</exception>
[Experimental("GirCore1009", UrlFormat = "https://gircore.github.io/docs/integration/diagnostic/1009.html")]
public static void SetCustomDllImportResolver(DllImportResolver customDllImportResolver)
{
if (IsInitialized)
throw new Exception("Can't set a custom DllImportResolver after initialization is done.");

CustomDllImportResolver = customDllImportResolver;
}
}
Loading