2
* Copyright 2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Ted Gould <ted.gould@canonical.com>
21
#include "desktop-single-trace.h"
24
main (int argc, char * argv[])
26
/* Nothing is single instance yet */
28
g_error("Should be called as: %s <app_id>", argv[0]);
32
g_setenv("LTTNG_UST_REGISTER_TIMEOUT", "0", FALSE); /* Set to zero if not set */
33
tracepoint(upstart_app_launch, desktop_single_start);
35
GKeyFile * keyfile = keyfile_for_appid(argv[1], NULL);
37
if (keyfile == NULL) {
38
g_error("Unable to find keyfile for application '%s'", argv[0]);
42
tracepoint(upstart_app_launch, desktop_single_found);
44
gboolean singleinstance = FALSE;
46
if (g_key_file_has_key(keyfile, "Desktop Entry", "X-Ubuntu-Single-Instance", NULL)) {
47
GError * error = NULL;
49
singleinstance = g_key_file_get_boolean(keyfile, "Desktop Entry", "X-Ubuntu-Single-Instance", &error);
52
g_warning("Unable to get single instance key for app '%s': %s", argv[1], error->message);
54
/* Ensure that if we got an error, we assume standard case */
55
singleinstance = FALSE;
59
g_key_file_free(keyfile);
61
tracepoint(upstart_app_launch, desktop_single_finished);