Changeset 3d3692a5077fa50f51604e7957b820667351de92
- Timestamp:
- 01/06/07 23:44:02 (6 years ago)
- Parents:
- c22e31bfd4133f8ff54382f2144309a4df2cf1a8
- Children:
- e1a4ceb7c162cd72af08edb9038ece416f06f399
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:44:02Z+0000
- Files:
-
- 4 modified
-
inc/joindialog.hpp (modified) (2 diffs)
-
inc/window.hpp (modified) (2 diffs)
-
src/joindialog.cpp (modified) (4 diffs)
-
src/window.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inc/joindialog.hpp
r1d335d3 r3d3692a 57 57 #endif 58 58 59 #ifndef WITH_HOWL 60 JoinDialog(Gtk::Window& parent, Gobby::Config& config); 61 #else 59 62 JoinDialog(Gtk::Window& parent, Gobby::Config& config, 60 void* zeroconf = NULL); 63 obby::zeroconf* zeroconf); 64 #endif 61 65 virtual ~JoinDialog(); 62 66 … … 97 101 Glib::RefPtr<Gtk::ListStore> m_session_list; 98 102 Columns m_session_cols; 99 obby::zeroconf &m_zeroconf;103 obby::zeroconf* m_zeroconf; 100 104 sigc::connection m_timer_connection; 101 105 #endif -
inc/window.hpp
rc22e31b r3d3692a 109 109 void save_local_file(Document& doc, const Glib::ustring& file); 110 110 void close_document(DocWindow& doc); 111 void display_error(const Glib::ustring& message); 111 void display_error(const Glib::ustring& message, 112 const Gtk::MessageType type = Gtk::MESSAGE_ERROR); 112 113 113 114 // Config … … 139 140 std::auto_ptr<obby::local_buffer> m_buffer; 140 141 #ifdef WITH_HOWL 141 obby::zeroconfm_zeroconf;142 std::auto_ptr<obby::zeroconf> m_zeroconf; 142 143 #endif 143 144 sigc::connection m_timer_conn; -
src/joindialog.cpp
r0f87c1f r3d3692a 31 31 #endif 32 32 33 #ifndef WITH_HOWL 34 Gobby::JoinDialog::JoinDialog(Gtk::Window& parent, Gobby::Config& config) 35 #else 33 36 Gobby::JoinDialog::JoinDialog(Gtk::Window& parent, Gobby::Config& config, 34 void* zeroconf) 37 obby::zeroconf* zeroconf) 38 #endif 35 39 : DefaultDialog(_("Join obby session"), parent, true, true), 36 40 m_config(config), … … 41 45 m_lbl_color(_("Colour:"), Gtk::ALIGN_RIGHT) 42 46 #ifdef WITH_HOWL 43 , m_ep_discover(_("Local network")), 44 m_zeroconf(*static_cast<obby::zeroconf*>(zeroconf)) 47 , m_ep_discover(_("Local network")), m_zeroconf(zeroconf) 45 48 #endif 46 49 { … … 90 93 91 94 #ifdef WITH_HOWL 92 m_session_list = Gtk::ListStore::create(m_session_cols); 93 m_session_view.set_model(m_session_list); 94 m_session_view.append_column(_("User"), m_session_cols.name); 95 m_session_view.append_column(_("Host"), m_session_cols.host); 96 m_session_view.append_column(_("Port"), m_session_cols.port); 97 m_session_view.get_selection()->set_mode( 98 Gtk::SELECTION_SINGLE); 99 m_session_view.get_selection()->signal_changed().connect( 100 sigc::mem_fun(*this, &JoinDialog::on_change) ); 101 m_ep_discover.add(m_session_view); 102 103 m_zeroconf.discover_event().connect(sigc::mem_fun(*this, 104 &JoinDialog::on_discover) ); 105 m_zeroconf.leave_event().connect(sigc::mem_fun(*this, 106 &JoinDialog::on_leave) ); 107 m_zeroconf.discover(); 108 m_timer_connection = Glib::signal_timeout().connect( 109 sigc::mem_fun(*this, &JoinDialog::on_timer), 400); 110 111 m_vbox.set_spacing(5); 112 m_vbox.pack_start(m_table); 113 m_vbox.pack_start(m_ep_discover); 114 get_vbox()->pack_start(m_vbox); 95 if(m_zeroconf) 96 { 97 m_session_list = Gtk::ListStore::create(m_session_cols); 98 m_session_view.set_model(m_session_list); 99 m_session_view.append_column(_("User"), m_session_cols.name); 100 m_session_view.append_column(_("Host"), m_session_cols.host); 101 m_session_view.append_column(_("Port"), m_session_cols.port); 102 m_session_view.get_selection()->set_mode( 103 Gtk::SELECTION_SINGLE); 104 m_session_view.get_selection()->signal_changed().connect( 105 sigc::mem_fun(*this, &JoinDialog::on_change) ); 106 m_ep_discover.add(m_session_view); 107 108 m_zeroconf->discover_event().connect( 109 sigc::mem_fun(*this, &JoinDialog::on_discover)); 110 m_zeroconf->leave_event().connect( 111 sigc::mem_fun(*this, &JoinDialog::on_leave) ); 112 m_zeroconf->discover(); 113 m_timer_connection = Glib::signal_timeout().connect( 114 sigc::mem_fun(*this, &JoinDialog::on_timer), 400); 115 116 m_vbox.set_spacing(5); 117 m_vbox.pack_start(m_table); 118 m_vbox.pack_start(m_ep_discover); 119 get_vbox()->pack_start(m_vbox); 120 } 121 else 122 { 123 // Howl is deactivated 124 get_vbox()->set_spacing(5); 125 get_vbox()->pack_start(m_table); 126 } 115 127 #else 116 128 get_vbox()->set_spacing(5); … … 200 212 bool Gobby::JoinDialog::on_timer() 201 213 { 202 m_zeroconf .select(0);214 m_zeroconf->select(0); 203 215 return true; 204 216 } -
src/window.cpp
rc22e31b r3d3692a 50 50 m_preferences(m_config), m_buffer(NULL), 51 51 #ifdef WITH_HOWL 52 m_zeroconf( ),52 m_zeroconf(NULL), 53 53 #endif 54 54 m_folder(m_preferences), m_header(m_folder), m_statusbar(m_folder) … … 129 129 set_title("Gobby"); 130 130 set_default_size(640, 480); 131 132 #ifdef WITH_HOWL 133 // Initialise Zeroconf 134 try 135 { 136 m_zeroconf.reset(new obby::zeroconf); 137 } 138 catch(std::runtime_error&) 139 { 140 display_error(_("Howl initialisation failed. Probably you need " 141 "to run mDNSResponder as root prior to Gobby. " 142 "Zeroconf support is deactivated for this session."), 143 Gtk::MESSAGE_WARNING); 144 m_zeroconf.reset(); 145 } 146 #endif 131 147 } 132 148 … … 223 239 m_statusbar.obby_end(); 224 240 225 // Delete buffer and zeroconf241 // Delete buffer 226 242 m_buffer.reset(); 243 227 244 #ifdef WITH_HOWL 228 m_zeroconf .unpublish_all();245 m_zeroconf->unpublish_all(); 229 246 #endif 230 247 } … … 257 274 buffer->set_global_password(password); 258 275 #ifdef WITH_HOWL 259 // Publish the newly created session via ZeroConf 260 m_zeroconf.publish(name, port); 276 // Publish the newly created session via Zeroconf 277 // if Howl is not deactivated 278 if(m_zeroconf.get() ) 279 m_zeroconf->publish(name, port); 261 280 #endif 262 281 … … 273 292 JoinDialog dlg(*this, m_config); 274 293 #else 275 JoinDialog dlg(*this, m_config, &m_zeroconf);294 JoinDialog dlg(*this, m_config, m_zeroconf.get() ); 276 295 #endif 277 296 … … 850 869 } 851 870 852 void Gobby::Window::display_error(const Glib::ustring& message) 853 { 854 Gtk::MessageDialog dlg(*this, message, false, Gtk::MESSAGE_ERROR, 871 void Gobby::Window::display_error(const Glib::ustring& message, 872 const Gtk::MessageType type) 873 { 874 Gtk::MessageDialog dlg(*this, message, false, type, 855 875 Gtk::BUTTONS_OK, true); 856 876 dlg.run();
