Commit c1232c50 authored by Jeremy White's avatar Jeremy White

Add options to start minimized or hidden.

parent 65590d66
......@@ -21,14 +21,17 @@
#include "gui.h"
#include "x11spice.h"
int gui_create(gui_t *gui, int argc, char *argv[])
int gui_create(gui_t *gui, int argc, char *argv[], int minimize, int hidden)
{
if (! gtk_init_check(&argc, &argv))
return X11SPICE_ERR_GTK_FAILED;
gui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(gui->window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show(gui->window);
if (! hidden)
gtk_widget_show(gui->window);
if (minimize)
gtk_window_iconify(GTK_WINDOW(gui->window));
return 0;
}
......
......@@ -34,7 +34,7 @@ typedef struct
/*----------------------------------------------------------------------------
** Prototypes
**--------------------------------------------------------------------------*/
int gui_create(gui_t *gui, int argc, char *argv[]);
int gui_create(gui_t *gui, int argc, char *argv[], int minimize, int hidden);
void gui_run(gui_t *gui);
void gui_destroy(gui_t *gui);
......
......@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
/*------------------------------------------------------------------------
** Initialize the GUI
**----------------------------------------------------------------------*/
rc = gui_create(&session.gui, argc, argv);
rc = gui_create(&session.gui, argc, argv, session.options.minimize, session.options.hide);
if (rc)
goto exit;
gui_created = 1;
......
......@@ -98,17 +98,19 @@ int options_parse_arguments(int argc, char *argv[], options_t *options)
int rc;
int longindex = 0;
enum option_types { OPTION_VIEWONLY, OPTION_TIMEOUT, OPTION_AUTOPORT,
OPTION_GENERATE_PASSCODE, OPTION_DISPLAY, OPTION_HELP
enum option_types { OPTION_VIEWONLY, OPTION_TIMEOUT, OPTION_HIDE,
OPTION_GENERATE_PASSCODE, OPTION_DISPLAY, OPTION_MINIMIZE,
OPTION_HELP
};
static struct option long_options[] =
{
{"viewonly", 0, 0, OPTION_VIEWONLY },
{"timeout", 1, 0, OPTION_TIMEOUT },
{"autoport", 0, 0, OPTION_AUTOPORT },
{"hide", 0, 0, OPTION_HIDE },
{"generate-passcode", 0, 0, OPTION_GENERATE_PASSCODE},
{"display", 1, 0, OPTION_DISPLAY },
{"minimize", 0, 0, OPTION_MINIMIZE },
{"help", 0, 0, OPTION_HELP},
{0, 0, 0, 0}
};
......@@ -132,10 +134,17 @@ int options_parse_arguments(int argc, char *argv[], options_t *options)
options->display = strdup(optarg);
break;
case OPTION_HIDE:
options->hide = 1;
break;
case OPTION_MINIMIZE:
options->minimize = 1;
break;
default:
usage(argv[0]);
rc = X11SPICE_ERR_BADARGS;
break;
return X11SPICE_ERR_BADARGS;
}
}
......
......@@ -27,6 +27,8 @@
typedef struct
{
long timeout;
int minimize;
int hide;
char *display;
char *spice_addr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment