~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/ui/dialog/whiteboard-sharewithchat.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * Whiteboard share with chatroom dialog
3
 
 *
4
 
 * Authors:
5
 
 * David Yip <yipdw@rose-hulman.edu>
6
 
 * Jason Segal, Jonas Collaros, Stephen Montgomery, Brandi Soggs, Matthew Weinstock (original C/Gtk version)
7
 
 *
8
 
 * Copyright (c) 2004-2005 Authors
9
 
 *
10
 
 * Released under GNU GPL, read the file 'COPYING' for more information
11
 
 */
12
 
 
13
 
#include <glibmm/i18n.h>
14
 
 
15
 
#include <sigc++/sigc++.h>
16
 
#include <gtk/gtkdialog.h>
17
 
 
18
 
#include "message-stack.h"
19
 
#include "message-context.h"
20
 
#include "inkscape.h"
21
 
#include "desktop.h"
22
 
 
23
 
#include "prefs-utils.h"
24
 
 
25
 
#include "jabber_whiteboard/typedefs.h"
26
 
#include "jabber_whiteboard/session-manager.h"
27
 
#include "jabber_whiteboard/buddy-list-manager.h"
28
 
 
29
 
#include "jabber_whiteboard/session-file-selector.h"
30
 
 
31
 
#include "ui/dialog/whiteboard-sharewithchat.h"
32
 
 
33
 
#include "util/ucompose.hpp"
34
 
 
35
 
namespace Inkscape {
36
 
 
37
 
namespace UI {
38
 
 
39
 
namespace Dialog {
40
 
 
41
 
WhiteboardShareWithChatroomDialog* 
42
 
WhiteboardShareWithChatroomDialog::create()
43
 
{
44
 
        return new WhiteboardShareWithChatroomDialogImpl();
45
 
}
46
 
 
47
 
WhiteboardShareWithChatroomDialogImpl::WhiteboardShareWithChatroomDialogImpl() :
48
 
        _layout(4, 2, false)
49
 
{
50
 
        this->setSessionManager();
51
 
        this->_construct();
52
 
        this->get_vbox()->show_all_children();
53
 
}
54
 
 
55
 
WhiteboardShareWithChatroomDialogImpl::~WhiteboardShareWithChatroomDialogImpl()
56
 
{
57
 
 
58
 
}
59
 
 
60
 
void
61
 
WhiteboardShareWithChatroomDialogImpl::setSessionManager()
62
 
{
63
 
        this->_desktop = SP_ACTIVE_DESKTOP;
64
 
        this->_sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
65
 
 
66
 
}
67
 
 
68
 
 
69
 
void
70
 
WhiteboardShareWithChatroomDialogImpl::_construct()
71
 
{
72
 
        Gtk::VBox* main = this->get_vbox();
73
 
 
74
 
        // Construct labels
75
 
        this->_labels[0].set_markup_with_mnemonic(_("Chatroom _name:"));
76
 
        this->_labels[1].set_markup_with_mnemonic(_("Chatroom _server:"));
77
 
        this->_labels[2].set_markup_with_mnemonic(_("Chatroom _password:"));
78
 
        this->_labels[3].set_markup_with_mnemonic(_("Chatroom _handle:"));
79
 
 
80
 
        this->_labels[0].set_mnemonic_widget(this->_roomname);
81
 
        this->_labels[1].set_mnemonic_widget(this->_confserver);
82
 
        this->_labels[2].set_mnemonic_widget(this->_roompass);
83
 
        this->_labels[3].set_mnemonic_widget(this->_handle);
84
 
 
85
 
 
86
 
        this->_roomname.set_text(prefs_get_string_attribute("whiteboard.room", "name"));
87
 
        this->_confserver.set_text(prefs_get_string_attribute("whiteboard.room", "server"));
88
 
        this->_handle.set_text(prefs_get_string_attribute("whiteboard.server", "username"));
89
 
 
90
 
        // Pack table
91
 
        this->_layout.attach(this->_labels[0], 0, 1, 0, 1);
92
 
        this->_layout.attach(this->_labels[1], 0, 1, 1, 2);
93
 
        this->_layout.attach(this->_labels[2], 0, 1, 2, 3);
94
 
        this->_layout.attach(this->_labels[3], 0, 1, 3, 4);
95
 
 
96
 
        this->_layout.attach(this->_roomname, 1, 2, 0, 1);
97
 
        this->_layout.attach(this->_confserver, 1, 2, 1, 2);
98
 
        this->_layout.attach(this->_roompass, 1, 2, 2, 3);
99
 
        this->_layout.attach(this->_handle, 1, 2, 3, 4);
100
 
 
101
 
        // Button setup and callback registration
102
 
        this->_share.set_label(_("Connect to chatroom"));
103
 
        this->_cancel.set_label(_("Cancel"));
104
 
        this->_share.set_use_underline(true);
105
 
        this->_cancel.set_use_underline(true);
106
 
 
107
 
        this->_share.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &WhiteboardShareWithChatroomDialogImpl::_respCallback), WhiteboardShareWithChatroomDialogImpl::SHARE));
108
 
        this->_cancel.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &WhiteboardShareWithChatroomDialogImpl::_respCallback), WhiteboardShareWithChatroomDialogImpl::CANCEL));
109
 
 
110
 
        // Pack buttons
111
 
        this->_buttonsbox.pack_start(this->_cancel);
112
 
        this->_buttonsbox.pack_start(this->_share);
113
 
 
114
 
        // Set default values
115
 
        Glib::ustring jid = this->_sm->session_data->jid;
116
 
        Glib::ustring nick = jid.substr(0, jid.find_first_of('@'));
117
 
        this->_handle.set_text(nick);
118
 
        this->_roomname.set_text("inkboard");
119
 
 
120
 
        // Pack into main box
121
 
        main->pack_start(this->_layout);
122
 
        main->pack_end(this->_buttonsbox);
123
 
}
124
 
 
125
 
void
126
 
WhiteboardShareWithChatroomDialogImpl::_respCallback(int resp)
127
 
{
128
 
        switch (resp) {
129
 
                case SHARE:
130
 
                {
131
 
                        Glib::ustring chatroom, server, handle, password;
132
 
                        chatroom = this->_roomname.get_text();
133
 
                        server = this->_confserver.get_text();
134
 
                        password = this->_roompass.get_text();
135
 
                        handle = this->_handle.get_text();
136
 
 
137
 
                        Glib::ustring msg = String::ucompose(_("Synchronizing with chatroom <b>%1@%2</b> using the handle <b>%3</b>"), chatroom, server, handle);
138
 
 
139
 
                        this->_desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.data());
140
 
 
141
 
                        this->_desktop->whiteboard_session_manager()->sendRequestToChatroom(server, chatroom, handle, password);
142
 
                }
143
 
                case CANCEL:
144
 
                default:
145
 
                        this->hide();
146
 
                        break;
147
 
        }
148
 
}
149
 
 
150
 
}
151
 
 
152
 
}
153
 
 
154
 
}