1. Long filename bug fix.

2. corba-gmc is now the default "gmc" installed
3. corba-gmc now by default tries to activate a running instance
   instead of registering a server.

Miguel.
This commit is contained in:
Miguel de Icaza 1999-01-28 04:37:47 +00:00
parent 4c17f82857
commit 53c34b967d
7 changed files with 85 additions and 17 deletions

View File

@ -1,5 +1,6 @@
mx
gmc
plain-gmc
corba-gmc
Makefile
.depend
mc.metadata

View File

@ -1,3 +1,11 @@
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gcorba.c: Provide new code to activate an existing
FileManagerFactory factory.
installed gmc is now corba-gmc. plain-gmc is still available if
you want it.
Thu Jan 28 02:15:48 1999 Timur Bakeyev <mc@bat.ru>
* gdialogs.c: fixed "regexp.h" -> "eregexp.h" conversion.

View File

@ -116,6 +116,7 @@ CORBAOBJS = \
main-corba.o \
gcorba.o \
FileManager-skels.o \
FileManager-stubs.o \
FileManager-common.o
OBJS = \
@ -188,12 +189,18 @@ Makefile: Makefile.in ../config.status
(cd ..; CONFIG_FILES=gnome/Makefile CONFIG_HEADERS= ./config.status)
mx: checklinks
$(MAKE) gmc
$(MAKE) plain-gmc
$(MAKE) corba-gmc
touch mx
@echo ----------------------------------------------------------
@echo -
@echo - GMC no longer exists here. Use plain-gmc or corba-gmc
@echo - if you are debugging/working on this.
@echo -
@echo -----------------------------------------------------------
@touch mx
gmc: @LIBVFS@ $(OBJS) $(NORMALOBJS) @LIBSLANG@ libgtkedit.a
$(CC) -o gmc $(NORMALOBJS) $(OBJS) $(LDFLAGS) -L../vfs -L../slang -L../gtkedit $(EXTRALIBS) $(LIBS)
plain-gmc: @LIBVFS@ $(OBJS) $(NORMALOBJS) @LIBSLANG@ libgtkedit.a
$(CC) -o plain-gmc $(NORMALOBJS) $(OBJS) $(LDFLAGS) -L../vfs -L../slang -L../gtkedit $(EXTRALIBS) $(LIBS)
corba-gmc: @LIBVFS@ $(OBJS) $(CORBAOBJS) @LIBSLANG@ libgtkedit.a
$(CC) -o corba-gmc $(CORBAOBJS) $(OBJS) $(CORBA_LDFLAGS) -L../vfs -L../slang -L../gtkedit $(EXTRALIBS) $(LIBS)
@ -243,7 +250,7 @@ TAGS: $(GNOMESRCS)
etags $(GNOMESRCS)
clean:
$(RMF) gmc corba-gmc *.o core a.out mx @LIBVFS@ libgtkedit.a libmcslang.a
$(RMF) plain-gmc corba-gmc *.o core a.out mx @LIBVFS@ libgtkedit.a libmcslang.a
realclean: clean
$(RMF) .depend
@ -269,8 +276,8 @@ install_mx: all
$(mcsrcdir)/xmkdir $(DESTDIR)$(libdir)
$(mcsrcdir)/xmkdir $(DESTDIR)$(bindir)
$(mcsrcdir)/xmkdir $(gnewdir)
$(INSTALL_PROGRAM) gmc $(DESTDIR)$(bindir)/$(binprefix)gmc
$(INSTALL_PROGRAM) corba-gmc $(DESTDIR)$(bindir)/$(binprefix)corba-gmc
$(INSTALL_PROGRAM) plain-gmc $(DESTDIR)$(bindir)/$(binprefix)plain-gmc
$(INSTALL_PROGRAM) corba-gmc $(DESTDIR)$(bindir)/$(binprefix)gmc
for I in $(ICONS); \
do $(INSTALL_DATA) $(srcdir)/$$I $(DESTDIR)$(icondir)/$$I; done
$(INSTALL_DATA) $(srcdir)/layout $(DESTDIR)$(libdir)/layout

View File

