summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-02-01 00:36:16 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-02-01 00:51:20 +0100
commit461be027295a975a37a905c9bdea4a7ebaae6400 (patch)
treeb43414a8302e63d4071ba912023776eb22ae98ce
parentbc70121fbc2fb6b9d12ca34d8ae8bec89e5f381e (diff)
gtk/spicy: add --version option
-rw-r--r--gtk/snappy.c25
-rw-r--r--gtk/spicy.c29
2 files changed, 42 insertions, 12 deletions
diff --git a/gtk/snappy.c b/gtk/snappy.c
index ec4da56..4a26569 100644
--- a/gtk/snappy.c
+++ b/gtk/snappy.c
@@ -26,6 +26,7 @@
/* config */
static char *outf = "snappy.ppm";
+static gboolean version = FALSE;
/* state */
static SpiceSession *session;
@@ -120,9 +121,16 @@ static GOptionEntry app_entries[] = {
.short_name = 'o',
.arg = G_OPTION_ARG_FILENAME,
.arg_data = &outf,
- .description = N_("output file name (*.ppm)"),
+ .description = N_("Output file name (default snappy.ppm)"),
.arg_description = N_("<filename>"),
- },{
+ },
+ {
+ .long_name = "version",
+ .arg = G_OPTION_ARG_NONE,
+ .arg_data = &version,
+ .description = N_("Display version and quit"),
+ },
+ {
/* end of list */
}
};
@@ -137,12 +145,19 @@ int main(int argc, char *argv[])
textdomain(GETTEXT_PACKAGE);
/* parse opts */
- context = g_option_context_new(_(" - write screen shots in ppm format"));
+ context = g_option_context_new(_(" - make screen shots"));
+ g_option_context_set_summary(context, _("A Spice server client to take screenshots in ppm format."));
+ g_option_context_set_description(context, _("Report bugs to " PACKAGE_BUGREPORT "."));
g_option_context_add_main_entries(context, app_entries, NULL);
g_option_context_add_group(context, spice_cmdline_get_option_group());
if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_print (_("option parsing failed: %s\n"), error->message);
- exit (1);
+ g_print(_("option parsing failed: %s\n"), error->message);
+ exit(1);
+ }
+
+ if (version) {
+ g_print("snappy " PACKAGE_VERSION "\n");
+ exit(0);
}
g_type_init();
diff --git a/gtk/spicy.c b/gtk/spicy.c
index 2375f4b..cd9784d 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -29,6 +29,7 @@
/* config */
static gboolean fullscreen = false;
+static gboolean version = false;
enum {
STATE_SCROLL_LOCK,
@@ -340,8 +341,8 @@ static void menu_cb_about(GtkAction *action, void *data)
"copyright", copyright,
"logo-icon-name", GTK_STOCK_ABOUT,
"website", website,
-// "version", VERSION,
-// "license", "GPLv2+",
+ "version", PACKAGE_VERSION,
+ "license", "LGPLv2.1",
NULL);
}
@@ -1020,8 +1021,15 @@ static GOptionEntry cmd_entries[] = {
.short_name = 'f',
.arg = G_OPTION_ARG_NONE,
.arg_data = &fullscreen,
- .description = N_("open in full screen mode"),
- },{
+ .description = N_("Open in full screen mode"),
+ },
+ {
+ .long_name = "version",
+ .arg = G_OPTION_ARG_NONE,
+ .arg_data = &version,
+ .description = N_("Display version and quit"),
+ },
+ {
/* end of list */
}
};
@@ -1057,12 +1065,19 @@ int main(int argc, char *argv[])
/* parse opts */
gtk_init(&argc, &argv);
context = g_option_context_new(_("- spice client application"));
- g_option_context_add_main_entries (context, cmd_entries, NULL);
+ g_option_context_set_summary(context, _("A Gtk client to connect to Spice servers."));
+ g_option_context_set_description(context, _("Report bugs to " PACKAGE_BUGREPORT "."));
+ g_option_context_add_main_entries(context, cmd_entries, NULL);
g_option_context_add_group(context, gtk_get_option_group(TRUE));
g_option_context_add_group(context, spice_cmdline_get_option_group());
if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_print (_("option parsing failed: %s\n"), error->message);
- exit (1);
+ g_print(_("option parsing failed: %s\n"), error->message);
+ exit(1);
+ }
+
+ if (version) {
+ g_print("spicy " PACKAGE_VERSION "\n");
+ exit(0);
}
g_type_init();