Commit c3c17bc9 authored by Arturo Espinosa's avatar Arturo Espinosa

Panel goes CORBA. -mig

parent bbbd0893
Wed Feb 18 17:40:39 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* mico-glue.cc, mico-glue.h: New files that include all of the
server side C++ glue code. This is in preparation for the
upcoming C-only bindings that Elliot is writing.
* main.c: use the mico-glue code for the server support
* Makefile.am: Rename panel -> corba_panel, this is the corbaized
panel.
* panel.in: New file, this one takes care of starting up the
corba_panel with the proper arguments (to register corba_panel as
a persistent corba server).
Wed Feb 18 17:40:18 1998 Federico Mena <federico@nuclecu.unam.mx>
* menu.c (menu_button_press): Use event->time for right menu popup behaviour
1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.c (main): Added app_id "panel-widget".
......
Wed Feb 18 17:40:39 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* mico-glue.cc, mico-glue.h: New files that include all of the
server side C++ glue code. This is in preparation for the
upcoming C-only bindings that Elliot is writing.
* main.c: use the mico-glue code for the server support
* Makefile.am: Rename panel -> corba_panel, this is the corbaized
panel.
* panel.in: New file, this one takes care of starting up the
corba_panel with the proper arguments (to register corba_panel as
a persistent corba server).
Wed Feb 18 17:40:18 1998 Federico Mena <federico@nuclecu.unam.mx>
* menu.c (menu_button_press): Use event->time for right menu popup behaviour
1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.c (main): Added app_id "panel-widget".
......
SUBDIRS = menu mailcheck clock launcher batmon netwatch logout \
@PROGRAMS_PANEL_CDPLAYER@
CXX = mico-c++
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) $(X_CFLAGS)
bin_PROGRAMS = panel clock_applet
panel_SOURCES = \
gdkextra.c \
gdkextra.h \
main.c \
panel.c \
panel.h \
menu.c \
menu.h \
drawer.c \
drawer.h \
panel-widget.c \
panel-widget.h \
panel_config_global.c \
panel_config_global.h \
panel_config.c \
panel_config.h
panel_LDADD = $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(INTLLIBS)
CORBA_SOURCES = \
gnome-panel.cc \
gnome-panel.h
gnome-panel.cc: gnome-panel.idl
idl gnome-panel.idl
panel_SOURCES = \
drawer.c \
drawer.h \
gdkextra.c \
gdkextra.h \
main.c \
menu.c \
menu.h \
mico-glue.cc \
mico-glue.h \
panel.c \
panel.h \
panel_config.c \
panel_config.h \
panel_config_global.c \
panel_config_global.h \
panel-widget.c \
panel-widget.h \
$(CORBA_SOURCES)
panel_LDADD = $(GNOME_LIBDIR) $(MICO_LIBS) -lmicocoss2.0.2 $(MICOAUX_LIBS) -lXt $(GNOMEUI_LIBS) $(INTLLIBS)
## FIXME: move clock applet into clock
clock_applet_SOURCES = \
clock.c
clock.c \
applet-lib.cc \
$(CORBA_SOURCES)
clock_applet_LDADD = $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(INTLLIBS)
clock_applet_LDADD = $(GNOME_LIBDIR) $(MICO_LIBS) -lmicocoss2.0.2 $(MICOAUX_LIBS) -lXt $(GNOMEUI_LIBS) $(INTLLIBS)
data_DATA = panelrc
## Why not just make this via configure? Because @datadir@ will be
## expanded incorrectly.
xpanel: xpanel.in Makefile
## Why do a sed and then an mv? To avoid problems if the user
## interrupts.
sed -e 's,\@bindir\@,$(bindir),g' < $(srcdir)/xpanel.in \
> xpanel.tmp && chmod +x xpanel.tmp && mv -f xpanel.tmp xpanel
panelrc: panelrc.in Makefile
## Why do a sed and then an mv? To avoid problems if the user
## interrupts.
......@@ -45,4 +65,4 @@ panelrc: panelrc.in Makefile
MOSTLYCLEANFILES = panelrc
EXTRA_DIST = panelrc.in
EXTRA_DIST = panelrc.in panel.in
BEGIN_GNOME_DECLS
char *gnome_panel_prepare_and_transfer (GtkWidget *widget);
int gnome_panel_applet_init_corba (int *argc, char ***argv);
END_GNOME_DECLS
......@@ -19,6 +19,7 @@
#include <time.h>
#include <gnome.h>
#include <gdk/gdkx.h>
#include <applet-lib.h>
#define CLOCK_DATA "clock_data"
......@@ -166,21 +167,28 @@ main(int argc, char **argv)
{
GtkWidget *clock;
GtkWidget *window;
char *result;
gnome_init("clock_applet", &argc, &argv);
if (!gnome_panel_applet_init_corba (&argc, &argv)){
fprintf (stderr, "Could not comunicate with the panel\n");
exit (1);
}
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
clock = create_clock_widget (GTK_WIDGET(window));
gtk_widget_show(clock);
gtk_container_add (GTK_CONTAINER (window), clock);
result = gnome_panel_prepare_and_transfer(window);
gtk_container_add(GTK_CONTAINER(window),clock);
gtk_widget_show(window);
printf ("The window id is: %d\n", GDK_WINDOW_XWINDOW (clock->window));
gtk_main();
if (result){
printf ("Could not talk to the Panel: %s\n", result);
exit (1);
}
gtk_main ();
return 0;
}
......@@ -7,12 +7,13 @@
#include <config.h>
#include <string.h>
#include "gnome.h"
#include <gnome.h>
#include "panel-widget.h"
#include "panel.h"
#include "panel_config_global.h"
#include "menu.h"
#include "drawer.h"
#include "mico-glue.h"
GList *panels = NULL;
GList *applets = NULL;
......@@ -268,8 +269,9 @@ main(int argc, char **argv)
{
GtkWidget *base_panel;
char buf[256];
gnome_init("panel", &argc, &argv);
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
textdomain(PACKAGE);
......@@ -302,6 +304,9 @@ main(int argc, char **argv)
apply_global_config();
gtk_main();
printf ("starting corba looop\n");
/* I use the glue code to avoid making this a C++ file */
panel_corba_gtk_main (&argc, &argv, "IDL:GNOME/Panel:1.0");
return 0;
}
......@@ -323,7 +323,7 @@ menu_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
Menu *menu = data;
if(event->button==1) {
gtk_menu_popup(GTK_MENU(menu->menu), 0,0, menu_position,
data, event->button, time(NULL));
data, event->button, event->time);
return TRUE;
}
return FALSE;
......
#include <iostream.h>
#include <mico/gtkmico.h>
#include <mico/naming.h>
#include <gnome.h>
#include "mico-glue.h"
#include "gnome-panel.h"
/* This implements the server-side of the gnome-panel.idl
* specification Currently there is no way to create new CORBA
* "instances" of the panel, as there is only one panel running on the
* screen.
* */
class Panel_impl : virtual public GNOME::Panel_skel {
public:
void reparent_window_id (CORBA::ULong wid){
printf ("REPARENT!\n");
::reparent_window_id (wid);
}
};
void
panel_corba_gtk_main (int *argc, char ***argv, char *service_name)
{
CORBA::ORB_var orb = CORBA::ORB_init (*argc, *argv, "mico-local-orb");
CORBA::BOA_var boa = orb->BOA_init (*argc, *argv, "mico-local-boa");
GNOME::Panel_ptr acc = new Panel_impl ();
char hostname [4096];
char *name;
gethostname (hostname, sizeof (hostname));
if (hostname [0] == 0)
strcpy (hostname, "unknown-host");
name = g_copy_strings ("/CORBA-servers/Panel-", hostname,
"/DISPLAY-", getenv ("DISPLAY"), NULL);
gnome_config_set_string (name, orb->object_to_string (acc));
gnome_config_sync ();
g_free (name);
orb->dispatcher (new GtkDispatcher ());
boa->impl_is_ready (CORBA::ImplementationDef::_nil());
}
BEGIN_GNOME_DECLS
void corba_gtk_main (int *argc, char ***argv, char *service_name, void *corba_object);
void panel_corba_gtk_main (int *argc, char ***argv, char *service_name);
END_GNOME_DECLS
......@@ -10,13 +10,11 @@
#include "gnome.h"
#include "panel-widget.h"
#include "gdkextra.h"
#include "panel.h"
#include "menu.h"
#include "panel_config.h"
#include "panel_config_global.h"
#include <gdk/gdkx.h>
static GtkWidget *applet_menu;
......@@ -283,7 +281,7 @@ panel_session_save (GnomeClient *client,
g_list_foreach(panels,destroy_widget_list,NULL);
gtk_widget_unref(applet_menu);
gtk_widget_unref(panel_tooltips);
gtk_object_unref(GTK_OBJECT (panel_tooltips));
small_icons = NULL;
/*prevent searches through the g_list to speed
......@@ -490,28 +488,44 @@ add_main_menu(GtkWidget *widget, gpointer data)
create_applet("Menu",".",PANEL_UNKNOWN_APPLET_POSITION,1);
}
/*FIXME: add a function that does this, so generalize register_toy for this*/
static void
add_reparent(GtkWidget *widget, gpointer data)
void
reparent_window_id (unsigned long id)
{
int id;
GtkWidget *eb;
GdkWindow *win;
int w,h;
puts("Enter window ID to reparent:");
scanf("%d",&id);
int i;
printf ("I got this window ID to reparent: %d\n", id);
eb = gtk_event_box_new();
gtk_widget_show(eb);
win = gdk_window_foreign_new(id);
gdk_window_get_size(win,&w,&h);
gtk_widget_set_usize(eb,w,h);
gtk_widget_show (eb);
panel_widget_add(PANEL_WIDGET(panels->data), eb, 0);
gdk_window_reparent(win,eb->window,0,0);
/* We dont know why, but that is how it goes */
for (i = 0; i < 200; i++){
gdk_window_reparent(win,eb->window,0,0);
gdk_flush ();
}
gtk_widget_queue_resize (PANEL_WIDGET (panels->data));
gtk_main_iteration ();
printf ("leaving reparent\n");
}
/*FIXME: add a function that does this, so generalize register_toy for this*/
static void
add_reparent(GtkWidget *widget, gpointer data)
{
int id;
puts("Enter window ID to reparent:");
scanf("%d",&id);
reparent_window_id (id);
}
GtkWidget *
......
......@@ -84,6 +84,8 @@ void apply_global_config(void);
/*these are in main.c*/
void load_applet(char *id, char *params, int pos, int panel);
void reparent_window_id (unsigned long id);
END_GNOME_DECLS
#endif
#!/bin/sh
#
# Unifinished and for now it is not required.
#
#
#
#
#
if test x$GNOME_CORBA = x; then
echo "Error: Variable GNOME_CORBA is not set."
echo "Please set this value appropiately so that the panel and the clients can talk"
exit 1
fi
echo "Using: $GNOME_CORBA"
PANEL_CORBA_NAME="GnomePanel"
#
# The panel is a persistent server, check section 4.3.4 "Activation Modes"
# in the MICO manual.
#
exec @bindir@/corba_panel -OARemoteAddr $GNOME_IMPL_REPO_ADDR $GNOME_CORBApwd -OAImplName $PANEL_CORBA_NAME $*
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