aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/application.vala
diff options
context:
space:
mode:
authorSergey <sshikaree@zoho.com>2021-03-05 19:29:40 +0300
committerGitHub <noreply@github.com>2021-03-05 17:29:40 +0100
commite19e0153ac7c2f5587f414144e1ba762262b89f5 (patch)
tree046aa611df77b5e68740bf67402068f6852bfc27 /main/src/ui/application.vala
parenta07723636f98dde4b15527fce3ef7da50108cc95 (diff)
downloaddino-e19e0153ac7c2f5587f414144e1ba762262b89f5.tar.gz
dino-e19e0153ac7c2f5587f414144e1ba762262b89f5.zip
Add '--version' flag (#1014)
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r--main/src/ui/application.vala12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 29b61357..17d67e9e 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -15,6 +15,12 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
public Plugins.Registry plugin_registry { get; set; default = new Plugins.Registry(); }
public SearchPathGenerator? search_path_generator { get; set; }
+ internal static bool print_version = false;
+ private const OptionEntry[] options = {
+ { "version", 0, 0, OptionArg.NONE, ref print_version, "Display version number", null },
+ { null }
+ };
+
public Application() throws Error {
Object(application_id: "im.dino.Dino", flags: ApplicationFlags.HANDLES_OPEN);
init();
@@ -26,8 +32,14 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_APPLICATION);
create_actions();
+ add_main_option_entries(options);
startup.connect(() => {
+ if (print_version) {
+ print(@"Dino $(Dino.VERSION)\n");
+ Process.exit(0);
+ }
+
NotificationEvents notification_events = stream_interactor.get_module(NotificationEvents.IDENTITY);
notification_events.register_notification_provider(new GNotificationsNotifier(stream_interactor));
FreeDesktopNotifier? free_desktop_notifier = FreeDesktopNotifier.try_create(stream_interactor);