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>
27 #include <unistd.h>
28 
29 #ifdef ENABLE_NLS
30 #include <libintl.h>
31 #endif
32 
33 #include "types.h"
34 #include "interface.h"
35 #include "functions.h"
36 
37 GtkWidget *main_window;
38 
39 GArray *task_array;
40 gint tasks;
41 uid_t own_uid;
42 
43 gchar *config_file;
44 
45 gboolean show_user_tasks;
46 gboolean show_root_tasks;
47 gboolean show_other_tasks;
48 gboolean show_full_path;
49 
50 gboolean show_cached_as_free; /* Show memory used Cache as free memory */
51 
52 gboolean full_view;
53 
54 
55 gint win_width;
56 gint win_height;
57 gint refresh_interval;
58 guint rID;
59 
main(int argc,char * argv[])60 int main (int argc, char *argv[])
61 {
62 
63 #ifdef ENABLE_NLS
64     bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
65     bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
66     textdomain (GETTEXT_PACKAGE);
67 #endif
68 
69 #if !GTK_CHECK_VERSION(3,0,0)
70     gtk_set_locale ();
71 #endif
72     gtk_init (&argc, &argv);
73 
74     own_uid = getuid();
75 
76     config_file = g_build_filename(g_get_user_config_dir(), "lxtask.conf", NULL);
77     load_config();
78 
79     task_array = g_array_new (FALSE, FALSE, sizeof (struct task));
80     tasks = 0;
81 
82     main_window = create_main_window ();
83     gtk_widget_show (main_window);
84 
85     if(!refresh_task_list())
86         return 0;
87 
88     rID = g_timeout_add_seconds(refresh_interval, (gpointer) refresh_task_list, NULL);
89 
90     gtk_main ();
91 
92     return 0;
93 }
94 
95