root/trunk/third/nautilus/components/rpmview/main.c @ 15547

Revision 15547, 2.8 KB (checked in by ghudson, 9 years ago)

This commit was generated by cvs2svn to compensate for changes in r15546,
which included commits to RCS files with non-trunk default branches.

Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2/*
3 * Copyright (C) 2000 Eazel, Inc
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (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 GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 *
20 * Author: Andy Hertzfeld
21 */
22
23/* main.c - main function and object activation function for the rpm view component. */
24
25#include <config.h>
26
27#include "nautilus-rpm-view.h"
28
29#include <gnome.h>
30#include <libgnomevfs/gnome-vfs.h>
31#include <liboaf/liboaf.h>
32#include <bonobo.h>
33
34static int object_count = 0;
35
36static void
37rpm_view_object_destroyed(GtkObject *obj)
38{
39        object_count--;
40        if (object_count <= 0) {
41                gtk_main_quit ();
42        }
43}
44
45static BonoboObject *
46rpm_view_make_object (BonoboGenericFactory *factory, 
47                    const char *goad_id, 
48                    void *closure)
49{
50        NautilusRPMView *rpm_view;
51        NautilusView *nautilus_view;
52
53        if (strcmp (goad_id, "OAFIID:nautilus_rpm_view:22ea002c-11e6-44fd-b13c-9445175a5e70")) {
54                return NULL;
55        }
56       
57        rpm_view = NAUTILUS_RPM_VIEW (gtk_object_new (NAUTILUS_TYPE_RPM_VIEW, NULL));
58
59        object_count++;
60
61        nautilus_view = nautilus_rpm_view_get_nautilus_view (rpm_view);
62
63        gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", rpm_view_object_destroyed, NULL);
64
65        return BONOBO_OBJECT (nautilus_view);
66}
67
68int main(int argc, char *argv[])
69{
70        BonoboGenericFactory *factory;
71        CORBA_ORB orb;
72        char *registration_id;
73       
74        /* Initialize gettext support */
75#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
76        bindtextdomain (PACKAGE, GNOMELOCALEDIR);
77        textdomain (PACKAGE);
78#endif
79       
80        gnome_init_with_popt_table("nautilus-rpm-view", VERSION, 
81                                   argc, argv,
82                                   oaf_popt_options, 0, NULL); 
83
84        orb = oaf_init (argc, argv);
85       
86        bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
87
88        /* initialize gnome-vfs, etc */
89        g_thread_init (NULL);
90        gnome_vfs_init ();
91       
92        registration_id = oaf_make_registration_id ("OAFIID:nautilus_rpm_view_factory:5986d6a5-8840-44ea-84a1-e7f052bd85cf", getenv ("DISPLAY"));
93        factory = bonobo_generic_factory_new_multi (registration_id, 
94                                                    rpm_view_make_object,
95                                                    NULL);
96        g_free (registration_id);
97
98       
99        do {
100                bonobo_main ();
101        } while (object_count > 0);
102       
103        gnome_vfs_shutdown ();
104
105        return 0;
106}
Note: See TracBrowser for help on using the browser.