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

fixed some stupidity induced by the older way of starting applets, removed

Thu May 21 00:23:13 1998  George Lebl  <jirka@5z.com>

        * panel.[ch],main.c,menu.c: fixed some stupidity induced
          by the older way of starting applets, removed the
          "multi_applet" ugly hack and generally cleaned up the
          mulapp code a bit, but still it is not tested, it only
          compiles now:)
parent 3fb57b15
Thu May 21 00:23:13 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c,menu.c: fixed some stupidity induced
by the older way of starting applets, removed the
"multi_applet" ugly hack and generally cleaned up the
mulapp code a bit, but still it is not tested, it only
compiles now:)
Mon May 18 23:35:13 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c: implement run queue, this will start up
......
Thu May 21 00:23:13 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c,menu.c: fixed some stupidity induced
by the older way of starting applets, removed the
"multi_applet" ugly hack and generally cleaned up the
mulapp code a bit, but still it is not tested, it only
compiles now:)
Mon May 18 23:35:13 1998 George Lebl <jirka@5z.com>
* panel.[ch],main.c: implement run queue, this will start up
......
......@@ -302,7 +302,7 @@ load_applet(gchar *id_str, gchar *path, gchar *params, gint dorestart,
g_free(fullpath);
return;
} else {
mulapp_add_to_queue(fullpath,applet_count-1);
mulapp_add_to_queue(fullpath);
}
}
......
......@@ -179,11 +179,7 @@ add_applet (GtkWidget *w, gpointer data)
param = gnome_string_joinv (" ", ii->exec + 1);
else
param = NULL;
/*slightly ugly but should work fine, if the applet executable ends
with multi_applet, we start this as a dorestart==FALSE type applet,
which handeles multiple applets or even applet types*/
if(strcmp(path+strlen(path)-12,"multi_applet")==0)
if(mulapp_is_in_queue(path))
dorestart = FALSE;
else
dorestart = TRUE;
......
......@@ -195,7 +195,8 @@ send_applet_change_orient (const char *ior, int applet_id, int orient)
}
void
send_applet_do_callback (const char *ior, int applet_id, char *callback_name)
send_applet_do_callback (const char *ior, int applet_id,
const char *callback_name)
{
/* Use the ior that was sent to us to get an Applet CORBA object */
CORBA::Object_var obj = orb_ptr->string_to_object (ior);
......@@ -206,7 +207,7 @@ send_applet_do_callback (const char *ior, int applet_id, char *callback_name)
}
void
send_applet_start_new_applet (const char *ior, char *param)
send_applet_start_new_applet (const char *ior, const char *param)
{
/* Use the ior that was sent to us to get an Applet CORBA object */
CORBA::Object_var obj = orb_ptr->string_to_object (ior);
......
......@@ -13,8 +13,9 @@ int send_applet_session_save (const char *ior, int id,
const char *cfgpath,
const char *globcfgpath);
void send_applet_change_orient (const char *ior, int id, int orient);
void send_applet_do_callback (const char *ior, int id, char *callback_name);
void send_applet_start_new_applet (const char *ior, char *param);
void send_applet_do_callback (const char *ior, int id,
const char *callback_name);
void send_applet_start_new_applet (const char *ior, const char *param);
END_GNOME_DECLS
......
......@@ -51,21 +51,45 @@ struct _MultiLoadQueue {
gchar *path;
gchar *ior;
GList *params;
gint applet_id;
};
static GList *multiple_applet_load_queue=NULL;
static gint
is_applet_running(const gchar *path)
{
gint i;
AppletInfo *info;
for(info=(AppletInfo *)applets->data,i=0;i<applet_count;i++,info++) {
if((info->type == APPLET_EXTERN ||
info->type == APPLET_EXTERN_PENDING ||
info->type == APPLET_EXTERN_RESERVED) &&
strcmp(info->path,path)==0) {
return TRUE;
}
}
return FALSE;
}
static void
mulapp_remove_emptyfrom_queue(void)
{
GList *list;
for(list=multiple_applet_load_queue;list!=NULL;list=g_list_next(list)){
MultiLoadQueue *mq = list->data;
AppletInfo *info = get_applet_info(mq->applet_id);
if(info->type == APPLET_EMPTY) {
if(is_applet_running(mq->path)) {
multiple_applet_load_queue =
g_list_remove_link(multiple_applet_load_queue,
list);
if(mq->params) g_warning("Whoops! there were applets "
"to be started while the "
"main one disappeared, this "
"should never happen and "
"most likely indicates a bug");
g_free(mq->path);
if(mq->ior) g_free(mq->ior);
g_free(mq);
/*since we should restart the loop now*/
mulapp_remove_emptyfrom_queue();
return;
......@@ -74,7 +98,7 @@ mulapp_remove_emptyfrom_queue(void)
}
gint
mulapp_is_in_queue(gchar *path)
mulapp_is_in_queue(const gchar *path)
{
GList *list;
mulapp_remove_emptyfrom_queue();
......@@ -89,7 +113,7 @@ mulapp_is_in_queue(gchar *path)
/*if the parent is already in queue, load the applet or add the param,
into a queue*/
void
mulapp_load_or_add_to_queue(gchar *path,gchar *param)
mulapp_load_or_add_to_queue(const gchar *path,const gchar *param)
{
GList *list;
mulapp_remove_emptyfrom_queue();
......@@ -108,7 +132,7 @@ mulapp_load_or_add_to_queue(gchar *path,gchar *param)
}
void
mulapp_add_to_queue(gchar *path, gint applet_id)
mulapp_add_to_queue(const gchar *path)
{
MultiLoadQueue *mq;
......@@ -116,13 +140,12 @@ mulapp_add_to_queue(gchar *path, gint applet_id)
mq->path = g_strdup(path);
mq->ior = NULL;
mq->params = NULL;
mq->applet_id = applet_id;
multiple_applet_load_queue = g_list_prepend(multiple_applet_load_queue,
mq);
}
static void
mulapp_add_ior_and_free_queue(gchar *path, gchar *ior)
mulapp_add_ior_and_free_queue(const gchar *path, const gchar *ior)
{
GList *list;
mulapp_remove_emptyfrom_queue();
......@@ -934,6 +957,10 @@ applet_request_id (const char *path, const char *param,
*globcfgpath = g_strdup(old_panel_cfg_path);
info->type = APPLET_EXTERN_RESERVED;
*winid=GDK_WINDOW_XWINDOW(info->applet_widget->window);
info->data = ITOP(dorestart);
if(!dorestart &&!mulapp_is_in_queue(path))
mulapp_add_to_queue(path);
return i;
}
}
......@@ -948,6 +975,11 @@ applet_request_id (const char *path, const char *param,
*cfgpath = NULL;
*globcfgpath = g_strdup(old_panel_cfg_path);
info = get_applet_info(applet_count-1);
info->data = ITOP(dorestart);
if(!dorestart &&!mulapp_is_in_queue(path))
mulapp_add_to_queue(path);
return i;
}
......
......@@ -136,13 +136,13 @@ void applet_remove_from_panel(gint applet_id);
/*multi applet que functions*/
gint mulapp_is_in_queue(gchar *path);
gint mulapp_is_in_queue(const gchar *path);
/*if the parent is already in queue, load the applet or add the param,
into a queue*/
void mulapp_load_or_add_to_queue(gchar *path,gchar *param);
void mulapp_load_or_add_to_queue(const gchar *path,const gchar *param);
void mulapp_add_to_queue(gchar *path, gint applet_id);
void mulapp_add_to_queue(const gchar *path);
/*exec queue done function from main.c*/
void exec_queue_done(gint applet_id);
......
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