Commit 0970bb6e authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

redid the way applets are initially read in

Wed Mar 18 23:10:27 1998  George Lebl  <jirka@5z.com>

        * launcher.c: redid the way applets are initially read in

        * panel.c: try contacting the launcher with a timeout and
          then tell it to reread launchers

        * launcher.c: does not contact the panel, but waits until the
          teh panel contacts it
parent 5af33c7c
Wed Mar 18 23:10:27 1998 George Lebl <jirka@5z.com>
* launcher.c: redid the way applets are initially read in
* panel.c: try contacting the launcher with a timeout and
then tell it to reread launchers
* launcher.c: does not contact the panel, but waits until the
teh panel contacts it
Wed Mar 18 18:13:35 1998 George Lebl <jirka@5z.com>
* gnome-panel.idl, mico-glue.cc: added unimplemented
......
Wed Mar 18 23:10:27 1998 George Lebl <jirka@5z.com>
* launcher.c: redid the way applets are initially read in
* panel.c: try contacting the launcher with a timeout and
then tell it to reread launchers
* launcher.c: does not contact the panel, but waits until the
teh panel contacts it
Wed Mar 18 18:13:35 1998 George Lebl <jirka@5z.com>
* gnome-panel.idl, mico-glue.cc: added unimplemented
......
......@@ -82,7 +82,6 @@ public:
int
gnome_panel_applet_init_corba (void)
{
char *binder_address;
char *name;
char *iior;
char hostname [1024];
......@@ -110,6 +109,33 @@ gnome_panel_applet_init_corba (void)
return 1;
}
/*reread the panel's address*/
int
gnome_panel_applet_reinit_corba (void)
{
char *name;
char *iior;
char hostname [1024];
gethostname (hostname, sizeof (hostname));
if (hostname [0] == 0)
strcpy (hostname, "unknown-host");
name = g_copy_strings ("/CORBA-servers/Panel-", hostname,
"/DISPLAY-", getenv ("DISPLAY"), NULL);
iior = gnome_config_get_string (name);
g_free (name);
if (!iior)
return 0;
CORBA::Object_var obj = orb_ptr->string_to_object (iior);
panel_client = GNOME::Panel::_narrow (obj);
return 1;
}
/*adds a callback to the callback hash*/
void
gnome_panel_applet_register_callback(int id,
......@@ -360,7 +386,7 @@ move_grab_add (GtkWidget *applet)
gtk_grab_add(applet);
gdk_pointer_grab(applet->window,
TRUE,
APPLET_EVENT_MASK,
(enum GdkEventMask)APPLET_EVENT_MASK,
NULL,
fleur_cursor,
GDK_CURRENT_TIME);
......
......@@ -13,6 +13,7 @@ char *gnome_panel_applet_abort_id (int id);
char *gnome_panel_applet_request_glob_cfg (char **globcfgpath);
char *gnome_panel_quit (void);
int gnome_panel_applet_init_corba (void);
int gnome_panel_applet_reinit_corba (void);
void gnome_panel_applet_register_callback (int id,
char *name,
char *menutext,
......
......@@ -46,7 +46,9 @@ launcher_corba_gtk_main (char *str)
gnome_config_sync ();
g_free (name);
//orb_ptr->dispatcher (new GtkDispatcher ());
panel_initialize_corba (&orb_ptr, &boa_ptr);
orb_ptr->dispatcher (new GtkDispatcher ());
boa_ptr->impl_is_ready (CORBA::ImplementationDef::_nil());
}
......@@ -415,6 +415,7 @@ session_save(int id, const char *cfgpath, const char *globcfgpath)
g_free(query);
gnome_config_sync();
gnome_config_drop_all();
}
void
......@@ -509,6 +510,9 @@ restart_all_launchers(void)
char *query;
int i,count;
if (!gnome_panel_applet_reinit_corba ())
g_error ("Could not comunicate with the panel\n");
launcher_count=0;
while(launchers) {
Launcher *launcher=launchers->data;
......@@ -533,20 +537,11 @@ restart_all_launchers(void)
int
main(int argc, char **argv)
{
char *globcfg;
char *query;
char *mypath;
int i,count;
panel_corba_register_arguments ();
gnome_init("clock_applet", NULL, argc, argv, 0, NULL);
if (!gnome_panel_applet_init_corba ()){
g_error ("Could not comunicate with the panel\n");
/*fprintf (stderr, "Could not comunicate with the panel\n");*/
/*exit (1);*/
}
/*we pass '#' plus a comment (our path) to the panel to start,
that will tell the panel to doing nothing (next session),
but it will reserve a spot for us on the correct place, and
......@@ -560,16 +555,6 @@ main(int argc, char **argv)
free(mypath);
}
gnome_panel_applet_request_glob_cfg(&globcfg);
query = g_copy_strings(globcfg,CONFIG_TAG,"/count=0",NULL);
count = gnome_config_get_int(query);
g_free(query);
g_free(globcfg);
for(i=0;i<count;i++)
start_new_launcher(NULL);
launcher_corba_gtk_main ("IDL:GNOME/Launcher:1.0");
return 0;
......
......@@ -501,6 +501,13 @@ init_user_panels(void)
panels = g_list_append(panels,panel);
}
}
gint
call_launcher_timeout(gpointer data)
{
puts("Waiting for launcher ...");
return !(panel_corba_restart_launchers());
}
int
......@@ -549,7 +556,8 @@ main(int argc, char **argv)
apply_global_config();
printf ("starting corba looop\n");
gtk_timeout_add(300,call_launcher_timeout,NULL);
/* I use the glue code to avoid making this a C++ file */
panel_corba_gtk_main ("IDL:GNOME/Panel:1.0");
......
......@@ -136,19 +136,51 @@ panel_corba_call_launcher(const char *path)
iior = gnome_config_get_string (name);
g_free (name);
puts("LAUNCHER_CALL");
if (!iior)
return 0;
return FALSE;
puts("LAUNCHER_iior");
puts(iior);
CORBA::Object_var obj = orb_ptr->string_to_object (iior);
GNOME::Launcher_var launcher_client = GNOME::Launcher::_narrow (obj);
try {
launcher_client->start_new_launcher(path);
} catch( ... ) {
return FALSE;
}
return TRUE;
}
int
panel_corba_restart_launchers(void)
{
char *name;
char *iior;
char hostname [1024];
gethostname (hostname, sizeof (hostname));
if (hostname [0] == 0)
strcpy (hostname, "unknown-host");
name = g_copy_strings ("/CORBA-servers/Launcher-", hostname,
"/DISPLAY-", getenv ("DISPLAY"), NULL);
iior = gnome_config_get_string (name);
g_free (name);
if (!iior)
return FALSE;
CORBA::Object_var obj = orb_ptr->string_to_object (iior);
GNOME::Launcher_var launcher_client = GNOME::Launcher::_narrow (obj);
launcher_client->start_new_launcher(path);
try {
launcher_client->restart_all_launchers();
} catch( ... ) {
return FALSE;
}
return 1;
return TRUE;
}
void
......
......@@ -8,6 +8,8 @@ BEGIN_GNOME_DECLS
void panel_corba_gtk_main (char *service_name);
int panel_corba_call_launcher(const char *path);
int panel_corba_restart_launchers(void);
void send_applet_session_save (const char *ior, int id,
const char *cfgpath,
......
......@@ -141,17 +141,13 @@ save_applet_configuration(gpointer data, gpointer user_data)
/*sync before the applet does it's stuff*/
gnome_config_sync();
/*FIXME:????????????: next time we do sync it's gonna
ignore whatever was written to our sections by other
programs ... whoops ... needs to be fixed in
gnome-config! it has to do with no locking on
config files and mtime resolution of 1 second*/
/*I think this should be done at sync and also that there
should be some flocking ... but this works for now*/
gnome_config_drop_all();
/*have the applet do it's own session saving*/
send_applet_session_save(info->id,(*num)-2,path,
panel_cfg_path);
/*FIXME: related to above FIXME, this makes it slightly work*/
sleep(1);
} else {
fullpath = g_copy_strings(path,"id",NULL);
gnome_config_set_string(fullpath, info->id);
......@@ -310,6 +306,9 @@ panel_session_save (GnomeClient *client,
info = list->data;
if(info->type == APPLET_EXTERN) {
/*printf("SHUTTING DOWN EXTERN (%d)\n",i);*/
gtk_container_remove(
GTK_CONTAINER(info->widget),
info->applet_widget);
send_applet_shutdown_applet(info->id,i);
/*puts("DONE");*/
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment