mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 16:06:16 +01:00
ffbf866d3b
We had a GApplication testcase that handled both open and commandline. This only way that this worked was by implementing the commandline handler without actually setting the HANDLES_COMMAND_LINE flag. This behaviour is now invalid, so just rip out the offending part of the test. https://bugzilla.gnome.org/show_bug.cgi?id=711099
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
#include <gio/gio.h>
|
|
#include <string.h>
|
|
|
|
static void
|
|
activate (GApplication *application)
|
|
{
|
|
g_application_hold (application);
|
|
g_print ("activated\n");
|
|
g_application_release (application);
|
|
}
|
|
|
|
static void
|
|
open (GApplication *application,
|
|
GFile **files,
|
|
gint n_files,
|
|
const gchar *hint)
|
|
{
|
|
gint i;
|
|
|
|
g_application_hold (application);
|
|
g_print ("open");
|
|
|
|
for (i = 0; i < n_files; i++)
|
|
{
|
|
gchar *uri = g_file_get_uri (files[i]);
|
|
g_print (" %s", uri);
|
|
g_free (uri);
|
|
}
|
|
g_application_release (application);
|
|
|
|
g_print ("\n");
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
GApplication *app;
|
|
int status;
|
|
|
|
app = g_application_new ("org.gtk.TestApplication",
|
|
G_APPLICATION_SEND_ENVIRONMENT |
|
|
G_APPLICATION_HANDLES_OPEN |
|
|
(g_strcmp0 (argv[1], "./cmd") == 0 ?
|
|
G_APPLICATION_HANDLES_COMMAND_LINE
|
|
: 0));
|
|
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
|
g_signal_connect (app, "open", G_CALLBACK (open), NULL);
|
|
#ifdef STANDALONE
|
|
g_application_set_inactivity_timeout (app, 10000);
|
|
#else
|
|
g_application_set_inactivity_timeout (app, 1000);
|
|
#endif
|
|
status = g_application_run (app, argc - 1, argv + 1);
|
|
|
|
g_object_unref (app);
|
|
|
|
g_print ("exit status: %d\n", status);
|
|
|
|
return 0;
|
|
}
|