Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #23 from dguglielmi/optional-unity-support
Browse files Browse the repository at this point in the history
meson: Make unity support optional
  • Loading branch information
bcedu authored Oct 29, 2019
2 parents de7de73 + 3f718d0 commit 7cd3308
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option('libunity',
type : 'boolean',
value : true,
description : 'build with unity support')
10 changes: 10 additions & 0 deletions src/controllers/AppController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ namespace App.Controllers {
public App.Application application;
public AppWindow window;
public ViewController view_controller;
#if LIBUNITY
public Unity.LauncherEntry launcher;
#endif
public App.VGriveClient vgrive;
public bool closed;
public signal void log_event (string msg);
Expand All @@ -48,7 +50,9 @@ namespace App.Controllers {
this.view_controller = new ViewController (this);
// Connect the signals
this.connect_signals();
#if LIBUNITY
this.launcher = Unity.LauncherEntry.get_for_desktop_id (Constants.LAUNCHER_ID);
#endif
if (vgrive.has_local_credentials()) {
if (vgrive.load_local_credentials() == 1) {
this.set_registered_view ("sync_view");
Expand All @@ -58,7 +62,9 @@ namespace App.Controllers {

public void activate () {
this.closed = false;
#if LIBUNITY
this.launcher.progress_visible = false;
#endif
// Show all elements from window
window.init ();
// Set current view
Expand Down Expand Up @@ -100,13 +106,17 @@ namespace App.Controllers {
if (this.vgrive.is_syncing ()) {
this.closed = true;
this.notify (_("Sync continues in background"));
#if LIBUNITY
this.launcher.progress_visible = true;
this.launcher.progress = 0;
#endif
return this.window.hide_on_delete ();
}else {
this.vgrive.stop_syncing ();
this.notify (_("Sync stopped"));
#if LIBUNITY
this.launcher.progress_visible = false;
#endif
return false;
}
});
Expand Down
8 changes: 7 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ deps = [
dependency('gee-0.8'),
dependency('json-glib-1.0'),
dependency('libsoup-2.4'),
dependency('unity')
]

libunity_dep = []
if get_option('libunity')
add_project_arguments('-D', 'LIBUNITY', language: 'vala')
libunity_dep = [dependency('unity')]
endif

deps += libunity_dep

executable(
meson.project_name(),
Expand Down

0 comments on commit 7cd3308

Please sign in to comment.