Codebase list virt-viewer / 9192879
kiosk: add --kiosk-quit option In kiosk mode, it's useful to keep the app alive, even if the remote session ended for example. Ie, we want to prevent the app from quiting itself, even if the remote end closed, lost network, or crashed etc. Marc-André Lureau 10 years ago
3 changed file(s) with 58 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
8989 window manager, limit the session capabilities, use some
9090 restart/watchdog mechanism, disable VT switching etc.
9191
92 =item --kiosk-quit <never|on-disconnect>
93
94 By default, when kiosk mode is enabled, virt-viewer will remain open
95 when the connection to the remote server is terminated. By setting
96 kiosk-quit option to "on-disconnect" value, virt-viewer will quit
97 instead.
98
9299 =back
93100
94101 =head1 HOTKEY
9898 window manager, limit the session capabilities, use some
9999 restart/watchdog mechanism, disable VT switching etc.
100100
101 =item --kiosk-quit <never|on-disconnect>
102
103 By default, when kiosk mode is enabled, virt-viewer will remain open
104 when the connection to the remote server is terminated. By setting
105 kiosk-quit option to "on-disconnect" value, virt-viewer will quit
106 instead. Please note that --reconnect takes precedence over this
107 option, and will attempt to do a reconnection before it quits.
108
101109 =back
102110
103111 =head1 EXAMPLES
147147 GdkModifierType insert_smartcard_accel_mods;
148148 guint remove_smartcard_accel_key;
149149 GdkModifierType remove_smartcard_accel_mods;
150 gboolean quit_on_disconnect;
150151 };
151152
152153
166167 PROP_HAS_FOCUS,
167168 PROP_FULLSCREEN_AUTO_CONF,
168169 PROP_KIOSK,
170 PROP_QUIT_ON_DISCONNECT,
169171 };
170172
171173 enum {
11291131 priv->guest_name);
11301132 }
11311133
1132 gtk_main_quit();
1134 if (self->priv->quit_on_disconnect)
1135 gtk_main_quit();
11331136 }
11341137
11351138 static void
13381341 g_value_set_boolean(value, priv->kiosk);
13391342 break;
13401343
1344 case PROP_QUIT_ON_DISCONNECT:
1345 g_value_set_boolean(value, priv->quit_on_disconnect);
1346 break;
1347
13411348 default:
13421349 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
13431350 }
13851392
13861393 case PROP_KIOSK:
13871394 virt_viewer_app_set_kiosk(self, g_value_get_boolean(value));
1395 break;
1396
1397 case PROP_QUIT_ON_DISCONNECT:
1398 priv->quit_on_disconnect = g_value_get_boolean(value);
13881399 break;
13891400
13901401 default:
14551466 static gboolean opt_fullscreen = FALSE;
14561467 static gboolean opt_fullscreen_auto_conf = FALSE;
14571468 static gboolean opt_kiosk = FALSE;
1469 static gboolean opt_kiosk_quit = FALSE;
14581470
14591471 static void
14601472 virt_viewer_app_init (VirtViewerApp *self)
14841496
14851497 self->priv->verbose = opt_verbose;
14861498 self->priv->fullscreen_auto_conf = opt_fullscreen_auto_conf;
1499 self->priv->quit_on_disconnect = opt_kiosk ? opt_kiosk_quit : TRUE;
14871500 }
14881501
14891502 static void
16811694 G_PARAM_READWRITE |
16821695 G_PARAM_STATIC_STRINGS));
16831696
1697 g_object_class_install_property(object_class,
1698 PROP_QUIT_ON_DISCONNECT,
1699 g_param_spec_boolean("quit-on-disconnect",
1700 "Quit on disconnect",
1701 "Quit on disconnect",
1702 TRUE,
1703 G_PARAM_READWRITE |
1704 G_PARAM_STATIC_STRINGS));
1705
16841706 signals[SIGNAL_WINDOW_ADDED] =
16851707 g_signal_new("window-added",
16861708 G_OBJECT_CLASS_TYPE(object_class),
21482170 return FALSE;
21492171 }
21502172
2173 static gboolean
2174 option_kiosk_quit(G_GNUC_UNUSED const gchar *option_name,
2175 const gchar *value,
2176 G_GNUC_UNUSED gpointer data, GError **error)
2177 {
2178 if (g_str_equal(value, "never")) {
2179 opt_kiosk_quit = FALSE;
2180 return TRUE;
2181 }
2182 if (g_str_equal(value, "on-disconnect")) {
2183 opt_kiosk_quit = TRUE;
2184 return TRUE;
2185 }
2186
2187 g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, _("Invalid kiosk-quit argument: %s"), value);
2188 return FALSE;
2189 }
2190
21512191 const GOptionEntry *
21522192 virt_viewer_app_get_options(void)
21532193 {
21602200 N_("Customise hotkeys"), NULL },
21612201 { "kiosk", 'k', 0, G_OPTION_ARG_NONE, &opt_kiosk,
21622202 N_("Enable kiosk mode"), NULL },
2203 { "kiosk-quit", '\0', 0, G_OPTION_ARG_CALLBACK, option_kiosk_quit,
2204 N_("Quit on given condition in kiosk mode"), N_("<never|on-disconnect>") },
21632205 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose,
21642206 N_("Display verbose information"), NULL },
21652207 { "debug", '\0', 0, G_OPTION_ARG_NONE, &opt_debug,