| 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: Maciej Stachowiak <mjs@eazel.com> |
|---|
| 21 | * J Shane Culpepper <pepper@eazel.com> |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | /* main.c - main function and object activation function for services |
|---|
| 25 | content view component. */ |
|---|
| 26 | |
|---|
| 27 | #include <config.h> |
|---|
| 28 | #include <gnome.h> |
|---|
| 29 | #include <liboaf/liboaf.h> |
|---|
| 30 | #include <bonobo.h> |
|---|
| 31 | #include "nautilus-summary-view.h" |
|---|
| 32 | #include <gconf/gconf.h> |
|---|
| 33 | #include <libtrilobite/libammonite.h> |
|---|
| 34 | #include <libtrilobite/trilobite-core-messaging.h> |
|---|
| 35 | |
|---|
| 36 | static int object_count =0; |
|---|
| 37 | |
|---|
| 38 | static void |
|---|
| 39 | summary_object_destroyed (GtkObject *obj) |
|---|
| 40 | { |
|---|
| 41 | object_count--; |
|---|
| 42 | if (object_count <= 0) { |
|---|
| 43 | gtk_main_quit (); |
|---|
| 44 | } |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | static BonoboObject* |
|---|
| 48 | summary_make_object (BonoboGenericFactory *factory, |
|---|
| 49 | const char *iid, |
|---|
| 50 | void *closure) |
|---|
| 51 | { |
|---|
| 52 | |
|---|
| 53 | NautilusSummaryView* view; |
|---|
| 54 | NautilusView* nautilus_view; |
|---|
| 55 | |
|---|
| 56 | if (strcmp (iid, "OAFIID:nautilus_summary_view:92811b0e-beb2-49db-858c-19a0dc8517e5")) { |
|---|
| 57 | return NULL; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | view = NAUTILUS_SUMMARY_VIEW (gtk_object_new (NAUTILUS_TYPE_SUMMARY_VIEW, NULL)); |
|---|
| 61 | |
|---|
| 62 | object_count++; |
|---|
| 63 | |
|---|
| 64 | nautilus_view = nautilus_summary_view_get_nautilus_view (view); |
|---|
| 65 | |
|---|
| 66 | gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", summary_object_destroyed, NULL); |
|---|
| 67 | |
|---|
| 68 | printf ("Returning new object %p\n", nautilus_view); |
|---|
| 69 | |
|---|
| 70 | return BONOBO_OBJECT (nautilus_view); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | int |
|---|
| 74 | main (int argc, char *argv[]) |
|---|
| 75 | { |
|---|
| 76 | |
|---|
| 77 | BonoboGenericFactory *factory; |
|---|
| 78 | CORBA_ORB orb; |
|---|
| 79 | char *registration_id; |
|---|
| 80 | |
|---|
| 81 | #ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */ |
|---|
| 82 | bindtextdomain (PACKAGE, GNOMELOCALEDIR); |
|---|
| 83 | textdomain (PACKAGE); |
|---|
| 84 | #endif |
|---|
| 85 | gnome_init_with_popt_table ("nautilus-summary-view", VERSION, |
|---|
| 86 | argc, argv, |
|---|
| 87 | oaf_popt_options, 0, NULL); |
|---|
| 88 | |
|---|
| 89 | gdk_rgb_init (); |
|---|
| 90 | orb = oaf_init (argc, argv); |
|---|
| 91 | |
|---|
| 92 | bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); |
|---|
| 93 | |
|---|
| 94 | gconf_init (argc, argv, NULL); |
|---|
| 95 | |
|---|
| 96 | ammonite_init (bonobo_poa()); |
|---|
| 97 | |
|---|
| 98 | trilobite_set_log_handler (NULL, G_LOG_DOMAIN); |
|---|
| 99 | |
|---|
| 100 | registration_id = oaf_make_registration_id ("OAFIID:nautilus_summary_view_factory:1b0b1018-e0ca-4f14-8d23-7a134486ab30", getenv ("DISPLAY")); |
|---|
| 101 | |
|---|
| 102 | factory = bonobo_generic_factory_new_multi (registration_id, |
|---|
| 103 | summary_make_object, |
|---|
| 104 | NULL); |
|---|
| 105 | |
|---|
| 106 | g_free (registration_id); |
|---|
| 107 | |
|---|
| 108 | do { |
|---|
| 109 | bonobo_main (); |
|---|
| 110 | } while (object_count > 0); |
|---|
| 111 | |
|---|
| 112 | return 0; |
|---|
| 113 | } |
|---|