Update memory sizes to 64 bit and fix compilation warnings.
[lxde/lxtask.git] / src / main.c
CommitLineData
580e78c2
HJYP
1/* $Id: main.c 2350 2007-01-13 10:12:31Z nick $
2 *
3 * Copyright (c) 2006 Johannes Zellner, <webmaster@nebulon.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifdef HAVE_CONFIG_H
21# include <config.h>
22#endif
23
24#include <gtk/gtk.h>
25#include <glib.h>
26#include <signal.h>
ac6cc864 27#include <unistd.h>
580e78c2 28
d726731c
AF
29#ifdef ENABLE_NLS
30#include <libintl.h>
31#endif
32
580e78c2
HJYP
33#include "types.h"
34#include "interface.h"
35#include "functions.h"
36
0d40bfa3
HJYP
37GtkWidget *main_window;
38
39GArray *task_array;
40gint tasks;
4ab5f812 41uid_t own_uid;
0d40bfa3
HJYP
42
43gchar *config_file;
44
45gboolean show_user_tasks;
46gboolean show_root_tasks;
47gboolean show_other_tasks;
5ff47b84 48gboolean show_full_path;
0d40bfa3
HJYP
49
50gboolean show_cached_as_free; /* Show memory used Cache as free memory */
51
52gboolean full_view;
53
d726731c 54
4ab5f812
AG
55gint win_width;
56gint win_height;
57gint refresh_interval;
401eb707 58guint rID;
0d40bfa3 59
ac6cc864 60int PAGE_SIZE;
0d40bfa3 61
580e78c2
HJYP
62int main (int argc, char *argv[])
63{
64
65#ifdef ENABLE_NLS
66 bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
67 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
68 textdomain (GETTEXT_PACKAGE);
69#endif
70
b4cdfbff 71#if !GTK_CHECK_VERSION(3,0,0)
580e78c2 72 gtk_set_locale ();
b4cdfbff 73#endif
580e78c2
HJYP
74 gtk_init (&argc, &argv);
75
ac6cc864 76 PAGE_SIZE=sysconf(_SC_PAGESIZE)>>10;
580e78c2
HJYP
77 own_uid = getuid();
78
27ac4bfc 79 config_file = g_build_filename(g_get_user_config_dir(), "lxtask.conf", NULL);
580e78c2
HJYP
80 load_config();
81
82 task_array = g_array_new (FALSE, FALSE, sizeof (struct task));
83 tasks = 0;
84
85 main_window = create_main_window ();
86 gtk_widget_show (main_window);
87
88 if(!refresh_task_list())
89 return 0;
90
543caf1f 91 rID = g_timeout_add_seconds(refresh_interval, (gpointer) refresh_task_list, NULL);
580e78c2
HJYP
92
93 gtk_main ();
94
95 return 0;
96}
97