1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5
* Copyright (C) 1998, 1999, 2000 Alex Roberts, Evan Lawrence, Jason Leach, Jose Celorio
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
24
#include <glade/glade.h>
26
#include <libgnomevfs/gnome-vfs.h>
39
#include <libgnorba/gnorba.h>
42
#include <libgnomeui/gnome-window-icon.h>
44
static const struct poptOption options[] =
46
{ "debug-window", '\0', 0, &debug_window, 0,
47
N_("Show window debugging messages."), NULL },
49
{ "debug-commands", '\0', 0, &debug_commands, 0,
50
N_("Show commands debugging messages."), NULL },
52
{ "debug-document", '\0', 0, &debug_document, 0,
53
N_("Show document debugging messages."), NULL },
55
{ "debug-file", '\0', 0, &debug_file, 0,
56
N_("Show file debugging messages."), NULL },
58
{ "debug-plugins", '\0', 0, &debug_plugins, 0,
59
N_("Show plugin debugging messages."), NULL },
61
{ "debug-prefs", '\0', 0, &debug_prefs, 0,
62
N_("Show prefs debugging messages."), NULL },
64
{ "debug-print", '\0', 0, &debug_print, 0,
65
N_("Show printing debugging messages."), NULL },
67
{ "debug-search", '\0', 0, &debug_search, 0,
68
N_("Show search debugging messages."), NULL },
70
{ "debug-undo", '\0', 0, &debug_undo, 0,
71
N_("Show undo debugging messages."), NULL },
73
{ "debug-view", '\0', 0, &debug_view, 0,
74
N_("Show view debugging messages."), NULL },
76
{ "debug-recent", '\0', 0, &debug_recent, 0,
77
N_("Show recent debugging messages."), NULL },
79
{ "debug", '\0', 0, &debug, 0,
80
N_("Turn on all debugging messages."), NULL },
82
{NULL, '\0', 0, NULL, 0}
89
gint debug_search = 0;
92
gint debug_plugins = 0;
94
gint debug_document = 0;
95
gint debug_commands = 0;
96
gint debug_recent = 0;
97
gint debug_window = 0;
101
CORBA_ORB global_orb;
102
PortableServer_POA root_poa;
103
PortableServer_POAManager root_poa_manager;
104
CORBA_Environment *global_ev;
105
CORBA_Object name_service;
108
corba_exception (CORBA_Environment* ev)
112
case CORBA_SYSTEM_EXCEPTION:
113
g_log ("gedit CORBA", G_LOG_LEVEL_DEBUG,
114
"CORBA system exception %s.\n",
115
CORBA_exception_id (ev));
117
case CORBA_USER_EXCEPTION:
118
g_log ("gedit CORBA", G_LOG_LEVEL_DEBUG,
119
"CORBA user exception: %s.\n",
120
CORBA_exception_id (ev));
127
#endif /* HAVE_LIBGNORBA */
130
main (int argc, char **argv)
136
GList *file_list = NULL;
138
/* Initialize i18n */
139
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
142
#ifdef HAVE_LIBGNORBA
143
global_ev = g_new0 (CORBA_Environment, 1);
144
CORBA_exception_init (global_ev);
145
global_orb = gnome_CORBA_init ("gedit", VERSION, &argc, argv,
146
options, 0, &ctx, global_ev);
147
corba_exception (global_ev);
148
root_poa = CORBA_ORB_resolve_initial_references
149
(global_orb, "RootPOA", global_ev);
150
corba_exception (global_ev);
151
root_poa_manager = PortableServer_POA__get_the_POAManager
152
(root_poa, global_ev);
153
corba_exception (global_ev);
154
PortableServer_POAManager_activate (root_poa_manager, global_ev);
155
corba_exception (global_ev);
156
name_service = gnome_name_service_get ();
158
gnome_init_with_popt_table ("gedit", VERSION, argc, argv, options, 0, &ctx);
159
#endif /* HAVE_LIBGNORBA */
161
args = (char**) poptGetArgs(ctx);
163
if (!g_file_exists (GNOME_ICONDIR "/gedit-icon.png"))
164
g_warning ("Could not find %s", GNOME_ICONDIR "/gedit-icon.png");
165
gnome_window_icon_set_default_from_file (GNOME_ICONDIR "/gedit-icon.png");
167
for (i = 0; args && args[i]; i++)
168
file_list = g_list_append (file_list, args[i]);
170
poptFreeContext (ctx);
172
if (!gnome_vfs_init ()) {
173
g_error (_("Cannot initialize gnome-vfs."));
178
gedit_prefs_load_settings ();
179
gedit_plugins_init ();
181
gedit_close_all_flag_clear ();
183
gtk_init_add ((GtkFunction)gedit_document_load, (gpointer)file_list);