gs-main.c 1.52 KB
Newer Older
1
2
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
Richard Hughes's avatar
Richard Hughes committed
3
 * Copyright (C) 2012-2013 Richard Hughes <richard@hughsie.com>
4
 * Copyright (C) 2013 Matthias Clasen <mclasen@redhat.com>
5
 * Copyright (C) 2015 Kalev Lember <klember@redhat.com>
6
 *
7
 * SPDX-License-Identifier: GPL-2.0+
8
9
10
11
12
 */

#include "config.h"

#include <glib/gi18n.h>
13
#include <gio/gio.h>
14
#include <gio/gdesktopappinfo.h>
15
#include <gtk/gtk.h>
16
17
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
18
#include <locale.h>
Kalev Lember's avatar
Kalev Lember committed
19
#include <sys/stat.h>
20

21
#include "gs-application.h"
Richard Hughes's avatar
Richard Hughes committed
22
#include "gs-debug.h"
Richard Hughes's avatar
Richard Hughes committed
23

24
25
26
int
main (int argc, char **argv)
{
27
	int status = 0;
28
	g_autoptr(GDesktopAppInfo) appinfo = NULL;
29
	g_autoptr(GsApplication) application = NULL;
Richard Hughes's avatar
Richard Hughes committed
30
	g_autoptr(GsDebug) debug = gs_debug_new ();
31

32
	g_set_prgname("org.gnome.Software");
33
34
35
36
37
38
	setlocale (LC_ALL, "");

	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

Kalev Lember's avatar
Kalev Lember committed
39
40
41
42
43
44
45
	/* Override the umask to 022 to make it possible to share files between
	 * the gnome-software process and flatpak system helper process.
	 * Ideally this should be set when needed in the flatpak plugin, but
	 * umask is thread-unsafe so there is really no local way to fix this.
	 */
	umask (022);

46
47
	hdy_init (&argc, &argv);

Richard Hughes's avatar
Richard Hughes committed
48
	/* redirect logs */
49
	application = gs_application_new ();
50
51
	appinfo = g_desktop_app_info_new ("org.gnome.Software.desktop");
	g_set_application_name (g_app_info_get_name (G_APP_INFO (appinfo)));
52
	status = g_application_run (G_APPLICATION (application), argc, argv);
53
54
	return status;
}