Skip to content
This repository has been archived by the owner on Mar 10, 2019. It is now read-only.

Commit

Permalink
Add --version command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
vrishab authored and Jonathan Matthew committed Oct 3, 2016
1 parent ac70f6e commit 576f05a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions remote/dbus/rb-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ static gchar **other_stuff = NULL;

static GMainLoop *mainloop = NULL;

G_GNUC_NORETURN static gboolean show_version_cb (const gchar *option_name, const gchar *value, gpointer data, GError **error);

static GOptionEntry args[] = {
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, NULL, NULL },
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb, N_("Show the version of the program"), NULL },

{ "no-start", 0, 0, G_OPTION_ARG_NONE, &no_start, N_("Don't start a new instance of Rhythmbox"), NULL },
{ "quit", 0, 0, G_OPTION_ARG_NONE, &quit, N_("Quit Rhythmbox"), NULL },
Expand Down Expand Up @@ -186,6 +189,16 @@ annoy (GError **error)
return FALSE;
}

G_GNUC_NORETURN static gboolean
show_version_cb (const gchar *option_name,
const gchar *value,
gpointer data,
GError **error)
{
g_print ("%s %s\n", PACKAGE, VERSION);

exit (0);
}

static char *
rb_make_duration_string (gint64 duration, gboolean show_zero)
Expand Down
12 changes: 12 additions & 0 deletions shell/rb-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ enum {
PROP_SHELL
};

G_GNUC_NORETURN static gboolean
show_version_cb (const gchar *option_name,
const gchar *value,
gpointer data,
GError **error)
{
g_print ("%s %s\n", PACKAGE, VERSION);

exit (0);
}

static void
load_uri_action_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
{
Expand Down Expand Up @@ -626,6 +637,7 @@ rb_application_run (RBApplication *app, int argc, char **argv)
{ "disable-plugins", 0, 0, G_OPTION_ARG_NONE, &app->priv->disable_plugins, N_("Disable loading of plugins"), NULL },
{ "rhythmdb-file", 0, 0, G_OPTION_ARG_STRING, &app->priv->rhythmdb_file, N_("Path for database file to use"), NULL },
{ "playlists-file", 0, 0, G_OPTION_ARG_STRING, &app->priv->playlists_file, N_("Path for playlists file to use"), NULL },
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb, N_("Show the version of the program"), NULL },
{ NULL }
};

Expand Down

0 comments on commit 576f05a

Please sign in to comment.