[gnome-documents] application: support --version command line switch
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] application: support --version command line switch
- Date: Sun, 31 Jul 2016 22:25:15 +0000 (UTC)
commit 93c3af5187a367850255758c32e83077b82a6f51
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Jul 31 15:24:39 2016 -0700
application: support --version command line switch
https://bugzilla.gnome.org/show_bug.cgi?id=760797
src/application.js | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 58c2005..e93da59 100644
--- a/src/application.js
+++ b/src/application.js
@@ -119,6 +119,9 @@ const Application = new Lang.Class({
this.parent({ application_id: appid,
inactivity_timeout: 12000 });
+ this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+ _("Show the version of the program"), null);
+
this._searchProvider = new ShellSearchProvider.ShellSearchProvider();
this._searchProvider.connect('activate-result', Lang.bind(this, this._onActivateResult));
this._searchProvider.connect('launch-search', Lang.bind(this, this._onLaunchSearch));
@@ -572,6 +575,15 @@ const Application = new Lang.Class({
this.parent(connection, path);
},
+ vfunc_handle_local_options: function(options) {
+ if (options.contains('version')) {
+ print(pkg.version);
+ return 0;
+ }
+
+ return -1;
+ },
+
vfunc_activate: function() {
if (!this._mainWindow) {
this._createWindow();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]