Merge lp:~fabiozaramella/audience/fix-1044329 into lp:~audience-members/audience/trunk

Proposed by Fabio Zaramella
Status: Work in progress
Proposed branch: lp:~fabiozaramella/audience/fix-1044329
Merge into: lp:~audience-members/audience/trunk
Diff against target: 95 lines (+43/-18)
1 file modified
src/Audience.vala (+43/-18)
To merge this branch: bzr merge lp:~fabiozaramella/audience/fix-1044329
Reviewer Review Type Date Requested Status
Audience Members Pending
Review via email: mp+248200@code.launchpad.net

Description of the change

add --version command

To post a comment you must log in.
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Hello fabio,
It would be better if its added into Granite.Applications,
we'll have --version for all apps

Unmerged revisions

486. By Fabio Zaramella

--version command

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Audience.vala'
--- src/Audience.vala 2015-01-07 10:29:27 +0000
+++ src/Audience.vala 2015-02-01 14:57:21 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-1// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
2/*-2/*-
3 * Copyright (c) 2013-2014 Audience Developers (http://launchpad.net/pantheon-chat)3 * Copyright (c) 2013-2015 Audience Developers (http://launchpad.net/pantheon-chat)
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by6 * it under the terms of the GNU General Public License as published by
@@ -30,6 +30,47 @@
3030
31 public Audience.Settings settings; //global space for easier access...31 public Audience.Settings settings; //global space for easier access...
3232
33 namespace Options {
34 private static bool PRINT_VERSION = false;
35 }
36
37 public static const OptionEntry[] app_options = {
38 { "version", 'v', 0, OptionArg.NONE, out Options.PRINT_VERSION, N_("Print version info and exit"), null },
39 { null }
40 };
41
42 public static void main (string [] args) {
43 X.init_threads ();
44
45 var context = new OptionContext ("Audience");
46 context.add_main_entries (app_options, null);
47 context.add_group (Gtk.get_option_group (false));
48
49 try {
50 context.parse (ref args);
51 } catch (Error e) {
52 warning (e.message);
53 }
54
55 if (Options.PRINT_VERSION) {
56 stdout.printf ("Audience %s\n", Constants.VERSION);
57 stdout.printf ("Copyright 2011-2015 Audience Developers.\n");
58
59 return;
60 }
61
62 var err = GtkClutter.init (ref args);
63 if (err != Clutter.InitError.SUCCESS) {
64 error ("Could not initalize clutter! "+err.to_string ());
65 }
66
67 Gst.init (ref args);
68 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
69
70 var app = Audience.App.get_instance ();
71 app.run (args);
72 }
73
33 public class App : Granite.Application {74 public class App : Granite.Application {
3475
35 /**76 /**
@@ -60,7 +101,7 @@
60 build_version = Constants.VERSION;101 build_version = Constants.VERSION;
61 build_version_info = Constants.VERSION_INFO;102 build_version_info = Constants.VERSION_INFO;
62103
63 app_years = "2011-2014";104 app_years = "2011-2015";
64 app_icon = "audience";105 app_icon = "audience";
65 app_launcher = "audience.desktop";106 app_launcher = "audience.desktop";
66 application_id = "net.launchpad.audience";107 application_id = "net.launchpad.audience";
@@ -111,7 +152,6 @@
111 public App () {152 public App () {
112 Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG;153 Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG;
113154
114 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
115 this.flags |= GLib.ApplicationFlags.HANDLES_OPEN;155 this.flags |= GLib.ApplicationFlags.HANDLES_OPEN;
116156
117 repeat = false;157 repeat = false;
@@ -835,18 +875,3 @@
835 }875 }
836 }876 }
837}877}
838
839public static void main (string [] args) {
840 X.init_threads ();
841
842 var err = GtkClutter.init (ref args);
843 if (err != Clutter.InitError.SUCCESS) {
844 error ("Could not initalize clutter! "+err.to_string ());
845 }
846
847 Gst.init (ref args);
848
849 var app = Audience.App.get_instance ();
850
851 app.run (args);
852}

Subscribers

People subscribed via source and target branches