[rhythmbox] Add --version command line option



commit 576f05abc8a6d2d33ee57064713cc804736eb698
Author: vrishab <vrishab in gmail com>
Date:   Wed Sep 14 14:04:32 2016 +0530

    Add --version command line option
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701608

 remote/dbus/rb-client.c |   13 +++++++++++++
 shell/rb-application.c  |   12 ++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/remote/dbus/rb-client.c b/remote/dbus/rb-client.c
index 9134ec6..a9bfe68 100644
--- a/remote/dbus/rb-client.c
+++ b/remote/dbus/rb-client.c
@@ -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 },
@@ -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)
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 089ae5c..0012f3c 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -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)
 {
@@ -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 }
        };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]