--- /dev/null
+--- ooqstart-0.8.3.orig/Makefile
++++ ooqstart-0.8.3/Makefile
+@@ -38,7 +38,7 @@
+ $(CXX) -o $@ $^
+
+ $(GNOME_TARGET) : $(GNOME_OBJECTS)
+- $(CXX) -o $@ $^ `gnome-config --libs applets gdk_pixbuf`
++ $(CXX) -o $@ $^ `pkg-config --libs libpanelapplet-2.0`
+
+ $(KDE_TARGET) : $(KDE_OBJECTS)
+ $(CXX) -o $@ $^
+@@ -53,7 +53,7 @@
+ $(CXX) $(CFLAGS) -O2 -o $@ -c $<
+
+ gnome.o : gnome/gnome.cxx
+- $(CXX) $(CFLAGS) `gnome-config --cflags gnomeui gnorba gdk_pixbuf` -O2 -o $@ -c $<
++ $(CXX) $(CFLAGS) `pkg-config --cflags libpanelapplet-2.0` -O2 -o $@ -c $<
+
+ %.o : %.cxx
+ $(CXX) $(CFLAGS) -O2 -o $@ -c $<
+@@ -64,20 +64,14 @@
+ #####################################################################
+ ROOT=
+ PREFIX=$(ROOT)/usr
+-BIN=$(PREFIX)/bin
+ SHARE=$(PREFIX)/share
+-ETC=$(ROOT)/etc
++LIB=$(PREFIX)/lib
++LIBEXEC=$(PREFIX)/libexec
+
+ install-gnome:
+- install -D -s -m 755 $(GNOME_TARGET) $(BIN)/$(GNOME_TARGET)
+- install -D -m 644 gnome/ooqstart_applet.desktop \
+- $(SHARE)/applets/Utility/ooqstart_applet.desktop
+- install -D -m 644 ooqstart.png \
+- $(SHARE)/pixmaps/gnome-ooqstart.png
+- install -D -m 644 gnome/ooqstart_applet.gnorba \
+- $(ETC)/CORBA/servers/ooqstart_applet.gnorba
+- mkdir -p $(SHARE)/gnome/help/ooqstart_applet/C
+- install -D -m 644 help/* $(SHARE)/gnome/help/ooqstart_applet/C
++ install -D -s -m 0755 $(GNOME_TARGET) $(LIBEXEC)/ooqstart_applet2
++ install -D -m 0644 gnome/GNOME_OOQStartApplet.server \
++ $(LIB)/bonobo/servers/GNOME_OOQStartApplet.server
+
+
+ #####################################################################
+--- ooqstart-0.8.3.orig/console/console.cxx
++++ ooqstart-0.8.3/console/console.cxx
+@@ -26,12 +26,12 @@
+ ========================================================================*/
+ int main (int argc, char **argv) {
+ if (argc != 2) {
+- printf("usage: ooqstart OPENOFFICE_BASE_DIR\n");
++ printf ("usage: ooqstart OPENOFFICE_PROGRAM_PATH\n");
+ return 1;
+ }
+
+ Model model;
+- model.setOpenOfficeDir(argv[1]);
++ model.setOpenOfficeProgram (argv[1]);
+ if (!model.isValid()) {
+ printf("error: Open Office executable not found in %s\n", argv[1]);
+ return 1;
+--- ooqstart-0.8.3.orig/gnome/gnome.cxx
++++ ooqstart-0.8.3/gnome/gnome.cxx
+@@ -15,7 +15,8 @@
+ | INCLUDES
+ ========================================================================*/
+ extern "C" {
+-#include <applet-widget.h>
++#include <panel-applet.h>
++#include <gnome.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
+ #include <X11/SM/SMlib.h>
+ }
+@@ -25,12 +26,18 @@
+ #include "ooqstart-wait.xpm"
+ #include "ooqstart-off.xpm"
+
+-
+ /*=========================================================================
+ | CONSTANTS
+ ========================================================================*/
+-#define PACKAGE "gnome-applets"
++#define PACKAGE "ooqstart"
++#define GETTEXT_PACKAGE "ooqstart"
++
++#define OOFFICE_DEFAULT_PATH "/usr/bin/ooffice"
+
++#define GC_PROG_PATH "/ooqstart-applet/paths/program"
++#define GC_APPLET_ENABLE "/ooqstart-applet/prefs/enable"
++
++#define oq_debug(format, args...)
+
+ /*=========================================================================
+ | STATIC GLOBALS
+@@ -38,7 +38,6 @@
+ static GtkWidget *propwindow;
+ static GtkWidget *applet;
+ static GtkWidget *entry;
+-static GtkWidget *checkbox;
+
+ static GtkWidget *tile;
+ static GtkWidget *tilepixmap;
+@@ -51,21 +58,30 @@
+ enum IconState { ICON_NONE, ICON_OFF, ICON_WAIT, ICON_ON };
+ static IconState iconState = ICON_NONE;
+
++static Model model;
+
+ /*=========================================================================
+ | LAUNCHERS
+ ========================================================================*/
+-static void startWriter (AppletWidget *, gpointer pModel) {
+- ((Model *)pModel)->startWriter();
+-}
+-static void startCalc (AppletWidget *, gpointer pModel) {
+- ((Model *)pModel)->startCalc();
+-}
+-static void startDraw (AppletWidget *, gpointer pModel) {
+- ((Model *)pModel)->startDraw();
+-}
+-static void startImpress (AppletWidget *, gpointer pModel) {
+- ((Model *)pModel)->startImpress();
++static void startWriter (PanelApplet*) {
++ oq_debug ("Starting oowriter\n");
++ //((Model *)pModel)->startWriter();
++ model.startWriter();
++}
++static void startCalc (PanelApplet*) {
++ oq_debug ("Starting oocalc\n");
++ //((Model *)pModel)->startCalc();
++ model.startCalc();
++}
++static void startDraw (PanelApplet*) {
++ oq_debug ("Starting oodraw\n");
++ //((Model *)pModel)->startDraw();
++ model.startDraw();
++}
++static void startImpress (PanelApplet*) {
++ oq_debug ("Starting ooimpress\n");
++ //((Model *)pModel)->startImpress();
++ model.startImpress();
+ }
+
+
+@@ -108,29 +124,30 @@
+ /*=========================================================================
+ | GUI UPDATE
+ ========================================================================*/
+-static void updateGUI (Model *model) {
++static void
++updateGUI (Model* pModel) {
+ IconState state = ICON_OFF;
+
+- switch (model->getStatus()) {
++ switch (pModel->getStatus()) {
+ case MODEL_OFFICE_STOPPED: state = ICON_OFF; break;
+ case MODEL_OFFICE_STARTING: state = ICON_WAIT; break;
+ case MODEL_OFFICE_RUNNING: state = ICON_ON; break;
+ }
+
+ if (state != iconState) {
+- int panelPixelSize =
+- applet_widget_get_panel_pixel_size(APPLET_WIDGET(applet));
++ int panelPixelSize = panel_applet_get_size (PANEL_APPLET(applet));
+ gtk_widget_set_usize(tile, panelPixelSize, panelPixelSize);
+
++/* FIXME
+ bool en = (state == ICON_ON);
+- applet_widget_callback_set_sensitive(APPLET_WIDGET(applet), "sw", en);
+- applet_widget_callback_set_sensitive(APPLET_WIDGET(applet), "sc", en);
+- applet_widget_callback_set_sensitive(APPLET_WIDGET(applet), "si", en);
+- applet_widget_callback_set_sensitive(APPLET_WIDGET(applet), "sd", en);
++ applet_widget_callback_set_sensitive(PANEL_APPLET(applet), "sw", en);
++ applet_widget_callback_set_sensitive(PANEL_APPLET(applet), "sc", en);
++ applet_widget_callback_set_sensitive(PANEL_APPLET(applet), "si", en);
++ applet_widget_callback_set_sensitive(PANEL_APPLET(applet), "sd", en);
++*/
+
+- if (tilepixmap) gtk_container_remove(GTK_CONTAINER(tile), tilepixmap);
++ //if (tilepixmap) gtk_container_remove(GTK_CONTAINER(tile), tilepixmap);
+ tilepixmap = 0;
+-
+ char **pixmapData = 0;
+ switch (state) {
+ case ICON_OFF: pixmapData = ooqstart_off_xpm; break;
+@@ -143,12 +160,13 @@
+ tilepixmap = create_pixmap(GTK_WIDGET(tile), pixmapData,
+ panelPixelSize, panelPixelSize);
+ }
+-
++
++/*
+ if (tilepixmap) {
+ gtk_widget_show(tilepixmap);
+ gtk_container_add(GTK_CONTAINER(tile), tilepixmap);
+ }
+-
++*/
+ iconState = state;
+ }
+ }
+@@ -264,8 +282,8 @@
+ gtk_idle_add(makeRequest, data);
+ }
+
+-
+-static void disableSessionManagement (Model *model) {
++static void
++disableSessionManagement (Model* pModel) {
+ // This is tricky because the X11 SM works on a callback
+ // basis. Essentially, what this function does is
+ // request all of the session manager's properties.
+@@ -278,8 +296,13 @@
+ // session management for the program.
+ SmProp *props[1];
+ props[0] = mkSmProp(GsmCommand, GsmSelectClientEvents);
++ // MECHANIX: g_usleep (G_USEC_PER_SEC * 10);
+ SmcSetProperties((SmcConn)client->smc_conn, 1, &props[0]);
+- gtk_idle_add(makeRequest, model);
++ /* MECHANIX: if (true) {
++ g_printerr ("debug return\n");
++ return;
++ }*/
++ gtk_idle_add (makeRequest, pModel);
+ }
+
+ static gint makeRequest (gpointer data) {
+@@ -291,23 +290,14 @@
+ /*=========================================================================
+ | LOAD / SAVE CONFIGURATION
+ ========================================================================*/
+-static void loadConfig (char *cfgpath, Model *model) {
+- gnome_config_push_prefix(cfgpath);
+-
+- model->setOpenOfficeDir(gnome_config_get_string("ooqstart/openoffice"));
+- if (gnome_config_get_bool("ooqstart/enable=false"))
+- model->enable();
+- else
+- model->disable();
+-
+- gnome_config_pop_prefix();
++static void
++loadConfig (Model* pModel) {
++ pModel->setOpenOfficeProgram (gnome_config_get_string (GC_PROG_PATH "=" OOFFICE_DEFAULT_PATH));
+ }
+
+-static void saveConfig (char *cfgpath, Model *model) {
+- gnome_config_push_prefix(cfgpath);
+- gnome_config_set_string("ooqstart/openoffice", model->getOpenOfficeDir());
+- gnome_config_set_bool("ooqstart/enable", model->getEnabled());
+- gnome_config_pop_prefix();
++static void
++saveConfig (Model* pModel) {
++ gnome_config_set_string (GC_PROG_PATH, pModel->getOpenOfficeProgram());
+
+ gnome_config_sync();
+ }
+@@ -320,64 +310,55 @@
+ {
+ if (propwindow == 0) return;
+
+- Model *model = (Model *)data;
++ Model* pModel = (Model*) data;
+
+- // Get the status of the checkbox
+- bool enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));
+-
+ // Check to see if the given path is valid
+- model->setOpenOfficeDir(gtk_entry_get_text(GTK_ENTRY(entry)));
+- if (!model->isValid()) {
+- GtkWidget *dialog = gnome_message_box_new
+- (_("Open Office was not found in the given path.\n"
+- "The QuickStarter applet will be disabled.\n"),
+- GNOME_MESSAGE_BOX_WARNING,
+- GNOME_STOCK_BUTTON_OK,
+- 0);
+- gnome_dialog_run(GNOME_DIALOG(dialog));
++ pModel->setOpenOfficeProgram (gtk_entry_get_text (GTK_ENTRY (entry)));
++ if (!pModel->isValid()) {
++ GtkWidget* dialog = gtk_message_dialog_new (NULL,
++ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
++ GTK_BUTTONS_CLOSE,
++ _("OpenOffice.org was not found in the given path.\n"
++ "The QuickStarter applet will be disabled.\n"));
++ gtk_dialog_run (GTK_DIALOG (dialog));
++ gtk_widget_destroy (dialog);
+
+- // Disable the quick starter
+- enable = false;
+ }
+
+- if (enable)
+- model->enable();
+- else
+- model->disable();
+-
+- saveConfig(APPLET_WIDGET(applet)->privcfgpath, model);
+- applet_widget_sync_config(APPLET_WIDGET(applet));
++ saveConfig (pModel);
++/* FIXME: applet_widget_sync_config(PANEL_APPLET(applet)); */
+ propwindow = 0;
+ }
+
+-static void showHelp (AppletWidget *, gpointer) {
+- GnomeHelpMenuEntry entry = { "ooqstart_applet", "index.html" };
+- gnome_help_display(0, &entry);
+-}
+
+ static gint propDestroy (GtkWidget *, gpointer) {
+ return 0;
+ }
+
+-static void properties (AppletWidget *, gpointer pModel) {
+- Model *model = (Model *)pModel;
+-
+- propwindow = gnome_property_box_new();
+- gtk_window_set_title
+- (GTK_WINDOW(&GNOME_PROPERTY_BOX(propwindow)->dialog.window),
+- _("Open Office QuickStarter Applet Settings"));
++static void
++properties (PanelApplet*) {
++ Model* pModel = (Model*) &model;
++
++ if (!pModel) {
++ return;
++ }
++
++ propwindow = gnome_property_box_new();
++ gtk_window_set_title (GTK_WINDOW (&GNOME_PROPERTY_BOX (propwindow)->dialog.window),
++ _("OpenOffice.org QuickStarter Settings"));
+
+ GtkWidget *vbox = gtk_vbox_new(FALSE, GNOME_PAD_SMALL);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), GNOME_PAD_SMALL);
+
+ GtkWidget *label = gtk_label_new
+- (_("Full path to Open Office or Star Office base directory:"));
++ (_("Full path to the OpenOffice.org or StarOffice application:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show(label);
+
+ entry = gtk_entry_new();
+- gtk_entry_set_text(GTK_ENTRY(entry), model->getOpenOfficeDir());
++ const gchar* prog = pModel->getOpenOfficeProgram();
++ gtk_entry_set_text (GTK_ENTRY (entry), prog);
+ gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
+ GTK_WIDGET_SET_FLAGS(entry, GTK_CAN_FOCUS);
+ gtk_signal_connect_object
+@@ -391,17 +375,6 @@
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show(label);
+
+- checkbox = gtk_check_button_new_with_label
+- (_("Enable QuickStarter"));
+- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
+- model->getEnabled());
+- gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0);
+- gtk_signal_connect_object
+- (GTK_OBJECT(checkbox), "clicked",
+- GTK_SIGNAL_FUNC(gnome_property_box_changed),
+- GTK_OBJECT(propwindow));
+- gtk_widget_show(checkbox);
+-
+ label = gtk_label_new(_("General"));
+ gnome_property_box_append_page
+ (GNOME_PROPERTY_BOX(propwindow), vbox, label);
+@@ -404,27 +404,29 @@
+ GTK_SIGNAL_FUNC(propApply), pModel);
+ gtk_signal_connect(GTK_OBJECT(propwindow), "destroy",
+ GTK_SIGNAL_FUNC(propDestroy), 0);
+- gtk_signal_connect(GTK_OBJECT(propwindow), "help",
+- GTK_SIGNAL_FUNC(showHelp), 0);
+ gtk_widget_show_all(propwindow);
+ }
+
+-static void about (AppletWidget *, gpointer) {
++static void about (PanelApplet*, gpointer) {
+ static GtkWidget *about = 0;
+
+ if (about == 0) {
+ const gchar *authors[4];
+ authors[0] = _("Kumaran Santhanam <kumaran@alumni.stanford.org>");
+- authors[1] = 0;
++ authors[1] = _("Filip Van Raemdonck <mechanix@debian.org>");
++ authors[2] = 0;
+
+ about = gnome_about_new
+ ( _("Open Office QuickStarter Applet"), VERSION,
+- _("(C) 2002 Kumaran Santhanam"), authors,
++ _("(C) 2002 Kumaran Santhanam\n 2003 Filip Van Raemdonck"),
+ _("Quick starter launch applet for Open Office 641C+ "
+ "and Star Office 6.0+.\n"
+ "Right-click on the applet icon for a context menu.\n"
+ " \n"
+ "Released under the GNU General Public License v2."),
++ authors,
++ NULL, /* documenters */
++ NULL, /* translators */
+ 0);
+
+ gtk_signal_connect(GTK_OBJECT(about), "destroy",
+@@ -445,33 +471,14 @@
+
+
+ /*=========================================================================
+-| MENUS
+- ========================================================================*/
+-static void menuItem (GtkWidget *applet,
+- char *name, char *text, char *stock,
+- void (*func) (AppletWidget *, gpointer),
+- Model *model)
+-{
+- if (stock == 0)
+- applet_widget_register_callback
+- (APPLET_WIDGET(applet), name, _(text), func, model);
+- else
+- applet_widget_register_stock_callback
+- (APPLET_WIDGET(applet), name, stock, _(text), func, model);
+-}
+-
+-static void tileClicked (GtkWidget *w, gpointer data) {
+- about((AppletWidget *)data, 0);
+-}
+-
+-
+-/*=========================================================================
+ | BACKGROUND TIMER
+ ========================================================================*/
+-static gint timeoutFunc (gpointer pModel) {
+- Model *model = (Model *)pModel;
+- model->process();
+- updateGUI(model);
++static gint
++timeoutFunc (gpointer data) {
++ g_assert (data);
++ Model* pModel = (Model*) data;
++ pModel->process();
++ updateGUI (pModel);
+ return TRUE;
+ }
+
+@@ -484,10 +491,11 @@
+ updateGUI((Model *)data);
+ }
+
+-static gint saveSession (GtkWidget *applet, gchar *privcfgpath,
++static gint saveSession (GtkWidget *applet,
+ gchar *globcfgpath, gpointer data)
+ {
+- saveConfig(privcfgpath, (Model *)data);
++ oq_debug ("saveSession (..., globcfgpath = %s, ...)\n", globcfgpath);
++ saveConfig((Model *)data);
+ gnome_config_drop_all();
+ return FALSE;
+ }
+@@ -507,77 +489,96 @@
+
+
+ /*=========================================================================
+-| MAIN PROGRAM
++| MENUS
+ ========================================================================*/
+-int main (int argc, char **argv)
+-{
+- // Initialize the i18n stuff
+- (void)bindtextdomain(PACKAGE, GNOMELOCALEDIR);
+- (void)textdomain(PACKAGE);
+-
+- // intialize, this will basically set up the applet, corba and
+- // call gnome_init
+- applet_widget_init("ooqstart_applet", VERSION, argc, argv, NULL, 0, NULL);
+-
+- // create a new applet_widget
+- applet = applet_widget_new("ooqstart_applet");
+-
+- // in the rare case that the communication with the panel
+- // failed, error out
+- if (!applet) g_error("Can't create applet!\n");
++static void tileClicked (GtkWidget *w, gpointer data) {
++ about((PanelApplet*)data, 0);
++}
+
+- // Get a GNOME client connected to the session manager
+- client = gnome_client_new();
+- gnome_client_connect(client);
++static const gchar ooqstart_menu_xml [] =
++ "<popup name=\"button3\">\n"
++ " <menuitem name=\"sw\" verb=\"OOQStartWriter\" _label=\"New _Text Document\"\n"
++ " pixtype=\"filename\" pixname=\"/usr/share/pixmaps/ximian-openoffice-writer.png\"/>"
++ " <menuitem name=\"sc\" verb=\"OOQStartCalc\" _label=\"New _Spreadsheet\"\n"
++ " pixtype=\"filename\" pixname=\"/usr/share/pixmaps/ximian-openoffice-calc.png\"/>"
++ " <menuitem name=\"si\" verb=\"OOQStartImpress\" _label=\"New _Presentation\"\n"
++ " pixtype=\"filename\" pixname=\"/usr/share/pixmaps/ximian-openoffice-impress.png\"/>"
++ " <menuitem name=\"sd\" verb=\"OOQStartDraw\" _label=\"New _Drawing\"\n"
++ " pixtype=\"filename\" pixname=\"/usr/share/pixmaps/ximian-openoffice-draw.png\"/>"
++ " <menuitem name=\"props\" verb=\"OOQPrefs\" _label=\"Pre_ferences\"\n"
++ " pixtype=\"stock\" pixname=\"gtk-properties\"/>\n"
++ " <menuitem name=\"about\" verb=\"OOQAbout\" _label=\"_About\"\n"
++ " pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
++ "</popup>\n";
+
+- // create the widget we are going to put on the applet
+- tile = gtk_button_new();
+- gtk_button_set_relief(GTK_BUTTON(tile), GTK_RELIEF_NONE);
+- GTK_WIDGET_UNSET_FLAGS(tile, GTK_CAN_FOCUS);
+- gtk_widget_show(tile);
+- gtk_signal_connect(GTK_OBJECT(tile), "clicked",
+- GTK_SIGNAL_FUNC(tileClicked), applet);
+-
+- // add the widget to the applet-widget, and thereby actually
+- // putting it "onto" the panel
+- applet_widget_add(APPLET_WIDGET(applet), tile);
+- gtk_widget_show(applet);
++/*=========================================================================
++| MAIN PROGRAM
++ ========================================================================*/
++static gboolean
++ooqstart_applet_new (PanelApplet* papplet) {
++ oq_debug ("Creating new applet");
++
++
++ applet = GTK_WIDGET (papplet);
++
++ GtkWidget* img = gtk_image_new_from_file ("/usr/share/pixmaps/gnome-ooqstart.png");
++ tile = gtk_event_box_new();
++ gtk_container_add (GTK_CONTAINER (tile), img);
++ gtk_container_add (GTK_CONTAINER (applet), tile);
++
++ gtk_widget_show_all(applet);
++
++ const BonoboUIVerb ooqstart_menu_verbs[] = {
++ BONOBO_UI_UNSAFE_VERB ("OOQStartWriter", startWriter),
++ BONOBO_UI_UNSAFE_VERB ("OOQStartCalc", startCalc),
++ BONOBO_UI_UNSAFE_VERB ("OOQStartImpress", startImpress),
++ BONOBO_UI_UNSAFE_VERB ("OOQStartDraw", startDraw),
++ BONOBO_UI_UNSAFE_VERB ("OOQPrefs", properties),
++ BONOBO_UI_UNSAFE_VERB ("OOQAbout", about),
++ BONOBO_UI_VERB_END
++ };
+
+- // initialize the model
+- Model model;
++ panel_applet_setup_menu (PANEL_APPLET (applet), ooqstart_menu_xml, ooqstart_menu_verbs, tile);
+
+ // connect the applet callbacks
+- gtk_signal_connect(GTK_OBJECT(applet), "change_pixel_size",
+- GTK_SIGNAL_FUNC(resizeApplet), &model);
+- gtk_signal_connect(GTK_OBJECT(applet), "save_session",
+- GTK_SIGNAL_FUNC(saveSession), &model);
+- gtk_signal_connect(GTK_OBJECT(applet), "destroy",
+- GTK_SIGNAL_FUNC(destroyApplet), &model);
+-
+- // add the items to the applet menu
+- menuItem(applet, "props", "Properties...",
+- GNOME_STOCK_PIXMAP_PROPERTIES,
+- properties, &model);
+- menuItem(applet, "about", "About...",
+- GNOME_STOCK_PIXMAP_ABOUT,
+- about, 0);
+- menuItem(applet, "help", "Help",
+- GNOME_STOCK_PIXMAP_HELP,
+- showHelp, 0);
+-
+- char *icon = 0;
+- menuItem(applet, "sw", "New Text Document", icon, startWriter, &model);
+- menuItem(applet, "sc", "New Spreadsheet", icon, startCalc, &model);
+- menuItem(applet, "si", "New Presentation", icon, startImpress, &model);
+- menuItem(applet, "sd", "New Drawing", icon, startDraw, &model);
++ if (false) {
++ g_signal_connect (G_OBJECT (tile), "clicked", G_CALLBACK (tileClicked), applet);
++ g_signal_connect (G_OBJECT (applet), "change_pixel_size", G_CALLBACK (resizeApplet), &model);
++ g_signal_connect (G_OBJECT (applet), "save_session", G_CALLBACK (saveSession), &model);
++ g_signal_connect (G_OBJECT (applet), "destroy", G_CALLBACK (destroyApplet), &model);
++ }
++
++ loadConfig (&model);
++ oq_debug ("%s\n", model.getOpenOfficeProgram());
+
+- loadConfig(APPLET_WIDGET(applet)->privcfgpath, &model);
++ // Get a GNOME client connected to the session manager
++ client = gnome_client_new();
++ gnome_client_connect(client);
++ gnome_client_flush(client);
+
+ // install appropriate handlers
+- disableSessionManagement(&model);
+- timeout = gtk_timeout_add(250, timeoutFunc, (gpointer)&model);
++ disableSessionManagement (&model);
++ timeout = gtk_timeout_add (250, timeoutFunc, (gpointer) &model);
+
+- // special corba main loop
+- applet_widget_gtk_main();
+- return 0;
++ return TRUE;
+ }
++
++static gboolean
++ooqstart_applet_factory (PanelApplet* papplet,
++ const gchar* iid, gpointer data) {
++ oq_debug ("Factory called");
++
++ if (strcmp (iid, "OAFIID:GNOME_OOQStartApplet")) {
++ g_printerr ("Returning FALSE");
++ return FALSE;
++ }
++
++ return ooqstart_applet_new (papplet);
++}
++
++PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_OOQStartApplet_Factory",
++ PANEL_TYPE_APPLET,
++ "OOoQStartApplet",
++ "0",
++ ooqstart_applet_factory,
++ NULL)
+
+--- ooqstart-0.8.3.orig/gnome/GNOME_OOQStartApplet.server
++++ ooqstart-0.8.3/gnome/GNOME_OOQStartApplet.server
+@@ -0,0 +1,35 @@
++<oaf_info>
++
++<oaf_server iid="OAFIID:GNOME_OOQStartApplet_Factory"
++ type="exe"
++ location="/usr/libexec/ooqstart_applet2">
++
++ <oaf_attribute name="repo_ids" type="stringv">
++ <item value="IDL:Bonobo/GenericFactory:1.0"/>
++ <item value="IDL:Bonobo/Unknown:1.0"/>
++ </oaf_attribute>
++ <oaf_attribute name="name" type="string" value="OOoQStartApplet"/>
++ <oaf_attribute name="description" type="string" value="Factory for OpenOffice.org quickstart applet"/>
++
++</oaf_server>
++
++<oaf_server iid="OAFIID:GNOME_OOQStartApplet"
++ type="factory"
++ location="OAFIID:GNOME_OOQStartApplet_Factory">
++
++ <oaf_attribute name="repo_ids" type="stringv">
++ <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
++ <item value="IDL:Bonobo/Control:1.0"/>
++ <item value="IDL:Bonobo/Unknown:1.0"/>
++ </oaf_attribute>
++ <oaf_attribute name="name" type="string" value="OpenOffice.org QuickStarter"/>
++ <oaf_attribute name="name-nl" type="string" value="OpenOffice.org SnelStarter"/>
++ <oaf_attribute name="description" type="string" value="Preload OpenOffice.org for rapid launching"/>
++ <oaf_attribute name="description-nl" type="string" value="Laad OpenOffice.org vast in om het snel te starten"/>
++ <oaf_attribute name="panel:category" type="string" value="Accessories"/>
++ <oaf_attribute name="panel:category-nl" type="string" value="Accessoires"/>
++ <oaf_attribute name="panel:icon" type="string" value="gnome-ooqstart.png"/>
++
++</oaf_server>
++
++</oaf_info>
+--- ooqstart-0.8.3.orig/help/index.html
++++ ooqstart-0.8.3/help/index.html
+@@ -25,7 +25,7 @@
+ Public License v2, though any later version of the license
+ may be used at your option.
+
+-<p> For more information, please see the <a href="license.txt">full
++<p> For more information, please see the <a href="/usr/share/common-licenses/GPL">full
+ text</a> of the license. Further details can be found at the
+ <a href="http://www.gnu.org/">GNU Project Homepage</a>.
+
+--- ooqstart-0.8.3.orig/model.cxx
++++ ooqstart-0.8.3/model.cxx
+@@ -2,6 +2,7 @@
+ | Open Office QuickStarter
+ |--------------------------------------------------------------------------
+ | (c) 2002 Kumaran Santhanam <kumaran@alumni.stanford.org>
++| 2003 Filip Van Raemdonck <mechanix@debian.org>
+ |
+ | This project is released under the GNU General Public License.
+ | Please see the file COPYING for more details.
+@@ -18,7 +19,6 @@
+ static const int MIN_TIME = 2; // seconds
+
+ static const char *BIN_SH = "/bin/sh";
+-static const char *SOFFICE = "program/soffice";
+ static const char *SWRITER = "private:factory/swriter";
+ static const char *SCALC = "private:factory/scalc";
+ static const char *SDRAW = "private:factory/sdraw";
+@@ -66,7 +66,10 @@
+ signal(SIGCHLD, sigchld);
+
+ // Fork and return the child's process ID
+- if ((pid = fork()) != 0) return pid;
++ if ((pid = fork()) != 0) {
++ //fprintf (stderr, "fork pid %d\n", pid);
++ return pid;
++ }
+
+ // Child process execution point
+ execl(path, path, arg1, arg2, arg3, 0);
+@@ -72,7 +72,7 @@
+ }
+
+ // Child process execution point
+- execl(path, path, arg1, arg2, arg3, 0);
++ execlp(arg1,arg1, arg2, arg3, 0);
+
+ // Execution should never reach this point.
+ // If it does, there was an error.
+@@ -95,17 +95,15 @@
+ | CONSTRUCTOR / DESTRUCTOR
+ ========================================================================*/
+ Model::Model () {
+- _enabled = false;
++ _enabled = true;
+ _daemonPID = 0;
+ _tick = 0;
+ _status = MODEL_OFFICE_STOPPED;
+- _sofficeDir = 0;
+ _soffice = 0;
+ }
+
+ Model::~Model () {
+ stopProcess(_daemonPID);
+- if (_sofficeDir) free(_sofficeDir);
+ if (_soffice) free(_soffice);
+ }
+
+@@ -113,32 +114,25 @@
+ /*=========================================================================
+ | OPEN OFFICE DIRECTORY
+ ========================================================================*/
+-// Sets the open office directory if the path is valid
+-void Model::setOpenOfficeDir (const char *dir) {
+- char path[1024];
+-
+- if (dir == 0) dir = "";
+- sprintf(path, "%s/%s", dir, SOFFICE);
+-
+- // Free the memory used by the previous path
+- if (_soffice) free(_soffice);
+- _soffice = 0;
+-
++/* Sets the OpenOffice.org location if the path is valid */
++void
++Model::setOpenOfficeProgram (const char* path) {
+ // Stat the path to see if it really exists
++ fprintf (stderr, "_soffice: %s\nnew path: %s\n", _soffice, path);
+ struct stat buf;
+ stat(path, &buf);
+ if (S_ISREG(buf.st_mode)) {
++ if (_soffice) {
++ free (_soffice);
++ }
+ _soffice = strdup(path);
+- }
++ fprintf (stderr, "_soffice: %s\n", _soffice);
+
+- // Save away the directory
+- if (_sofficeDir) free(_sofficeDir);
+- _sofficeDir = strdup(dir);
+-
+- // Make sure to stop the current running process
+- stopProcess(_daemonPID);
+- _daemonPID = 0;
+- _tick = time(0);
++ /* Make sure to stop the current running process */
++ stopProcess (_daemonPID);
++ _daemonPID = 0;
++ _tick = time (0);
++ }
+ }
+
+
+@@ -171,6 +165,7 @@
+ _status = MODEL_OFFICE_STARTING;
+ _tick = time(0);
+ }
++ //fprintf (stderr, "started _daemonPID %d\n", _daemonPID);
+ }
+
+ // If the quickstarter is disabled, terminate the
+@@ -186,11 +181,24 @@
+ /*=========================================================================
+ | LAUNCHERS
+ ========================================================================*/
+-#define START_APP(app) \
+- if (isRunning(_daemonPID) && _soffice != 0) \
+- { startProcess(BIN_SH, _soffice, app, 0); }
+-
+-void Model::startWriter () const { START_APP(SWRITER); }
+-void Model::startCalc () const { START_APP(SCALC); }
+-void Model::startDraw () const { START_APP(SDRAW); }
+-void Model::startImpress () const { START_APP(SIMPRESS); }
++void
++Model::startApp (const char* app) {
++ fprintf (stderr, "starting app %s\n", app);
++
++ if (_daemonPID) {
++ fprintf (stderr, "checking _daemonPID %d\n", _daemonPID);
++ int result = waitpid (_daemonPID, 0, WNOHANG);
++ if (result < 0 && errno == ECHILD) {
++ fprintf (stderr, "_daemonPid %d, waitpid %d, ECHILD %d\n", _daemonPID, result, (errno == ECHILD));
++ return;
++ } else if (_soffice) {
++ startProcess (BIN_SH, _soffice, app, 0);
++ }
++ }
++}
++
++void Model::startWriter (void) { startApp (SWRITER); }
++void Model::startCalc (void) { startApp (SCALC); }
++void Model::startDraw (void) { startApp (SDRAW); }
++void Model::startImpress (void) { startApp (SIMPRESS); }
++
+--- ooqstart-0.8.3.orig/model.h
++++ ooqstart-0.8.3/model.h
+@@ -2,6 +2,7 @@
+ | Open Office QuickStarter
+ |--------------------------------------------------------------------------
+ | (c) 2002 Kumaran Santhanam <kumaran@alumni.stanford.org>
++| 2003 Filip Van Raemdonck <mechanix@debian.org>
+ |
+ | This project is released under the GNU General Public License.
+ | Please see the file COPYING for more details.
+@@ -39,10 +40,7 @@
+ Model ();
+ ~Model ();
+
+- void setOpenOfficeDir (const char *dir);
+- const char *getOpenOfficeDir () const {
+- return _sofficeDir;
+- }
++ void setOpenOfficeProgram (const char*);
+ const char *getOpenOfficeProgram () const {
+ return _soffice;
+ }
+@@ -57,11 +55,12 @@
+ void process ();
+ ModelStatus getStatus () const { return _status; }
+
+- void startWriter () const;
+- void startCalc () const;
+- void startDraw () const;
+- void startImpress () const;
++ void startApp (const char*);
+
++ void startWriter (void);
++ void startCalc (void);
++ void startDraw (void);
++ void startImpress (void);
+
+ private:
+ bool _enabled;
+@@ -69,9 +68,7 @@
+ time_t _tick;
+ ModelStatus _status;
+
+- char *_sofficeDir;
+ char *_soffice;
+ };
+
+-
+ #endif