summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/whiteboard-sharewithchat.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-01-16 02:36:01 +0000
committermental <mental@users.sourceforge.net>2006-01-16 02:36:01 +0000
commit179fa413b047bede6e32109e2ce82437c5fb8d34 (patch)
treea5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/ui/dialog/whiteboard-sharewithchat.cpp
downloadinkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz
inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/ui/dialog/whiteboard-sharewithchat.cpp')
-rw-r--r--src/ui/dialog/whiteboard-sharewithchat.cpp147
1 files changed, 147 insertions, 0 deletions
diff --git a/src/ui/dialog/whiteboard-sharewithchat.cpp b/src/ui/dialog/whiteboard-sharewithchat.cpp
new file mode 100644
index 000000000..4c86b0dfa
--- /dev/null
+++ b/src/ui/dialog/whiteboard-sharewithchat.cpp
@@ -0,0 +1,147 @@
+/**
+ * Whiteboard share with chatroom dialog
+ *
+ * Authors:
+ * David Yip <yipdw@rose-hulman.edu>
+ * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version)
+ *
+ * Copyright (c) 2004-2005 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <glibmm/i18n.h>
+
+#include <sigc++/sigc++.h>
+#include <gtk/gtkdialog.h>
+
+#include "message-stack.h"
+#include "message-context.h"
+#include "inkscape.h"
+#include "desktop.h"
+
+#include "jabber_whiteboard/typedefs.h"
+#include "jabber_whiteboard/session-manager.h"
+#include "jabber_whiteboard/buddy-list-manager.h"
+
+#include "jabber_whiteboard/session-file-selector.h"
+
+#include "ui/dialog/whiteboard-sharewithchat.h"
+
+#include "util/ucompose.hpp"
+
+namespace Inkscape {
+
+namespace UI {
+
+namespace Dialog {
+
+WhiteboardShareWithChatroomDialog*
+WhiteboardShareWithChatroomDialog::create()
+{
+ return new WhiteboardShareWithChatroomDialogImpl();
+}
+
+WhiteboardShareWithChatroomDialogImpl::WhiteboardShareWithChatroomDialogImpl() :
+ _layout(4, 2, false)
+{
+ this->setSessionManager();
+ this->_construct();
+ this->get_vbox()->show_all_children();
+}
+
+WhiteboardShareWithChatroomDialogImpl::~WhiteboardShareWithChatroomDialogImpl()
+{
+
+}
+
+void
+WhiteboardShareWithChatroomDialogImpl::setSessionManager()
+{
+ this->_desktop = SP_ACTIVE_DESKTOP;
+ this->_sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
+
+}
+
+
+void
+WhiteboardShareWithChatroomDialogImpl::_construct()
+{
+ Gtk::VBox* main = this->get_vbox();
+
+ // Construct labels
+ this->_labels[0].set_markup_with_mnemonic(_("Chatroom _name:"));
+ this->_labels[1].set_markup_with_mnemonic(_("Chatroom _server:"));
+ this->_labels[2].set_markup_with_mnemonic(_("Chatroom _password:"));
+ this->_labels[3].set_markup_with_mnemonic(_("Chatroom _handle:"));
+
+ this->_labels[0].set_mnemonic_widget(this->_roomname);
+ this->_labels[1].set_mnemonic_widget(this->_confserver);
+ this->_labels[2].set_mnemonic_widget(this->_roompass);
+ this->_labels[3].set_mnemonic_widget(this->_handle);
+
+ // Pack table
+ this->_layout.attach(this->_labels[0], 0, 1, 0, 1);
+ this->_layout.attach(this->_labels[1], 0, 1, 1, 2);
+ this->_layout.attach(this->_labels[2], 0, 1, 2, 3);
+ this->_layout.attach(this->_labels[3], 0, 1, 3, 4);
+
+ this->_layout.attach(this->_roomname, 1, 2, 0, 1);
+ this->_layout.attach(this->_confserver, 1, 2, 1, 2);
+ this->_layout.attach(this->_roompass, 1, 2, 2, 3);
+ this->_layout.attach(this->_handle, 1, 2, 3, 4);
+
+ // Button setup and callback registration
+ this->_share.set_label(_("Connect to chatroom"));
+ this->_cancel.set_label(_("Cancel"));
+ this->_share.set_use_underline(true);
+ this->_cancel.set_use_underline(true);
+
+ this->_share.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &WhiteboardShareWithChatroomDialogImpl::_respCallback), WhiteboardShareWithChatroomDialogImpl::SHARE));
+ this->_cancel.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &WhiteboardShareWithChatroomDialogImpl::_respCallback), WhiteboardShareWithChatroomDialogImpl::CANCEL));
+
+ // Pack buttons
+ this->_buttonsbox.pack_start(this->_cancel);
+ this->_buttonsbox.pack_start(this->_share);
+
+ // Set default values
+ Glib::ustring jid = lm_connection_get_jid(this->_sm->session_data->connection);
+ Glib::ustring nick = jid.substr(0, jid.find_first_of('@'));
+ this->_handle.set_text(nick);
+ this->_roomname.set_text("inkboard");
+
+ // Pack into main box
+ main->pack_start(this->_layout);
+ main->pack_end(this->_buttonsbox);
+}
+
+void
+WhiteboardShareWithChatroomDialogImpl::_respCallback(int resp)
+{
+ switch (resp) {
+ case SHARE:
+ {
+ Glib::ustring chatroom, server, handle, password;
+ chatroom = this->_roomname.get_text();
+ server = this->_confserver.get_text();
+ password = this->_roompass.get_text();
+ handle = this->_handle.get_text();
+
+ Glib::ustring msg = String::ucompose(_("Synchronizing with chatroom <b>%1@%2</b> using the handle <b>%3</b>"), chatroom, server, handle);
+
+ this->_desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.data());
+
+ this->_desktop->whiteboard_session_manager()->sendRequestToChatroom(server, chatroom, handle, password);
+ }
+ case CANCEL:
+ default:
+ this->hide();
+ break;
+ }
+}
+
+}
+
+}
+
+}