@ -189,10 +189,46 @@ impl_GNOME_FileManagerFactory_create_object(impl_POA_GNOME_FileManagerFactory *
return CORBA_OBJECT_NIL;
}
void
corba_register_server (void)
int
try_to_activate_running_copy (void)
{
CORBA_Object name_service;
CORBA_Environment ev;
CosNaming_NameComponent nc[3] = {{"GNOME", "subcontext"},
{"Servers", "subcontext"},
{"gmc_filemanager_factory", "object"}};
CosNaming_Name nom = {0, 3, nc, CORBA_FALSE};
CORBA_Object retval = CORBA_OBJECT_NIL;
CORBA_exception_init (&ev);
name_service = gnome_name_service_get();
if (name_service == CORBA_OBJECT_NIL)
goto out;
retval = CosNaming_NamingContext_resolve (name_service, &nom, &ev);
if (ev._major == CORBA_USER_EXCEPTION
&& strcmp(CORBA_exception_id(&ev), ex_CosNaming_NamingContext_NotFound) == 0){
retval = CORBA_OBJECT_NIL;
goto out;
}
if (CORBA_Object_is_nil (retval, &ev))
goto out;
GNOME_FileManagerFactory_create_window (retval, home_dir, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
retval = CORBA_OBJECT_NIL;
out:
CORBA_exception_free (&ev);
CORBA_Object_release (name_service, &ev);
return retval != CORBA_OBJECT_NIL;
}
void
corba_init (void)
{
int v;
CORBA_Environment ev;
CORBA_exception_init (&ev);
@ -216,6 +252,15 @@ corba_register_server (void)
printf ("Can not get the POAmanager");
return;
}
}
void
corba_register_server (void)
{
CORBA_Environment ev;
int v;
CORBA_exception_init (&ev);
/*
* Initialize the Factory Object
@ -225,6 +270,7 @@ corba_register_server (void)
&ev);
if (ev._major != CORBA_NO_EXCEPTION){
CORBA_exception_free (&ev);
printf ("Can not initialize FileManagerFactory object\n");
return;
}
@ -241,6 +287,7 @@ corba_register_server (void)
NULL, filemanagerfactory_server,
"gmc_filemanager_factory", "server", &ev);
CORBA_exception_free (&ev);
if (v != 0)
return;

View File

@ -2,7 +2,7 @@
type=exe
repo_id=IDL:GNOME/FileManagerFactory:1.0 IDL:GNOME/GenericFactory:1.0
description=GNOME Midnight Commander
location_info=corba-gmc
location_info=gmc
[gmc_filemanager_window]
type=factory

View File

@ -2606,6 +2606,7 @@ static void parse_an_arg (poptContext state,
char *cmdline_geometry = NULL;
int nowindows = 0;
char **directory_list = NULL;
int force_activation = 0;
static struct poptOption argument_table [] = {
#ifdef HAVE_GNOME
@ -2662,6 +2663,7 @@ static struct poptOption argument_table [] = {
#ifdef HAVE_GNOME
{ "geometry", '\0', POPT_ARG_STRING, &cmdline_geometry, 0, N_("Geometry for the window"), N_("GEOMETRY")},
{"nowindows", '\0', POPT_ARG_NONE, &nowindows, 0, N_("No windows opened at startup"), NULL},
{"force-activation",0,POPT_ARG_NONE, &force_activation, 0, N_("Force activation even if a server is already running"), NULL},
#endif
{ NULL, 0, 0, NULL, 0 }
@ -2687,10 +2689,13 @@ handle_args (int argc, char *argv [])
CORBA_Environment ev;
CORBA_exception_init (&ev);
orb = gnome_CORBA_init_with_popt_table (
"gmc", VERSION, &argc, argv, argument_table, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev);
corba_init ();
if (!force_activation)
if (try_to_activate_running_copy ())
exit (1);
#else
gnome_init_with_popt_table ("gmc", VERSION, argc, argv, argument_table, 0, &ctx);
#endif

View File

@ -467,7 +467,7 @@ to_buffer (char *dest, int just_mode, int len, char *txt)
}
still = len - txtlen;
if (just_mode == J_LEFT){
strcpy (dest, txt);
strncpy (dest, txt, txtlen);
dest += txtlen;
while (still--)
*dest++ = ' ';
@ -475,7 +475,7 @@ to_buffer (char *dest, int just_mode, int len, char *txt)
} else {
while (still--)
*dest++ = ' ';
strcpy (dest, txt);
strncpy (dest, txt, len);
dest += txtlen;
}
return dest;