Remove duplicated calls to update_working_area.
[lxde/pcmanfm.git] / src / pcmanfm.c
CommitLineData
b6e3c554
HJYP
1/*
2 * pcmanfm.c
3 *
f0ce8c37 4 * Copyright 2009 PCMan <pcman.tw@gmail.com>
b6e3c554
HJYP
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <config.h>
23#include <gtk/gtk.h>
24#include <stdio.h>
25
26#include <fm-gtk.h>
4d55886c 27#include "app-config.h"
b6e3c554 28#include "main-win.h"
8505a8ef
HJYP
29#include "desktop.h"
30
31static void on_manage_desktop_changed(FmConfig* cfg, gpointer user_data)
32{
33 if(FM_APP_CONFIG(fm_config)->manage_desktop)
34 fm_desktop_manager_init();
35 else
36 fm_desktop_manager_finalize();
37}
b6e3c554
HJYP
38
39int main(int argc, char** argv)
40{
41 GtkWidget* w;
4d55886c 42 FmConfig* config;
b6e3c554
HJYP
43 gtk_init(&argc, &argv);
44
4d55886c
HJYP
45 config = fm_app_config_new();
46 fm_gtk_init(config);
b6e3c554 47
8505a8ef
HJYP
48 g_signal_connect(fm_config, "changed::manage_desktop", G_CALLBACK(on_manage_desktop_changed), NULL);
49 if(FM_APP_CONFIG(fm_config)->manage_desktop)
50 fm_desktop_manager_init();
51
b6e3c554
HJYP
52 w = fm_main_win_new();
53 gtk_window_set_default_size(w, 640, 480);
54 gtk_widget_show(w);
55
56 if(argc > 1)
57 {
58 FmPath* path = fm_path_new(argv[1]);
59 fm_main_win_chdir(w, path);
60 fm_path_unref(path);
61 }
8505a8ef 62
b6e3c554
HJYP
63 gtk_main();
64
19fbd668
HJYP
65 fm_config_save(config, NULL); /* save libfm config */
66 fm_app_config_save((FmAppConfig*)config, NULL); /* save pcmanfm config */
67
8505a8ef
HJYP
68 if(FM_APP_CONFIG(fm_config)->manage_desktop)
69 fm_desktop_manager_finalize();
70
19fbd668 71 fm_gtk_finalize();
b6e3c554
HJYP
72
73 return 0;
74}