context = /* Translators: this message will appear immediately after the */ /* usage string - Usage: COMMAND [OPTION…] <THIS_MESSAGE> */
g_option_context_new (_("APPLICATION [URI…] — launch an APPLICATION"));
/* Translators: this message will appear after the usage string */ /* and before the list of options. */
summary = _("Launch an application (specified by its desktop file name),\n" "optionally passing one or more URIs as arguments.");
g_option_context_set_summary (context, summary);
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
if (error != NULL)
{
g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try “%s --help” for more information."), g_get_prgname ());
g_printerr ("\n");
g_error_free (error); return1;
}
if (!args)
{ /* Translators: the %s is the program name. This error message */ /* means the user is calling gtk-launch without any argument. */
g_printerr (_("%s: missing application name"), g_get_prgname ());
g_printerr ("\n");
g_printerr (_("Try “%s --help” for more information."), g_get_prgname ());
g_printerr ("\n"); return1;
}
if (!g_dbus_is_name (bus_name))
g_clear_pointer (&bus_name, g_free);
info = G_APP_INFO (g_desktop_app_info_new (desktop_file_name));
g_free (desktop_file_name); #else
g_printerr (_("Creating AppInfo from id not supported on non unix operating systems")); #endif
args++;
if (!info)
{ /* Translators: the first %s is the program name, the second one */ /* is the application name. */
g_printerr (_("%s: no such application %s"),
g_get_prgname (), app_name);
g_printerr ("\n"); return2;
}
l = NULL; for (; *args; args++)
{
f = g_file_new_for_commandline_arg (*args);
l = g_list_append (l, f);
}
launch_context = (GAppLaunchContext*) gdk_display_get_app_launch_context (gdk_display_get_default ()); if (!g_app_info_launch (info, l, launch_context, &error))
{ /* Translators: the first %s is the program name, the second one */ /* is the error message. */
g_printerr (_("%s: error launching application: %s\n"),
g_get_prgname (), error->message); return3;
}
g_object_unref (info);
g_object_unref (launch_context);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.