File: main.c

package info (click to toggle)
liferea 1.12~rc3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,608 kB
  • ctags: 3,161
  • sloc: ansic: 27,950; makefile: 512; python: 347; sh: 52
file content (86 lines) | stat: -rw-r--r-- 2,211 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
 * @file main.c Liferea startup
 *
 * Copyright (C) 2003-2012 Lars Windolf <lars.windolf@gmx.de>
 * Copyright (C) 2004-2006 Nathan J. Conrad <t98502@users.sourceforge.net>
 *  
 * Some code like the command line handling was inspired by 
 *
 * Pan - A Newsreader for Gtk+
 * Copyright (C) 2002  Charles Kerr <charles@rebelbase.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include <stdlib.h>
#include <signal.h>
#include <unistd.h>

#include "common.h"
#include "liferea_application.h"

static LifereaApplication *liferea_app = NULL;

gboolean
liferea_shutdown_source_func (gpointer userdata)
{
	g_application_quit (G_APPLICATION (liferea_app));
	return FALSE;
}

void liferea_shutdown ()
{
	g_idle_add (liferea_shutdown_source_func, NULL);
}

static void
signal_handler (int sig)
{
	liferea_shutdown ();
}

int
main (int argc, char *argv[])
{
	gint status;

	signal (SIGTERM, signal_handler);
	signal (SIGINT, signal_handler);
#ifdef SIGHUP
	signal (SIGHUP, signal_handler);
#endif

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	liferea_app = liferea_application_new ();
	g_set_prgname ("liferea");
	g_set_application_name (_("Liferea"));
	gtk_window_set_default_icon_name ("liferea");	/* GTK theme support */

	status = g_application_run (G_APPLICATION (liferea_app), argc, argv);
	g_object_unref (liferea_app);

	return status;
}