summaryrefslogtreecommitdiff
path: root/src/file-manager/gnome-desktop.c
blob: c8735b9d1581fc97e838512fc818cdd1a3f85c25 (plain)
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
87
/*  -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 * Desktop component of GNOME file manager
 * 
 * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation
 * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza)
 *
 * 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
 */

/* NOTE this is just a test program, the desktop will probably be in
   the file manager process, to share the icon cache and such */

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

#include <gnome.h>
#include <libgnorba/gnorba.h>
#include "desktop-window.h"
#include "desktop-canvas.h"

static gint
delete_event_cb(GtkWidget* window, GdkEventAny* event, gpointer data)
{
  gtk_main_quit();

  return TRUE;
}

int
main (int argc, char *argv[])
{
        GtkWidget *window;
        GtkWidget *canvas;
        CORBA_Environment ev;
        
#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
        bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
        textdomain (PACKAGE);
#endf

        CORBA_exception_init(&ev);
        
        gnome_CORBA_init ("gnome-desktop", VERSION, &argc, argv,
                          GNORBA_INIT_SERVER_FUNC, &ev);
        gnome_vfs_init();
        gdk_rgb_init();

        window = desktop_window_new();

        gtk_widget_push_visual(gdk_rgb_get_visual());
        gtk_widget_push_colormap(gdk_rgb_get_cmap());
        canvas = desktop_canvas_new();
        gtk_widget_pop_visual();
        gtk_widget_pop_colormap();

        gtk_container_add(GTK_CONTAINER(window), canvas);

        desktop_canvas_set_solid_background_color(DESKTOP_CANVAS(canvas), 0xFF0000);

        desktop_canvas_load_desktop_icons(DESKTOP_CANVAS (canvas),
                                          "file:/cvs/gnome-cvs/nautilus/");
        
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(delete_event_cb), NULL);
        
        gtk_widget_show_all(window);
        
        gtk_main ();
        
        return 0;
}