From 348be309da1f61d4266ceb8faae2eee1ce7c2d78 Mon Sep 17 00:00:00 2001 From: daleharvey Date: Tue, 25 Jul 2006 19:18:09 +0000 Subject: [PATCH] session can be initlialised with a current document which is copied into the inkboard document --- src/jabber_whiteboard/session-manager.cpp | 62 ++++++++++++++++------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index c8b2420e6..536bc8db4 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -218,30 +218,58 @@ SessionManager::processXmppEvent(const Pedro::XmppEvent &event) void SessionManager::doShare(Glib::ustring const& to, SessionType type) { - ChooseDesktop dialog; - int result = dialog.run(); + InkboardDocument* doc; + SPDesktop* dt; - if(result == Gtk::RESPONSE_OK) + switch (type) { - InkboardDocument* doc; - SPDesktop *desktop = dialog.getDesktop(); + // Just create a new blank canvas for MUC sessions + case INKBOARD_MUC: + + dt = createInkboardDesktop(to, type); - if(desktop == NULL) - { - SPDesktop* dt = createInkboardDesktop(to, type); if (dt != NULL) { - doc = dynamic_cast< InkboardDocument* >(sp_desktop_document(dt)->rdoc); + doc = dynamic_cast< InkboardDocument* >(sp_desktop_document(dt)->rdoc); + + if (doc != NULL) + { + doc->startSessionNegotiation(); + } } - }else - { - doc = dynamic_cast< InkboardDocument* >(sp_desktop_document(desktop)->rdoc); - } + break; - if (doc != NULL) - { - doc->startSessionNegotiation(); - } + // Let the user pick the document which to start a peer ro peer session + // with, or a blank one, then create a blank document, copy over the contents + // and initialise session + case INKBOARD_PRIVATE: + default: + + ChooseDesktop dialog; + int result = dialog.run(); + + if(result == Gtk::RESPONSE_OK) + { + SPDesktop *desktop = dialog.getDesktop(); + dt = createInkboardDesktop(to, type); + + if (dt != NULL) + { + doc = dynamic_cast< InkboardDocument* >(sp_desktop_document(dt)->rdoc); + + if (doc != NULL) + { + if(desktop != NULL) + { + Inkscape::XML::Document *old_doc = sp_desktop_document(desktop)->rdoc; + doc->root()->mergeFrom(old_doc->root(),"id"); + } + + doc->startSessionNegotiation(); + } + } + } + break; } } -- 2.30.2