mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 23:00:54 +00:00
Use GOptionGroup for VirtViewerApp options
Encapsulate things a bit better by adding virt_viewer_app_get_option_group() which provides a GOptionGroup rather than exposing an array of options. This option is then set as the main option group, and additional options can be added by subclasses, so the effect to the user should be equivalent.
This commit is contained in:
parent
de3e27b333
commit
abb888bce7
@ -107,14 +107,16 @@ main(int argc, char **argv)
|
||||
NULL, "URI|VV-FILE" },
|
||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
||||
};
|
||||
GOptionGroup *app_options = NULL;
|
||||
|
||||
virt_viewer_util_init(_("Remote Viewer"));
|
||||
|
||||
/* Setup command line options */
|
||||
context = g_option_context_new (NULL);
|
||||
g_option_context_set_summary(context, _("Remote viewer client"));
|
||||
g_option_context_add_main_entries (context, virt_viewer_app_get_options(), NULL);
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
app_options = virt_viewer_app_get_option_group();
|
||||
g_option_group_add_entries (app_options, options);
|
||||
g_option_context_set_main_group (context, app_options);
|
||||
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
||||
#ifdef HAVE_GTK_VNC
|
||||
g_option_context_add_group (context, vnc_display_get_option_group ());
|
||||
|
||||
@ -2279,8 +2279,8 @@ option_kiosk_quit(G_GNUC_UNUSED const gchar *option_name,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const GOptionEntry *
|
||||
virt_viewer_app_get_options(void)
|
||||
GOptionGroup*
|
||||
virt_viewer_app_get_option_group(void)
|
||||
{
|
||||
static const GOptionEntry options [] = {
|
||||
{ "zoom", 'z', 0, G_OPTION_ARG_INT, &opt_zoom,
|
||||
@ -2299,8 +2299,11 @@ virt_viewer_app_get_options(void)
|
||||
N_("Display debugging information"), NULL },
|
||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
||||
};
|
||||
GOptionGroup *group;
|
||||
group = g_option_group_new("virt-viewer", NULL, NULL, NULL, NULL);
|
||||
g_option_group_add_entries(group, options);
|
||||
|
||||
return options;
|
||||
return group;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -96,7 +96,7 @@ GHashTable* virt_viewer_app_get_windows(VirtViewerApp *self);
|
||||
gboolean virt_viewer_app_get_enable_accel(VirtViewerApp *self);
|
||||
VirtViewerSession* virt_viewer_app_get_session(VirtViewerApp *self);
|
||||
gboolean virt_viewer_app_get_fullscreen(VirtViewerApp *app);
|
||||
const GOptionEntry* virt_viewer_app_get_options(void);
|
||||
GOptionGroup* virt_viewer_app_get_option_group(void);
|
||||
void virt_viewer_app_clear_hotkeys(VirtViewerApp *app);
|
||||
gint virt_viewer_app_get_n_initial_displays(VirtViewerApp* self);
|
||||
gint virt_viewer_app_get_initial_monitor_for_display(VirtViewerApp* self, gint display);
|
||||
|
||||
@ -72,6 +72,7 @@ int main(int argc, char **argv)
|
||||
NULL, "-- DOMAIN-NAME|ID|UUID" },
|
||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
||||
};
|
||||
GOptionGroup* app_options = NULL;
|
||||
|
||||
virt_viewer_util_init(_("Virt Viewer"));
|
||||
|
||||
@ -83,8 +84,9 @@ int main(int argc, char **argv)
|
||||
/* Setup command line options */
|
||||
context = g_option_context_new (NULL);
|
||||
g_option_context_set_summary (context, _("Virtual machine graphical console"));
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
g_option_context_add_main_entries (context, virt_viewer_app_get_options(), NULL);
|
||||
app_options = virt_viewer_app_get_option_group();
|
||||
g_option_group_add_entries (app_options, options);
|
||||
g_option_context_set_main_group (context, app_options);
|
||||
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
||||
#ifdef HAVE_GTK_VNC
|
||||
g_option_context_add_group (context, vnc_display_get_option_group ());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user