app-manager/app-manager.c
changeset 103 c4b0d5cc34bc
parent 61 31fb35727621
child 106 cc42fad3fe31
     1.1 --- a/app-manager/app-manager.c	Sat Jul 16 11:07:18 2016 +0100
     1.2 +++ b/app-manager/app-manager.c	Mon Aug 31 07:07:40 2020 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (C) 2010  J. Ali Harlow <ali@juiblex.co.uk>
     1.6 + * Copyright (C) 2010, 2020  J. Ali Harlow <ali@juiblex.co.uk>
     1.7   *
     1.8   * This program is free software; you can redistribute it and/or modify
     1.9   * it under the terms of the GNU General Public License as published by
    1.10 @@ -217,6 +217,7 @@
    1.11      GtkWidget *w;
    1.12      gchar *s,*database_uri,*contents;
    1.13      gchar *database=NULL,*setup_base=NULL,*update_base=NULL;
    1.14 +    gchar *default_action_base=NULL;
    1.15      gsize len;
    1.16      struct comps *comps;
    1.17      PloverPackageSet *set=NULL;
    1.18 @@ -229,6 +230,8 @@
    1.19  	  "Setup from installation media","uri"},
    1.20  	{"update",0,0,G_OPTION_ARG_STRING,&update_base,
    1.21  	  "Update from upgrade media","uri"},
    1.22 +	{"default-action",0,0,G_OPTION_ARG_STRING,&default_action_base,
    1.23 +	  "Install, remove or update from repository","uri"},
    1.24  	{NULL}
    1.25      };
    1.26  #ifdef WIN32
    1.27 @@ -256,9 +259,10 @@
    1.28  	g_printerr("%s\n",err->message);
    1.29  	exit(1);
    1.30      }
    1.31 -    if (setup_base && update_base)
    1.32 +    if (!!setup_base+!!update_base+!!default_action_base>1)
    1.33      {
    1.34 -	g_printerr("--setup and --update are mutually exclusive\n");
    1.35 +	g_printerr(
    1.36 +	  "--setup, --update and --default_action are mutually exclusive\n");
    1.37  	exit(1);
    1.38      }
    1.39  #ifdef WIN32
    1.40 @@ -294,6 +298,8 @@
    1.41  	started=setup(setup_base);
    1.42      else if (update_base)
    1.43  	started=update(update_base);
    1.44 +    else if (default_action_base)
    1.45 +	started=default_action(default_action_base);
    1.46      else
    1.47      {
    1.48  	if (database)
    1.49 @@ -357,6 +363,7 @@
    1.50      g_free(prefix);
    1.51      g_free(setup_base);
    1.52      g_free(update_base);
    1.53 +    g_free(default_action_base);
    1.54      g_free(database);
    1.55      exit(0);
    1.56  }