mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
These are a bunch of changes to fix CORBA and session management. They
are almost complete (i.e. to handle all nitty gritty cases), but they seem to be working OK right now. SM should be much more stable now. Please tell me if you find any weird behavior - Federico 1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx> * gdesktop-icon.c (desktop_icon_realize): Remove the WM_CLIENT_LEADER property from icon windows so that window managers will not store SM information for them. * gnome-open-dialog.c: Added missing #includes. * gdesktop-init.c (desktop_init_at): Removed an unused variable. * gdesktop.h: Added some missing prototypes. * gmain.h: Added some missing prototypes. * Makefile.in: Added gsession.[ch] to the list of sources. * gmain.c (create_panels): Consider whether we have a CORBA server and session management. * gdesktop.c: #include "gdesktop-init.h" * gdesktop.c: Added a missing cast to GNOME_DIALOG. * gmain.c (create_panels): Removed the run_desktop global variable. * glayout.c (create_container): Set the wmclass of the panel to include its unique ID. * gsession.[ch]: New file with the functions that deal with session management. * glayout.c (gnome_exit): Use session_set_restart(). * gcorba.c (corba_init): Now returns an int with an error value. (corba_init_server): Initialize the server properly. Fixed all the object implementation code. (corba_create_window): New function used to create a window with the CORBA server. * gmain.c (gnome_check_super_user): Now the check for running as root is done here. There should be no GUI code in src/. 1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx> * dlg.c (dlg_run_done): Do not call the callback of a NULL current widget. * setup.h: Added missing prototype for setup_init(). * filegui.c (check_progress_buttons): Added a missing return value. * dlg.c (remove_widget): Added a missing return value. * main.c: Removed the global directory_list variable. Removed the main_corba_register_server() function. * main.h: Removed the global run_desktop variable. * panel.h: Now the panel structure has a unique numerical ID used for session management. * screen.c (panel_new): Maintain a unique ID for each panel. * main.c (maybe_display_linksdir): Handle display of the desktop init dir here. (main): Call gnome_check_super_user(). (init_corba_with_args): Call corba_init_server(). * main.c (init_corba_with_args): Do CORBA initialization here. Also removed the global force_activation option. 1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx> * vfs.c (vfs_add_current_stamps): Only do stamping of the panels if they exist. * mcserv.c: #include <sys/wait.h> (get_client): Put `#ifdef __EMX__' around an otherwise-unused variable. * utilvfs.c (vfs_split_url): Fix NULL <-> 0 confusion when comparing characters. * ftpfs.c (retrieve_dir): Removed unused variable dot_dot_found. * extfs.c (extfs_init): Assign `key' to c, not `&key'.
This commit is contained in:
parent
05e0754f46
commit
b3bb157ad5
@ -1,3 +1,45 @@
|
||||
1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdesktop-icon.c (desktop_icon_realize): Remove the
|
||||
WM_CLIENT_LEADER property from icon windows so that window
|
||||
managers will not store SM information for them.
|
||||
|
||||
* gnome-open-dialog.c: Added missing #includes.
|
||||
|
||||
* gdesktop-init.c (desktop_init_at): Removed an unused variable.
|
||||
|
||||
* gdesktop.h: Added some missing prototypes.
|
||||
|
||||
* gmain.h: Added some missing prototypes.
|
||||
|
||||
* Makefile.in: Added gsession.[ch] to the list of sources.
|
||||
|
||||
* gmain.c (create_panels): Consider whether we have a CORBA server
|
||||
and session management.
|
||||
|
||||
* gdesktop.c: #include "gdesktop-init.h"
|
||||
* gdesktop.c: Added a missing cast to GNOME_DIALOG.
|
||||
|
||||
* gmain.c (create_panels): Removed the run_desktop global
|
||||
variable.
|
||||
|
||||
* glayout.c (create_container): Set the wmclass of the panel to
|
||||
include its unique ID.
|
||||
|
||||
* gsession.[ch]: New file with the functions that deal with
|
||||
session management.
|
||||
|
||||
* glayout.c (gnome_exit): Use session_set_restart().
|
||||
|
||||
* gcorba.c (corba_init): Now returns an int with an error value.
|
||||
(corba_init_server): Initialize the server properly.
|
||||
Fixed all the object implementation code.
|
||||
(corba_create_window): New function used to create a window with
|
||||
the CORBA server.
|
||||
|
||||
* gmain.c (gnome_check_super_user): Now the check for running as
|
||||
root is done here. There should be no GUI code in src/.
|
||||
|
||||
1999-03-29 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gdesktop.c (create_desktop_dir): improved wording.
|
||||
|
@ -57,6 +57,7 @@ GNOMESRCS = \
|
||||
gnome-file-property-dialog.c \
|
||||
gnome-open-dialog.c \
|
||||
gscreen.c \
|
||||
gsession.c \
|
||||
gtools.c \
|
||||
gtkdtree.c \
|
||||
gtree.c \
|
||||
@ -88,6 +89,7 @@ GNOMEHDRS = \
|
||||
gnome-file-property-dialog.h \
|
||||
gnome-open-dialog.h \
|
||||
gscreen.h \
|
||||
gsession.h \
|
||||
gtkdtree.h \
|
||||
gtree.h \
|
||||
gwidget.h
|
||||
@ -164,6 +166,7 @@ OBJS = \
|
||||
gnome-file-property-dialog.o \
|
||||
gnome-open-dialog.o \
|
||||
gscreen.o \
|
||||
gsession.o \
|
||||
gtools.o \
|
||||
gtree.o \
|
||||
gutil.o \
|
||||
|
430
gnome/gcorba.c
430
gnome/gcorba.c
@ -1,36 +1,37 @@
|
||||
/*
|
||||
* gcorba.c: CORBA support code for the GNOME Midnight Commander
|
||||
/* CORBA support for the Midhignt Commander
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza (miguel@gnu.org)
|
||||
* Elliot Lee (sopwith@cuc.edu)
|
||||
* Copyright (C) 1999 The Free Sofware Foundation
|
||||
*
|
||||
* Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
* Federico Mena <federico@nuclecu.unam.mx>
|
||||
* Elliot Lee <sopwith@cuc.edu>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <libgnorba/gnorba.h>
|
||||
#include <libgnorba/gnome-factory.h>
|
||||
#include "FileManager.h"
|
||||
#include <config.h>
|
||||
#include "x.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include "dir.h"
|
||||
#include "global.h"
|
||||
#include "panel.h"
|
||||
#include "gscreen.h"
|
||||
#include "main.h"
|
||||
#include "gmain.h"
|
||||
#include <libgnorba/gnorba.h>
|
||||
#include "FileManager.h"
|
||||
#include "gcmd.h"
|
||||
#include "gcorba.h"
|
||||
#include "global.h"
|
||||
#include "gmain.h"
|
||||
|
||||
PortableServer_POA poa;
|
||||
PortableServer_POAManager poa_manager;
|
||||
CORBA_ORB orb;
|
||||
/*** Global variables ***/
|
||||
|
||||
CORBA_ORB orb = CORBA_OBJECT_NIL;
|
||||
|
||||
/*** Local variables ***/
|
||||
|
||||
/* Reference to the server object */
|
||||
static CORBA_Object gmc_server;
|
||||
|
||||
/*** App-specific servant structures ***/
|
||||
|
||||
typedef struct {
|
||||
POA_GNOME_FileManagerWindow servant;
|
||||
PortableServer_POA poa;
|
||||
|
||||
WPanel *mywin;
|
||||
WPanel *panel;
|
||||
} impl_POA_GNOME_FileManagerWindow;
|
||||
|
||||
typedef struct {
|
||||
@ -40,44 +41,53 @@ typedef struct {
|
||||
|
||||
/*** Implementation stub prototypes ***/
|
||||
|
||||
static void
|
||||
impl_GNOME_FileManagerWindow_close (impl_POA_GNOME_FileManagerWindow * servant,
|
||||
static void impl_GNOME_FileManagerWindow__destroy (impl_POA_GNOME_FileManagerWindow *servant,
|
||||
CORBA_Environment *ev);
|
||||
static void impl_GNOME_FileManagerWindow_close (impl_POA_GNOME_FileManagerWindow *servant,
|
||||
CORBA_Environment *ev);
|
||||
|
||||
GNOME_FileManagerWindow
|
||||
impl_GNOME_FileManagerFactory_create_window (impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * dir,
|
||||
static void impl_GNOME_FileManagerFactory__destroy (impl_POA_GNOME_FileManagerFactory *servant,
|
||||
CORBA_Environment *ev);
|
||||
|
||||
CORBA_boolean
|
||||
impl_GNOME_FileManagerFactory_supports (impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * obj_goad_id,
|
||||
static CORBA_boolean impl_GNOME_FileManagerFactory_supports (
|
||||
impl_POA_GNOME_FileManagerFactory *servant,
|
||||
const CORBA_char *obj_goad_id,
|
||||
CORBA_Environment *ev);
|
||||
CORBA_Object
|
||||
impl_GNOME_FileManagerFactory_create_object (impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * goad_id,
|
||||
GNOME_stringlist * params,
|
||||
|
||||
static CORBA_Object impl_GNOME_FileManagerFactory_create_object (
|
||||
impl_POA_GNOME_FileManagerFactory *servant,
|
||||
const CORBA_char *goad_id,
|
||||
const GNOME_stringlist *params,
|
||||
CORBA_Environment *ev);
|
||||
|
||||
static GNOME_FileManagerWindow impl_GNOME_FileManagerFactory_create_window (
|
||||
impl_POA_GNOME_FileManagerFactory * servant,
|
||||
const CORBA_char * dir,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
/*** epv structures ***/
|
||||
|
||||
static PortableServer_ServantBase__epv impl_GNOME_FileManagerWindow_base_epv =
|
||||
{
|
||||
NULL, NULL, NULL
|
||||
NULL, /* _private data */
|
||||
NULL, /* finalize routine */
|
||||
NULL, /* default_POA routine */
|
||||
};
|
||||
|
||||
static POA_GNOME_FileManagerWindow__epv impl_GNOME_FileManagerWindow_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) &impl_GNOME_FileManagerWindow_close,
|
||||
|
||||
};
|
||||
|
||||
static PortableServer_ServantBase__epv impl_GNOME_FileManagerFactory_base_epv =
|
||||
{
|
||||
NULL, /* _private data */
|
||||
NULL,
|
||||
NULL /* default_POA routine */
|
||||
NULL, /* finalize routine */
|
||||
NULL, /* default_POA routine */
|
||||
};
|
||||
|
||||
static POA_GNOME_FileManagerFactory__epv impl_GNOME_FileManagerFactory_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
@ -88,7 +98,7 @@ static POA_GNOME_GenericFactory__epv impl_GNOME_FileManagerFactory_GNOME_Generic
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) &impl_GNOME_FileManagerFactory_supports,
|
||||
(gpointer) & impl_GNOME_FileManagerFactory_create_object,
|
||||
(gpointer) &impl_GNOME_FileManagerFactory_create_object
|
||||
};
|
||||
|
||||
/*** vepv structures ***/
|
||||
@ -96,56 +106,21 @@ static POA_GNOME_GenericFactory__epv impl_GNOME_FileManagerFactory_GNOME_Generic
|
||||
static POA_GNOME_FileManagerWindow__vepv impl_GNOME_FileManagerWindow_vepv =
|
||||
{
|
||||
&impl_GNOME_FileManagerWindow_base_epv,
|
||||
&impl_GNOME_FileManagerWindow_epv,
|
||||
&impl_GNOME_FileManagerWindow_epv
|
||||
};
|
||||
|
||||
static POA_GNOME_FileManagerFactory__vepv impl_GNOME_FileManagerFactory_vepv =
|
||||
{
|
||||
&impl_GNOME_FileManagerFactory_base_epv,
|
||||
&impl_GNOME_FileManagerFactory_GNOME_GenericFactory_epv,
|
||||
&impl_GNOME_FileManagerFactory_epv,
|
||||
&impl_GNOME_FileManagerFactory_epv
|
||||
};
|
||||
|
||||
impl_POA_GNOME_FileManagerFactory poa_filemanagerfactory_servant =
|
||||
{
|
||||
{ NULL, &impl_GNOME_FileManagerFactory_vepv}, NULL
|
||||
};
|
||||
|
||||
GNOME_FileManagerFactory filemanagerfactory_server;
|
||||
|
||||
/*** Stub implementations ***/
|
||||
|
||||
static void
|
||||
do_window_close(GtkWidget *widget, gpointer _servant)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
PortableServer_ObjectId *objid;
|
||||
impl_POA_GNOME_FileManagerWindow *servant = _servant;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
objid = PortableServer_POA_servant_to_id (servant->poa, _servant, &ev);
|
||||
PortableServer_POA_deactivate_object (servant->poa, objid, &ev);
|
||||
#if 1
|
||||
#warning Remove this ifdef when the new ORBit is released.
|
||||
g_warning ("Developer Warning: when a new ORBIt is released, remove this code\n");
|
||||
#else
|
||||
CORBA_free (objid);
|
||||
#endif
|
||||
POA_GNOME_FileManagerWindow__fini(_servant, &ev);
|
||||
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_GNOME_FileManagerWindow_close (impl_POA_GNOME_FileManagerWindow * servant, CORBA_Environment * ev)
|
||||
{
|
||||
gnome_close_panel (GTK_WIDGET (servant->mywin->widget.wdata), servant->mywin);
|
||||
}
|
||||
|
||||
GNOME_FileManagerWindow
|
||||
impl_GNOME_FileManagerFactory_create_window (impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * dir,
|
||||
static GNOME_FileManagerWindow
|
||||
impl_GNOME_FileManagerWindow__create(PortableServer_POA poa,
|
||||
impl_POA_GNOME_FileManagerWindow **servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GNOME_FileManagerWindow retval;
|
||||
@ -155,146 +130,245 @@ impl_GNOME_FileManagerFactory_create_window (impl_POA_GNOME_FileManagerFactory *
|
||||
newservant = g_new0 (impl_POA_GNOME_FileManagerWindow, 1);
|
||||
newservant->servant.vepv = &impl_GNOME_FileManagerWindow_vepv;
|
||||
newservant->poa = poa;
|
||||
newservant->mywin = new_panel_at ((dir && *dir) ? dir : home_dir);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(newservant->mywin->xwindow),
|
||||
"destroy", do_window_close,
|
||||
newservant);
|
||||
|
||||
POA_GNOME_FileManagerWindow__init ((PortableServer_Servant) newservant, ev);
|
||||
objid = PortableServer_POA_activate_object (poa, newservant, ev);
|
||||
CORBA_free (objid);
|
||||
retval = PortableServer_POA_servant_to_reference (poa, newservant, ev);
|
||||
|
||||
if (servant)
|
||||
*servant = newservant;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
CORBA_boolean
|
||||
impl_GNOME_FileManagerFactory_supports (impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * obj_goad_id,
|
||||
/* You shouldn't call this routine directly without first deactivating the servant... */
|
||||
static void
|
||||
impl_GNOME_FileManagerWindow__destroy(impl_POA_GNOME_FileManagerWindow *servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
return !strcmp(obj_goad_id, "gmc_filemanager_window");
|
||||
PortableServer_ObjectId *objid;
|
||||
|
||||
objid = PortableServer_POA_servant_to_id (servant->poa, servant, ev);
|
||||
PortableServer_POA_deactivate_object (servant->poa, objid, ev);
|
||||
CORBA_free (objid);
|
||||
|
||||
POA_GNOME_FileManagerWindow__fini ((PortableServer_Servant) servant, ev);
|
||||
g_free(servant);
|
||||
}
|
||||
|
||||
CORBA_Object
|
||||
impl_GNOME_FileManagerFactory_create_object(impl_POA_GNOME_FileManagerFactory * servant,
|
||||
CORBA_char * goad_id,
|
||||
GNOME_stringlist * params,
|
||||
static void
|
||||
impl_GNOME_FileManagerWindow_close(impl_POA_GNOME_FileManagerWindow *servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
if(!strcmp(goad_id, "gmc_filemanager_window"))
|
||||
return impl_GNOME_FileManagerFactory_create_window(
|
||||
servant,
|
||||
params->_length ? params->_buffer [0] : home_dir, ev);
|
||||
gnome_close_panel (GTK_WIDGET (servant->panel->xwindow), servant->panel);
|
||||
}
|
||||
|
||||
static GNOME_FileManagerFactory
|
||||
impl_GNOME_FileManagerFactory__create(PortableServer_POA poa,
|
||||
impl_POA_GNOME_FileManagerFactory **servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GNOME_FileManagerFactory retval;
|
||||
impl_POA_GNOME_FileManagerFactory *newservant;
|
||||
PortableServer_ObjectId *objid;
|
||||
|
||||
newservant = g_new0 (impl_POA_GNOME_FileManagerFactory, 1);
|
||||
newservant->servant.vepv = &impl_GNOME_FileManagerFactory_vepv;
|
||||
newservant->poa = poa;
|
||||
POA_GNOME_FileManagerFactory__init ((PortableServer_Servant) newservant, ev);
|
||||
objid = PortableServer_POA_activate_object (poa, newservant, ev);
|
||||
CORBA_free (objid);
|
||||
retval = PortableServer_POA_servant_to_reference (poa, newservant, ev);
|
||||
|
||||
if (servant)
|
||||
*servant = newservant;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* You shouldn't call this routine directly without first deactivating the servant... */
|
||||
static void
|
||||
impl_GNOME_FileManagerFactory__destroy(impl_POA_GNOME_FileManagerFactory *servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
|
||||
objid = PortableServer_POA_servant_to_id (servant->poa, servant, ev);
|
||||
PortableServer_POA_deactivate_object (servant->poa, objid, ev);
|
||||
CORBA_free (objid);
|
||||
|
||||
POA_GNOME_FileManagerFactory__fini ((PortableServer_Servant) servant, ev);
|
||||
g_free (servant);
|
||||
}
|
||||
|
||||
static CORBA_boolean
|
||||
impl_GNOME_FileManagerFactory_supports (impl_POA_GNOME_FileManagerFactory *servant,
|
||||
const CORBA_char *obj_goad_id,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
if (strcmp (obj_goad_id, "gmc_filemanager_window") == 0)
|
||||
return CORBA_TRUE;
|
||||
else
|
||||
return CORBA_FALSE;
|
||||
}
|
||||
|
||||
static CORBA_Object
|
||||
impl_GNOME_FileManagerFactory_create_object (impl_POA_GNOME_FileManagerFactory *servant,
|
||||
const CORBA_char *goad_id,
|
||||
const GNOME_stringlist *params,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
if (strcmp (goad_id, "gmc_filemanager_window") != 0) {
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_GNOME_GenericFactory_CannotActivate,
|
||||
NULL);
|
||||
|
||||
return CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
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;
|
||||
return impl_GNOME_FileManagerFactory_create_window (
|
||||
servant,
|
||||
params->_length ? params->_buffer[0] : home_dir,
|
||||
ev);
|
||||
}
|
||||
|
||||
if (CORBA_Object_is_nil (retval, &ev))
|
||||
goto out;
|
||||
/* Callback used when a panel is destroyed */
|
||||
static void
|
||||
panel_destroyed (GtkObject *object, gpointer data)
|
||||
{
|
||||
impl_POA_GNOME_FileManagerWindow *servant;
|
||||
CORBA_Environment ev;
|
||||
|
||||
GNOME_FileManagerFactory_create_window (retval, home_dir, &ev);
|
||||
servant = data;
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
retval = CORBA_OBJECT_NIL;
|
||||
out:
|
||||
CORBA_exception_init (&ev);
|
||||
impl_GNOME_FileManagerWindow__destroy (servant, &ev);
|
||||
CORBA_exception_free (&ev);
|
||||
CORBA_Object_release (name_service, &ev);
|
||||
return retval != CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
void
|
||||
corba_init (void)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
orb = gnome_CORBA_ORB ();
|
||||
|
||||
poa = (PortableServer_POA) CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION){
|
||||
printf ("Can not resolve initial reference to RootPOA");
|
||||
return;
|
||||
}
|
||||
|
||||
poa_manager = PortableServer_POA__get_the_POAManager (poa, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION){
|
||||
printf ("Can not get the POAmanager");
|
||||
return;
|
||||
}
|
||||
|
||||
PortableServer_POAManager_activate (poa_manager, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION){
|
||||
printf ("Can not get the POAmanager");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
corba_register_server (void)
|
||||
static GNOME_FileManagerWindow
|
||||
impl_GNOME_FileManagerFactory_create_window(impl_POA_GNOME_FileManagerFactory *servant,
|
||||
const CORBA_char *dir,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GNOME_FileManagerWindow retval;
|
||||
impl_POA_GNOME_FileManagerWindow *newservant;
|
||||
WPanel *panel;
|
||||
|
||||
retval = impl_GNOME_FileManagerWindow__create (servant->poa,
|
||||
&newservant,
|
||||
ev);
|
||||
|
||||
panel = new_panel_at ((dir && *dir) ? dir : home_dir);
|
||||
newservant->panel = panel;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (panel->xwindow), "destroy",
|
||||
(GtkSignalFunc) panel_destroyed,
|
||||
newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*** Public non-implementation functions ***/
|
||||
|
||||
/* Creates the CORBA server */
|
||||
static int
|
||||
create_server (void)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
PortableServer_POA poa;
|
||||
PortableServer_POAManager poa_manager;
|
||||
int retval;
|
||||
int v;
|
||||
|
||||
retval = FALSE;
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
/*
|
||||
* Initialize the Factory Object
|
||||
*/
|
||||
POA_GNOME_FileManagerFactory__init (
|
||||
(POA_GNOME_FileManagerFactory*)&poa_filemanagerfactory_servant,
|
||||
&ev);
|
||||
/* Get the POA and create the server */
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION){
|
||||
CORBA_exception_free (&ev);
|
||||
printf ("Can not initialize FileManagerFactory object\n");
|
||||
return;
|
||||
}
|
||||
poa = (PortableServer_POA) CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
/* Activate the object */
|
||||
CORBA_free (PortableServer_POA_activate_object
|
||||
(poa, &poa_filemanagerfactory_servant, &ev));
|
||||
poa_manager = PortableServer_POA__get_the_POAManager (poa, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
/* Get a refeerence to te object */
|
||||
filemanagerfactory_server = PortableServer_POA_servant_to_reference (
|
||||
poa, &poa_filemanagerfactory_servant, &ev);
|
||||
PortableServer_POAManager_activate (poa_manager, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
v = goad_server_register (
|
||||
NULL, filemanagerfactory_server,
|
||||
gmc_server = impl_GNOME_FileManagerFactory__create (poa, NULL, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
CORBA_Object_release ((CORBA_Object) poa, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
/* Register the server and see if it was already there */
|
||||
|
||||
v = goad_server_register (CORBA_OBJECT_NIL, gmc_server,
|
||||
"gmc_filemanager_factory", "server", &ev);
|
||||
switch (v) {
|
||||
case 0:
|
||||
corba_have_server = FALSE;
|
||||
break;
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
if (v != 0)
|
||||
return;
|
||||
case -2:
|
||||
corba_have_server = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
goto out;
|
||||
}
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
/* Done */
|
||||
|
||||
out:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* corba_init_server:
|
||||
* @void:
|
||||
*
|
||||
* Initializes the CORBA factory object for gmc. Returns whether initialization
|
||||
* was successful or not, and sets the global corba_have_server variable.
|
||||
*
|
||||
* Return value: TRUE if successful, FALSE otherwise.
|
||||
**/
|
||||
int
|
||||
corba_init_server (void)
|
||||
{
|
||||
gmc_server = goad_server_activate_with_id (NULL,
|
||||
"gmc_filemanager_factory",
|
||||
GOAD_ACTIVATE_EXISTING_ONLY,
|
||||
NULL);
|
||||
|
||||
if (gmc_server != CORBA_OBJECT_NIL) {
|
||||
corba_have_server = TRUE;
|
||||
return TRUE;
|
||||
} else
|
||||
return create_server ();
|
||||
}
|
||||
|
||||
/**
|
||||
* corba_create_window:
|
||||
* @void:
|
||||
*
|
||||
* Creates a GMC window using a CORBA call to the server.
|
||||
**/
|
||||
void
|
||||
corba_create_window (void)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
char cwd[MC_MAXPATHLEN];
|
||||
|
||||
mc_get_current_wd (cwd, MC_MAXPATHLEN);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
GNOME_FileManagerFactory_create_window (gmc_server, cwd, &ev);
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
@ -1,8 +1,24 @@
|
||||
/* CORBA support for the Midhignt Commander
|
||||
*
|
||||
* Copyright (C) 1999 The Free Sofware Foundation
|
||||
*
|
||||
* Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
* Federico Mena <federico@nuclecu.unam.mx>
|
||||
* Elliot Lee <sopwith@cuc.edu>
|
||||
*/
|
||||
|
||||
#ifndef __GCORBA_H
|
||||
#define __GCORBA_H
|
||||
|
||||
#include <orb/orbit.h>
|
||||
|
||||
|
||||
/* The ORB */
|
||||
extern CORBA_ORB orb;
|
||||
|
||||
void corba_register_server (void);
|
||||
|
||||
int corba_init_server (void);
|
||||
void corba_create_window (void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -158,6 +158,14 @@ desktop_icon_realize (GtkWidget *widget)
|
||||
gdk_window_set_decorations (widget->window, 0);
|
||||
gdk_window_set_functions (widget->window, 0);
|
||||
|
||||
/* Remove the client leader property so that the window manager will not
|
||||
* save SM information for icons.
|
||||
*/
|
||||
|
||||
gdk_property_delete (widget->window, gdk_atom_intern ("WM_CLIENT_LEADER", FALSE));
|
||||
|
||||
/* Set the proper GNOME hints */
|
||||
|
||||
gnome_win_hints_init ();
|
||||
|
||||
if (gnome_win_hints_wm_exists ()) {
|
||||
|
@ -82,7 +82,6 @@ desktop_init_at (const char *dir)
|
||||
DIR *d;
|
||||
struct dirent *dent;
|
||||
const int links_extlen = sizeof (".links")-1;
|
||||
struct stat s;
|
||||
|
||||
d = opendir (dir);
|
||||
if (!d)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "gconf.h"
|
||||
#include "gdesktop.h"
|
||||
#include "gdesktop-icon.h"
|
||||
#include "gdesktop-init.h"
|
||||
#include "gicon.h"
|
||||
#include "gmain.h"
|
||||
#include "gmetadata.h"
|
||||
@ -1364,6 +1365,7 @@ create_panel_from_desktop (void)
|
||||
panel->total = total;
|
||||
panel->selected = selected_index;
|
||||
panel->is_a_desktop_panel = TRUE;
|
||||
panel->id = -1;
|
||||
|
||||
return panel;
|
||||
}
|
||||
@ -2399,19 +2401,22 @@ set_background_image (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gchar *bg_capplet;
|
||||
gchar *argv[1];
|
||||
GtkWidget *msg_box;
|
||||
|
||||
bg_capplet = gnome_is_program_in_path ("background-properties-capplet");
|
||||
|
||||
if (bg_capplet) {
|
||||
argv[0] = bg_capplet;
|
||||
gnome_execute_async (bg_capplet, 1, argv);
|
||||
g_free (bg_capplet);
|
||||
} else {
|
||||
GtkWidget *msg_box;
|
||||
msg_box = gnome_message_box_new (_("Unable to locate the file:\nbackground-properties-capplet\n"
|
||||
msg_box = gnome_message_box_new (
|
||||
_("Unable to locate the file:\nbackground-properties-capplet\n"
|
||||
"in your path.\n\nWe are unable to set the background."),
|
||||
GNOME_MESSAGE_BOX_WARNING,
|
||||
GNOME_STOCK_BUTTON_OK,
|
||||
NULL);
|
||||
gnome_dialog_run (msg_box);
|
||||
gnome_dialog_run (GNOME_DIALOG (msg_box));
|
||||
}
|
||||
}
|
||||
static GnomeUIInfo gnome_panel_new_menu [] = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Desktop management for the Midnight Commander
|
||||
*
|
||||
* Copyright (C) 1998 The Free Software Foundation
|
||||
* Copyright (C) 1998-1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Federico Mena <federico@nuclecu.unam.mx>
|
||||
* Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
@ -66,6 +66,8 @@ gboolean do_eject (char *filename);
|
||||
void desktop_arrange_icons (void);
|
||||
void desktop_rescan_devices (void);
|
||||
void desktop_reload_icons (int user_pos, int xpos, int ypos);
|
||||
void desktop_create_url (const char *filename, const char *title, const char *url, const char *icon);
|
||||
|
||||
extern int desktop_wm_is_gnome_compliant;
|
||||
|
||||
#endif
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "gscreen.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include "gdesktop.h"
|
||||
#include "gdnd.h"
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "setup.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include "gprefs.h"
|
||||
#include "gsession.h"
|
||||
#include "listing-iconic.xpm"
|
||||
#include "listing-brief-list.xpm"
|
||||
#include "listing-list.xpm"
|
||||
@ -337,7 +338,7 @@ gnome_exit (void)
|
||||
/*
|
||||
* We do not want to be restarted by the session manager now
|
||||
*/
|
||||
gnome_client_set_restart_style (session_client, GNOME_RESTART_NEVER);
|
||||
session_set_restart (FALSE);
|
||||
gmc_do_quit ();
|
||||
}
|
||||
}
|
||||
@ -705,17 +706,19 @@ copy_uiinfo_widgets (GnomeUIInfo *uiinfo, gpointer **dest)
|
||||
WPanel *
|
||||
create_container (Dlg_head *h, char *name, char *geometry)
|
||||
{
|
||||
PanelContainer *container = g_new (PanelContainer, 1);
|
||||
PanelContainer *container;
|
||||
WPanel *panel;
|
||||
GtkWidget *app, *vbox;
|
||||
int xpos, ypos, width, height;
|
||||
GnomeUIInfo *uiinfo;
|
||||
char buf[50];
|
||||
|
||||
container = g_new (PanelContainer, 1);
|
||||
|
||||
gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height);
|
||||
|
||||
container->splitted = 0;
|
||||
app = gnome_app_new ("gmc", name);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (app), "gmc", "gmc");
|
||||
|
||||
/* Geometry configuration */
|
||||
if (width != -1 && height != -1)
|
||||
@ -727,6 +730,12 @@ create_container (Dlg_head *h, char *name, char *geometry)
|
||||
|
||||
panel = panel_new (name);
|
||||
|
||||
/* Set the unique name for session management */
|
||||
|
||||
sprintf (buf, "%d", panel->id);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (app), "gmc", buf);
|
||||
|
||||
/* Create the holder for the contents */
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
|
||||
@ -787,7 +796,9 @@ new_panel_with_geometry_at (char *dir, char *geometry)
|
||||
panel = create_container (desktop_dlg, dir, geometry);
|
||||
add_widget (desktop_dlg, panel);
|
||||
set_current_panel (panel);
|
||||
#if 0
|
||||
x_flush_events ();
|
||||
#endif
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
154
gnome/gmain.c
154
gnome/gmain.c
@ -21,9 +21,11 @@
|
||||
#include "panel.h"
|
||||
#include "gscreen.h"
|
||||
#include "gcmd.h"
|
||||
#include "gcorba.h"
|
||||
#include "gdesktop.h"
|
||||
#include "gsession.h"
|
||||
#include "command.h"
|
||||
#include "cmd.h"
|
||||
#include "gdesktop.h"
|
||||
|
||||
GdkColorContext *mc_cc;
|
||||
|
||||
@ -52,14 +54,15 @@ int dialog_panel_callback (struct Dlg_head *h, int id, int msg);
|
||||
/* The Dlg_head for the whole desktop */
|
||||
Dlg_head *desktop_dlg;
|
||||
|
||||
int run_desktop = 1;
|
||||
|
||||
/* Session client */
|
||||
GnomeClient *session_client;
|
||||
|
||||
/* Used during argument processing */
|
||||
extern int finish_program;
|
||||
|
||||
/* Whether the gmc server was present or not */
|
||||
int corba_have_server = FALSE;
|
||||
|
||||
/* This is only used by the editor, so we provide a dummy implementation */
|
||||
void
|
||||
try_alloc_color_pair (char *str, char *str2)
|
||||
@ -453,52 +456,48 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern char *cmdline_geometry;
|
||||
|
||||
typedef struct {
|
||||
char *dir; char *geometry;
|
||||
} dir_and_geometry;
|
||||
|
||||
static int
|
||||
idle_create_panel (void *data)
|
||||
/* Ugly function to support the hack described in non_corba_create_panels() */
|
||||
static gint
|
||||
idle_destroy_panel (gpointer data)
|
||||
{
|
||||
dir_and_geometry *dg = data;
|
||||
|
||||
new_panel_with_geometry_at (dg->dir, dg->geometry);
|
||||
g_free (data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
idle_destroy_window (void *data)
|
||||
{
|
||||
WPanel *panel = data;
|
||||
WPanel *panel;
|
||||
|
||||
panel = data;
|
||||
gnome_close_panel (GTK_WIDGET (panel->widget.wdata), panel);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* wrapper for new_panel_with_geometry_at.
|
||||
* first invocation is called directly, further calls use
|
||||
* the idle handler
|
||||
/* Initializes the desktop and creates the initial panels. This is to be used
|
||||
* when we do not have a CORBA server.
|
||||
*/
|
||||
static WPanel *
|
||||
create_one_panel (char *dir, char *geometry)
|
||||
static void
|
||||
non_corba_create_panels (void)
|
||||
{
|
||||
static int first = 1;
|
||||
WPanel *panel;
|
||||
|
||||
if (first){
|
||||
first = 0;
|
||||
return new_panel_with_geometry_at (dir, geometry);
|
||||
} else {
|
||||
dir_and_geometry *dg = g_new (dir_and_geometry, 1);
|
||||
dg->dir = dir;
|
||||
dg->geometry = geometry;
|
||||
gtk_idle_add (idle_create_panel, dg);
|
||||
return NULL;
|
||||
}
|
||||
desktop_init ();
|
||||
gnome_init_panels ();
|
||||
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_hint = label_new (0, 0, 0, NULL);
|
||||
desktop_dlg = create_dlg (0, 0, 24, 80, 0,
|
||||
dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED);
|
||||
|
||||
session_load ();
|
||||
|
||||
/* The following is a hack. We have to have at least one panel for
|
||||
* run_dlg() to be happy. So we destroy it in the idle loop if we
|
||||
* didn't need it in the first place. This idle function is to be run
|
||||
* at a higher priority than the one used in session_load().
|
||||
*/
|
||||
|
||||
panel = new_panel_at (".");
|
||||
gtk_idle_add_priority (GTK_PRIORITY_DEFAULT, idle_destroy_panel, panel);
|
||||
panel->widget.options |= W_PANEL_HIDDEN;
|
||||
|
||||
run_dlg (desktop_dlg);
|
||||
|
||||
desktop_destroy ();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -511,46 +510,14 @@ create_one_panel (char *dir, char *geometry)
|
||||
void
|
||||
create_panels (void)
|
||||
{
|
||||
WPanel *panel;
|
||||
if (!corba_have_server)
|
||||
non_corba_create_panels ();
|
||||
else {
|
||||
if (!nowindows)
|
||||
corba_create_window ();
|
||||
|
||||
if (run_desktop)
|
||||
desktop_init ();
|
||||
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_hint = label_new (0, 0, 0, NULL);
|
||||
|
||||
gnome_init_panels ();
|
||||
|
||||
desktop_dlg = create_dlg (0, 0, 24, 80, 0, dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED);
|
||||
|
||||
#if 0
|
||||
if (directory_list){
|
||||
|
||||
for (p = directory_list; p; p = p->next){
|
||||
create_one_panel (p->data, cmdline_geometry);
|
||||
session_set_restart (FALSE);
|
||||
}
|
||||
panel = NULL;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
panel = create_one_panel (".", cmdline_geometry);
|
||||
|
||||
if (nowindows){
|
||||
gtk_idle_add (idle_destroy_window, panel);
|
||||
panel->widget.options |= W_PANEL_HIDDEN;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
g_list_free (directory_list);
|
||||
#endif
|
||||
|
||||
main_corba_register_server ();
|
||||
|
||||
run_dlg (desktop_dlg);
|
||||
|
||||
/* shutdown gnome specific bits of midnight commander */
|
||||
|
||||
desktop_destroy ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -561,7 +528,7 @@ gmc_do_quit (void)
|
||||
quit = 1;
|
||||
dlg_stop (desktop_dlg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
session_die (void)
|
||||
{
|
||||
@ -632,7 +599,7 @@ session_management_setup (char *name)
|
||||
GTK_SIGNAL_FUNC (session_die), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Configures the GtkWindow/GnomeDialog from a WPanel.
|
||||
*
|
||||
@ -645,3 +612,28 @@ gmc_window_setup_from_panel (GnomeDialog *dialog, WPanel *panel)
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
gnome_dialog_set_parent (dialog, GTK_WINDOW (panel->xwindow));
|
||||
}
|
||||
|
||||
/**
|
||||
* gnome_check_super_user:
|
||||
* @void:
|
||||
*
|
||||
* Puts out a warning if the user is running gmc as root. If the user selects
|
||||
* Cancel, then gmc will terminate.
|
||||
**/
|
||||
void
|
||||
gnome_check_super_user (void)
|
||||
{
|
||||
GtkWidget *warning_dlg;
|
||||
GnomeClient *client;
|
||||
|
||||
if (geteuid () != 0)
|
||||
return;
|
||||
|
||||
warning_dlg = gnome_message_box_new (
|
||||
_("You are running the GNOME Midnight Commander as root. \n\n"
|
||||
"You will not be protected from severly damaging your system."),
|
||||
GNOME_MESSAGE_BOX_WARNING,
|
||||
GNOME_STOCK_BUTTON_OK, NULL);
|
||||
|
||||
gnome_dialog_run (GNOME_DIALOG (warning_dlg));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ void xtoolkit_end (void);
|
||||
|
||||
extern Dlg_head *desktop_dlg;
|
||||
extern int nowindows;
|
||||
extern int corba_have_server;
|
||||
|
||||
/* Required by the standard code */
|
||||
widget_data xtoolkit_create_dialog (Dlg_head *h, int with_grid);
|
||||
@ -44,6 +45,8 @@ int gmc_can_view_file (char *filename);
|
||||
int gmc_view (char *filename, int start_line);
|
||||
void x_show_info (WInfo *info, struct my_statfs *s, struct stat *b);
|
||||
void x_create_info (Dlg_head *h, widget_data parent, WInfo *info);
|
||||
void gnome_check_super_user (void);
|
||||
gint create_new_menu_from (char *file, GtkWidget *shell, gint pos);
|
||||
|
||||
/*
|
||||
* stuff from gaction.c
|
||||
@ -60,7 +63,9 @@ struct gmc_color_pairs_s {
|
||||
};
|
||||
|
||||
void gmc_do_quit (void);
|
||||
#if 0
|
||||
extern GnomeClient *session_client;
|
||||
#endif
|
||||
|
||||
extern struct gmc_color_pairs_s gmc_color_pairs [];
|
||||
#endif
|
||||
|
@ -434,7 +434,7 @@ static GtkWidget *
|
||||
generate_icon_sel (GnomeFilePropertyDialog *fp_dlg)
|
||||
{
|
||||
GtkWidget *retval;
|
||||
const gchar *icon;
|
||||
gchar *icon;
|
||||
|
||||
retval = gnome_icon_entry_new ("gmc_file_icon", "Select an Icon");
|
||||
icon = g_strdup (gicon_get_filename_for_icon (fp_dlg->im));
|
||||
|
@ -17,12 +17,15 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
#include <gnome.h>
|
||||
#include "gnome-open-dialog.h"
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void gnome_open_dialog_init (GnomeOpenDialog *open_dialog);
|
||||
static void gnome_open_dialog_class_init (GnomeOpenDialogClass *klass);
|
||||
static void gnome_open_dialog_destroy (GtkObject *object);
|
||||
|
@ -2022,10 +2022,11 @@ static void
|
||||
panel_tree_check_auto_expand (WPanel *panel, GtkCTreeNode *current)
|
||||
{
|
||||
GtkDTree *dtree = GTK_DTREE (panel->tree);
|
||||
GtkCList *clist = GTK_CLIST (dtree);
|
||||
GList *tmp_list = dtree->auto_expanded_nodes;
|
||||
GList *free_list;
|
||||
#if 0
|
||||
GtkCList *clist = GTK_CLIST (dtree);
|
||||
gint row, old_y, new_y;
|
||||
#endif
|
||||
|
||||
if (current) {
|
||||
while (tmp_list) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "main.h"
|
||||
#include "treestore.h"
|
||||
#include "gtkdtree.h"
|
||||
#include "../vfs/vfs.h"
|
||||
|
||||
#ifdef HACK
|
||||
# define mc_opendir opendir
|
||||
|
@ -20,26 +20,20 @@
|
||||
#include "color.h"
|
||||
#include "gmain.h"
|
||||
#include "gwidget.h"
|
||||
|
||||
Dlg_head *last_query_dlg;
|
||||
static int sel_pos;
|
||||
|
||||
void query_set_sel (int new_sel)
|
||||
void
|
||||
query_set_sel (int new_sel)
|
||||
{
|
||||
sel_pos = new_sel;
|
||||
}
|
||||
|
||||
static void
|
||||
pack_button (WButton *button, GtkBox *box)
|
||||
{
|
||||
if (!button)
|
||||
return;
|
||||
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (button->widget.wdata), 0, 0, 0);
|
||||
}
|
||||
|
||||
int query_dialog (char *header, char *text, int flags, int count, ...)
|
||||
int
|
||||
query_dialog (char *header, char *text, int flags, int count, ...)
|
||||
{
|
||||
va_list ap;
|
||||
WLabel *label;
|
||||
GtkWidget *dialog;
|
||||
int i, result = -1;
|
||||
const gchar **buttons;
|
||||
@ -94,7 +88,8 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
|
||||
}
|
||||
|
||||
/* To show nice messages to the users */
|
||||
Dlg_head *message (int error, char *header, char *text, ...)
|
||||
Dlg_head *
|
||||
message (int error, char *header, char *text, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer [4096];
|
||||
|
@ -326,7 +326,9 @@ x_create_input (Dlg_head *h, widget_data parent, WInput *in)
|
||||
void
|
||||
x_update_input (WInput *in)
|
||||
{
|
||||
#ifdef USE_GNOME_ENTRY
|
||||
GnomeEntry *gnome_entry;
|
||||
#endif
|
||||
GtkEntry *entry;
|
||||
char *text;
|
||||
int draw = 0;
|
||||
@ -545,6 +547,7 @@ x_label_set_text (WLabel *label, char *text)
|
||||
gtk_label_set (GTK_LABEL (label->widget.wdata), text);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Buttonbar */
|
||||
static void
|
||||
buttonbar_clicked (GtkWidget *widget, WButtonBar *bb)
|
||||
@ -563,12 +566,15 @@ buttonbar_clicked (GtkWidget *widget, WButtonBar *bb)
|
||||
}
|
||||
printf ("Mhm, should not happen or The Cow is out\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
x_create_buttonbar (Dlg_head *h, widget_data parent, WButtonBar *bb)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
#if 0
|
||||
int i;
|
||||
#endif
|
||||
|
||||
hbox = gtk_hbox_new (0, 0);
|
||||
#if 0
|
||||
|
@ -1,3 +1,33 @@
|
||||
1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* dlg.c (dlg_run_done): Do not call the callback of a NULL current
|
||||
widget.
|
||||
|
||||
* setup.h: Added missing prototype for setup_init().
|
||||
|
||||
* filegui.c (check_progress_buttons): Added a missing return
|
||||
value.
|
||||
|
||||
* dlg.c (remove_widget): Added a missing return value.
|
||||
|
||||
* main.c: Removed the global directory_list variable.
|
||||
Removed the main_corba_register_server() function.
|
||||
|
||||
* main.h: Removed the global run_desktop variable.
|
||||
|
||||
* panel.h: Now the panel structure has a unique numerical ID used
|
||||
for session management.
|
||||
|
||||
* screen.c (panel_new): Maintain a unique ID for each panel.
|
||||
|
||||
* main.c (maybe_display_linksdir): Handle display of the desktop
|
||||
init dir here.
|
||||
(main): Call gnome_check_super_user().
|
||||
(init_corba_with_args): Call corba_init_server().
|
||||
|
||||
* main.c (init_corba_with_args): Do CORBA initialization here. Also
|
||||
removed the global force_activation option.
|
||||
|
||||
1999-03-29 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* main.c (main): updated message.
|
||||
|
@ -341,7 +341,7 @@ int remove_widget (Dlg_head *h, void *what)
|
||||
Widget_Item *first, *p;
|
||||
|
||||
if (!h->current)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
first = p = h->current;
|
||||
|
||||
@ -866,7 +866,9 @@ void init_dlg (Dlg_head *h)
|
||||
/* Shutdown the run_dlg */
|
||||
void dlg_run_done (Dlg_head *h)
|
||||
{
|
||||
if (h->current)
|
||||
(*h->callback) (h, h->current->dlg_id, DLG_END);
|
||||
|
||||
current_dlg = (Dlg_head *) h->previous_dialog;
|
||||
if (current_dlg){
|
||||
|
||||
|
@ -179,7 +179,7 @@ check_progress_buttons (FileOpContext *ctx)
|
||||
FileOpContextUI *ui;
|
||||
|
||||
if (ctx->ui == NULL)
|
||||
return;
|
||||
return FILE_CONT;
|
||||
|
||||
ui = ctx->ui;
|
||||
|
||||
|
104
src/main.c
104
src/main.c
@ -81,7 +81,6 @@
|
||||
|
||||
#ifdef HAVE_CORBA
|
||||
# include <libgnorba/gnorba.h>
|
||||
# include "gcorba.h"
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
@ -139,6 +138,12 @@
|
||||
|
||||
#include "popt.h"
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
#include "gcorba.h"
|
||||
#include "gmain.h"
|
||||
#include "gsession.h"
|
||||
#endif
|
||||
|
||||
/* "$Id$" */
|
||||
|
||||
/* When the modes are active, left_panel, right_panel and tree_panel */
|
||||
@ -2637,8 +2642,6 @@ static void parse_an_arg (poptContext state,
|
||||
#endif
|
||||
|
||||
char *cmdline_geometry = NULL;
|
||||
char **directory_list = NULL;
|
||||
int force_activation = 0;
|
||||
|
||||
static struct poptOption argument_table [] = {
|
||||
#ifdef HAVE_GNOME
|
||||
@ -2715,21 +2718,58 @@ 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},
|
||||
{"desktop-linksdir", '\0', POPT_ARG_NONE, &display_linksdir, 0,
|
||||
N_("Displays the directory that holds the .links startup files")},
|
||||
N_("Display the directory that holds the .links startup files and exit")},
|
||||
#endif
|
||||
|
||||
{ NULL, 0, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
main_corba_register_server (void)
|
||||
/* Convenience function to display the desktop initialization directory and exit */
|
||||
static void
|
||||
maybe_display_linksdir (void)
|
||||
{
|
||||
#ifdef HAVE_CORBA
|
||||
corba_register_server ();
|
||||
#endif
|
||||
if (display_linksdir) {
|
||||
puts (DESKTOP_INIT_DIR);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_CORBA
|
||||
/* Initializes the ORB and does the initial argument processing */
|
||||
static void
|
||||
init_corba_with_args (int *argc, char **argv, poptContext *ctx)
|
||||
{
|
||||
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);
|
||||
|
||||
maybe_display_linksdir ();
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
CORBA_exception_free (&ev);
|
||||
g_warning ("Could not initialize CORBA");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
if (!corba_init_server ()) {
|
||||
g_warning ("Could not initialize the CORBA server");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_CORBA
|
||||
void
|
||||
corba_create_window (void)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
handle_args (int argc, char *argv [])
|
||||
@ -2740,28 +2780,12 @@ handle_args (int argc, char *argv [])
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
#ifdef HAVE_CORBA
|
||||
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);
|
||||
|
||||
if (display_linksdir){
|
||||
puts (DESKTOP_INIT_DIR);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
corba_init ();
|
||||
if (!force_activation)
|
||||
if (try_to_activate_running_copy ())
|
||||
exit (1);
|
||||
init_corba_with_args (&argc, argv, &ctx);
|
||||
#else
|
||||
gnome_init_with_popt_table ("gmc", VERSION, argc, argv, argument_table, 0, &ctx);
|
||||
#endif
|
||||
if (display_linksdir){
|
||||
puts (DESKTOP_INIT_DIR);
|
||||
exit (1);
|
||||
}
|
||||
maybe_display_linksdir ();
|
||||
|
||||
gtk_widget_push_visual (gdk_imlib_get_visual ());
|
||||
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
|
||||
|
||||
@ -2913,15 +2937,17 @@ int main (int argc, char *argv [])
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain ("mc", LOCALEDIR);
|
||||
textdomain ("mc");
|
||||
|
||||
/* This is here to debug the CORBA async invocations */
|
||||
#if 0
|
||||
/* This is here to debug startup stuff */
|
||||
{
|
||||
volatile int i = 1;
|
||||
volatile int i = 0;
|
||||
|
||||
printf ("GMC IS WAITING %d\n", getpid ());
|
||||
while (!i)
|
||||
;
|
||||
|
||||
}
|
||||
#endif
|
||||
/* Initialize list of all user group for timur_clr_mode */
|
||||
init_groups ();
|
||||
|
||||
@ -2956,7 +2982,7 @@ int main (int argc, char *argv [])
|
||||
|
||||
mc_tree_store_load ();
|
||||
|
||||
session_management_setup (argv [0]);
|
||||
session_init ();
|
||||
probably_finish_program ();
|
||||
#endif
|
||||
|
||||
@ -3065,17 +3091,11 @@ int main (int argc, char *argv [])
|
||||
if (alternate_plus_minus)
|
||||
application_keypad_mode ();
|
||||
# endif
|
||||
/* INSERT ROOT DIALOG HERE */
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
if (geteuid () == 0) {
|
||||
GtkWidget *warning_dlg;
|
||||
warning_dlg = gnome_message_box_new (_("You are running the GNOME Midnight Commander as root. \n\n"
|
||||
"You will not be protected from severly damaging your system.")
|
||||
GNOME_MESSAGE_BOX_WARNING,
|
||||
GNOME_STOCK_BUTTON_OK, NULL);
|
||||
gnome_dialog_run (GNOME_DIALOG (warning_dlg));
|
||||
}
|
||||
gnome_check_super_user ();
|
||||
#endif
|
||||
|
||||
if (show_change_notice){
|
||||
message (1, _(" Notice "),
|
||||
_(" The Midnight Commander configuration files \n"
|
||||
|
@ -99,7 +99,7 @@ extern int output_starts_shell;
|
||||
extern int midnight_shutdown;
|
||||
extern char search_buffer [256];
|
||||
extern char cmd_buf [512];
|
||||
extern int run_desktop;
|
||||
extern char *cmdline_geometry;
|
||||
|
||||
#if HAVE_GNOME
|
||||
#define MENU_PANEL get_current_panel ()
|
||||
@ -188,8 +188,6 @@ void done_menu (void);
|
||||
void init_menu (void);
|
||||
void exec_shell (void);
|
||||
|
||||
void main_corba_register_server (void);
|
||||
|
||||
#ifdef OS2_NT
|
||||
# define MC_BASE ""
|
||||
#else
|
||||
|
@ -158,6 +158,9 @@ typedef struct {
|
||||
|
||||
int dragging;
|
||||
|
||||
/* Unique numerical ID for session management */
|
||||
int id;
|
||||
|
||||
/* Used for scrolling nicely during drags */
|
||||
int timer_id;
|
||||
int drag_motion_x;
|
||||
|
@ -955,6 +955,9 @@ void directory_history_add (WPanel * panel, char *s);
|
||||
WPanel *
|
||||
panel_new (char *panel_name)
|
||||
{
|
||||
#ifdef HAVE_GNOME
|
||||
static int panel_id = 0;
|
||||
#endif
|
||||
WPanel *panel;
|
||||
char *section;
|
||||
int i, err;
|
||||
@ -995,6 +998,7 @@ panel_new (char *panel_name)
|
||||
panel->format_modified = 1;
|
||||
#ifdef HAVE_GNOME
|
||||
panel->is_a_desktop_panel = FALSE;
|
||||
panel->id = panel_id++;
|
||||
#endif
|
||||
|
||||
panel->panel_name = g_strdup (panel_name);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef __SETUP_H
|
||||
#define __SETUP_H
|
||||
|
||||
char *setup_init (void);
|
||||
void save_layout (void);
|
||||
void save_configure (void);
|
||||
void load_setup (void);
|
||||
|
@ -1,3 +1,19 @@
|
||||
1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* vfs.c (vfs_add_current_stamps): Only do stamping of the panels
|
||||
if they exist.
|
||||
|
||||
* mcserv.c: #include <sys/wait.h>
|
||||
(get_client): Put `#ifdef __EMX__' around an otherwise-unused
|
||||
variable.
|
||||
|
||||
* utilvfs.c (vfs_split_url): Fix NULL <-> 0 confusion when
|
||||
comparing characters.
|
||||
|
||||
* ftpfs.c (retrieve_dir): Removed unused variable dot_dot_found.
|
||||
|
||||
* extfs.c (extfs_init): Assign `key' to c, not `&key'.
|
||||
|
||||
Sun Mar 28 23:50:47 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* vfs.h (vfs_translate_url): Fixed the macro which is used when
|
||||
|
@ -920,7 +920,7 @@ static int extfs_init (vfs *me)
|
||||
*c = 0;
|
||||
c = &key [strlen (key) - 1];
|
||||
} else {
|
||||
c = &key;
|
||||
c = key;
|
||||
}
|
||||
extfs_need_archive [extfs_no] = !(*c == ':');
|
||||
if (*c == ':')
|
||||
|
@ -1292,7 +1292,6 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
struct dir *dcache;
|
||||
int got_intr = 0;
|
||||
int dot_found = 0;
|
||||
int dot_dot_found = 0;
|
||||
int has_spaces = (strchr (remote_path, ' ') != NULL);
|
||||
|
||||
canonicalize_pathname (remote_path);
|
||||
|
@ -63,6 +63,7 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#ifdef SCO_FLAVOR
|
||||
@ -1109,7 +1110,9 @@ char *get_client (int portnum)
|
||||
struct hostent *hp;
|
||||
char hostname [255];
|
||||
int yes = 1;
|
||||
#ifdef __EMX__
|
||||
char *me;
|
||||
#endif
|
||||
|
||||
if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
return "Can't create socket";
|
||||
|
@ -102,7 +102,7 @@ char *vfs_split_url (char *path, char **host, char **user, int *port, char **pas
|
||||
else
|
||||
*pass = g_strdup (inner_colon);
|
||||
}
|
||||
if (*pcopy != NULL)
|
||||
if (*pcopy != 0)
|
||||
*user = g_strdup (pcopy);
|
||||
else
|
||||
default_is_anon = 0;
|
||||
|
@ -865,11 +865,17 @@ void
|
||||
vfs_add_current_stamps (void)
|
||||
{
|
||||
vfs_stamp_path (current_dir);
|
||||
|
||||
if (cpanel) {
|
||||
if (get_current_type () == view_listing)
|
||||
vfs_stamp_path (cpanel->cwd);
|
||||
}
|
||||
|
||||
if (opanel) {
|
||||
if (get_other_type () == view_listing)
|
||||
vfs_stamp_path (opanel->cwd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is really broken */
|
||||
|
Loading…
Reference in New Issue
Block a user