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

added a way to call new Launchers

Sun Mar 15 17:49:33 1998  George Lebl  <jirka@5z.com>

        * mico-glue.(cc|h): added a way to call new Launchers

        * launcher.c: more CORBA stuff
parent b9cd0e71
Sun Mar 15 17:49:33 1998 George Lebl <jirka@5z.com>
* mico-glue.(cc|h): added a way to call new Launchers
* launcher.c: more CORBA stuff
Sat Mar 14 01:38:34 1998 George Lebl <jirka@5z.com>
* panel.c, main.c: added menu positioning to popup menus
......
Sun Mar 15 17:49:33 1998 George Lebl <jirka@5z.com>
* mico-glue.(cc|h): added a way to call new Launchers
* launcher.c: more CORBA stuff
Sat Mar 14 01:38:34 1998 George Lebl <jirka@5z.com>
* panel.c, main.c: added menu positioning to popup menus
......
......@@ -29,7 +29,7 @@ module GNOME {
};
interface Launcher {
void change_orient (in string path);
void start_new_launcher (in string path);
};
};
......@@ -22,7 +22,32 @@ END_GNOME_DECLS
class Launcher_impl : virtual public GNOME::Launcher_skel {
public:
void stat_new_launcher (const char *path) {
void start_new_launcher (const char *path) {
::start_new_launcher(path);
}
};
void
launcher_corba_gtk_main (char *str)
{
GNOME::Panel_ptr acc = new Launcher_impl ();
char hostname [4096];
char *name;
panel_initialize_corba (&orb_ptr, &boa_ptr);
gethostname (hostname, sizeof (hostname));
if (hostname [0] == 0)
strcpy (hostname, "unknown-host");
name = g_copy_strings ("/CORBA-servers/Launcher-", hostname,
"/DISPLAY-", getenv ("DISPLAY"), NULL);
gnome_config_set_string (name, orb_ptr->object_to_string (acc));
gnome_config_sync ();
g_free (name);
orb_ptr->dispatcher (new GtkDispatcher ());
boa_ptr->impl_is_ready (CORBA::ImplementationDef::_nil());
}
......@@ -21,9 +21,14 @@
#define CONFIG_TAG "Launcher"
#define APPLET_DATA "launcher_data"
static int launcher_count = 0;
GList *lauchers = NULL;
static char *default_app_pixmap;
typedef struct {
int applet_id;
GtkWidget *aw;
GtkWidget *button;
gint signal_click_tag;
GnomeDesktopEntry *dentry;
......@@ -398,6 +403,106 @@ create_instance (PanelWidget *panel, char *params, int pos)
(*panel_cmd_func) (&cmd);
}
/*these are commands sent over corba:*/
void
change_orient(int id, int orient)
{
PanelOrientType o = (PanelOrientType)orient;
}
void
session_save(int id, const char *cfgpath, const char *globcfgpath)
{
/*save the session here*/
}
static gint
quit_launcher(gpointer data)
{
if(launcher_count<=0)
exit(0);
return FALSE;
}
void
shutdown_applet(int id)
{
/*kill our window using destroy to avoid warnings we need to
kill the aw but we also need to return from this call*/
gtk_widget_destroy(aw);
launcher_count--;
if(launcher_count<=0)
gtk_idle_add(quit_launcher,NULL);
}
int
main(int argc, char **argv)
{
GtkWidget *clock;
char *result;
char *cfgpath;
char *globcfgpath;
char *mypath;
char *myinvoc;
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);*/
}
aw = applet_widget_new ();
if(argv[0][0] == '/')
myinvoc = g_strdup(argv[0]);
else {
mypath = getcwd(NULL,0);
myinvoc = g_copy_strings(mypath,"/",argv[0],NULL);
free(mypath);
}
result = gnome_panel_applet_request_id(aw,myinvoc,&applet_id,
&cfgpath,&globcfgpath);
g_free(myinvoc);
if (result){
g_error ("Could not talk to the Panel: %s\n", result);
/*exit (1);*/
}
/*use cfg path for loading up data!*/
g_free(globcfgpath);
g_free(cfgpath);
gnome_panel_applet_register_callback (APPLET_WIDGET(aw),
applet_id,
"test",
"TEST CALLBACK",
test_callback,
NULL);
clock = create_clock_widget (GTK_WIDGET(aw));
gtk_widget_show(clock);
applet_widget_add (APPLET_WIDGET (aw), clock);
gtk_widget_show (aw);
result = gnome_panel_prepare_and_transfer(aw,applet_id);
/*printf ("Done\n");*/
if (result){
g_error ("Could not talk to the Panel: %s\n", result);
/*exit (1);*/
}
applet_corba_gtk_main ("IDL:GNOME/Launcher:1.0");
return 0;
}
gpointer
applet_cmd_func(AppletCommand *cmd)
{
......
......@@ -98,6 +98,34 @@ panel_corba_gtk_main (char *service_name)
boa_ptr->impl_is_ready (CORBA::ImplementationDef::_nil());
}
int
panel_corba_call_launcher(const char *path)
{
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 0;
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);
return 1;
}
void
send_applet_session_save (const char *ior, int id, const char *cfgpath,
const char *globcfgpath)
......
......@@ -7,6 +7,8 @@ BEGIN_GNOME_DECLS
void panel_corba_gtk_main (char *service_name);
int panel_corba_call_launcher(const char *path);
void send_applet_session_save (const char *ior, int id,
const char *cfgpath,
const char *globcfgpath);
......
......@@ -29,7 +29,7 @@ module GNOME {
};
interface Launcher {
void change_orient (in string path);
void start_new_launcher (in string path);
};
};
......@@ -29,7 +29,7 @@ module GNOME {
};
interface Launcher {
void change_orient (in string path);
void start_new_launcher (in string path);
};
};
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