dasher-project / dasher

Dasher
http://www.inference.phy.cam.ac.uk/dasher/
GNU General Public License v2.0
158 stars 45 forks source link

Dasher should support a --version option #41

Closed dbarnett closed 7 years ago

dbarnett commented 9 years ago

Most programs accept a --version argument to run them in a mode that prints the program version and exits, e.g.:

$ ls --version
ls (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Richard M. Stallman and David MacKenzie.

Dasher completely ignores a --version arg if I pass it and starts normally instead. It doesn't seem to have any way to query the version besides loading the GUI and checking Help>About.

cagdasgerede commented 7 years ago

Melike will work on this.

cagdasgerede commented 7 years ago

Something like this:

main.cc

gboolean do_show_version = false;

...

// Note to translators: This is the help string for "--version"
{"version", 'v', 0, G_OPTION_ARG_NONE, &do_show_version, N_("Show the version details."), NULL},

...

if (do_show_version)
  {
    option_version();
    return 0;
  }

DasherAppSettings.h

void option_version()

DasherAppSettings.cpp

void option_version()
{
  g_print("\n");
  // Note to translators: This is the version keyword showing for the command line option "--version"
  g_print("%-30s %-30s\n", _("Version"), PACKAGE_VERSION);
}
cagdasgerede commented 7 years ago

Also check dasher_main.cpp. Constants such as PACKAGE_VERSION and other information such as license can be used in producing the version string inside option_version() method.

gtk_show_about_dialog(GTK_WINDOW(pPrivate->pMainWindow),
                        "authors", authors,
                        "comments", _("Dasher is a predictive text entry application"), 
                        "copyright", "Copyright \xC2\xA9 1998-2011 The Dasher Project", 
                        "documenters", documenters,
                        "license", "GPL 2+",
                        "logo-icon-name", "dasher",
                        "translator-credits", _("translator-credits"),
                        "version", PACKAGE_VERSION,
                        "website", PACKAGE_URL,
                        "wrap-license", true,
                        NULL);
mbgazi commented 7 years ago

Hi, I committed some changes in the files Src/main.cc, Src/Gtk2/DasherAppSettings.h and Src/Gtk2/DasherAppSettings.cpp Could you please check them? Thanks Melike